aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-02 11:00:46 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 20:16:05 -0400
commit64f346425175ad33812cd693fbca48cd512dab63 (patch)
tree3ee3b0927b515de000d2c33fdc68bf9a9f4d4b12 /drivers/pcmcia
parentef313e36d8896a42fc567a83a5d4b86821634e8d (diff)
pcmcia: move pccard_get_configuration_info to ioctl
With the PCMCIA ioctl being the only remaining user of _get_configuration_info, move the function to pcmcia_ioctl.c Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/cs_internal.h1
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c72
-rw-r--r--drivers/pcmcia/pcmcia_resource.c79
3 files changed, 72 insertions, 80 deletions
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
index 481a823c94b4..384a76bd38eb 100644
--- a/drivers/pcmcia/cs_internal.h
+++ b/drivers/pcmcia/cs_internal.h
@@ -116,7 +116,6 @@ extern void pccard_sysfs_remove_socket(struct device *dev);
116extern struct rw_semaphore pcmcia_socket_list_rwsem; 116extern struct rw_semaphore pcmcia_socket_list_rwsem;
117extern struct list_head pcmcia_socket_list; 117extern struct list_head pcmcia_socket_list;
118int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); 118int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req);
119int pccard_get_configuration_info(struct pcmcia_socket *s, struct pcmcia_device *p_dev, config_info_t *config);
120int pccard_reset_card(struct pcmcia_socket *skt); 119int pccard_reset_card(struct pcmcia_socket *skt);
121 120
122 121
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index f555a505214f..53dadc111002 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -287,6 +287,78 @@ static int pccard_get_status(struct pcmcia_socket *s,
287 return CS_SUCCESS; 287 return CS_SUCCESS;
288} /* pccard_get_status */ 288} /* pccard_get_status */
289 289
290int pccard_get_configuration_info(struct pcmcia_socket *s,
291 struct pcmcia_device *p_dev,
292 config_info_t *config)
293{
294 config_t *c;
295
296 if (!(s->state & SOCKET_PRESENT))
297 return CS_NO_CARD;
298
299
300#ifdef CONFIG_CARDBUS
301 if (s->state & SOCKET_CARDBUS) {
302 memset(config, 0, sizeof(config_info_t));
303 config->Vcc = s->socket.Vcc;
304 config->Vpp1 = config->Vpp2 = s->socket.Vpp;
305 config->Option = s->cb_dev->subordinate->number;
306 if (s->state & SOCKET_CARDBUS_CONFIG) {
307 config->Attributes = CONF_VALID_CLIENT;
308 config->IntType = INT_CARDBUS;
309 config->AssignedIRQ = s->irq.AssignedIRQ;
310 if (config->AssignedIRQ)
311 config->Attributes |= CONF_ENABLE_IRQ;
312 if (s->io[0].res) {
313 config->BasePort1 = s->io[0].res->start;
314 config->NumPorts1 = s->io[0].res->end -
315 config->BasePort1 + 1;
316 }
317 }
318 return CS_SUCCESS;
319 }
320#endif
321
322 if (p_dev) {
323 c = p_dev->function_config;
324 config->Function = p_dev->func;
325 } else {
326 c = NULL;
327 config->Function = 0;
328 }
329
330 if ((c == NULL) || !(c->state & CONFIG_LOCKED)) {
331 config->Attributes = 0;
332 config->Vcc = s->socket.Vcc;
333 config->Vpp1 = config->Vpp2 = s->socket.Vpp;
334 return CS_SUCCESS;
335 }
336
337 config->Attributes = c->Attributes | CONF_VALID_CLIENT;
338 config->Vcc = s->socket.Vcc;
339 config->Vpp1 = config->Vpp2 = s->socket.Vpp;
340 config->IntType = c->IntType;
341 config->ConfigBase = c->ConfigBase;
342 config->Status = c->Status;
343 config->Pin = c->Pin;
344 config->Copy = c->Copy;
345 config->Option = c->Option;
346 config->ExtStatus = c->ExtStatus;
347 config->Present = config->CardValues = c->CardValues;
348 config->IRQAttributes = c->irq.Attributes;
349 config->AssignedIRQ = s->irq.AssignedIRQ;
350 config->BasePort1 = c->io.BasePort1;
351 config->NumPorts1 = c->io.NumPorts1;
352 config->Attributes1 = c->io.Attributes1;
353 config->BasePort2 = c->io.BasePort2;
354 config->NumPorts2 = c->io.NumPorts2;
355 config->Attributes2 = c->io.Attributes2;
356 config->IOAddrLines = c->io.IOAddrLines;
357
358 return CS_SUCCESS;
359} /* pccard_get_configuration_info */
360
361
290/*====================================================================== 362/*======================================================================
291 363
292 These manage a ring buffer of events pending for one user process 364 These manage a ring buffer of events pending for one user process
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 9afe420c41f4..c5a2b005091c 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -197,85 +197,6 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
197EXPORT_SYMBOL(pcmcia_access_configuration_register); 197EXPORT_SYMBOL(pcmcia_access_configuration_register);
198 198
199 199
200int pccard_get_configuration_info(struct pcmcia_socket *s,
201 struct pcmcia_device *p_dev,
202 config_info_t *config)
203{
204 config_t *c;
205
206 if (!(s->state & SOCKET_PRESENT))
207 return CS_NO_CARD;
208
209
210#ifdef CONFIG_CARDBUS
211 if (s->state & SOCKET_CARDBUS) {
212 memset(config, 0, sizeof(config_info_t));
213 config->Vcc = s->socket.Vcc;
214 config->Vpp1 = config->Vpp2 = s->socket.Vpp;
215 config->Option = s->cb_dev->subordinate->number;
216 if (s->state & SOCKET_CARDBUS_CONFIG) {
217 config->Attributes = CONF_VALID_CLIENT;
218 config->IntType = INT_CARDBUS;
219 config->AssignedIRQ = s->irq.AssignedIRQ;
220 if (config->AssignedIRQ)
221 config->Attributes |= CONF_ENABLE_IRQ;
222 if (s->io[0].res) {
223 config->BasePort1 = s->io[0].res->start;
224 config->NumPorts1 = s->io[0].res->end - config->BasePort1 + 1;
225 }
226 }
227 return CS_SUCCESS;
228 }
229#endif
230
231 if (p_dev) {
232 c = p_dev->function_config;
233 config->Function = p_dev->func;
234 } else {
235 c = NULL;
236 config->Function = 0;
237 }
238
239 if ((c == NULL) || !(c->state & CONFIG_LOCKED)) {
240 config->Attributes = 0;
241 config->Vcc = s->socket.Vcc;
242 config->Vpp1 = config->Vpp2 = s->socket.Vpp;
243 return CS_SUCCESS;
244 }
245
246 config->Attributes = c->Attributes | CONF_VALID_CLIENT;
247 config->Vcc = s->socket.Vcc;
248 config->Vpp1 = config->Vpp2 = s->socket.Vpp;
249 config->IntType = c->IntType;
250 config->ConfigBase = c->ConfigBase;
251 config->Status = c->Status;
252 config->Pin = c->Pin;
253 config->Copy = c->Copy;
254 config->Option = c->Option;
255 config->ExtStatus = c->ExtStatus;
256 config->Present = config->CardValues = c->CardValues;
257 config->IRQAttributes = c->irq.Attributes;
258 config->AssignedIRQ = s->irq.AssignedIRQ;
259 config->BasePort1 = c->io.BasePort1;
260 config->NumPorts1 = c->io.NumPorts1;
261 config->Attributes1 = c->io.Attributes1;
262 config->BasePort2 = c->io.BasePort2;
263 config->NumPorts2 = c->io.NumPorts2;
264 config->Attributes2 = c->io.Attributes2;
265 config->IOAddrLines = c->io.IOAddrLines;
266
267 return CS_SUCCESS;
268} /* pccard_get_configuration_info */
269
270int pcmcia_get_configuration_info(struct pcmcia_device *p_dev,
271 config_info_t *config)
272{
273 return pccard_get_configuration_info(p_dev->socket, p_dev,
274 config);
275}
276EXPORT_SYMBOL(pcmcia_get_configuration_info);
277
278
279/** pcmcia_get_window 200/** pcmcia_get_window
280 */ 201 */
281int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, 202int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle,