diff options
Diffstat (limited to 'drivers/parport/parport_cs.c')
-rw-r--r-- | drivers/parport/parport_cs.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index ad2738ae222..6dcaf44c120 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c | |||
@@ -88,8 +88,8 @@ typedef struct parport_info_t { | |||
88 | } parport_info_t; | 88 | } parport_info_t; |
89 | 89 | ||
90 | static void parport_detach(struct pcmcia_device *p_dev); | 90 | static void parport_detach(struct pcmcia_device *p_dev); |
91 | static void parport_config(dev_link_t *link); | 91 | static void parport_config(struct pcmcia_device *link); |
92 | static void parport_cs_release(dev_link_t *); | 92 | static void parport_cs_release(struct pcmcia_device *); |
93 | 93 | ||
94 | /*====================================================================== | 94 | /*====================================================================== |
95 | 95 | ||
@@ -99,10 +99,9 @@ static void parport_cs_release(dev_link_t *); | |||
99 | 99 | ||
100 | ======================================================================*/ | 100 | ======================================================================*/ |
101 | 101 | ||
102 | static int parport_attach(struct pcmcia_device *p_dev) | 102 | static int parport_attach(struct pcmcia_device *link) |
103 | { | 103 | { |
104 | parport_info_t *info; | 104 | parport_info_t *info; |
105 | dev_link_t *link = dev_to_instance(p_dev); | ||
106 | 105 | ||
107 | DEBUG(0, "parport_attach()\n"); | 106 | DEBUG(0, "parport_attach()\n"); |
108 | 107 | ||
@@ -111,7 +110,7 @@ static int parport_attach(struct pcmcia_device *p_dev) | |||
111 | if (!info) return -ENOMEM; | 110 | if (!info) return -ENOMEM; |
112 | memset(info, 0, sizeof(*info)); | 111 | memset(info, 0, sizeof(*info)); |
113 | link->priv = info; | 112 | link->priv = info; |
114 | info->p_dev = p_dev; | 113 | info->p_dev = link; |
115 | 114 | ||
116 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 115 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
117 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 116 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
@@ -135,10 +134,8 @@ static int parport_attach(struct pcmcia_device *p_dev) | |||
135 | 134 | ||
136 | ======================================================================*/ | 135 | ======================================================================*/ |
137 | 136 | ||
138 | static void parport_detach(struct pcmcia_device *p_dev) | 137 | static void parport_detach(struct pcmcia_device *link) |
139 | { | 138 | { |
140 | dev_link_t *link = dev_to_instance(p_dev); | ||
141 | |||
142 | DEBUG(0, "parport_detach(0x%p)\n", link); | 139 | DEBUG(0, "parport_detach(0x%p)\n", link); |
143 | 140 | ||
144 | if (link->state & DEV_CONFIG) | 141 | if (link->state & DEV_CONFIG) |
@@ -158,9 +155,8 @@ static void parport_detach(struct pcmcia_device *p_dev) | |||
158 | #define CS_CHECK(fn, ret) \ | 155 | #define CS_CHECK(fn, ret) \ |
159 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 156 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
160 | 157 | ||
161 | void parport_config(dev_link_t *link) | 158 | void parport_config(struct pcmcia_device *link) |
162 | { | 159 | { |
163 | client_handle_t handle = link->handle; | ||
164 | parport_info_t *info = link->priv; | 160 | parport_info_t *info = link->priv; |
165 | tuple_t tuple; | 161 | tuple_t tuple; |
166 | u_short buf[128]; | 162 | u_short buf[128]; |
@@ -176,9 +172,9 @@ void parport_config(dev_link_t *link) | |||
176 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 172 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
177 | tuple.Attributes = 0; | 173 | tuple.Attributes = 0; |
178 | tuple.DesiredTuple = CISTPL_CONFIG; | 174 | tuple.DesiredTuple = CISTPL_CONFIG; |
179 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 175 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
180 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 176 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
181 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 177 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
182 | link->conf.ConfigBase = parse.config.base; | 178 | link->conf.ConfigBase = parse.config.base; |
183 | link->conf.Present = parse.config.rmask[0]; | 179 | link->conf.Present = parse.config.rmask[0]; |
184 | 180 | ||
@@ -187,10 +183,10 @@ void parport_config(dev_link_t *link) | |||
187 | 183 | ||
188 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 184 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
189 | tuple.Attributes = 0; | 185 | tuple.Attributes = 0; |
190 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 186 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
191 | while (1) { | 187 | while (1) { |
192 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 188 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
193 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0) | 189 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) |
194 | goto next_entry; | 190 | goto next_entry; |
195 | 191 | ||
196 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | 192 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { |
@@ -205,7 +201,7 @@ void parport_config(dev_link_t *link) | |||
205 | link->io.BasePort2 = io->win[1].base; | 201 | link->io.BasePort2 = io->win[1].base; |
206 | link->io.NumPorts2 = io->win[1].len; | 202 | link->io.NumPorts2 = io->win[1].len; |
207 | } | 203 | } |
208 | if (pcmcia_request_io(link->handle, &link->io) != 0) | 204 | if (pcmcia_request_io(link, &link->io) != 0) |
209 | goto next_entry; | 205 | goto next_entry; |
210 | /* If we've got this far, we're done */ | 206 | /* If we've got this far, we're done */ |
211 | break; | 207 | break; |
@@ -213,11 +209,11 @@ void parport_config(dev_link_t *link) | |||
213 | 209 | ||
214 | next_entry: | 210 | next_entry: |
215 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; | 211 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; |
216 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 212 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
217 | } | 213 | } |
218 | 214 | ||
219 | CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); | 215 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
220 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 216 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
221 | 217 | ||
222 | p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, | 218 | p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, |
223 | link->irq.AssignedIRQ, PARPORT_DMA_NONE, | 219 | link->irq.AssignedIRQ, PARPORT_DMA_NONE, |
@@ -243,7 +239,7 @@ void parport_config(dev_link_t *link) | |||
243 | return; | 239 | return; |
244 | 240 | ||
245 | cs_failed: | 241 | cs_failed: |
246 | cs_error(link->handle, last_fn, last_ret); | 242 | cs_error(link, last_fn, last_ret); |
247 | failed: | 243 | failed: |
248 | parport_cs_release(link); | 244 | parport_cs_release(link); |
249 | link->state &= ~DEV_CONFIG_PENDING; | 245 | link->state &= ~DEV_CONFIG_PENDING; |
@@ -258,7 +254,7 @@ failed: | |||
258 | 254 | ||
259 | ======================================================================*/ | 255 | ======================================================================*/ |
260 | 256 | ||
261 | void parport_cs_release(dev_link_t *link) | 257 | void parport_cs_release(struct pcmcia_device *link) |
262 | { | 258 | { |
263 | parport_info_t *info = link->priv; | 259 | parport_info_t *info = link->priv; |
264 | 260 | ||
@@ -270,7 +266,7 @@ void parport_cs_release(dev_link_t *link) | |||
270 | } | 266 | } |
271 | info->ndev = 0; | 267 | info->ndev = 0; |
272 | 268 | ||
273 | pcmcia_disable_device(link->handle); | 269 | pcmcia_disable_device(link); |
274 | } /* parport_cs_release */ | 270 | } /* parport_cs_release */ |
275 | 271 | ||
276 | 272 | ||