diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-06-09 10:11:16 -0400 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2007-07-19 14:22:12 -0400 |
commit | 2df6d811574f46bea0d38bf91aa54df4c05488cd (patch) | |
tree | 055b75e8cce2c052004eceff927ebd4b05a42bb9 /drivers/hwmon | |
parent | f641b588fdfd25e73c73f6e4977cd2daf8a5e363 (diff) |
hwmon: Use platform_device_add_data()
Use platform_device_add_data() in hardware monitoring drivers. This
makes the code nicer and smaller too. Reported by David Hubbard.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Hubbard <david.c.hubbard@gmail.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/f71805f.c | 9 | ||||
-rw-r--r-- | drivers/hwmon/smsc47m1.c | 9 | ||||
-rw-r--r-- | drivers/hwmon/w83627hf.c | 9 |
3 files changed, 9 insertions, 18 deletions
diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index cdbe309b8fc4..e8b15047a6d3 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c | |||
@@ -1290,15 +1290,12 @@ static int __init f71805f_device_add(unsigned short address, | |||
1290 | goto exit_device_put; | 1290 | goto exit_device_put; |
1291 | } | 1291 | } |
1292 | 1292 | ||
1293 | pdev->dev.platform_data = kmalloc(sizeof(struct f71805f_sio_data), | 1293 | err = platform_device_add_data(pdev, sio_data, |
1294 | GFP_KERNEL); | 1294 | sizeof(struct f71805f_sio_data)); |
1295 | if (!pdev->dev.platform_data) { | 1295 | if (err) { |
1296 | err = -ENOMEM; | ||
1297 | printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); | 1296 | printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); |
1298 | goto exit_device_put; | 1297 | goto exit_device_put; |
1299 | } | 1298 | } |
1300 | memcpy(pdev->dev.platform_data, sio_data, | ||
1301 | sizeof(struct f71805f_sio_data)); | ||
1302 | 1299 | ||
1303 | err = platform_device_add(pdev); | 1300 | err = platform_device_add(pdev); |
1304 | if (err) { | 1301 | if (err) { |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 1e21c8cc948f..9bac3c2d84f9 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -693,15 +693,12 @@ static int __init smsc47m1_device_add(unsigned short address, | |||
693 | goto exit_device_put; | 693 | goto exit_device_put; |
694 | } | 694 | } |
695 | 695 | ||
696 | pdev->dev.platform_data = kmalloc(sizeof(struct smsc47m1_sio_data), | 696 | err = platform_device_add_data(pdev, sio_data, |
697 | GFP_KERNEL); | 697 | sizeof(struct smsc47m1_sio_data)); |
698 | if (!pdev->dev.platform_data) { | 698 | if (err) { |
699 | err = -ENOMEM; | ||
700 | printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); | 699 | printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); |
701 | goto exit_device_put; | 700 | goto exit_device_put; |
702 | } | 701 | } |
703 | memcpy(pdev->dev.platform_data, sio_data, | ||
704 | sizeof(struct smsc47m1_sio_data)); | ||
705 | 702 | ||
706 | err = platform_device_add(pdev); | 703 | err = platform_device_add(pdev); |
707 | if (err) { | 704 | if (err) { |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 12cb40a975de..72aee3c0e8de 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -1548,15 +1548,12 @@ static int __init w83627hf_device_add(unsigned short address, | |||
1548 | goto exit_device_put; | 1548 | goto exit_device_put; |
1549 | } | 1549 | } |
1550 | 1550 | ||
1551 | pdev->dev.platform_data = kmalloc(sizeof(struct w83627hf_sio_data), | 1551 | err = platform_device_add_data(pdev, sio_data, |
1552 | GFP_KERNEL); | 1552 | sizeof(struct w83627hf_sio_data)); |
1553 | if (!pdev->dev.platform_data) { | 1553 | if (err) { |
1554 | err = -ENOMEM; | ||
1555 | printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); | 1554 | printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); |
1556 | goto exit_device_put; | 1555 | goto exit_device_put; |
1557 | } | 1556 | } |
1558 | memcpy(pdev->dev.platform_data, sio_data, | ||
1559 | sizeof(struct w83627hf_sio_data)); | ||
1560 | 1557 | ||
1561 | err = platform_device_add(pdev); | 1558 | err = platform_device_add(pdev); |
1562 | if (err) { | 1559 | if (err) { |