--- zzzz-none-000/linux-3.10.107/drivers/hwmon/twl4030-madc-hwmon.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/hwmon/twl4030-madc-hwmon.c 2021-02-04 17:41:59.000000000 +0000 @@ -74,7 +74,7 @@ static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, madc_read, NULL, 12); static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, madc_read, NULL, 15); -static struct attribute *twl4030_madc_attributes[] = { +static struct attribute *twl4030_madc_attrs[] = { &sensor_dev_attr_in0_input.dev_attr.attr, &sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_in2_input.dev_attr.attr, @@ -91,49 +91,22 @@ &sensor_dev_attr_in15_input.dev_attr.attr, NULL }; - -static const struct attribute_group twl4030_madc_group = { - .attrs = twl4030_madc_attributes, -}; +ATTRIBUTE_GROUPS(twl4030_madc); static int twl4030_madc_hwmon_probe(struct platform_device *pdev) { - int ret; struct device *hwmon; - ret = sysfs_create_group(&pdev->dev.kobj, &twl4030_madc_group); - if (ret) - goto err_sysfs; - hwmon = hwmon_device_register(&pdev->dev); - if (IS_ERR(hwmon)) { - dev_err(&pdev->dev, "hwmon_device_register failed.\n"); - ret = PTR_ERR(hwmon); - goto err_reg; - } - - return 0; - -err_reg: - sysfs_remove_group(&pdev->dev.kobj, &twl4030_madc_group); -err_sysfs: - - return ret; -} - -static int twl4030_madc_hwmon_remove(struct platform_device *pdev) -{ - hwmon_device_unregister(&pdev->dev); - sysfs_remove_group(&pdev->dev.kobj, &twl4030_madc_group); - - return 0; + hwmon = devm_hwmon_device_register_with_groups(&pdev->dev, + "twl4030_madc", NULL, + twl4030_madc_groups); + return PTR_ERR_OR_ZERO(hwmon); } static struct platform_driver twl4030_madc_hwmon_driver = { .probe = twl4030_madc_hwmon_probe, - .remove = twl4030_madc_hwmon_remove, .driver = { .name = "twl4030_madc_hwmon", - .owner = THIS_MODULE, }, };