diff options
Diffstat (limited to 'drivers/pcmcia/socket_sysfs.c')
-rw-r--r-- | drivers/pcmcia/socket_sysfs.c | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index b4409002b7f8..562384d6f321 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -356,19 +356,23 @@ static ssize_t pccard_store_cis(struct kobject *kobj, | |||
356 | } | 356 | } |
357 | 357 | ||
358 | 358 | ||
359 | static struct device_attribute *pccard_socket_attributes[] = { | 359 | static struct attribute *pccard_socket_attributes[] = { |
360 | &dev_attr_card_type, | 360 | &dev_attr_card_type.attr, |
361 | &dev_attr_card_voltage, | 361 | &dev_attr_card_voltage.attr, |
362 | &dev_attr_card_vpp, | 362 | &dev_attr_card_vpp.attr, |
363 | &dev_attr_card_vcc, | 363 | &dev_attr_card_vcc.attr, |
364 | &dev_attr_card_insert, | 364 | &dev_attr_card_insert.attr, |
365 | &dev_attr_card_pm_state, | 365 | &dev_attr_card_pm_state.attr, |
366 | &dev_attr_card_eject, | 366 | &dev_attr_card_eject.attr, |
367 | &dev_attr_card_irq_mask, | 367 | &dev_attr_card_irq_mask.attr, |
368 | &dev_attr_available_resources_setup_done, | 368 | &dev_attr_available_resources_setup_done.attr, |
369 | NULL, | 369 | NULL, |
370 | }; | 370 | }; |
371 | 371 | ||
372 | static const struct attribute_group socket_attrs = { | ||
373 | .attrs = pccard_socket_attributes, | ||
374 | }; | ||
375 | |||
372 | static struct bin_attribute pccard_cis_attr = { | 376 | static struct bin_attribute pccard_cis_attr = { |
373 | .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR }, | 377 | .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR }, |
374 | .size = 0x200, | 378 | .size = 0x200, |
@@ -376,35 +380,21 @@ static struct bin_attribute pccard_cis_attr = { | |||
376 | .write = pccard_store_cis, | 380 | .write = pccard_store_cis, |
377 | }; | 381 | }; |
378 | 382 | ||
379 | static int __devinit pccard_sysfs_add_socket(struct device *dev, | 383 | int pccard_sysfs_add_socket(struct device *dev) |
380 | struct class_interface *class_intf) | ||
381 | { | 384 | { |
382 | struct device_attribute **attr; | ||
383 | int ret = 0; | 385 | int ret = 0; |
384 | 386 | ||
385 | for (attr = pccard_socket_attributes; *attr; attr++) { | 387 | ret = sysfs_create_group(&dev->kobj, &socket_attrs); |
386 | ret = device_create_file(dev, *attr); | 388 | if (!ret) { |
389 | ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr); | ||
387 | if (ret) | 390 | if (ret) |
388 | break; | 391 | sysfs_remove_group(&dev->kobj, &socket_attrs); |
389 | } | 392 | } |
390 | if (!ret) | ||
391 | ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr); | ||
392 | |||
393 | return ret; | 393 | return ret; |
394 | } | 394 | } |
395 | 395 | ||
396 | static void __devexit pccard_sysfs_remove_socket(struct device *dev, | 396 | void pccard_sysfs_remove_socket(struct device *dev) |
397 | struct class_interface *class_intf) | ||
398 | { | 397 | { |
399 | struct device_attribute **attr; | ||
400 | |||
401 | sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr); | 398 | sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr); |
402 | for (attr = pccard_socket_attributes; *attr; attr++) | 399 | sysfs_remove_group(&dev->kobj, &socket_attrs); |
403 | device_remove_file(dev, *attr); | ||
404 | } | 400 | } |
405 | |||
406 | struct class_interface pccard_sysfs_interface = { | ||
407 | .class = &pcmcia_socket_class, | ||
408 | .add_dev = &pccard_sysfs_add_socket, | ||
409 | .remove_dev = __devexit_p(&pccard_sysfs_remove_socket), | ||
410 | }; | ||