From 2df6d811574f46bea0d38bf91aa54df4c05488cd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 9 Jun 2007 10:11:16 -0400 Subject: 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 Cc: David Hubbard --- drivers/hwmon/w83627hf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/hwmon/w83627hf.c') 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, 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) { -- cgit v1.2.1