]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/hwmon/nct6775.c
arm: imx6: defconfig: update tx6 defconfigs
[karo-tx-linux.git] / drivers / hwmon / nct6775.c
index 58e9e11ef32a43990c215727696c8210c0e3485b..d17325db0ea3d9f2478fc2fd7c42641603797e92 100644 (file)
@@ -724,8 +724,6 @@ struct nct6775_data {
        enum kinds kind;
        const char *name;
 
-       struct device *hwmon_dev;
-
        int num_attr_groups;
        const struct attribute_group *groups[6];
 
@@ -941,7 +939,7 @@ nct6775_create_attr_group(struct device *dev, struct sensor_template_group *tg,
        struct sensor_device_attribute_2 *a2;
        struct attribute **attrs;
        struct sensor_device_template **t;
-       int i, j, count;
+       int i, count;
 
        if (repeat <= 0)
                return ERR_PTR(-EINVAL);
@@ -972,7 +970,7 @@ nct6775_create_attr_group(struct device *dev, struct sensor_template_group *tg,
 
        for (i = 0; i < repeat; i++) {
                t = tg->templates;
-               for (j = 0; *t != NULL; j++) {
+               while (*t != NULL) {
                        snprintf(su->name, sizeof(su->name),
                                 (*t)->dev_attr.attr.name, tg->base + i);
                        if ((*t)->s2) {
@@ -3260,6 +3258,7 @@ static int nct6775_probe(struct platform_device *pdev)
        int num_reg_temp;
        u8 cr2a;
        struct attribute_group *group;
+       struct device *hwmon_dev;
 
        res = platform_get_resource(pdev, IORESOURCE_IO, 0);
        if (!devm_request_region(&pdev->dev, res->start, IOREGION_LENGTH,
@@ -3861,21 +3860,9 @@ static int nct6775_probe(struct platform_device *pdev)
        data->groups[data->num_attr_groups++] = group;
        data->groups[data->num_attr_groups++] = &nct6775_group_other;
 
-       data->hwmon_dev = hwmon_device_register_with_groups(dev, data->name,
-                                                           data, data->groups);
-       if (IS_ERR(data->hwmon_dev))
-               return PTR_ERR(data->hwmon_dev);
-
-       return 0;
-}
-
-static int nct6775_remove(struct platform_device *pdev)
-{
-       struct nct6775_data *data = platform_get_drvdata(pdev);
-
-       hwmon_device_unregister(data->hwmon_dev);
-
-       return 0;
+       hwmon_dev = devm_hwmon_device_register_with_groups(dev, data->name,
+                                                          data, data->groups);
+       return PTR_ERR_OR_ZERO(hwmon_dev);
 }
 
 #ifdef CONFIG_PM
@@ -3964,7 +3951,6 @@ static struct platform_driver nct6775_driver = {
                .pm     = NCT6775_DEV_PM_OPS,
        },
        .probe          = nct6775_probe,
-       .remove         = nct6775_remove,
 };
 
 static const char * const nct6775_sio_names[] __initconst = {