diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2008-06-12 21:13:55 +0200 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-06-24 15:33:40 +0200 |
commit | 7d5789616dd3090fe8486fbb849da3e9d9f36bb9 (patch) | |
tree | bf78d2c5670facb0413a4126b1684eab7e865fb9 /drivers/pcmcia/rsrc_nonstatic.c | |
parent | pcmcia: add support CompactFlash PCMCIA support for Blackfin. (diff) | |
download | linux-7d5789616dd3090fe8486fbb849da3e9d9f36bb9.tar.xz linux-7d5789616dd3090fe8486fbb849da3e9d9f36bb9.zip |
pcmcia: simplify rsrc_nonstatic attributes
Simplify sysfs attribute registration for sockets without static
resource mappings by using an attribute_group. This shrinks object
size a bit: use loops in sysfs code, but have more data.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/rsrc_nonstatic.c')
-rw-r--r-- | drivers/pcmcia/rsrc_nonstatic.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 0fcf763b9175..4123155e2f7a 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -1008,41 +1008,34 @@ static ssize_t store_mem_db(struct device *dev, } static DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db); -static struct device_attribute *pccard_rsrc_attributes[] = { - &dev_attr_available_resources_io, - &dev_attr_available_resources_mem, +static struct attribute *pccard_rsrc_attributes[] = { + &dev_attr_available_resources_io.attr, + &dev_attr_available_resources_mem.attr, NULL, }; +static const struct attribute_group rsrc_attributes = { + .attrs = pccard_rsrc_attributes, +}; + static int __devinit pccard_sysfs_add_rsrc(struct device *dev, struct class_interface *class_intf) { struct pcmcia_socket *s = dev_get_drvdata(dev); - struct device_attribute **attr; - int ret = 0; + if (s->resource_ops != &pccard_nonstatic_ops) return 0; - - for (attr = pccard_rsrc_attributes; *attr; attr++) { - ret = device_create_file(dev, *attr); - if (ret) - break; - } - - return ret; + return sysfs_create_group(&dev->kobj, &rsrc_attributes); } static void __devexit pccard_sysfs_remove_rsrc(struct device *dev, struct class_interface *class_intf) { struct pcmcia_socket *s = dev_get_drvdata(dev); - struct device_attribute **attr; if (s->resource_ops != &pccard_nonstatic_ops) return; - - for (attr = pccard_rsrc_attributes; *attr; attr++) - device_remove_file(dev, *attr); + sysfs_remove_group(&dev->kobj, &rsrc_attributes); } static struct class_interface pccard_rsrc_interface __refdata = { |