From 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 9 Nov 2005 22:32:44 +0000 Subject: [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 Acked-by: Greg Kroah-Hartman --- drivers/net/tokenring/proteon.c | 17 +++++++++-------- drivers/net/tokenring/skisa.c | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'drivers/net/tokenring') diff --git a/drivers/net/tokenring/proteon.c b/drivers/net/tokenring/proteon.c index d04c918ebef8..4f756960db2a 100644 --- a/drivers/net/tokenring/proteon.c +++ b/drivers/net/tokenring/proteon.c @@ -344,9 +344,10 @@ module_param_array(dma, int, NULL, 0); static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS]; -static struct device_driver proteon_driver = { - .name = "proteon", - .bus = &platform_bus_type, +static struct platform_driver proteon_driver = { + .driver = { + .name = "proteon", + }, }; static int __init proteon_init(void) @@ -355,7 +356,7 @@ static int __init proteon_init(void) struct platform_device *pdev; int i, num = 0, err = 0; - err = driver_register(&proteon_driver); + err = platform_driver_register(&proteon_driver); if (err) return err; @@ -372,7 +373,7 @@ static int __init proteon_init(void) err = setup_card(dev, &pdev->dev); if (!err) { proteon_dev[i] = pdev; - dev_set_drvdata(&pdev->dev, dev); + platform_set_drvdata(pdev, dev); ++num; } else { platform_device_unregister(pdev); @@ -399,17 +400,17 @@ static void __exit proteon_cleanup(void) if (!pdev) continue; - dev = dev_get_drvdata(&pdev->dev); + dev = platform_get_drvdata(pdev); unregister_netdev(dev); release_region(dev->base_addr, PROTEON_IO_EXTENT); free_irq(dev->irq, dev); free_dma(dev->dma); tmsdev_term(dev); free_netdev(dev); - dev_set_drvdata(&pdev->dev, NULL); + platform_set_drvdata(pdev, NULL); platform_device_unregister(pdev); } - driver_unregister(&proteon_driver); + platform_driver_unregister(&proteon_driver); } module_init(proteon_init); diff --git a/drivers/net/tokenring/skisa.c b/drivers/net/tokenring/skisa.c index 72cf708396be..d6ba41cf3110 100644 --- a/drivers/net/tokenring/skisa.c +++ b/drivers/net/tokenring/skisa.c @@ -354,9 +354,10 @@ module_param_array(dma, int, NULL, 0); static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS]; -static struct device_driver sk_isa_driver = { - .name = "skisa", - .bus = &platform_bus_type, +static struct platform_driver sk_isa_driver = { + .driver = { + .name = "skisa", + }, }; static int __init sk_isa_init(void) @@ -365,7 +366,7 @@ static int __init sk_isa_init(void) struct platform_device *pdev; int i, num = 0, err = 0; - err = driver_register(&sk_isa_driver); + err = platform_driver_register(&sk_isa_driver); if (err) return err; @@ -382,7 +383,7 @@ static int __init sk_isa_init(void) err = setup_card(dev, &pdev->dev); if (!err) { sk_isa_dev[i] = pdev; - dev_set_drvdata(&sk_isa_dev[i]->dev, dev); + platform_set_drvdata(sk_isa_dev[i], dev); ++num; } else { platform_device_unregister(pdev); @@ -409,17 +410,17 @@ static void __exit sk_isa_cleanup(void) if (!pdev) continue; - dev = dev_get_drvdata(&pdev->dev); + dev = platform_get_drvdata(pdev); unregister_netdev(dev); release_region(dev->base_addr, SK_ISA_IO_EXTENT); free_irq(dev->irq, dev); free_dma(dev->dma); tmsdev_term(dev); free_netdev(dev); - dev_set_drvdata(&pdev->dev, NULL); + platform_set_drvdata(pdev, NULL); platform_device_unregister(pdev); } - driver_unregister(&sk_isa_driver); + platform_driver_unregister(&sk_isa_driver); } module_init(sk_isa_init); -- cgit v1.2.1