hwmon: (mc13783-adc.c) Convert to use devm_ functions
Guenter Roeck
maintainerPATCH 1/95 hwmon: (mc13783-adc.c) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.
Cc Uwe Kleine-Koenig <[email protected]>
Signed-off-by Guenter Roeck <[email protected]>
--- drivers/hwmon/mc13783-adc.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/hwmon/mc13783-adc.c +2 -10
@@ -179,7 +179,7 @@ static int __init mc13783_adc_probe(struct platform_device *pdev)const struct platform_device_id *id =platform_get_device_id (pdev);char *dash; - priv =kzalloc (sizeof (*priv),GFP_KERNEL ); + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;
@@ -194,7 +194,7 @@ static int __init mc13783_adc_probe(struct platform_device *pdev)/* Register sysfs hooks */ ret =sysfs_create_group (&pdev->dev.kobj, &mc13783_group_base);if (ret) - goto out_err_create_base; +return ret;if (id->driver_data &MC13783_ADC_16CHANS ) { ret = sysfs_create_group(&pdev->dev.kobj,
@@ -230,11 +230,6 @@ out_err_create_ts: out_err_create_16chans:sysfs_remove_group (&pdev->dev.kobj, &mc13783_group_base); -out_err_create_base: - -platform_set_drvdata (pdev,NULL ); -kfree (priv); -return ret; }
@@ -253,9 +248,6 @@ static int __devexit mc13783_adc_remove(struct platform_device *pdev)sysfs_remove_group (&pdev->dev.kobj, &mc13783_group_base); -platform_set_drvdata (pdev,NULL ); -kfree (priv); -return 0 ; }
Signature · 7 lines
1.7.9.7 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 4 lines · Guenter Roeck
Convert to use
devm_functions to reduce code size and simplify the code.Cc Uwe Kleine-Koenig <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Looks good, Acked-by: Uwe Kleine-Koenig <[email protected]>
Thanks
Uwe
Quoted 52 lines
--- drivers/hwmon/mc13783-adc.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)drivers/hwmon/mc13783-adc.c +2
-10@@ -179,7 +179,7 @@ static int __init mc13783_adc_probe(struct platform_device *pdev)const struct platform_device_id *id =platform_get_device_id (pdev);char *dash; - priv =kzalloc (sizeof (*priv),GFP_KERNEL ); + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;@@ -194,7 +194,7 @@ static int __init mc13783_adc_probe(struct platform_device *pdev)/* Register sysfs hooks */ ret =sysfs_create_group (&pdev->dev.kobj, &mc13783_group_base);if (ret) - goto out_err_create_base; +return ret;if (id->driver_data &MC13783_ADC_16CHANS ) { ret = sysfs_create_group(&pdev->dev.kobj,@@ -230,11 +230,6 @@ out_err_create_ts: out_err_create_16chans:sysfs_remove_group (&pdev->dev.kobj, &mc13783_group_base); -out_err_create_base: - -platform_set_drvdata (pdev,NULL ); -kfree (priv); -return ret; }@@ -253,9 +248,6 @@ static int __devexit mc13783_adc_remove(struct platform_device *pdev)sysfs_remove_group (&pdev->dev.kobj, &mc13783_group_base); -platform_set_drvdata (pdev,NULL ); -kfree (priv); -return 0 ; }Signature · 1 line
1.7.9.7
Signature · 7 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors