diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/net/irda | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff) |
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/net/irda')
-rw-r--r-- | drivers/net/irda/sa1100_ir.c | 28 | ||||
-rw-r--r-- | drivers/net/irda/smsc-ircc2.c | 27 |
2 files changed, 28 insertions, 27 deletions
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index 76e0b9fb5e96..63d38fbbd04e 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c | |||
@@ -291,9 +291,9 @@ static void sa1100_irda_shutdown(struct sa1100_irda *si) | |||
291 | /* | 291 | /* |
292 | * Suspend the IrDA interface. | 292 | * Suspend the IrDA interface. |
293 | */ | 293 | */ |
294 | static int sa1100_irda_suspend(struct device *_dev, pm_message_t state) | 294 | static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state) |
295 | { | 295 | { |
296 | struct net_device *dev = dev_get_drvdata(_dev); | 296 | struct net_device *dev = platform_get_drvdata(pdev); |
297 | struct sa1100_irda *si; | 297 | struct sa1100_irda *si; |
298 | 298 | ||
299 | if (!dev) | 299 | if (!dev) |
@@ -316,9 +316,9 @@ static int sa1100_irda_suspend(struct device *_dev, pm_message_t state) | |||
316 | /* | 316 | /* |
317 | * Resume the IrDA interface. | 317 | * Resume the IrDA interface. |
318 | */ | 318 | */ |
319 | static int sa1100_irda_resume(struct device *_dev) | 319 | static int sa1100_irda_resume(struct platform_device *pdev) |
320 | { | 320 | { |
321 | struct net_device *dev = dev_get_drvdata(_dev); | 321 | struct net_device *dev = platform_get_drvdata(pdev); |
322 | struct sa1100_irda *si; | 322 | struct sa1100_irda *si; |
323 | 323 | ||
324 | if (!dev) | 324 | if (!dev) |
@@ -886,9 +886,8 @@ static int sa1100_irda_init_iobuf(iobuff_t *io, int size) | |||
886 | return io->head ? 0 : -ENOMEM; | 886 | return io->head ? 0 : -ENOMEM; |
887 | } | 887 | } |
888 | 888 | ||
889 | static int sa1100_irda_probe(struct device *_dev) | 889 | static int sa1100_irda_probe(struct platform_device *pdev) |
890 | { | 890 | { |
891 | struct platform_device *pdev = to_platform_device(_dev); | ||
892 | struct net_device *dev; | 891 | struct net_device *dev; |
893 | struct sa1100_irda *si; | 892 | struct sa1100_irda *si; |
894 | unsigned int baudrate_mask; | 893 | unsigned int baudrate_mask; |
@@ -967,7 +966,7 @@ static int sa1100_irda_probe(struct device *_dev) | |||
967 | 966 | ||
968 | err = register_netdev(dev); | 967 | err = register_netdev(dev); |
969 | if (err == 0) | 968 | if (err == 0) |
970 | dev_set_drvdata(&pdev->dev, dev); | 969 | platform_set_drvdata(pdev, dev); |
971 | 970 | ||
972 | if (err) { | 971 | if (err) { |
973 | err_mem_5: | 972 | err_mem_5: |
@@ -985,9 +984,9 @@ static int sa1100_irda_probe(struct device *_dev) | |||
985 | return err; | 984 | return err; |
986 | } | 985 | } |
987 | 986 | ||
988 | static int sa1100_irda_remove(struct device *_dev) | 987 | static int sa1100_irda_remove(struct platform_device *pdev) |
989 | { | 988 | { |
990 | struct net_device *dev = dev_get_drvdata(_dev); | 989 | struct net_device *dev = platform_get_drvdata(pdev); |
991 | 990 | ||
992 | if (dev) { | 991 | if (dev) { |
993 | struct sa1100_irda *si = dev->priv; | 992 | struct sa1100_irda *si = dev->priv; |
@@ -1004,13 +1003,14 @@ static int sa1100_irda_remove(struct device *_dev) | |||
1004 | return 0; | 1003 | return 0; |
1005 | } | 1004 | } |
1006 | 1005 | ||
1007 | static struct device_driver sa1100ir_driver = { | 1006 | static struct platform_driver sa1100ir_driver = { |
1008 | .name = "sa11x0-ir", | ||
1009 | .bus = &platform_bus_type, | ||
1010 | .probe = sa1100_irda_probe, | 1007 | .probe = sa1100_irda_probe, |
1011 | .remove = sa1100_irda_remove, | 1008 | .remove = sa1100_irda_remove, |
1012 | .suspend = sa1100_irda_suspend, | 1009 | .suspend = sa1100_irda_suspend, |
1013 | .resume = sa1100_irda_resume, | 1010 | .resume = sa1100_irda_resume, |
1011 | .driver = { | ||
1012 | .name = "sa11x0-ir", | ||
1013 | }, | ||
1014 | }; | 1014 | }; |
1015 | 1015 | ||
1016 | static int __init sa1100_irda_init(void) | 1016 | static int __init sa1100_irda_init(void) |
@@ -1023,12 +1023,12 @@ static int __init sa1100_irda_init(void) | |||
1023 | if (power_level > 3) | 1023 | if (power_level > 3) |
1024 | power_level = 3; | 1024 | power_level = 3; |
1025 | 1025 | ||
1026 | return driver_register(&sa1100ir_driver); | 1026 | return platform_driver_register(&sa1100ir_driver); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | static void __exit sa1100_irda_exit(void) | 1029 | static void __exit sa1100_irda_exit(void) |
1030 | { | 1030 | { |
1031 | driver_unregister(&sa1100ir_driver); | 1031 | platform_driver_unregister(&sa1100ir_driver); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | module_init(sa1100_irda_init); | 1034 | module_init(sa1100_irda_init); |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index a1d207f2fa68..ec94ecdb103d 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -214,14 +214,15 @@ static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base); | |||
214 | 214 | ||
215 | /* Power Management */ | 215 | /* Power Management */ |
216 | 216 | ||
217 | static int smsc_ircc_suspend(struct device *dev, pm_message_t state); | 217 | static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state); |
218 | static int smsc_ircc_resume(struct device *dev); | 218 | static int smsc_ircc_resume(struct platform_device *dev); |
219 | 219 | ||
220 | static struct device_driver smsc_ircc_driver = { | 220 | static struct platform_driver smsc_ircc_driver = { |
221 | .name = SMSC_IRCC2_DRIVER_NAME, | ||
222 | .bus = &platform_bus_type, | ||
223 | .suspend = smsc_ircc_suspend, | 221 | .suspend = smsc_ircc_suspend, |
224 | .resume = smsc_ircc_resume, | 222 | .resume = smsc_ircc_resume, |
223 | .driver = { | ||
224 | .name = SMSC_IRCC2_DRIVER_NAME, | ||
225 | }, | ||
225 | }; | 226 | }; |
226 | 227 | ||
227 | /* Transceivers for SMSC-ircc */ | 228 | /* Transceivers for SMSC-ircc */ |
@@ -346,7 +347,7 @@ static int __init smsc_ircc_init(void) | |||
346 | 347 | ||
347 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); | 348 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); |
348 | 349 | ||
349 | ret = driver_register(&smsc_ircc_driver); | 350 | ret = platform_driver_register(&smsc_ircc_driver); |
350 | if (ret) { | 351 | if (ret) { |
351 | IRDA_ERROR("%s, Can't register driver!\n", driver_name); | 352 | IRDA_ERROR("%s, Can't register driver!\n", driver_name); |
352 | return ret; | 353 | return ret; |
@@ -378,7 +379,7 @@ static int __init smsc_ircc_init(void) | |||
378 | } | 379 | } |
379 | 380 | ||
380 | if (ret) | 381 | if (ret) |
381 | driver_unregister(&smsc_ircc_driver); | 382 | platform_driver_unregister(&smsc_ircc_driver); |
382 | 383 | ||
383 | return ret; | 384 | return ret; |
384 | } | 385 | } |
@@ -491,7 +492,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u | |||
491 | err = PTR_ERR(self->pldev); | 492 | err = PTR_ERR(self->pldev); |
492 | goto err_out5; | 493 | goto err_out5; |
493 | } | 494 | } |
494 | dev_set_drvdata(&self->pldev->dev, self); | 495 | platform_set_drvdata(self->pldev, self); |
495 | 496 | ||
496 | IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); | 497 | IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); |
497 | dev_count++; | 498 | dev_count++; |
@@ -1685,9 +1686,9 @@ static int smsc_ircc_net_close(struct net_device *dev) | |||
1685 | return 0; | 1686 | return 0; |
1686 | } | 1687 | } |
1687 | 1688 | ||
1688 | static int smsc_ircc_suspend(struct device *dev, pm_message_t state) | 1689 | static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state) |
1689 | { | 1690 | { |
1690 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1691 | struct smsc_ircc_cb *self = platform_get_drvdata(dev); |
1691 | 1692 | ||
1692 | if (!self->io.suspended) { | 1693 | if (!self->io.suspended) { |
1693 | IRDA_DEBUG(1, "%s, Suspending\n", driver_name); | 1694 | IRDA_DEBUG(1, "%s, Suspending\n", driver_name); |
@@ -1706,9 +1707,9 @@ static int smsc_ircc_suspend(struct device *dev, pm_message_t state) | |||
1706 | return 0; | 1707 | return 0; |
1707 | } | 1708 | } |
1708 | 1709 | ||
1709 | static int smsc_ircc_resume(struct device *dev) | 1710 | static int smsc_ircc_resume(struct platform_device *dev) |
1710 | { | 1711 | { |
1711 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1712 | struct smsc_ircc_cb *self = platform_get_drvdata(dev); |
1712 | 1713 | ||
1713 | if (self->io.suspended) { | 1714 | if (self->io.suspended) { |
1714 | IRDA_DEBUG(1, "%s, Waking up\n", driver_name); | 1715 | IRDA_DEBUG(1, "%s, Waking up\n", driver_name); |
@@ -1788,7 +1789,7 @@ static void __exit smsc_ircc_cleanup(void) | |||
1788 | smsc_ircc_close(dev_self[i]); | 1789 | smsc_ircc_close(dev_self[i]); |
1789 | } | 1790 | } |
1790 | 1791 | ||
1791 | driver_unregister(&smsc_ircc_driver); | 1792 | platform_driver_unregister(&smsc_ircc_driver); |
1792 | } | 1793 | } |
1793 | 1794 | ||
1794 | /* | 1795 | /* |