X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=drivers%2Fpnp%2Fisapnp%2Fproc.c;h=3f94edab25fa7f8551d456b2d8df34e1fc0d3ed4;hb=31f297143b9905647fa5ef12086626a6f172a4ea;hp=40b724ebe23bd1ce8e1bba713beb022df61b7036;hpb=6f8c480f998a619082f18407f8d7f4c29e94dc6e;p=linux-2.6-omap-h63xx.git diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c index 40b724ebe23..3f94edab25f 100644 --- a/drivers/pnp/isapnp/proc.c +++ b/drivers/pnp/isapnp/proc.c @@ -1,7 +1,6 @@ /* * ISA Plug & Play support - * Copyright (c) by Jaroslav Kysela - * + * Copyright (c) by Jaroslav Kysela * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * */ #include @@ -54,7 +52,8 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence) return (file->f_pos = new); } -static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) +static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf, + size_t nbytes, loff_t * ppos) { struct inode *ino = file->f_path.dentry->d_inode; struct proc_dir_entry *dp = PDE(ino); @@ -74,7 +73,7 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t return -EINVAL; isapnp_cfg_begin(dev->card->number, dev->number); - for ( ; pos < 256 && cnt > 0; pos++, buf++, cnt--) { + for (; pos < 256 && cnt > 0; pos++, buf++, cnt--) { unsigned char val; val = isapnp_read_byte(pos); __put_user(val, buf); @@ -85,10 +84,10 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t return nbytes; } -static const struct file_operations isapnp_proc_bus_file_operations = -{ - .llseek = isapnp_proc_bus_lseek, - .read = isapnp_proc_bus_read, +static const struct file_operations isapnp_proc_bus_file_operations = { + .owner = THIS_MODULE, + .llseek = isapnp_proc_bus_lseek, + .read = isapnp_proc_bus_read, }; static int isapnp_proc_attach_device(struct pnp_dev *dev) @@ -104,67 +103,21 @@ static int isapnp_proc_attach_device(struct pnp_dev *dev) return -ENOMEM; } sprintf(name, "%02x", dev->number); - e = dev->procent = create_proc_entry(name, S_IFREG | S_IRUGO, de); + e = dev->procent = proc_create_data(name, S_IFREG | S_IRUGO, de, + &isapnp_proc_bus_file_operations, dev); if (!e) return -ENOMEM; - e->proc_fops = &isapnp_proc_bus_file_operations; - e->owner = THIS_MODULE; - e->data = dev; e->size = 256; return 0; } -#ifdef MODULE -static int __exit isapnp_proc_detach_device(struct pnp_dev *dev) -{ - struct pnp_card *bus = dev->card; - struct proc_dir_entry *de; - char name[16]; - - if (!(de = bus->procdir)) - return -EINVAL; - sprintf(name, "%02x", dev->number); - remove_proc_entry(name, de); - return 0; -} - -static int __exit isapnp_proc_detach_bus(struct pnp_card *bus) -{ - struct proc_dir_entry *de; - char name[16]; - - if (!(de = bus->procdir)) - return -EINVAL; - sprintf(name, "%02x", bus->number); - remove_proc_entry(name, isapnp_proc_bus_dir); - return 0; -} -#endif /* MODULE */ - int __init isapnp_proc_init(void) { struct pnp_dev *dev; - isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus); - protocol_for_each_dev(&isapnp_protocol,dev) { - isapnp_proc_attach_device(dev); - } - return 0; -} - -#ifdef MODULE -int __exit isapnp_proc_done(void) -{ - struct pnp_dev *dev; - struct pnp_bus *card; - isapnp_for_each_dev(dev) { - isapnp_proc_detach_device(dev); - } - isapnp_for_each_card(card) { - isapnp_proc_detach_bus(card); + isapnp_proc_bus_dir = proc_mkdir("bus/isapnp", NULL); + protocol_for_each_dev(&isapnp_protocol, dev) { + isapnp_proc_attach_device(dev); } - if (isapnp_proc_bus_dir) - remove_proc_entry("isapnp", proc_bus); return 0; } -#endif /* MODULE */