From patchwork Mon Jun 27 22:28:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 922652 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5RMWUOh010125 for ; Mon, 27 Jun 2011 22:32:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753959Ab1F0W25 (ORCPT ); Mon, 27 Jun 2011 18:28:57 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:35103 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755025Ab1F0W2d (ORCPT ); Mon, 27 Jun 2011 18:28:33 -0400 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id A16222AC00D; Mon, 27 Jun 2011 22:28:32 +0000 (UTC) From: Mike Frysinger To: linux-fbdev@vger.kernel.org, Paul Mundt Cc: uclinux-dist-devel@blackfin.uclinux.org, Alexey Dobriyan Subject: [PATCH] fbdev: bfin_adv7393fb: convert to seq_file Date: Mon, 27 Jun 2011 18:28:35 -0400 Message-Id: <1309213715-31842-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 1.7.5.3 In-Reply-To: <20110514165533.GC5703@p183> References: <20110514165533.GC5703@p183> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 27 Jun 2011 22:32:31 +0000 (UTC) From: Alexey Dobriyan ->read_proc and ->write_proc interfaces are going away, switch to seq_file/->write(). Signed-off-by: Alexey Dobriyan Signed-off-by: Mike Frysinger --- drivers/video/bfin_adv7393fb.c | 44 ++++++++++++++------------------------- 1 files changed, 16 insertions(+), 28 deletions(-) diff --git a/drivers/video/bfin_adv7393fb.c b/drivers/video/bfin_adv7393fb.c index 8486f54..ac19284 100644 --- a/drivers/video/bfin_adv7393fb.c +++ b/drivers/video/bfin_adv7393fb.c @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -322,42 +323,25 @@ static irqreturn_t ppi_irq_error(int irq, void *dev_id) } -static int proc_output(char *buf) +static int adv7393_proc_show(struct seq_file *m, void *v) { - char *p = buf; - - p += sprintf(p, + return seq_puts(m, "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_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int adv7393_proc_open(struct inode *inode, struct file *file) { - 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; + return single_open(file, adv7393_proc_show, NULL); } static int adv7393_write_proc(struct file *file, const char __user * buffer, unsigned long count, void *data) { - struct adv7393fb_device *fbdev = data; + struct adv7393fb_device *fbdev = PDE(file->f_path.dentry->d_inode)->data; char line[8]; unsigned int val; int ret; @@ -372,6 +356,14 @@ 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) { @@ -509,17 +501,13 @@ 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 = create_proc_entry("driver/adv7393", 0, NULL); + entry = proc_create_data("driver/adv7393", 0, NULL, + &adv7393_proc_ops, fbdev); 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 = fbdev; - return 0; out_0: