aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/8250.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-09 17:32:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-09 17:32:44 -0500
commit3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch)
treed8825be54cefb6ad6707478d719c8e30605bee7b /drivers/serial/8250.c
parent00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (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/serial/8250.c')
-rw-r--r--drivers/serial/8250.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 98820603e75f..3742753241ee 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2381,9 +2381,9 @@ void serial8250_resume_port(int line)
2381 * list is terminated with a zero flags entry, which means we expect 2381 * list is terminated with a zero flags entry, which means we expect
2382 * all entries to have at least UPF_BOOT_AUTOCONF set. 2382 * all entries to have at least UPF_BOOT_AUTOCONF set.
2383 */ 2383 */
2384static int __devinit serial8250_probe(struct device *dev) 2384static int __devinit serial8250_probe(struct platform_device *dev)
2385{ 2385{
2386 struct plat_serial8250_port *p = dev->platform_data; 2386 struct plat_serial8250_port *p = dev->dev.platform_data;
2387 struct uart_port port; 2387 struct uart_port port;
2388 int ret, i; 2388 int ret, i;
2389 2389
@@ -2399,12 +2399,12 @@ static int __devinit serial8250_probe(struct device *dev)
2399 port.flags = p->flags; 2399 port.flags = p->flags;
2400 port.mapbase = p->mapbase; 2400 port.mapbase = p->mapbase;
2401 port.hub6 = p->hub6; 2401 port.hub6 = p->hub6;
2402 port.dev = dev; 2402 port.dev = &dev->dev;
2403 if (share_irqs) 2403 if (share_irqs)
2404 port.flags |= UPF_SHARE_IRQ; 2404 port.flags |= UPF_SHARE_IRQ;
2405 ret = serial8250_register_port(&port); 2405 ret = serial8250_register_port(&port);
2406 if (ret < 0) { 2406 if (ret < 0) {
2407 dev_err(dev, "unable to register port at index %d " 2407 dev_err(&dev->dev, "unable to register port at index %d "
2408 "(IO%lx MEM%lx IRQ%d): %d\n", i, 2408 "(IO%lx MEM%lx IRQ%d): %d\n", i,
2409 p->iobase, p->mapbase, p->irq, ret); 2409 p->iobase, p->mapbase, p->irq, ret);
2410 } 2410 }
@@ -2415,54 +2415,55 @@ static int __devinit serial8250_probe(struct device *dev)
2415/* 2415/*
2416 * Remove serial ports registered against a platform device. 2416 * Remove serial ports registered against a platform device.
2417 */ 2417 */
2418static int __devexit serial8250_remove(struct device *dev) 2418static int __devexit serial8250_remove(struct platform_device *dev)
2419{ 2419{
2420 int i; 2420 int i;
2421 2421
2422 for (i = 0; i < UART_NR; i++) { 2422 for (i = 0; i < UART_NR; i++) {
2423 struct uart_8250_port *up = &serial8250_ports[i]; 2423 struct uart_8250_port *up = &serial8250_ports[i];
2424 2424
2425 if (up->port.dev == dev) 2425 if (up->port.dev == &dev->dev)
2426 serial8250_unregister_port(i); 2426 serial8250_unregister_port(i);
2427 } 2427 }
2428 return 0; 2428 return 0;
2429} 2429}
2430 2430
2431static int serial8250_suspend(struct device *dev, pm_message_t state) 2431static int serial8250_suspend(struct platform_device *dev, pm_message_t state)
2432{ 2432{
2433 int i; 2433 int i;
2434 2434
2435 for (i = 0; i < UART_NR; i++) { 2435 for (i = 0; i < UART_NR; i++) {
2436 struct uart_8250_port *up = &serial8250_ports[i]; 2436 struct uart_8250_port *up = &serial8250_ports[i];
2437 2437
2438 if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) 2438 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
2439 uart_suspend_port(&serial8250_reg, &up->port); 2439 uart_suspend_port(&serial8250_reg, &up->port);
2440 } 2440 }
2441 2441
2442 return 0; 2442 return 0;
2443} 2443}
2444 2444
2445static int serial8250_resume(struct device *dev) 2445static int serial8250_resume(struct platform_device *dev)
2446{ 2446{
2447 int i; 2447 int i;
2448 2448
2449 for (i = 0; i < UART_NR; i++) { 2449 for (i = 0; i < UART_NR; i++) {
2450 struct uart_8250_port *up = &serial8250_ports[i]; 2450 struct uart_8250_port *up = &serial8250_ports[i];
2451 2451
2452 if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) 2452 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
2453 uart_resume_port(&serial8250_reg, &up->port); 2453 uart_resume_port(&serial8250_reg, &up->port);
2454 } 2454 }
2455 2455
2456 return 0; 2456 return 0;
2457} 2457}
2458 2458
2459static struct device_driver serial8250_isa_driver = { 2459static struct platform_driver serial8250_isa_driver = {
2460 .name = "serial8250",
2461 .bus = &platform_bus_type,
2462 .probe = serial8250_probe, 2460 .probe = serial8250_probe,
2463 .remove = __devexit_p(serial8250_remove), 2461 .remove = __devexit_p(serial8250_remove),
2464 .suspend = serial8250_suspend, 2462 .suspend = serial8250_suspend,
2465 .resume = serial8250_resume, 2463 .resume = serial8250_resume,
2464 .driver = {
2465 .name = "serial8250",
2466 },
2466}; 2467};
2467 2468
2468/* 2469/*
@@ -2608,7 +2609,7 @@ static int __init serial8250_init(void)
2608 2609
2609 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); 2610 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
2610 2611
2611 ret = driver_register(&serial8250_isa_driver); 2612 ret = platform_driver_register(&serial8250_isa_driver);
2612 if (ret == 0) 2613 if (ret == 0)
2613 goto out; 2614 goto out;
2614 2615
@@ -2630,7 +2631,7 @@ static void __exit serial8250_exit(void)
2630 */ 2631 */
2631 serial8250_isa_devs = NULL; 2632 serial8250_isa_devs = NULL;
2632 2633
2633 driver_unregister(&serial8250_isa_driver); 2634 platform_driver_unregister(&serial8250_isa_driver);
2634 platform_device_unregister(isa_dev); 2635 platform_device_unregister(isa_dev);
2635 2636
2636 uart_unregister_driver(&serial8250_reg); 2637 uart_unregister_driver(&serial8250_reg);