Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mfd: kempld: Use device core to create driver-specific device attributes

Instead of creating driver-specific device attributes with
sysfs_create_group() have device core do this by setting up dev_groups
pointer in the driver structure.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240223195113.880121-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Andy Shevchenko and committed by
Lee Jones
b5036277 392654ad

+5 -16
+5 -16
drivers/mfd/kempld-core.c
··· 15 15 #include <linux/dmi.h> 16 16 #include <linux/io.h> 17 17 #include <linux/delay.h> 18 + #include <linux/sysfs.h> 18 19 19 20 #define MAX_ID_LEN 4 20 21 static char force_device_id[MAX_ID_LEN + 1] = ""; ··· 374 373 static DEVICE_ATTR_RO(pld_specification); 375 374 static DEVICE_ATTR_RO(pld_type); 376 375 377 - static struct attribute *pld_attributes[] = { 376 + static struct attribute *pld_attrs[] = { 378 377 &dev_attr_pld_version.attr, 379 378 &dev_attr_pld_specification.attr, 380 379 &dev_attr_pld_type.attr, 381 380 NULL 382 381 }; 383 - 384 - static const struct attribute_group pld_attr_group = { 385 - .attrs = pld_attributes, 386 - }; 382 + ATTRIBUTE_GROUPS(pld); 387 383 388 384 static int kempld_detect_device(struct kempld_device_data *pld) 389 385 { ··· 413 415 pld->info.version, kempld_get_type_string(pld), 414 416 pld->info.spec_major, pld->info.spec_minor); 415 417 416 - ret = sysfs_create_group(&pld->dev->kobj, &pld_attr_group); 417 - if (ret) 418 - return ret; 419 - 420 - ret = kempld_register_cells(pld); 421 - if (ret) 422 - sysfs_remove_group(&pld->dev->kobj, &pld_attr_group); 423 - 424 - return ret; 418 + return kempld_register_cells(pld); 425 419 } 426 420 427 421 static int kempld_probe(struct platform_device *pdev) ··· 479 489 struct kempld_device_data *pld = platform_get_drvdata(pdev); 480 490 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); 481 491 482 - sysfs_remove_group(&pld->dev->kobj, &pld_attr_group); 483 - 484 492 mfd_remove_devices(&pdev->dev); 485 493 pdata->release_hardware_mutex(pld); 486 494 } ··· 494 506 .driver = { 495 507 .name = "kempld", 496 508 .acpi_match_table = kempld_acpi_table, 509 + .dev_groups = pld_groups, 497 510 }, 498 511 .probe = kempld_probe, 499 512 .remove_new = kempld_remove,