diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-21 17:25:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-21 17:25:16 -0400 |
commit | b65378898c2eefb20f419632c1199bc0592e2f79 (patch) | |
tree | 052bb72d329c44790f91fc8097b8500d4774d02c /drivers/isdn/hisax/avma1_cs.c | |
parent | 157b6ceb13e4b4148ee03dd517dbe88748943125 (diff) | |
parent | 5b917a1420d3d1a9c8da49fb0090692dc9aaee86 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (22 commits)
pcmcia: synclink_cs: fix information leak to userland
pcmcia: don't call flush_scheduled_work() spuriously
serial_cs: drop spurious flush_scheduled_work() call
pcmcia/yenta: guide users in case of problems with O2-bridges
pcmcia: fix unused function compile warning
pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device
pcmcia: add a few debug statements
pcmcia: remove obsolete and wrong comments
pcmcia: avoid messages on module (un)loading
pcmcia: move driver name to struct pcmcia_driver
pcmcia: remove the "Finally, report what we've done" message
pcmcia: use autoconfiguration feature for ioports and iomem
pcmcia: introduce autoconfiguration feature
pcmcia: Documentation update
pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device
pcmcia: move config_{base,index,regs} to struct pcmcia_device
pcmcia: simplify IntType
pcmcia: simplify Status, ExtStatus register access
pcmcia: remove Pin, Copy configuration register access
pcmcia: move Vpp setup to struct pcmcia_device
...
Diffstat (limited to 'drivers/isdn/hisax/avma1_cs.c')
-rw-r--r-- | drivers/isdn/hisax/avma1_cs.c | 97 |
1 files changed, 11 insertions, 86 deletions
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 94263c22b874..ac4dd7857cbd 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | #include <asm/system.h> | 21 | #include <asm/system.h> |
22 | 22 | ||
23 | #include <pcmcia/cs.h> | ||
24 | #include <pcmcia/cistpl.h> | 23 | #include <pcmcia/cistpl.h> |
25 | #include <pcmcia/ds.h> | 24 | #include <pcmcia/ds.h> |
26 | #include "hisax_cfg.h" | 25 | #include "hisax_cfg.h" |
@@ -40,67 +39,22 @@ module_param(isdnprot, int, 0); | |||
40 | 39 | ||
41 | /*====================================================================*/ | 40 | /*====================================================================*/ |
42 | 41 | ||
43 | /* | ||
44 | The event() function is this driver's Card Services event handler. | ||
45 | It will be called by Card Services when an appropriate card status | ||
46 | event is received. The config() and release() entry points are | ||
47 | used to configure or release a socket, in response to card insertion | ||
48 | and ejection events. They are invoked from the skeleton event | ||
49 | handler. | ||
50 | */ | ||
51 | |||
52 | static int avma1cs_config(struct pcmcia_device *link) __devinit ; | 42 | static int avma1cs_config(struct pcmcia_device *link) __devinit ; |
53 | static void avma1cs_release(struct pcmcia_device *link); | 43 | static void avma1cs_release(struct pcmcia_device *link); |
54 | |||
55 | /* | ||
56 | The attach() and detach() entry points are used to create and destroy | ||
57 | "instances" of the driver, where each instance represents everything | ||
58 | needed to manage one actual PCMCIA card. | ||
59 | */ | ||
60 | |||
61 | static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ; | 44 | static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ; |
62 | 45 | ||
63 | |||
64 | /*====================================================================== | ||
65 | |||
66 | avma1cs_attach() creates an "instance" of the driver, allocating | ||
67 | local data structures for one device. The device is registered | ||
68 | with Card Services. | ||
69 | |||
70 | The dev_link structure is initialized, but we don't actually | ||
71 | configure the card at this point -- we wait until we receive a | ||
72 | card insertion event. | ||
73 | |||
74 | ======================================================================*/ | ||
75 | |||
76 | static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) | 46 | static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) |
77 | { | 47 | { |
78 | dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); | 48 | dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); |
79 | 49 | ||
80 | /* The io structure describes IO port mapping */ | ||
81 | p_dev->resource[0]->end = 16; | ||
82 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | ||
83 | p_dev->resource[1]->end = 16; | ||
84 | p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; | ||
85 | |||
86 | /* General socket configuration */ | 50 | /* General socket configuration */ |
87 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 51 | p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; |
88 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 52 | p_dev->config_index = 1; |
89 | p_dev->conf.ConfigIndex = 1; | 53 | p_dev->config_regs = PRESENT_OPTION; |
90 | p_dev->conf.Present = PRESENT_OPTION; | ||
91 | 54 | ||
92 | return avma1cs_config(p_dev); | 55 | return avma1cs_config(p_dev); |
93 | } /* avma1cs_attach */ | 56 | } /* avma1cs_attach */ |
94 | 57 | ||
95 | /*====================================================================== | ||
96 | |||
97 | This deletes a driver "instance". The device is de-registered | ||
98 | with Card Services. If it has been released, all local data | ||
99 | structures are freed. Otherwise, the structures will be freed | ||
100 | when the device is released. | ||
101 | |||
102 | ======================================================================*/ | ||
103 | |||
104 | static void __devexit avma1cs_detach(struct pcmcia_device *link) | 58 | static void __devexit avma1cs_detach(struct pcmcia_device *link) |
105 | { | 59 | { |
106 | dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link); | 60 | dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link); |
@@ -108,26 +62,13 @@ static void __devexit avma1cs_detach(struct pcmcia_device *link) | |||
108 | kfree(link->priv); | 62 | kfree(link->priv); |
109 | } /* avma1cs_detach */ | 63 | } /* avma1cs_detach */ |
110 | 64 | ||
111 | /*====================================================================== | 65 | static int avma1cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) |
112 | |||
113 | avma1cs_config() is scheduled to run after a CARD_INSERTION event | ||
114 | is received, to configure the PCMCIA socket, and to make the | ||
115 | ethernet device available to the system. | ||
116 | |||
117 | ======================================================================*/ | ||
118 | |||
119 | static int avma1cs_configcheck(struct pcmcia_device *p_dev, | ||
120 | cistpl_cftable_entry_t *cf, | ||
121 | cistpl_cftable_entry_t *dflt, | ||
122 | unsigned int vcc, | ||
123 | void *priv_data) | ||
124 | { | 66 | { |
125 | if (cf->io.nwin <= 0) | 67 | p_dev->resource[0]->end = 16; |
126 | return -ENODEV; | 68 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
127 | 69 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | |
128 | p_dev->resource[0]->start = cf->io.win[0].base; | ||
129 | p_dev->resource[0]->end = cf->io.win[0].len; | ||
130 | p_dev->io_lines = 5; | 70 | p_dev->io_lines = 5; |
71 | |||
131 | return pcmcia_request_io(p_dev); | 72 | return pcmcia_request_io(p_dev); |
132 | } | 73 | } |
133 | 74 | ||
@@ -161,7 +102,7 @@ static int __devinit avma1cs_config(struct pcmcia_device *link) | |||
161 | /* | 102 | /* |
162 | * configure the PCMCIA socket | 103 | * configure the PCMCIA socket |
163 | */ | 104 | */ |
164 | i = pcmcia_request_configuration(link, &link->conf); | 105 | i = pcmcia_enable_device(link); |
165 | if (i != 0) { | 106 | if (i != 0) { |
166 | pcmcia_disable_device(link); | 107 | pcmcia_disable_device(link); |
167 | break; | 108 | break; |
@@ -175,9 +116,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link) | |||
175 | return -ENODEV; | 116 | return -ENODEV; |
176 | } | 117 | } |
177 | 118 | ||
178 | printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n", | ||
179 | (unsigned int) link->resource[0]->start, link->irq); | ||
180 | |||
181 | icard.para[0] = link->irq; | 119 | icard.para[0] = link->irq; |
182 | icard.para[1] = link->resource[0]->start; | 120 | icard.para[1] = link->resource[0]->start; |
183 | icard.protocol = isdnprot; | 121 | icard.protocol = isdnprot; |
@@ -196,14 +134,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link) | |||
196 | return 0; | 134 | return 0; |
197 | } /* avma1cs_config */ | 135 | } /* avma1cs_config */ |
198 | 136 | ||
199 | /*====================================================================== | ||
200 | |||
201 | After a card is removed, avma1cs_release() will unregister the net | ||
202 | device, and release the PCMCIA configuration. If the device is | ||
203 | still open, this will be postponed until it is closed. | ||
204 | |||
205 | ======================================================================*/ | ||
206 | |||
207 | static void avma1cs_release(struct pcmcia_device *link) | 137 | static void avma1cs_release(struct pcmcia_device *link) |
208 | { | 138 | { |
209 | unsigned long minor = (unsigned long) link->priv; | 139 | unsigned long minor = (unsigned long) link->priv; |
@@ -216,7 +146,6 @@ static void avma1cs_release(struct pcmcia_device *link) | |||
216 | pcmcia_disable_device(link); | 146 | pcmcia_disable_device(link); |
217 | } /* avma1cs_release */ | 147 | } /* avma1cs_release */ |
218 | 148 | ||
219 | |||
220 | static struct pcmcia_device_id avma1cs_ids[] = { | 149 | static struct pcmcia_device_id avma1cs_ids[] = { |
221 | PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), | 150 | PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), |
222 | PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b), | 151 | PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b), |
@@ -226,19 +155,15 @@ MODULE_DEVICE_TABLE(pcmcia, avma1cs_ids); | |||
226 | 155 | ||
227 | static struct pcmcia_driver avma1cs_driver = { | 156 | static struct pcmcia_driver avma1cs_driver = { |
228 | .owner = THIS_MODULE, | 157 | .owner = THIS_MODULE, |
229 | .drv = { | 158 | .name = "avma1_cs", |
230 | .name = "avma1_cs", | ||
231 | }, | ||
232 | .probe = avma1cs_probe, | 159 | .probe = avma1cs_probe, |
233 | .remove = __devexit_p(avma1cs_detach), | 160 | .remove = __devexit_p(avma1cs_detach), |
234 | .id_table = avma1cs_ids, | 161 | .id_table = avma1cs_ids, |
235 | }; | 162 | }; |
236 | 163 | ||
237 | /*====================================================================*/ | ||
238 | |||
239 | static int __init init_avma1_cs(void) | 164 | static int __init init_avma1_cs(void) |
240 | { | 165 | { |
241 | return(pcmcia_register_driver(&avma1cs_driver)); | 166 | return pcmcia_register_driver(&avma1cs_driver); |
242 | } | 167 | } |
243 | 168 | ||
244 | static void __exit exit_avma1_cs(void) | 169 | static void __exit exit_avma1_cs(void) |