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

Input: axp20x-pek - convert driver to use dev_groups

Drivers now have the option to have the driver core create and remove any
needed sysfs attribute files. So take advantage of that and do not
register "by hand" a sysfs group of attributes.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Greg Kroah-Hartman and committed by
Dmitry Torokhov
d99995a4 cf1b2a20

+3 -12
+3 -12
drivers/input/misc/axp20x-pek.c
··· 195 195 DEVICE_ATTR(shutdown, 0644, axp20x_show_attr_shutdown, 196 196 axp20x_store_attr_shutdown); 197 197 198 - static struct attribute *axp20x_attributes[] = { 198 + static struct attribute *axp20x_attrs[] = { 199 199 &dev_attr_startup.attr, 200 200 &dev_attr_shutdown.attr, 201 201 NULL, 202 202 }; 203 - 204 - static const struct attribute_group axp20x_attribute_group = { 205 - .attrs = axp20x_attributes, 206 - }; 203 + ATTRIBUTE_GROUPS(axp20x); 207 204 208 205 static irqreturn_t axp20x_pek_irq(int irq, void *pwr) 209 206 { ··· 353 356 354 357 axp20x_pek->info = (struct axp20x_info *)match->driver_data; 355 358 356 - error = devm_device_add_group(&pdev->dev, &axp20x_attribute_group); 357 - if (error) { 358 - dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n", 359 - error); 360 - return error; 361 - } 362 - 363 359 platform_set_drvdata(pdev, axp20x_pek); 364 360 365 361 return 0; ··· 401 411 .driver = { 402 412 .name = "axp20x-pek", 403 413 .pm = &axp20x_pek_pm_ops, 414 + .dev_groups = axp20x_groups, 404 415 }, 405 416 }; 406 417 module_platform_driver(axp20x_pek_driver);