aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/pcmcia_resource.c')
-rw-r--r--drivers/pcmcia/pcmcia_resource.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 11a94d9a15fb..aabde8be6470 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -165,21 +165,19 @@ static void release_io_space(struct pcmcia_socket *s, ioaddr_t base,
165 * this and the tuple reading services. 165 * this and the tuple reading services.
166 */ 166 */
167 167
168int pccard_access_configuration_register(struct pcmcia_socket *s, 168int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
169 unsigned int function,
170 conf_reg_t *reg) 169 conf_reg_t *reg)
171{ 170{
171 struct pcmcia_socket *s;
172 config_t *c; 172 config_t *c;
173 int addr; 173 int addr;
174 u_char val; 174 u_char val;
175 175
176 if (!s || !s->config) 176 if (!p_dev || !p_dev->function_config)
177 return CS_NO_CARD; 177 return CS_NO_CARD;
178 178
179 c = &s->config[function]; 179 s = p_dev->socket;
180 180 c = p_dev->function_config;
181 if (c == NULL)
182 return CS_NO_CARD;
183 181
184 if (!(c->state & CONFIG_LOCKED)) 182 if (!(c->state & CONFIG_LOCKED))
185 return CS_CONFIGURATION_LOCKED; 183 return CS_CONFIGURATION_LOCKED;
@@ -200,20 +198,12 @@ int pccard_access_configuration_register(struct pcmcia_socket *s,
200 break; 198 break;
201 } 199 }
202 return CS_SUCCESS; 200 return CS_SUCCESS;
203} /* pccard_access_configuration_register */ 201} /* pcmcia_access_configuration_register */
204
205int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
206 conf_reg_t *reg)
207{
208 return pccard_access_configuration_register(p_dev->socket,
209 p_dev->func, reg);
210}
211EXPORT_SYMBOL(pcmcia_access_configuration_register); 202EXPORT_SYMBOL(pcmcia_access_configuration_register);
212 203
213 204
214
215int pccard_get_configuration_info(struct pcmcia_socket *s, 205int pccard_get_configuration_info(struct pcmcia_socket *s,
216 unsigned int function, 206 struct pcmcia_device *p_dev,
217 config_info_t *config) 207 config_info_t *config)
218{ 208{
219 config_t *c; 209 config_t *c;
@@ -221,7 +211,7 @@ int pccard_get_configuration_info(struct pcmcia_socket *s,
221 if (!(s->state & SOCKET_PRESENT)) 211 if (!(s->state & SOCKET_PRESENT))
222 return CS_NO_CARD; 212 return CS_NO_CARD;
223 213
224 config->Function = function; 214 config->Function = p_dev->func;
225 215
226#ifdef CONFIG_CARDBUS 216#ifdef CONFIG_CARDBUS
227 if (s->state & SOCKET_CARDBUS) { 217 if (s->state & SOCKET_CARDBUS) {
@@ -242,7 +232,7 @@ int pccard_get_configuration_info(struct pcmcia_socket *s,
242 } 232 }
243#endif 233#endif
244 234
245 c = (s->config != NULL) ? &s->config[function] : NULL; 235 c = (p_dev) ? p_dev->function_config : NULL;
246 236
247 if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { 237 if ((c == NULL) || !(c->state & CONFIG_LOCKED)) {
248 config->Attributes = 0; 238 config->Attributes = 0;
@@ -271,7 +261,7 @@ int pccard_get_configuration_info(struct pcmcia_socket *s,
271int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, 261int pcmcia_get_configuration_info(struct pcmcia_device *p_dev,
272 config_info_t *config) 262 config_info_t *config)
273{ 263{
274 return pccard_get_configuration_info(p_dev->socket, p_dev->func, 264 return pccard_get_configuration_info(p_dev->socket, p_dev,
275 config); 265 config);
276} 266}
277EXPORT_SYMBOL(pcmcia_get_configuration_info); 267EXPORT_SYMBOL(pcmcia_get_configuration_info);
@@ -317,7 +307,7 @@ EXPORT_SYMBOL(pcmcia_get_window);
317 * SocketState yet: I haven't seen any point for it. 307 * SocketState yet: I haven't seen any point for it.
318 */ 308 */
319 309
320int pccard_get_status(struct pcmcia_socket *s, unsigned int function, 310int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev,
321 cs_status_t *status) 311 cs_status_t *status)
322{ 312{
323 config_t *c; 313 config_t *c;
@@ -334,7 +324,8 @@ int pccard_get_status(struct pcmcia_socket *s, unsigned int function,
334 if (!(s->state & SOCKET_PRESENT)) 324 if (!(s->state & SOCKET_PRESENT))
335 return CS_NO_CARD; 325 return CS_NO_CARD;
336 326
337 c = (s->config != NULL) ? &s->config[function] : NULL; 327 c = (p_dev) ? p_dev->function_config : NULL;
328
338 if ((c != NULL) && (c->state & CONFIG_LOCKED) && 329 if ((c != NULL) && (c->state & CONFIG_LOCKED) &&
339 (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { 330 (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) {
340 u_char reg; 331 u_char reg;
@@ -370,9 +361,9 @@ int pccard_get_status(struct pcmcia_socket *s, unsigned int function,
370 return CS_SUCCESS; 361 return CS_SUCCESS;
371} /* pccard_get_status */ 362} /* pccard_get_status */
372 363
373int pcmcia_get_status(client_handle_t handle, cs_status_t *status) 364int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status)
374{ 365{
375 return pccard_get_status(handle->socket, handle->func, status); 366 return pccard_get_status(p_dev->socket, p_dev, status);
376} 367}
377EXPORT_SYMBOL(pcmcia_get_status); 368EXPORT_SYMBOL(pcmcia_get_status);
378 369