Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2df6d811574f46bea0d38bf91aa54df4c05488cd
Commit:     2df6d811574f46bea0d38bf91aa54df4c05488cd
Parent:     f641b588fdfd25e73c73f6e4977cd2daf8a5e363
Author:     Jean Delvare <[EMAIL PROTECTED]>
AuthorDate: Sat Jun 9 10:11:16 2007 -0400
Committer:  Mark M. Hoffman <[EMAIL PROTECTED]>
CommitDate: Thu Jul 19 14:22:12 2007 -0400

    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 <[EMAIL PROTECTED]>
    Cc: David Hubbard <[EMAIL PROTECTED]>
---
 drivers/hwmon/f71805f.c  |    9 +++------
 drivers/hwmon/smsc47m1.c |    9 +++------
 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 cdbe309..e8b1504 100644
--- a/drivers/hwmon/f71805f.c
+++ b/drivers/hwmon/f71805f.c
@@ -1290,15 +1290,12 @@ static int __init f71805f_device_add(unsigned short 
address,
                goto exit_device_put;
        }
 
-       pdev->dev.platform_data = kmalloc(sizeof(struct f71805f_sio_data),
-                                         GFP_KERNEL);
-       if (!pdev->dev.platform_data) {
-               err = -ENOMEM;
+       err = platform_device_add_data(pdev, sio_data,
+                                      sizeof(struct f71805f_sio_data));
+       if (err) {
                printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
                goto exit_device_put;
        }
-       memcpy(pdev->dev.platform_data, sio_data,
-              sizeof(struct f71805f_sio_data));
 
        err = platform_device_add(pdev);
        if (err) {
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 1e21c8c..9bac3c2 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -693,15 +693,12 @@ static int __init smsc47m1_device_add(unsigned short 
address,
                goto exit_device_put;
        }
 
-       pdev->dev.platform_data = kmalloc(sizeof(struct smsc47m1_sio_data),
-                                         GFP_KERNEL);
-       if (!pdev->dev.platform_data) {
-               err = -ENOMEM;
+       err = platform_device_add_data(pdev, sio_data,
+                                      sizeof(struct smsc47m1_sio_data));
+       if (err) {
                printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
                goto exit_device_put;
        }
-       memcpy(pdev->dev.platform_data, sio_data,
-              sizeof(struct smsc47m1_sio_data));
 
        err = platform_device_add(pdev);
        if (err) {
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index 12cb40a..72aee3c 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -1548,15 +1548,12 @@ static int __init w83627hf_device_add(unsigned short 
address,
                goto exit_device_put;
        }
 
-       pdev->dev.platform_data = kmalloc(sizeof(struct w83627hf_sio_data),
-                                         GFP_KERNEL);
-       if (!pdev->dev.platform_data) {
-               err = -ENOMEM;
+       err = platform_device_add_data(pdev, sio_data,
+                                      sizeof(struct w83627hf_sio_data));
+       if (err) {
                printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
                goto exit_device_put;
        }
-       memcpy(pdev->dev.platform_data, sio_data,
-              sizeof(struct w83627hf_sio_data));
 
        err = platform_device_add(pdev);
        if (err) {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to