aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/dream/pmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/dream/pmem.c')
-rw-r--r--drivers/staging/dream/pmem.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/staging/dream/pmem.c b/drivers/staging/dream/pmem.c
index 6387365a833d..7d6bbadd7fc7 100644
--- a/drivers/staging/dream/pmem.c
+++ b/drivers/staging/dream/pmem.c
@@ -24,8 +24,8 @@
#include <linux/mempolicy.h>
#include <linux/sched.h>
#include <linux/slab.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
#include <asm/cacheflush.h>
#define PMEM_MAX_DEVICES 10
@@ -175,7 +175,7 @@ static int pmem_mmap(struct file *, struct vm_area_struct *);
static int pmem_open(struct inode *, struct file *);
static long pmem_ioctl(struct file *, unsigned int, unsigned long);
-struct file_operations pmem_fops = {
+const struct file_operations pmem_fops = {
.release = pmem_release,
.mmap = pmem_mmap,
.open = pmem_open,
@@ -209,7 +209,7 @@ static int has_allocation(struct file *file)
if (unlikely(!file->private_data))
return 0;
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
if (unlikely(data->index < 0))
return 0;
return 1;
@@ -223,7 +223,7 @@ static int is_master_owner(struct file *file)
if (!is_pmem_file(file) || !has_allocation(file))
return 0;
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
if (PMEM_FLAGS_MASTERMAP & data->flags)
return 1;
master_file = fget_light(data->master_fd, &put_needed);
@@ -268,7 +268,7 @@ static void pmem_revoke(struct file *file, struct pmem_data *data);
static int pmem_release(struct inode *inode, struct file *file)
{
- struct pmem_data *data = (struct pmem_data *)file->private_data;
+ struct pmem_data *data = file->private_data;
struct pmem_region_node *region_node;
struct list_head *elt, *elt2;
int id = get_id(file), ret = 0;
@@ -399,8 +399,8 @@ static int pmem_allocate(int id, unsigned long len)
DLOG("order %lx\n", order);
/* look through the bitmap:
- * if you find a free slot of the correct order use it
- * otherwise, use the best fit (smallest with size > order) slot
+ * if you find a free slot of the correct order use it
+ * otherwise, use the best fit (smallest with size > order) slot
*/
while (curr < end) {
if (PMEM_IS_FREE(id, curr)) {
@@ -426,8 +426,8 @@ static int pmem_allocate(int id, unsigned long len)
}
/* now partition the best fit:
- * split the slot into 2 buddies of order - 1
- * repeat until the slot is of the correct order
+ * split the slot into 2 buddies of order - 1
+ * repeat until the slot is of the correct order
*/
while (PMEM_ORDER(id, best_fit) > (unsigned char)order) {
int buddy;
@@ -591,7 +591,7 @@ static int pmem_mmap(struct file *file, struct vm_area_struct *vma)
return -EINVAL;
}
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
down_write(&data->sem);
/* check this file isn't already mmaped, for submaps check this file
* has never been mmaped */
@@ -690,7 +690,7 @@ int get_pmem_user_addr(struct file *file, unsigned long *start,
#endif
return -1;
}
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
down_read(&data->sem);
if (data->vma) {
*start = data->vma->vm_start;
@@ -712,7 +712,7 @@ int get_pmem_addr(struct file *file, unsigned long *start,
if (!is_pmem_file(file) || !has_allocation(file))
return -1;
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
if (data->index == -1) {
#if PMEM_DEBUG
printk(KERN_INFO "pmem: requested pmem data from file with no "
@@ -766,7 +766,7 @@ void put_pmem_file(struct file *file)
if (!is_pmem_file(file))
return;
id = get_id(file);
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
#if PMEM_DEBUG
down_write(&data->sem);
if (data->ref == 0) {
@@ -793,7 +793,7 @@ void flush_pmem_file(struct file *file, unsigned long offset, unsigned long len)
return;
id = get_id(file);
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
if (!pmem[id].cached)
return;
@@ -822,7 +822,7 @@ end:
static int pmem_connect(unsigned long connect, struct file *file)
{
- struct pmem_data *data = (struct pmem_data *)file->private_data;
+ struct pmem_data *data = file->private_data;
struct pmem_data *src_data;
struct file *src_file;
int ret = 0, put_needed;
@@ -842,7 +842,7 @@ static int pmem_connect(unsigned long connect, struct file *file)
ret = -EINVAL;
goto err_bad_file;
}
- src_data = (struct pmem_data *)src_file->private_data;
+ src_data = src_file->private_data;
if (has_allocation(file) && (data->index != src_data->index)) {
printk(KERN_INFO "pmem: file is already mapped but doesn't "
@@ -929,7 +929,7 @@ int pmem_remap(struct pmem_region *region, struct file *file,
struct mm_struct *mm = NULL;
struct list_head *elt, *elt2;
int id = get_id(file);
- struct pmem_data *data = (struct pmem_data *)file->private_data;
+ struct pmem_data *data = file->private_data;
/* pmem region must be aligned on a page boundry */
if (unlikely(!PMEM_IS_PAGE_ALIGNED(region->offset) ||
@@ -1053,7 +1053,7 @@ static void pmem_revoke(struct file *file, struct pmem_data *data)
static void pmem_get_size(struct pmem_region *region, struct file *file)
{
- struct pmem_data *data = (struct pmem_data *)file->private_data;
+ struct pmem_data *data = file->private_data;
int id = get_id(file);
if (!has_allocation(file)) {
@@ -1082,7 +1082,7 @@ static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
region.offset = 0;
region.len = 0;
} else {
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
region.offset = pmem_start_addr(id, data);
region.len = pmem_len(id, data);
}
@@ -1099,7 +1099,7 @@ static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (copy_from_user(&region, (void __user *)arg,
sizeof(struct pmem_region)))
return -EFAULT;
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
return pmem_remap(&region, file, PMEM_MAP);
}
break;
@@ -1109,7 +1109,7 @@ static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (copy_from_user(&region, (void __user *)arg,
sizeof(struct pmem_region)))
return -EFAULT;
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
return pmem_remap(&region, file, PMEM_UNMAP);
break;
}
@@ -1139,7 +1139,7 @@ static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
if (has_allocation(file))
return -EINVAL;
- data = (struct pmem_data *)file->private_data;
+ data = file->private_data;
data->index = pmem_allocate(id, arg);
break;
}