Commit 64f346425175ad33812cd693fbca48cd512dab63

Authored by Dominik Brodowski
1 parent ef313e36d8

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>

Showing 4 changed files with 72 additions and 81 deletions Side-by-side Diff

drivers/pcmcia/cs_internal.h
... ... @@ -116,7 +116,6 @@
116 116 extern struct rw_semaphore pcmcia_socket_list_rwsem;
117 117 extern struct list_head pcmcia_socket_list;
118 118 int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req);
119   -int pccard_get_configuration_info(struct pcmcia_socket *s, struct pcmcia_device *p_dev, config_info_t *config);
120 119 int pccard_reset_card(struct pcmcia_socket *skt);
121 120  
122 121  
drivers/pcmcia/pcmcia_ioctl.c
... ... @@ -287,6 +287,78 @@
287 287 return CS_SUCCESS;
288 288 } /* pccard_get_status */
289 289  
  290 +int 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 364 These manage a ring buffer of events pending for one user process
drivers/pcmcia/pcmcia_resource.c
... ... @@ -197,85 +197,6 @@
197 197 EXPORT_SYMBOL(pcmcia_access_configuration_register);
198 198  
199 199  
200   -int 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   -
270   -int 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   -}
276   -EXPORT_SYMBOL(pcmcia_get_configuration_info);
277   -
278   -
279 200 /** pcmcia_get_window
280 201 */
281 202 int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle,
... ... @@ -372,7 +372,6 @@
372 372 struct pcmcia_socket;
373 373  
374 374 int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg);
375   -int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config);
376 375 int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
377 376 int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
378 377 int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);