提交 5d224ade 编写于 作者: G Guenter Roeck

hwmon: (sis5595) Convert to use devm_ functions

Convert to use devm_ functions to reduce code size and simplify the code.
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
Acked-by: NJean Delvare <khali@linux-fr.org>
上级 5e0c8769
...@@ -593,17 +593,14 @@ static int __devinit sis5595_probe(struct platform_device *pdev) ...@@ -593,17 +593,14 @@ static int __devinit sis5595_probe(struct platform_device *pdev)
/* Reserve the ISA region */ /* Reserve the ISA region */
res = platform_get_resource(pdev, IORESOURCE_IO, 0); res = platform_get_resource(pdev, IORESOURCE_IO, 0);
if (!request_region(res->start, SIS5595_EXTENT, if (!devm_request_region(&pdev->dev, res->start, SIS5595_EXTENT,
sis5595_driver.driver.name)) { sis5595_driver.driver.name))
err = -EBUSY; return -EBUSY;
goto exit;
}
data = kzalloc(sizeof(struct sis5595_data), GFP_KERNEL); data = devm_kzalloc(&pdev->dev, sizeof(struct sis5595_data),
if (!data) { GFP_KERNEL);
err = -ENOMEM; if (!data)
goto exit_release; return -ENOMEM;
}
mutex_init(&data->lock); mutex_init(&data->lock);
mutex_init(&data->update_lock); mutex_init(&data->update_lock);
...@@ -636,7 +633,7 @@ static int __devinit sis5595_probe(struct platform_device *pdev) ...@@ -636,7 +633,7 @@ static int __devinit sis5595_probe(struct platform_device *pdev)
/* Register sysfs hooks */ /* Register sysfs hooks */
err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group); err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group);
if (err) if (err)
goto exit_free; return err;
if (data->maxins == 4) { if (data->maxins == 4) {
err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group_in4); err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group_in4);
if (err) if (err)
...@@ -659,11 +656,6 @@ static int __devinit sis5595_probe(struct platform_device *pdev) ...@@ -659,11 +656,6 @@ static int __devinit sis5595_probe(struct platform_device *pdev)
sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); sysfs_remove_group(&pdev->dev.kobj, &sis5595_group);
sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4); sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4);
sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1); sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1);
exit_free:
kfree(data);
exit_release:
release_region(res->start, SIS5595_EXTENT);
exit:
return err; return err;
} }
...@@ -676,10 +668,6 @@ static int __devexit sis5595_remove(struct platform_device *pdev) ...@@ -676,10 +668,6 @@ static int __devexit sis5595_remove(struct platform_device *pdev)
sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4); sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4);
sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1); sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1);
release_region(data->addr, SIS5595_EXTENT);
platform_set_drvdata(pdev, NULL);
kfree(data);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册