Skip to content

Commit 4c33dea

Browse files
committed
firmware: dcdbas: use binary attribute groups
The dcdbas code was "hand rolling" a binary attribute group, which the driver core now supports automatically. So remove the "create the files by hand" logic, and just set the proper field in the attribute group structure, saving lots of code and headache. Cc: Doug Warzecha <Douglas_Warzecha@dell.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -- Doug, I can take this through my driver-core tree if you don't object. drivers/firmware/dcdbas.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
1 parent f799878 commit 4c33dea

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

‎drivers/firmware/dcdbas.c‎

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -535,11 +535,12 @@ static struct attribute *dcdbas_dev_attrs[] = {
535535

536536
static struct attribute_group dcdbas_attr_group = {
537537
.attrs = dcdbas_dev_attrs,
538+
.bin_attrs = dcdbas_bin_attrs,
538539
};
539540

540541
static int dcdbas_probe(struct platform_device *dev)
541542
{
542-
int i, error;
543+
int error;
543544

544545
host_control_action = HC_ACTION_NONE;
545546
host_control_smi_type = HC_SMITYPE_NONE;
@@ -555,18 +556,6 @@ static int dcdbas_probe(struct platform_device *dev)
555556
if (error)
556557
return error;
557558

558-
for (i = 0; dcdbas_bin_attrs[i]; i++) {
559-
error = sysfs_create_bin_file(&dev->dev.kobj,
560-
dcdbas_bin_attrs[i]);
561-
if (error) {
562-
while (--i >= 0)
563-
sysfs_remove_bin_file(&dev->dev.kobj,
564-
dcdbas_bin_attrs[i]);
565-
sysfs_remove_group(&dev->dev.kobj, &dcdbas_attr_group);
566-
return error;
567-
}
568-
}
569-
570559
register_reboot_notifier(&dcdbas_reboot_nb);
571560

572561
dev_info(&dev->dev, "%s (version %s)\n",
@@ -577,11 +566,7 @@ static int dcdbas_probe(struct platform_device *dev)
577566

578567
static int dcdbas_remove(struct platform_device *dev)
579568
{
580-
int i;
581-
582569
unregister_reboot_notifier(&dcdbas_reboot_nb);
583-
for (i = 0; dcdbas_bin_attrs[i]; i++)
584-
sysfs_remove_bin_file(&dev->dev.kobj, dcdbas_bin_attrs[i]);
585570
sysfs_remove_group(&dev->dev.kobj, &dcdbas_attr_group);
586571

587572
return 0;

0 commit comments

Comments
 (0)