diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 12:40:26 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 12:40:26 -0700 |
commit | c813b4e16ead3c3df98ac84419d4df2adf33fe01 (patch) | |
tree | 2ca4a5b6966d833b6149e3dda7a4e85d1255779c /drivers/pnp | |
parent | c8d8a2321f9c4ee18fbcc399fdc2a77e580a03b9 (diff) | |
parent | 02683ffdf655b4ae15245376ba6fea6d9e5829a6 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (46 commits)
UIO: Fix mapping of logical and virtual memory
UIO: add automata sercos3 pci card support
UIO: Change driver name of uio_pdrv
UIO: Add alignment warnings for uio-mem
Driver core: add bus_sort_breadthfirst() function
NET: convert the phy_device file to use bus_find_device_by_name
kobject: Cleanup kobject_rename and !CONFIG_SYSFS
kobject: Fix kobject_rename and !CONFIG_SYSFS
sysfs: Make dir and name args to sysfs_notify() const
platform: add new device registration helper
sysfs: use ilookup5() instead of ilookup5_nowait()
PNP: create device attributes via default device attributes
Driver core: make bus_find_device_by_name() more robust
usb: turn dev_warn+WARN_ON combos into dev_WARN
debug: use dev_WARN() rather than WARN_ON() in device_pm_add()
debug: Introduce a dev_WARN() function
sysfs: fix deadlock
device model: Do a quickcheck for driver binding before doing an expensive check
Driver core: Fix cleanup in device_create_vargs().
Driver core: Clarify device cleanup.
...
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/base.h | 2 | ||||
-rw-r--r-- | drivers/pnp/core.c | 10 | ||||
-rw-r--r-- | drivers/pnp/driver.c | 1 | ||||
-rw-r--r-- | drivers/pnp/interface.c | 37 |
4 files changed, 11 insertions, 39 deletions
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h index 7cc7bf5304aa..3b8b9d3cb03d 100644 --- a/drivers/pnp/base.h +++ b/drivers/pnp/base.h @@ -4,6 +4,7 @@ */ extern spinlock_t pnp_lock; +extern struct device_attribute pnp_interface_attrs[]; void *pnp_alloc(long size); int pnp_register_protocol(struct pnp_protocol *protocol); @@ -16,7 +17,6 @@ struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid); int pnp_add_device(struct pnp_dev *dev); struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id); -int pnp_interface_attach_device(struct pnp_dev *dev); int pnp_add_card(struct pnp_card *card); void pnp_remove_card(struct pnp_card *card); diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c index cc0aeaed6179..817fe626e15b 100644 --- a/drivers/pnp/core.c +++ b/drivers/pnp/core.c @@ -159,21 +159,13 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid int __pnp_add_device(struct pnp_dev *dev) { - int ret; - pnp_fixup_device(dev); dev->status = PNP_READY; spin_lock(&pnp_lock); list_add_tail(&dev->global_list, &pnp_global); list_add_tail(&dev->protocol_list, &dev->protocol->devices); spin_unlock(&pnp_lock); - - ret = device_register(&dev->dev); - if (ret) - return ret; - - pnp_interface_attach_device(dev); - return 0; + return device_register(&dev->dev); } /* diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index d3f869ee1d92..e3f7e89c4dfb 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c @@ -206,6 +206,7 @@ struct bus_type pnp_bus_type = { .remove = pnp_device_remove, .suspend = pnp_bus_suspend, .resume = pnp_bus_resume, + .dev_attrs = pnp_interface_attrs, }; int pnp_register_driver(struct pnp_driver *drv) diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index a876ecf7028c..478a4a739c00 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c @@ -243,8 +243,6 @@ static ssize_t pnp_show_options(struct device *dmdev, return ret; } -static DEVICE_ATTR(options, S_IRUGO, pnp_show_options, NULL); - static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_attribute *attr, char *buf) @@ -420,9 +418,6 @@ done: return count; } -static DEVICE_ATTR(resources, S_IRUGO | S_IWUSR, - pnp_show_current_resources, pnp_set_current_resources); - static ssize_t pnp_show_current_ids(struct device *dmdev, struct device_attribute *attr, char *buf) { @@ -437,27 +432,11 @@ static ssize_t pnp_show_current_ids(struct device *dmdev, return (str - buf); } -static DEVICE_ATTR(id, S_IRUGO, pnp_show_current_ids, NULL); - -int pnp_interface_attach_device(struct pnp_dev *dev) -{ - int rc = device_create_file(&dev->dev, &dev_attr_options); - - if (rc) - goto err; - rc = device_create_file(&dev->dev, &dev_attr_resources); - if (rc) - goto err_opt; - rc = device_create_file(&dev->dev, &dev_attr_id); - if (rc) - goto err_res; - - return 0; - -err_res: - device_remove_file(&dev->dev, &dev_attr_resources); -err_opt: - device_remove_file(&dev->dev, &dev_attr_options); -err: - return rc; -} +struct device_attribute pnp_interface_attrs[] = { + __ATTR(resources, S_IRUGO | S_IWUSR, + pnp_show_current_resources, + pnp_set_current_resources), + __ATTR(options, S_IRUGO, pnp_show_options, NULL), + __ATTR(id, S_IRUGO, pnp_show_current_ids, NULL), + __ATTR_NULL, +}; |