summaryrefslogtreecommitdiffstats
path: root/drivers/pnp/interface.c
diff options
context:
space:
mode:
authorDrew Moseley <dmoseley@mvista.com>2008-09-28 01:31:35 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-16 09:24:51 -0700
commit8a89efd18aa15bb832778baa4e6eee3857ecada4 (patch)
tree91b4fe321aecd787d995543bc49e894a3c123628 /drivers/pnp/interface.c
parent3ce24d8d93f8f9617841d0c8416174da7ee1b042 (diff)
downloadlinux-8a89efd18aa15bb832778baa4e6eee3857ecada4.tar.gz
linux-8a89efd18aa15bb832778baa4e6eee3857ecada4.tar.bz2
linux-8a89efd18aa15bb832778baa4e6eee3857ecada4.zip
PNP: create device attributes via default device attributes
This creates the attributes before the uevent is sent. Signed-off-by: Drew Moseley <dmoseley@mvista.com> Acked-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pnp/interface.c')
-rw-r--r--drivers/pnp/interface.c37
1 files changed, 8 insertions, 29 deletions
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,
+};