diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2012-10-14 03:05:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-24 14:39:47 -0400 |
commit | 95113728f03cc6775ae895133c7fc420221cc8a4 (patch) | |
tree | da238da9b0b17e20db16e3b39dd7ce7209e032c1 /drivers/tty/serial/clps711x.c | |
parent | e1a9c17969f0aa60cb00f1f777b33a07f4e84883 (diff) |
serial: clps711x: Add platform_driver interface to clps711x driver
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/clps711x.c')
-rw-r--r-- | drivers/tty/serial/clps711x.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index d0f719fafc84..07fef1cbc115 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c | |||
@@ -37,10 +37,13 @@ | |||
37 | #include <linux/serial_core.h> | 37 | #include <linux/serial_core.h> |
38 | #include <linux/serial.h> | 38 | #include <linux/serial.h> |
39 | #include <linux/io.h> | 39 | #include <linux/io.h> |
40 | #include <linux/platform_device.h> | ||
40 | 41 | ||
41 | #include <mach/hardware.h> | 42 | #include <mach/hardware.h> |
42 | #include <asm/irq.h> | 43 | #include <asm/irq.h> |
43 | 44 | ||
45 | #define UART_CLPS711X_NAME "uart-clps711x" | ||
46 | |||
44 | #define UART_NR 2 | 47 | #define UART_NR 2 |
45 | 48 | ||
46 | #define SERIAL_CLPS711X_MAJOR 204 | 49 | #define SERIAL_CLPS711X_MAJOR 204 |
@@ -543,7 +546,7 @@ static struct uart_driver clps711x_reg = { | |||
543 | .cons = CLPS711X_CONSOLE, | 546 | .cons = CLPS711X_CONSOLE, |
544 | }; | 547 | }; |
545 | 548 | ||
546 | static int __init clps711xuart_init(void) | 549 | static int __devinit uart_clps711x_probe(struct platform_device *pdev) |
547 | { | 550 | { |
548 | int ret, i; | 551 | int ret, i; |
549 | 552 | ||
@@ -559,7 +562,7 @@ static int __init clps711xuart_init(void) | |||
559 | return 0; | 562 | return 0; |
560 | } | 563 | } |
561 | 564 | ||
562 | static void __exit clps711xuart_exit(void) | 565 | static int __devexit uart_clps711x_remove(struct platform_device *pdev) |
563 | { | 566 | { |
564 | int i; | 567 | int i; |
565 | 568 | ||
@@ -567,12 +570,36 @@ static void __exit clps711xuart_exit(void) | |||
567 | uart_remove_one_port(&clps711x_reg, &clps711x_ports[i]); | 570 | uart_remove_one_port(&clps711x_reg, &clps711x_ports[i]); |
568 | 571 | ||
569 | uart_unregister_driver(&clps711x_reg); | 572 | uart_unregister_driver(&clps711x_reg); |
573 | |||
574 | return 0; | ||
570 | } | 575 | } |
571 | 576 | ||
572 | module_init(clps711xuart_init); | 577 | static struct platform_driver clps711x_uart_driver = { |
573 | module_exit(clps711xuart_exit); | 578 | .driver = { |
579 | .name = UART_CLPS711X_NAME, | ||
580 | .owner = THIS_MODULE, | ||
581 | }, | ||
582 | .probe = uart_clps711x_probe, | ||
583 | .remove = __devexit_p(uart_clps711x_remove), | ||
584 | }; | ||
585 | module_platform_driver(clps711x_uart_driver); | ||
586 | |||
587 | static struct platform_device clps711x_uart_device = { | ||
588 | .name = UART_CLPS711X_NAME, | ||
589 | }; | ||
590 | |||
591 | static int __init uart_clps711x_init(void) | ||
592 | { | ||
593 | return platform_device_register(&clps711x_uart_device); | ||
594 | } | ||
595 | module_init(uart_clps711x_init); | ||
596 | |||
597 | static void __exit uart_clps711x_exit(void) | ||
598 | { | ||
599 | platform_device_unregister(&clps711x_uart_device); | ||
600 | } | ||
601 | module_exit(uart_clps711x_exit); | ||
574 | 602 | ||
575 | MODULE_AUTHOR("Deep Blue Solutions Ltd"); | 603 | MODULE_AUTHOR("Deep Blue Solutions Ltd"); |
576 | MODULE_DESCRIPTION("CLPS-711x generic serial driver"); | 604 | MODULE_DESCRIPTION("CLPS711X serial driver"); |
577 | MODULE_LICENSE("GPL"); | 605 | MODULE_LICENSE("GPL"); |
578 | MODULE_ALIAS_CHARDEV(SERIAL_CLPS711X_MAJOR, SERIAL_CLPS711X_MINOR); | ||