simdisk.c (a69755b187749e7cc020e17127a54f395aea4eaa) simdisk.c (d9dda78bad879595d8c4220a067fc029d6484a16)
1/*
2 * arch/xtensa/platforms/iss/simdisk.c
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001-2013 Tensilica Inc.

--- 203 unchanged lines hidden (view full) ---

212 }
213 spin_unlock(&dev->lock);
214 return err;
215}
216
217static ssize_t proc_read_simdisk(struct file *file, char __user *buf,
218 size_t size, loff_t *ppos)
219{
1/*
2 * arch/xtensa/platforms/iss/simdisk.c
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001-2013 Tensilica Inc.

--- 203 unchanged lines hidden (view full) ---

212 }
213 spin_unlock(&dev->lock);
214 return err;
215}
216
217static ssize_t proc_read_simdisk(struct file *file, char __user *buf,
218 size_t size, loff_t *ppos)
219{
220 struct simdisk *dev = PDE(file_inode(file))->data;
220 struct simdisk *dev = PDE_DATA(file_inode(file));
221 char *s = dev->filename;
222 if (s) {
223 ssize_t n = simple_read_from_buffer(buf, size, ppos,
224 s, strlen(s));
225 if (n < 0)
226 return n;
227 buf += n;
228 size -= n;
229 }
230 return simple_read_from_buffer(buf, size, ppos, "\n", 1);
231}
232
233static ssize_t proc_write_simdisk(struct file *file, const char __user *buf,
234 size_t size, loff_t *ppos)
235{
236 char *tmp = kmalloc(count + 1, GFP_KERNEL);
221 char *s = dev->filename;
222 if (s) {
223 ssize_t n = simple_read_from_buffer(buf, size, ppos,
224 s, strlen(s));
225 if (n < 0)
226 return n;
227 buf += n;
228 size -= n;
229 }
230 return simple_read_from_buffer(buf, size, ppos, "\n", 1);
231}
232
233static ssize_t proc_write_simdisk(struct file *file, const char __user *buf,
234 size_t size, loff_t *ppos)
235{
236 char *tmp = kmalloc(count + 1, GFP_KERNEL);
237 struct simdisk *dev = PDE(file_inode(file))->data;
237 struct simdisk *dev = PDE_DATA(file_inode(file));
238 int err;
239
240 if (tmp == NULL)
241 return -ENOMEM;
242 if (copy_from_user(tmp, buffer, count)) {
243 err = -EFAULT;
244 goto out_free;
245 }

--- 140 unchanged lines hidden ---
238 int err;
239
240 if (tmp == NULL)
241 return -ENOMEM;
242 if (copy_from_user(tmp, buffer, count)) {
243 err = -EFAULT;
244 goto out_free;
245 }

--- 140 unchanged lines hidden ---