aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/smsc47m1.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/smsc47m1.c')
-rw-r--r--drivers/hwmon/smsc47m1.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 1e21c8cc948f..d3181967f167 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -134,7 +134,7 @@ struct smsc47m1_sio_data {
134 134
135 135
136static int smsc47m1_probe(struct platform_device *pdev); 136static int smsc47m1_probe(struct platform_device *pdev);
137static int smsc47m1_remove(struct platform_device *pdev); 137static int __devexit smsc47m1_remove(struct platform_device *pdev);
138static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, 138static struct smsc47m1_data *smsc47m1_update_device(struct device *dev,
139 int init); 139 int init);
140 140
@@ -585,6 +585,8 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev)
585 585
586 if ((err = device_create_file(dev, &dev_attr_alarms))) 586 if ((err = device_create_file(dev, &dev_attr_alarms)))
587 goto error_remove_files; 587 goto error_remove_files;
588 if ((err = device_create_file(dev, &dev_attr_name)))
589 goto error_remove_files;
588 590
589 data->class_dev = hwmon_device_register(dev); 591 data->class_dev = hwmon_device_register(dev);
590 if (IS_ERR(data->class_dev)) { 592 if (IS_ERR(data->class_dev)) {
@@ -597,6 +599,7 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev)
597error_remove_files: 599error_remove_files:
598 sysfs_remove_group(&dev->kobj, &smsc47m1_group); 600 sysfs_remove_group(&dev->kobj, &smsc47m1_group);
599error_free: 601error_free:
602 platform_set_drvdata(pdev, NULL);
600 kfree(data); 603 kfree(data);
601error_release: 604error_release:
602 release_region(res->start, SMSC_EXTENT); 605 release_region(res->start, SMSC_EXTENT);
@@ -608,12 +611,12 @@ static int __devexit smsc47m1_remove(struct platform_device *pdev)
608 struct smsc47m1_data *data = platform_get_drvdata(pdev); 611 struct smsc47m1_data *data = platform_get_drvdata(pdev);
609 struct resource *res; 612 struct resource *res;
610 613
611 platform_set_drvdata(pdev, NULL);
612 hwmon_device_unregister(data->class_dev); 614 hwmon_device_unregister(data->class_dev);
613 sysfs_remove_group(&pdev->dev.kobj, &smsc47m1_group); 615 sysfs_remove_group(&pdev->dev.kobj, &smsc47m1_group);
614 616
615 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 617 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
616 release_region(res->start, SMSC_EXTENT); 618 release_region(res->start, SMSC_EXTENT);
619 platform_set_drvdata(pdev, NULL);
617 kfree(data); 620 kfree(data);
618 621
619 return 0; 622 return 0;
@@ -693,15 +696,12 @@ static int __init smsc47m1_device_add(unsigned short address,
693 goto exit_device_put; 696 goto exit_device_put;
694 } 697 }
695 698
696 pdev->dev.platform_data = kmalloc(sizeof(struct smsc47m1_sio_data), 699 err = platform_device_add_data(pdev, sio_data,
697 GFP_KERNEL); 700 sizeof(struct smsc47m1_sio_data));
698 if (!pdev->dev.platform_data) { 701 if (err) {
699 err = -ENOMEM;
700 printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); 702 printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
701 goto exit_device_put; 703 goto exit_device_put;
702 } 704 }
703 memcpy(pdev->dev.platform_data, sio_data,
704 sizeof(struct smsc47m1_sio_data));
705 705
706 err = platform_device_add(pdev); 706 err = platform_device_add(pdev);
707 if (err) { 707 if (err) {