From patchwork Wed Nov 25 07:12:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 62698 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 nAP7ClKG001075 for ; Wed, 25 Nov 2009 07:12:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752560AbZKYHMV (ORCPT ); Wed, 25 Nov 2009 02:12:21 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752550AbZKYHMU (ORCPT ); Wed, 25 Nov 2009 02:12:20 -0500 Received: from mail-ew0-f219.google.com ([209.85.219.219]:42132 "EHLO mail-ew0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752512AbZKYHMS (ORCPT ); Wed, 25 Nov 2009 02:12:18 -0500 Received: by ewy19 with SMTP id 19so91574ewy.21 for ; Tue, 24 Nov 2009 23:12:23 -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=adBMc6QrTPg94rT/AfmEH/vfOMB19b6tjfqZYWlezhA=; b=oNHzNIifcdEie6XL7SD5LOLZvIXhYwfE4hQ899amfamyn1+3/OdFWBhlGH/TmJHoRo DuZ66wid/nHPx4TSzc0omqPZODNVe9xNpLEwo1H6dFQhNSCbfD5q2NZVP9plfowHMZjY 4pRd4Q/kkxXNjeaaAxch+lEVbpZ1lbJNdMUbg= 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=KNT+CQX5H2mzcf7LUy4EZovTcCEa8BhEVorOIAqiw105CipWvaqqrgLYg8ZuNFzmCS xG22nKgwkQjt8P2J40Ua5rM47DLQSyGo4gqxUcgw4MDz6dNNSHPvtFOwXI8fxiWkqJ/Y ij2MVWKywvSrm1sTiwd1Be8RFx/wx8MsInUI4= Received: by 10.213.103.83 with SMTP id j19mr6239857ebo.31.1259133143623; Tue, 24 Nov 2009 23:12:23 -0800 (PST) Received: from x200.malnet.ru ([213.171.34.237]) by mx.google.com with ESMTPS id 23sm3240754eya.19.2009.11.24.23.12.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 24 Nov 2009 23:12:23 -0800 (PST) Date: Wed, 25 Nov 2009 10:12:20 +0300 From: Alexey Dobriyan To: linville@tuxdriver.com, akpm@linux-foundation.org Cc: linux-wireless@vger.kernel.org Subject: [PATCH] ray_cs: convert to proc_fops Message-ID: <20091125071220.GB3459@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/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -2865,18 +2865,8 @@ static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) /*===========================================================================*/ #ifdef CONFIG_PROC_FS -static void raycs_write(const char *name, write_proc_t *w, void *data) -{ - struct proc_dir_entry *entry = - create_proc_entry(name, S_IFREG | S_IWUSR, NULL); - if (entry) { - entry->write_proc = w; - entry->data = data; - } -} - -static int write_essid(struct file *file, const char __user *buffer, - unsigned long count, void *data) +static ssize_t ray_cs_essid_proc_write(struct file *file, + const char __user *buffer, size_t count, loff_t *pos) { static char proc_essid[33]; unsigned int len = count; @@ -2890,8 +2880,13 @@ static int write_essid(struct file *file, const char __user *buffer, return count; } -static int write_int(struct file *file, const char __user *buffer, - unsigned long count, void *data) +static const struct file_operations ray_cs_essid_proc_fops = { + .owner = THIS_MODULE, + .write = ray_cs_essid_proc_write, +}; + +static ssize_t int_proc_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) { static char proc_number[10]; char *p; @@ -2914,9 +2909,14 @@ static int write_int(struct file *file, const char __user *buffer, nr = nr * 10 + c; p++; } while (--len); - *(int *)data = nr; + *(int *)PDE(file->f_path.dentry->d_inode)->data = nr; return count; } + +static const struct file_operations int_proc_fops = { + .owner = THIS_MODULE, + .write = int_proc_write, +}; #endif static struct pcmcia_device_id ray_ids[] = { @@ -2951,9 +2951,9 @@ static int __init init_ray_cs(void) proc_mkdir("driver/ray_cs", NULL); proc_create("driver/ray_cs/ray_cs", 0, NULL, &ray_cs_proc_fops); - raycs_write("driver/ray_cs/essid", write_essid, NULL); - raycs_write("driver/ray_cs/net_type", write_int, &net_type); - raycs_write("driver/ray_cs/translate", write_int, &translate); + proc_create("driver/ray_cs/essid", S_IWUSR, NULL, &ray_cs_essid_proc_fops); + proc_create_data("driver/ray_cs/net_type", S_IWUSR, NULL, &int_proc_fops, &net_type); + proc_create_data("driver/ray_cs/translate", S_IWUSR, NULL, &int_proc_fops, &translate); #endif if (translate != 0) translate = 1;