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>
This commit is contained in:
parent
f641b588fd
commit
2df6d81157
@ -1290,15 +1290,12 @@ static int __init f71805f_device_add(unsigned short address,
|
|||||||
goto exit_device_put;
|
goto exit_device_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdev->dev.platform_data = kmalloc(sizeof(struct f71805f_sio_data),
|
err = platform_device_add_data(pdev, sio_data,
|
||||||
GFP_KERNEL);
|
sizeof(struct f71805f_sio_data));
|
||||||
if (!pdev->dev.platform_data) {
|
if (err) {
|
||||||
err = -ENOMEM;
|
|
||||||
printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
|
printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
|
||||||
goto exit_device_put;
|
goto exit_device_put;
|
||||||
}
|
}
|
||||||
memcpy(pdev->dev.platform_data, sio_data,
|
|
||||||
sizeof(struct f71805f_sio_data));
|
|
||||||
|
|
||||||
err = platform_device_add(pdev);
|
err = platform_device_add(pdev);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -693,15 +693,12 @@ static int __init smsc47m1_device_add(unsigned short address,
|
|||||||
goto exit_device_put;
|
goto exit_device_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdev->dev.platform_data = kmalloc(sizeof(struct smsc47m1_sio_data),
|
err = platform_device_add_data(pdev, sio_data,
|
||||||
GFP_KERNEL);
|
sizeof(struct smsc47m1_sio_data));
|
||||||
if (!pdev->dev.platform_data) {
|
if (err) {
|
||||||
err = -ENOMEM;
|
|
||||||
printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
|
printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
|
||||||
goto exit_device_put;
|
goto exit_device_put;
|
||||||
}
|
}
|
||||||
memcpy(pdev->dev.platform_data, sio_data,
|
|
||||||
sizeof(struct smsc47m1_sio_data));
|
|
||||||
|
|
||||||
err = platform_device_add(pdev);
|
err = platform_device_add(pdev);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -1548,15 +1548,12 @@ static int __init w83627hf_device_add(unsigned short address,
|
|||||||
goto exit_device_put;
|
goto exit_device_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdev->dev.platform_data = kmalloc(sizeof(struct w83627hf_sio_data),
|
err = platform_device_add_data(pdev, sio_data,
|
||||||
GFP_KERNEL);
|
sizeof(struct w83627hf_sio_data));
|
||||||
if (!pdev->dev.platform_data) {
|
if (err) {
|
||||||
err = -ENOMEM;
|
|
||||||
printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
|
printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
|
||||||
goto exit_device_put;
|
goto exit_device_put;
|
||||||
}
|
}
|
||||||
memcpy(pdev->dev.platform_data, sio_data,
|
|
||||||
sizeof(struct w83627hf_sio_data));
|
|
||||||
|
|
||||||
err = platform_device_add(pdev);
|
err = platform_device_add(pdev);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user