From patchwork Wed Nov 25 07:14:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 62700 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAP7ESN5001251 for ; Wed, 25 Nov 2009 07:14:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753607AbZKYHOL (ORCPT ); Wed, 25 Nov 2009 02:14:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752448AbZKYHOL (ORCPT ); Wed, 25 Nov 2009 02:14:11 -0500 Received: from mail-ew0-f219.google.com ([209.85.219.219]:33202 "EHLO mail-ew0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752469AbZKYHOK (ORCPT ); Wed, 25 Nov 2009 02:14:10 -0500 Received: by ewy19 with SMTP id 19so92455ewy.21 for ; Tue, 24 Nov 2009 23:14:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=/+yKyDiZxVgL43iXBBV/wgmepiMMi4PtnX29SWcOu5E=; b=CrtP90+kjZAYVEeL2vm0yEZ3FzQkgVRO66hJP3ktzFtYoYcjKnnratqfDujGNE1Fr9 iX2c5S0kuqvpsP4cl5vHNxeIrnUgP0nH29w+7d6mxcq/I4JbBeyNtdPC8fFoE+6ZTDRN KIb6XUSeq9Kt4l3vovuxOU+U6sEX3Vr1v0R1Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=Boei7BiNABh3eKNVjbLgs80DGgHC+ZEQWbBJTwstQdmqnERcaDBDext60yoHCmmKSr CdYMe/dqYjF9JL5ixtSzo/wQNOEPjsghuPplPYZm5sg26nxD8hyAjm8PyohQk0Nu6+m9 jk1f5cHbUw37L/BAA1Wu0UdcJQID4ANWdLyCw= Received: by 10.213.23.151 with SMTP id r23mr7325477ebb.63.1259133255747; Tue, 24 Nov 2009 23:14:15 -0800 (PST) Received: from x200.malnet.ru ([213.171.34.237]) by mx.google.com with ESMTPS id 7sm3256896eyg.1.2009.11.24.23.14.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 24 Nov 2009 23:14:15 -0800 (PST) Date: Wed, 25 Nov 2009 10:14:12 +0300 From: Alexey Dobriyan To: linville@tuxdriver.com, akpm@linux-foundation.org Cc: linux-wireless@vger.kernel.org Subject: [PATCH] ipw2x00: convert to seq_file Message-ID: <20091125071412.GC3459@x200.malnet.ru> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --- a/drivers/net/wireless/ipw2x00/libipw_module.c +++ b/drivers/net/wireless/ipw2x00/libipw_module.c @@ -216,17 +216,22 @@ u32 libipw_debug_level = 0; EXPORT_SYMBOL_GPL(libipw_debug_level); static struct proc_dir_entry *libipw_proc = NULL; -static int show_debug_level(char *page, char **start, off_t offset, - int count, int *eof, void *data) +static int debug_level_proc_show(struct seq_file *m, void *v) { - return snprintf(page, count, "0x%08X\n", libipw_debug_level); + seq_printf(m, "0x%08X\n", libipw_debug_level); + return 0; } -static int store_debug_level(struct file *file, const char __user * buffer, - unsigned long count, void *data) +static int debug_level_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, debug_level_proc_show, NULL); +} + +static ssize_t debug_level_proc_write(struct file *file, + const char __user *buffer, size_t count, loff_t *pos) { char buf[] = "0x00000000\n"; - unsigned long len = min((unsigned long)sizeof(buf) - 1, count); + size_t len = min(sizeof(buf) - 1, count); unsigned long val; if (copy_from_user(buf, buffer, len)) @@ -240,6 +245,15 @@ static int store_debug_level(struct file *file, const char __user * buffer, return strnlen(buf, len); } + +static const struct file_operations debug_level_proc_fops = { + .owner = THIS_MODULE, + .open = debug_level_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + .write = debug_level_proc_write, +}; #endif /* CONFIG_LIBIPW_DEBUG */ static int __init libipw_init(void) @@ -254,16 +268,13 @@ static int __init libipw_init(void) " proc directory\n"); return -EIO; } - e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, - libipw_proc); + e = proc_create("debug_level", S_IRUGO | S_IWUSR, libipw_proc, + &debug_level_proc_fops); if (!e) { remove_proc_entry(DRV_NAME, init_net.proc_net); libipw_proc = NULL; return -EIO; } - e->read_proc = show_debug_level; - e->write_proc = store_debug_level; - e->data = NULL; #endif /* CONFIG_LIBIPW_DEBUG */ printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");