diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2012-11-30 20:07:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-12-03 13:32:15 -0500 |
commit | 96070ae4d08eefe62ac534904ce21a01e1a5c9c4 (patch) | |
tree | b515765ef5f286e870cfea782f2bcf15666a426c | |
parent | 60e476d02129acb1f863a9b4932358678ee6a355 (diff) |
irda: ep7211-sir: Convert to platform_diver
This patch converts ep7211-sir driver to platform_driver.
Since driver can be used not only for EP7211 CPU, function names
was be renamed to generic clps711x...
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/irda/ep7211-sir.c | 73 |
1 files changed, 27 insertions, 46 deletions
diff --git a/drivers/net/irda/ep7211-sir.c b/drivers/net/irda/ep7211-sir.c index f83c5b881d2d..5fe1f4dd3369 100644 --- a/drivers/net/irda/ep7211-sir.c +++ b/drivers/net/irda/ep7211-sir.c | |||
@@ -1,52 +1,18 @@ | |||
1 | /* | 1 | /* |
2 | * IR port driver for the Cirrus Logic EP7211 processor. | 2 | * IR port driver for the Cirrus Logic CLPS711X processors |
3 | * | 3 | * |
4 | * Copyright 2001, Blue Mug Inc. All rights reserved. | 4 | * Copyright 2001, Blue Mug Inc. All rights reserved. |
5 | * Copyright 2007, Samuel Ortiz <samuel@sortiz.org> | 5 | * Copyright 2007, Samuel Ortiz <samuel@sortiz.org> |
6 | */ | 6 | */ |
7 | #include <linux/module.h> | ||
8 | #include <linux/delay.h> | ||
9 | #include <linux/tty.h> | ||
10 | #include <linux/init.h> | ||
11 | #include <linux/spinlock.h> | ||
12 | 7 | ||
13 | #include <net/irda/irda.h> | 8 | #include <linux/module.h> |
14 | #include <net/irda/irda_device.h> | 9 | #include <linux/platform_device.h> |
15 | 10 | ||
16 | #include <asm/io.h> | ||
17 | #include <mach/hardware.h> | 11 | #include <mach/hardware.h> |
18 | 12 | ||
19 | #include "sir-dev.h" | 13 | #include "sir-dev.h" |
20 | 14 | ||
21 | #define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */ | 15 | static int clps711x_dongle_open(struct sir_dev *dev) |
22 | #define MAX_DELAY 10000 /* 1 ms */ | ||
23 | |||
24 | static int ep7211_open(struct sir_dev *dev); | ||
25 | static int ep7211_close(struct sir_dev *dev); | ||
26 | static int ep7211_change_speed(struct sir_dev *dev, unsigned speed); | ||
27 | static int ep7211_reset(struct sir_dev *dev); | ||
28 | |||
29 | static struct dongle_driver ep7211 = { | ||
30 | .owner = THIS_MODULE, | ||
31 | .driver_name = "EP7211 IR driver", | ||
32 | .type = IRDA_EP7211_DONGLE, | ||
33 | .open = ep7211_open, | ||
34 | .close = ep7211_close, | ||
35 | .reset = ep7211_reset, | ||
36 | .set_speed = ep7211_change_speed, | ||
37 | }; | ||
38 | |||
39 | static int __init ep7211_sir_init(void) | ||
40 | { | ||
41 | return irda_register_dongle(&ep7211); | ||
42 | } | ||
43 | |||
44 | static void __exit ep7211_sir_cleanup(void) | ||
45 | { | ||
46 | irda_unregister_dongle(&ep7211); | ||
47 | } | ||
48 | |||
49 | static int ep7211_open(struct sir_dev *dev) | ||
50 | { | 16 | { |
51 | unsigned int syscon; | 17 | unsigned int syscon; |
52 | 18 | ||
@@ -58,7 +24,7 @@ static int ep7211_open(struct sir_dev *dev) | |||
58 | return 0; | 24 | return 0; |
59 | } | 25 | } |
60 | 26 | ||
61 | static int ep7211_close(struct sir_dev *dev) | 27 | static int clps711x_dongle_close(struct sir_dev *dev) |
62 | { | 28 | { |
63 | unsigned int syscon; | 29 | unsigned int syscon; |
64 | 30 | ||
@@ -70,20 +36,35 @@ static int ep7211_close(struct sir_dev *dev) | |||
70 | return 0; | 36 | return 0; |
71 | } | 37 | } |
72 | 38 | ||
73 | static int ep7211_change_speed(struct sir_dev *dev, unsigned speed) | 39 | static struct dongle_driver clps711x_dongle = { |
40 | .owner = THIS_MODULE, | ||
41 | .driver_name = "EP7211 IR driver", | ||
42 | .type = IRDA_EP7211_DONGLE, | ||
43 | .open = clps711x_dongle_open, | ||
44 | .close = clps711x_dongle_close, | ||
45 | }; | ||
46 | |||
47 | static int clps711x_sir_probe(struct platform_device *pdev) | ||
74 | { | 48 | { |
75 | return 0; | 49 | return irda_register_dongle(&clps711x_dongle); |
76 | } | 50 | } |
77 | 51 | ||
78 | static int ep7211_reset(struct sir_dev *dev) | 52 | static int clps711x_sir_remove(struct platform_device *pdev) |
79 | { | 53 | { |
80 | return 0; | 54 | return irda_unregister_dongle(&clps711x_dongle); |
81 | } | 55 | } |
82 | 56 | ||
57 | static struct platform_driver clps711x_sir_driver = { | ||
58 | .driver = { | ||
59 | .name = "sir-clps711x", | ||
60 | .owner = THIS_MODULE, | ||
61 | }, | ||
62 | .probe = clps711x_sir_probe, | ||
63 | .remove = clps711x_sir_remove, | ||
64 | }; | ||
65 | module_platform_driver(clps711x_sir_driver); | ||
66 | |||
83 | MODULE_AUTHOR("Samuel Ortiz <samuel@sortiz.org>"); | 67 | MODULE_AUTHOR("Samuel Ortiz <samuel@sortiz.org>"); |
84 | MODULE_DESCRIPTION("EP7211 IR dongle driver"); | 68 | MODULE_DESCRIPTION("EP7211 IR dongle driver"); |
85 | MODULE_LICENSE("GPL"); | 69 | MODULE_LICENSE("GPL"); |
86 | MODULE_ALIAS("irda-dongle-13"); /* IRDA_EP7211_DONGLE */ | 70 | MODULE_ALIAS("irda-dongle-13"); /* IRDA_EP7211_DONGLE */ |
87 | |||
88 | module_init(ep7211_sir_init); | ||
89 | module_exit(ep7211_sir_cleanup); | ||