--- zzzz-none-000/linux-3.10.107/drivers/leds/leds-wm831x-status.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/leds/leds-wm831x-status.c 2021-02-04 17:41:59.000000000 +0000 @@ -10,7 +10,6 @@ */ #include -#include #include #include #include @@ -220,6 +219,12 @@ static DEVICE_ATTR(src, 0644, wm831x_status_src_show, wm831x_status_src_store); +static struct attribute *wm831x_status_attrs[] = { + &dev_attr_src.attr, + NULL +}; +ATTRIBUTE_GROUPS(wm831x_status); + static int wm831x_status_probe(struct platform_device *pdev) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); @@ -233,21 +238,20 @@ res = platform_get_resource(pdev, IORESOURCE_REG, 0); if (res == NULL) { dev_err(&pdev->dev, "No register resource\n"); - ret = -EINVAL; - goto err; + return -EINVAL; } drvdata = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_status), GFP_KERNEL); if (!drvdata) return -ENOMEM; - dev_set_drvdata(&pdev->dev, drvdata); + platform_set_drvdata(pdev, drvdata); drvdata->wm831x = wm831x; drvdata->reg = res->start; - if (wm831x->dev->platform_data) - chip_pdata = wm831x->dev->platform_data; + if (dev_get_platdata(wm831x->dev)) + chip_pdata = dev_get_platdata(wm831x->dev); else chip_pdata = NULL; @@ -285,31 +289,21 @@ drvdata->cdev.default_trigger = pdata.default_trigger; drvdata->cdev.brightness_set = wm831x_status_set; drvdata->cdev.blink_set = wm831x_status_blink_set; + drvdata->cdev.groups = wm831x_status_groups; ret = led_classdev_register(wm831x->dev, &drvdata->cdev); if (ret < 0) { dev_err(&pdev->dev, "Failed to register LED: %d\n", ret); - goto err_led; + return ret; } - ret = device_create_file(drvdata->cdev.dev, &dev_attr_src); - if (ret != 0) - dev_err(&pdev->dev, - "No source control for LED: %d\n", ret); - return 0; - -err_led: - led_classdev_unregister(&drvdata->cdev); -err: - return ret; } static int wm831x_status_remove(struct platform_device *pdev) { struct wm831x_status *drvdata = platform_get_drvdata(pdev); - device_remove_file(drvdata->cdev.dev, &dev_attr_src); led_classdev_unregister(&drvdata->cdev); return 0; @@ -318,7 +312,6 @@ static struct platform_driver wm831x_status_driver = { .driver = { .name = "wm831x-status", - .owner = THIS_MODULE, }, .probe = wm831x_status_probe, .remove = wm831x_status_remove,