commit: http://blackfin.uclinux.org/git/?p=linux-kernel;a=commitdiff;h=2d135ecc5c624befef5e989aad6e0c292a04b42f branch: http://blackfin.uclinux.org/git/?p=linux-kernel;a=shortlog;h=refs/heads/trunk
last patch want to change proc to seq file, but seq file only care about read method. Signed-off-by: Scott Jiang <[email protected]> --- drivers/video/bfin_adv7393fb.c | 44 +++++++++++++++++++++++++-------------- 1 files changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/video/bfin_adv7393fb.c b/drivers/video/bfin_adv7393fb.c index ac19284..8486f54 100644 --- a/drivers/video/bfin_adv7393fb.c +++ b/drivers/video/bfin_adv7393fb.c @@ -35,7 +35,6 @@ #include <linux/dma-mapping.h> #include <linux/proc_fs.h> -#include <linux/seq_file.h> #include <linux/platform_device.h> #include <linux/i2c.h> @@ -323,25 +322,42 @@ static irqreturn_t ppi_irq_error(int irq, void *dev_id) } -static int adv7393_proc_show(struct seq_file *m, void *v) +static int proc_output(char *buf) { - return seq_puts(m, + char *p = buf; + + p += sprintf(p, "Usage:\n" "echo 0x[REG][Value] > adv7393\n" "example: echo 0x1234 >adv7393\n" "writes 0x34 into Register 0x12\n"); + + return p - buf; } -static int adv7393_proc_open(struct inode *inode, struct file *file) +static int +adv7393_read_proc(char *page, char **start, off_t off, + int count, int *eof, void *data) { - return single_open(file, adv7393_proc_show, NULL); + int len; + + len = proc_output(page); + if (len <= off + count) + *eof = 1; + *start = page + off; + len -= off; + if (len > count) + len = count; + if (len < 0) + len = 0; + return len; } static int adv7393_write_proc(struct file *file, const char __user * buffer, unsigned long count, void *data) { - struct adv7393fb_device *fbdev = PDE(file->f_path.dentry->d_inode)->data; + struct adv7393fb_device *fbdev = data; char line[8]; unsigned int val; int ret; @@ -356,14 +372,6 @@ adv7393_write_proc(struct file *file, const char __user * buffer, return count; } -static const struct file_operations adv7393_proc_ops = { - .open = adv7393_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, - .write = adv7393_proc_write, -}; - static int __devinit bfin_adv7393_fb_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -501,13 +509,17 @@ static int __devinit bfin_adv7393_fb_probe(struct i2c_client *client, fbdev->info.node, fbdev->info.fix.id); dev_info(&client->dev, "fb memory address : 0x%p\n", fbdev->fb_mem); - entry = proc_create_data("driver/adv7393", 0, NULL, - &adv7393_proc_ops, fbdev); + entry = create_proc_entry("driver/adv7393", 0, NULL); if (!entry) { dev_err(&client->dev, "unable to create /proc entry\n"); ret = -EFAULT; goto out_0; } + + entry->read_proc = adv7393_read_proc; + entry->write_proc = adv7393_write_proc; + entry->data = ""> + return 0; out_0:
_______________________________________________ Linux-kernel-commits mailing list [email protected] https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits
