diff options
author | David Howells <dhowells@redhat.com> | 2006-12-06 10:01:18 -0500 |
---|---|---|
committer | David Howells <dhowells@warthog.cambridge.redhat.com> | 2006-12-06 10:01:18 -0500 |
commit | 4796b71fbb907ce6b8a9acf1852d3646a80b4576 (patch) | |
tree | 6263f165446c581efdbb760205c1f85378fe6259 /drivers/pcmcia | |
parent | 6d5aefb8eaa38e44b5b8cf60c812aceafc02d924 (diff) | |
parent | ec0bf39a471bf6fcd01def2bd677128cea940b73 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
drivers/pcmcia/ds.c
Fix up merge failures with Linus's head and fix new compile failures.
Signed-Off-By: David Howells <dhowells@redhat.com>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/at91_cf.c | 69 | ||||
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 2 | ||||
-rw-r--r-- | drivers/pcmcia/ds.c | 271 | ||||
-rw-r--r-- | drivers/pcmcia/m32r_cfc.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 7 | ||||
-rw-r--r-- | drivers/pcmcia/pd6729.c | 8 | ||||
-rw-r--r-- | drivers/pcmcia/socket_sysfs.c | 4 |
7 files changed, 224 insertions, 139 deletions
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c index 3bcb7dc32995..b6746301d9a9 100644 --- a/drivers/pcmcia/at91_cf.c +++ b/drivers/pcmcia/at91_cf.c | |||
@@ -32,10 +32,11 @@ | |||
32 | * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW; | 32 | * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW; |
33 | * some other bit in {A24,A22..A11} is nREG to flag memory access | 33 | * some other bit in {A24,A22..A11} is nREG to flag memory access |
34 | * (vs attributes). So more than 2KB/region would just be waste. | 34 | * (vs attributes). So more than 2KB/region would just be waste. |
35 | * Note: These are offsets from the physical base address. | ||
35 | */ | 36 | */ |
36 | #define CF_ATTR_PHYS (AT91_CF_BASE) | 37 | #define CF_ATTR_PHYS (0) |
37 | #define CF_IO_PHYS (AT91_CF_BASE + (1 << 23)) | 38 | #define CF_IO_PHYS (1 << 23) |
38 | #define CF_MEM_PHYS (AT91_CF_BASE + 0x017ff800) | 39 | #define CF_MEM_PHYS (0x017ff800) |
39 | 40 | ||
40 | /*--------------------------------------------------------------------------*/ | 41 | /*--------------------------------------------------------------------------*/ |
41 | 42 | ||
@@ -48,6 +49,8 @@ struct at91_cf_socket { | |||
48 | 49 | ||
49 | struct platform_device *pdev; | 50 | struct platform_device *pdev; |
50 | struct at91_cf_data *board; | 51 | struct at91_cf_data *board; |
52 | |||
53 | unsigned long phys_baseaddr; | ||
51 | }; | 54 | }; |
52 | 55 | ||
53 | #define SZ_2K (2 * SZ_1K) | 56 | #define SZ_2K (2 * SZ_1K) |
@@ -154,9 +157,8 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) | |||
154 | 157 | ||
155 | /* | 158 | /* |
156 | * Use 16 bit accesses unless/until we need 8-bit i/o space. | 159 | * Use 16 bit accesses unless/until we need 8-bit i/o space. |
157 | * Always set CSR4 ... PCMCIA won't always unmap things. | ||
158 | */ | 160 | */ |
159 | csr = at91_sys_read(AT91_SMC_CSR(4)) & ~AT91_SMC_DBW; | 161 | csr = at91_sys_read(AT91_SMC_CSR(cf->board->chipselect)) & ~AT91_SMC_DBW; |
160 | 162 | ||
161 | /* | 163 | /* |
162 | * NOTE: this CF controller ignores IOIS16, so we can't really do | 164 | * NOTE: this CF controller ignores IOIS16, so we can't really do |
@@ -168,14 +170,14 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) | |||
168 | * some cards only like that way to get at the odd byte, despite | 170 | * some cards only like that way to get at the odd byte, despite |
169 | * CF 3.0 spec table 35 also giving the D8-D15 option. | 171 | * CF 3.0 spec table 35 also giving the D8-D15 option. |
170 | */ | 172 | */ |
171 | if (!(io->flags & (MAP_16BIT|MAP_AUTOSZ))) { | 173 | if (!(io->flags & (MAP_16BIT | MAP_AUTOSZ))) { |
172 | csr |= AT91_SMC_DBW_8; | 174 | csr |= AT91_SMC_DBW_8; |
173 | pr_debug("%s: 8bit i/o bus\n", driver_name); | 175 | pr_debug("%s: 8bit i/o bus\n", driver_name); |
174 | } else { | 176 | } else { |
175 | csr |= AT91_SMC_DBW_16; | 177 | csr |= AT91_SMC_DBW_16; |
176 | pr_debug("%s: 16bit i/o bus\n", driver_name); | 178 | pr_debug("%s: 16bit i/o bus\n", driver_name); |
177 | } | 179 | } |
178 | at91_sys_write(AT91_SMC_CSR(4), csr); | 180 | at91_sys_write(AT91_SMC_CSR(cf->board->chipselect), csr); |
179 | 181 | ||
180 | io->start = cf->socket.io_offset; | 182 | io->start = cf->socket.io_offset; |
181 | io->stop = io->start + SZ_2K - 1; | 183 | io->stop = io->start + SZ_2K - 1; |
@@ -194,11 +196,11 @@ at91_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map) | |||
194 | 196 | ||
195 | cf = container_of(s, struct at91_cf_socket, socket); | 197 | cf = container_of(s, struct at91_cf_socket, socket); |
196 | 198 | ||
197 | map->flags &= MAP_ACTIVE|MAP_ATTRIB|MAP_16BIT; | 199 | map->flags &= (MAP_ACTIVE | MAP_ATTRIB | MAP_16BIT); |
198 | if (map->flags & MAP_ATTRIB) | 200 | if (map->flags & MAP_ATTRIB) |
199 | map->static_start = CF_ATTR_PHYS; | 201 | map->static_start = cf->phys_baseaddr + CF_ATTR_PHYS; |
200 | else | 202 | else |
201 | map->static_start = CF_MEM_PHYS; | 203 | map->static_start = cf->phys_baseaddr + CF_MEM_PHYS; |
202 | 204 | ||
203 | return 0; | 205 | return 0; |
204 | } | 206 | } |
@@ -219,7 +221,6 @@ static int __init at91_cf_probe(struct platform_device *pdev) | |||
219 | struct at91_cf_socket *cf; | 221 | struct at91_cf_socket *cf; |
220 | struct at91_cf_data *board = pdev->dev.platform_data; | 222 | struct at91_cf_data *board = pdev->dev.platform_data; |
221 | struct resource *io; | 223 | struct resource *io; |
222 | unsigned int csa; | ||
223 | int status; | 224 | int status; |
224 | 225 | ||
225 | if (!board || !board->det_pin || !board->rst_pin) | 226 | if (!board || !board->det_pin || !board->rst_pin) |
@@ -235,33 +236,11 @@ static int __init at91_cf_probe(struct platform_device *pdev) | |||
235 | 236 | ||
236 | cf->board = board; | 237 | cf->board = board; |
237 | cf->pdev = pdev; | 238 | cf->pdev = pdev; |
239 | cf->phys_baseaddr = io->start; | ||
238 | platform_set_drvdata(pdev, cf); | 240 | platform_set_drvdata(pdev, cf); |
239 | 241 | ||
240 | /* CF takes over CS4, CS5, CS6 */ | ||
241 | csa = at91_sys_read(AT91_EBI_CSA); | ||
242 | at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH); | ||
243 | |||
244 | /* nWAIT is _not_ a default setting */ | ||
245 | (void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */ | ||
246 | |||
247 | /* | ||
248 | * Static memory controller timing adjustments. | ||
249 | * REVISIT: these timings are in terms of MCK cycles, so | ||
250 | * when MCK changes (cpufreq etc) so must these values... | ||
251 | */ | ||
252 | at91_sys_write(AT91_SMC_CSR(4), | ||
253 | AT91_SMC_ACSS_STD | ||
254 | | AT91_SMC_DBW_16 | ||
255 | | AT91_SMC_BAT | ||
256 | | AT91_SMC_WSEN | ||
257 | | AT91_SMC_NWS_(32) /* wait states */ | ||
258 | | AT91_SMC_RWSETUP_(6) /* setup time */ | ||
259 | | AT91_SMC_RWHOLD_(4) /* hold time */ | ||
260 | ); | ||
261 | |||
262 | /* must be a GPIO; ergo must trigger on both edges */ | 242 | /* must be a GPIO; ergo must trigger on both edges */ |
263 | status = request_irq(board->det_pin, at91_cf_irq, | 243 | status = request_irq(board->det_pin, at91_cf_irq, 0, driver_name, cf); |
264 | IRQF_SAMPLE_RANDOM, driver_name, cf); | ||
265 | if (status < 0) | 244 | if (status < 0) |
266 | goto fail0; | 245 | goto fail0; |
267 | device_init_wakeup(&pdev->dev, 1); | 246 | device_init_wakeup(&pdev->dev, 1); |
@@ -282,14 +261,18 @@ static int __init at91_cf_probe(struct platform_device *pdev) | |||
282 | cf->socket.pci_irq = NR_IRQS + 1; | 261 | cf->socket.pci_irq = NR_IRQS + 1; |
283 | 262 | ||
284 | /* pcmcia layer only remaps "real" memory not iospace */ | 263 | /* pcmcia layer only remaps "real" memory not iospace */ |
285 | cf->socket.io_offset = (unsigned long) ioremap(CF_IO_PHYS, SZ_2K); | 264 | cf->socket.io_offset = (unsigned long) ioremap(cf->phys_baseaddr + CF_IO_PHYS, SZ_2K); |
286 | if (!cf->socket.io_offset) | 265 | if (!cf->socket.io_offset) { |
266 | status = -ENXIO; | ||
287 | goto fail1; | 267 | goto fail1; |
268 | } | ||
288 | 269 | ||
289 | /* reserve CS4, CS5, and CS6 regions; but use just CS4 */ | 270 | /* reserve chip-select regions */ |
290 | if (!request_mem_region(io->start, io->end + 1 - io->start, | 271 | if (!request_mem_region(io->start, io->end + 1 - io->start, |
291 | driver_name)) | 272 | driver_name)) { |
273 | status = -ENXIO; | ||
292 | goto fail1; | 274 | goto fail1; |
275 | } | ||
293 | 276 | ||
294 | pr_info("%s: irqs det #%d, io #%d\n", driver_name, | 277 | pr_info("%s: irqs det #%d, io #%d\n", driver_name, |
295 | board->det_pin, board->irq_pin); | 278 | board->det_pin, board->irq_pin); |
@@ -319,9 +302,7 @@ fail1: | |||
319 | fail0a: | 302 | fail0a: |
320 | device_init_wakeup(&pdev->dev, 0); | 303 | device_init_wakeup(&pdev->dev, 0); |
321 | free_irq(board->det_pin, cf); | 304 | free_irq(board->det_pin, cf); |
322 | device_init_wakeup(&pdev->dev, 0); | ||
323 | fail0: | 305 | fail0: |
324 | at91_sys_write(AT91_EBI_CSA, csa); | ||
325 | kfree(cf); | 306 | kfree(cf); |
326 | return status; | 307 | return status; |
327 | } | 308 | } |
@@ -331,19 +312,15 @@ static int __exit at91_cf_remove(struct platform_device *pdev) | |||
331 | struct at91_cf_socket *cf = platform_get_drvdata(pdev); | 312 | struct at91_cf_socket *cf = platform_get_drvdata(pdev); |
332 | struct at91_cf_data *board = cf->board; | 313 | struct at91_cf_data *board = cf->board; |
333 | struct resource *io = cf->socket.io[0].res; | 314 | struct resource *io = cf->socket.io[0].res; |
334 | unsigned int csa; | ||
335 | 315 | ||
336 | pcmcia_unregister_socket(&cf->socket); | 316 | pcmcia_unregister_socket(&cf->socket); |
337 | if (board->irq_pin) | 317 | if (board->irq_pin) |
338 | free_irq(board->irq_pin, cf); | 318 | free_irq(board->irq_pin, cf); |
339 | free_irq(board->det_pin, cf); | ||
340 | device_init_wakeup(&pdev->dev, 0); | 319 | device_init_wakeup(&pdev->dev, 0); |
320 | free_irq(board->det_pin, cf); | ||
341 | iounmap((void __iomem *) cf->socket.io_offset); | 321 | iounmap((void __iomem *) cf->socket.io_offset); |
342 | release_mem_region(io->start, io->end + 1 - io->start); | 322 | release_mem_region(io->start, io->end + 1 - io->start); |
343 | 323 | ||
344 | csa = at91_sys_read(AT91_EBI_CSA); | ||
345 | at91_sys_write(AT91_EBI_CSA, csa & ~AT91_EBI_CS4A); | ||
346 | |||
347 | kfree(cf); | 324 | kfree(cf); |
348 | return 0; | 325 | return 0; |
349 | } | 326 | } |
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index d6164cd583fd..f573ea04db6f 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -135,7 +135,7 @@ int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, cs_s | |||
135 | struct pcmcia_callback{ | 135 | struct pcmcia_callback{ |
136 | struct module *owner; | 136 | struct module *owner; |
137 | int (*event) (struct pcmcia_socket *s, event_t event, int priority); | 137 | int (*event) (struct pcmcia_socket *s, event_t event, int priority); |
138 | void (*requery) (struct pcmcia_socket *s); | 138 | void (*requery) (struct pcmcia_socket *s, int new_cis); |
139 | int (*suspend) (struct pcmcia_socket *s); | 139 | int (*suspend) (struct pcmcia_socket *s); |
140 | int (*resume) (struct pcmcia_socket *s); | 140 | int (*resume) (struct pcmcia_socket *s); |
141 | }; | 141 | }; |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index ff14fd8f0cd1..7355eb455a88 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -231,65 +231,6 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | 233 | ||
234 | #ifdef CONFIG_PCMCIA_LOAD_CIS | ||
235 | |||
236 | /** | ||
237 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken | ||
238 | * @dev - the pcmcia device which needs a CIS override | ||
239 | * @filename - requested filename in /lib/firmware/ | ||
240 | * | ||
241 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if | ||
242 | * the one provided by the card is broken. The firmware files reside in | ||
243 | * /lib/firmware/ in userspace. | ||
244 | */ | ||
245 | static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | ||
246 | { | ||
247 | struct pcmcia_socket *s = dev->socket; | ||
248 | const struct firmware *fw; | ||
249 | char path[20]; | ||
250 | int ret=-ENOMEM; | ||
251 | cisdump_t *cis; | ||
252 | |||
253 | if (!filename) | ||
254 | return -EINVAL; | ||
255 | |||
256 | ds_dbg(1, "trying to load firmware %s\n", filename); | ||
257 | |||
258 | if (strlen(filename) > 14) | ||
259 | return -EINVAL; | ||
260 | |||
261 | snprintf(path, 20, "%s", filename); | ||
262 | |||
263 | if (request_firmware(&fw, path, &dev->dev) == 0) { | ||
264 | if (fw->size >= CISTPL_MAX_CIS_SIZE) | ||
265 | goto release; | ||
266 | |||
267 | cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL); | ||
268 | if (!cis) | ||
269 | goto release; | ||
270 | |||
271 | cis->Length = fw->size + 1; | ||
272 | memcpy(cis->Data, fw->data, fw->size); | ||
273 | |||
274 | if (!pcmcia_replace_cis(s, cis)) | ||
275 | ret = 0; | ||
276 | } | ||
277 | release: | ||
278 | release_firmware(fw); | ||
279 | |||
280 | return (ret); | ||
281 | } | ||
282 | |||
283 | #else /* !CONFIG_PCMCIA_LOAD_CIS */ | ||
284 | |||
285 | static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | ||
286 | { | ||
287 | return -ENODEV; | ||
288 | } | ||
289 | |||
290 | #endif | ||
291 | |||
292 | |||
293 | /*======================================================================*/ | 234 | /*======================================================================*/ |
294 | 235 | ||
295 | 236 | ||
@@ -309,6 +250,8 @@ int pcmcia_register_driver(struct pcmcia_driver *driver) | |||
309 | driver->drv.bus = &pcmcia_bus_type; | 250 | driver->drv.bus = &pcmcia_bus_type; |
310 | driver->drv.owner = driver->owner; | 251 | driver->drv.owner = driver->owner; |
311 | 252 | ||
253 | ds_dbg(3, "registering driver %s\n", driver->drv.name); | ||
254 | |||
312 | return driver_register(&driver->drv); | 255 | return driver_register(&driver->drv); |
313 | } | 256 | } |
314 | EXPORT_SYMBOL(pcmcia_register_driver); | 257 | EXPORT_SYMBOL(pcmcia_register_driver); |
@@ -318,6 +261,7 @@ EXPORT_SYMBOL(pcmcia_register_driver); | |||
318 | */ | 261 | */ |
319 | void pcmcia_unregister_driver(struct pcmcia_driver *driver) | 262 | void pcmcia_unregister_driver(struct pcmcia_driver *driver) |
320 | { | 263 | { |
264 | ds_dbg(3, "unregistering driver %s\n", driver->drv.name); | ||
321 | driver_unregister(&driver->drv); | 265 | driver_unregister(&driver->drv); |
322 | } | 266 | } |
323 | EXPORT_SYMBOL(pcmcia_unregister_driver); | 267 | EXPORT_SYMBOL(pcmcia_unregister_driver); |
@@ -343,23 +287,27 @@ void pcmcia_put_dev(struct pcmcia_device *p_dev) | |||
343 | static void pcmcia_release_function(struct kref *ref) | 287 | static void pcmcia_release_function(struct kref *ref) |
344 | { | 288 | { |
345 | struct config_t *c = container_of(ref, struct config_t, ref); | 289 | struct config_t *c = container_of(ref, struct config_t, ref); |
290 | ds_dbg(1, "releasing config_t\n"); | ||
346 | kfree(c); | 291 | kfree(c); |
347 | } | 292 | } |
348 | 293 | ||
349 | static void pcmcia_release_dev(struct device *dev) | 294 | static void pcmcia_release_dev(struct device *dev) |
350 | { | 295 | { |
351 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 296 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
352 | ds_dbg(1, "releasing dev %p\n", p_dev); | 297 | ds_dbg(1, "releasing device %s\n", p_dev->dev.bus_id); |
353 | pcmcia_put_socket(p_dev->socket); | 298 | pcmcia_put_socket(p_dev->socket); |
354 | kfree(p_dev->devname); | 299 | kfree(p_dev->devname); |
355 | kref_put(&p_dev->function_config->ref, pcmcia_release_function); | 300 | kref_put(&p_dev->function_config->ref, pcmcia_release_function); |
356 | kfree(p_dev); | 301 | kfree(p_dev); |
357 | } | 302 | } |
358 | 303 | ||
359 | static void pcmcia_add_pseudo_device(struct pcmcia_socket *s) | 304 | static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) |
360 | { | 305 | { |
361 | if (!s->pcmcia_state.device_add_pending) { | 306 | if (!s->pcmcia_state.device_add_pending) { |
307 | ds_dbg(1, "scheduling to add %s secondary" | ||
308 | " device to %d\n", mfc ? "mfc" : "pfc", s->sock); | ||
362 | s->pcmcia_state.device_add_pending = 1; | 309 | s->pcmcia_state.device_add_pending = 1; |
310 | s->pcmcia_state.mfc_pfc = mfc; | ||
363 | schedule_work(&s->device_add); | 311 | schedule_work(&s->device_add); |
364 | } | 312 | } |
365 | return; | 313 | return; |
@@ -371,6 +319,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
371 | struct pcmcia_driver *p_drv; | 319 | struct pcmcia_driver *p_drv; |
372 | struct pcmcia_device_id *did; | 320 | struct pcmcia_device_id *did; |
373 | struct pcmcia_socket *s; | 321 | struct pcmcia_socket *s; |
322 | cistpl_config_t cis_config; | ||
374 | int ret = 0; | 323 | int ret = 0; |
375 | 324 | ||
376 | dev = get_device(dev); | 325 | dev = get_device(dev); |
@@ -381,15 +330,33 @@ static int pcmcia_device_probe(struct device * dev) | |||
381 | p_drv = to_pcmcia_drv(dev->driver); | 330 | p_drv = to_pcmcia_drv(dev->driver); |
382 | s = p_dev->socket; | 331 | s = p_dev->socket; |
383 | 332 | ||
333 | ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id, | ||
334 | p_drv->drv.name); | ||
335 | |||
384 | if ((!p_drv->probe) || (!p_dev->function_config) || | 336 | if ((!p_drv->probe) || (!p_dev->function_config) || |
385 | (!try_module_get(p_drv->owner))) { | 337 | (!try_module_get(p_drv->owner))) { |
386 | ret = -EINVAL; | 338 | ret = -EINVAL; |
387 | goto put_dev; | 339 | goto put_dev; |
388 | } | 340 | } |
389 | 341 | ||
342 | /* set up some more device information */ | ||
343 | ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, | ||
344 | &cis_config); | ||
345 | if (!ret) { | ||
346 | p_dev->conf.ConfigBase = cis_config.base; | ||
347 | p_dev->conf.Present = cis_config.rmask[0]; | ||
348 | } else { | ||
349 | printk(KERN_INFO "pcmcia: could not parse base and rmask0 of CIS\n"); | ||
350 | p_dev->conf.ConfigBase = 0; | ||
351 | p_dev->conf.Present = 0; | ||
352 | } | ||
353 | |||
390 | ret = p_drv->probe(p_dev); | 354 | ret = p_drv->probe(p_dev); |
391 | if (ret) | 355 | if (ret) { |
356 | ds_dbg(1, "binding %s to %s failed with %d\n", | ||
357 | p_dev->dev.bus_id, p_drv->drv.name, ret); | ||
392 | goto put_module; | 358 | goto put_module; |
359 | } | ||
393 | 360 | ||
394 | /* handle pseudo multifunction devices: | 361 | /* handle pseudo multifunction devices: |
395 | * there are at most two pseudo multifunction devices. | 362 | * there are at most two pseudo multifunction devices. |
@@ -400,7 +367,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
400 | did = p_dev->dev.driver_data; | 367 | did = p_dev->dev.driver_data; |
401 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && | 368 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && |
402 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) | 369 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) |
403 | pcmcia_add_pseudo_device(p_dev->socket); | 370 | pcmcia_add_device_later(p_dev->socket, 0); |
404 | 371 | ||
405 | put_module: | 372 | put_module: |
406 | if (ret) | 373 | if (ret) |
@@ -421,8 +388,8 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
421 | struct pcmcia_device *tmp; | 388 | struct pcmcia_device *tmp; |
422 | unsigned long flags; | 389 | unsigned long flags; |
423 | 390 | ||
424 | ds_dbg(2, "unbind_request(%d)\n", s->sock); | 391 | ds_dbg(2, "pcmcia_card_remove(%d) %s\n", s->sock, |
425 | 392 | leftover ? leftover->devname : ""); | |
426 | 393 | ||
427 | if (!leftover) | 394 | if (!leftover) |
428 | s->device_count = 0; | 395 | s->device_count = 0; |
@@ -439,6 +406,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
439 | p_dev->_removed=1; | 406 | p_dev->_removed=1; |
440 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 407 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
441 | 408 | ||
409 | ds_dbg(2, "unregistering device %s\n", p_dev->dev.bus_id); | ||
442 | device_unregister(&p_dev->dev); | 410 | device_unregister(&p_dev->dev); |
443 | } | 411 | } |
444 | 412 | ||
@@ -455,6 +423,8 @@ static int pcmcia_device_remove(struct device * dev) | |||
455 | p_dev = to_pcmcia_dev(dev); | 423 | p_dev = to_pcmcia_dev(dev); |
456 | p_drv = to_pcmcia_drv(dev->driver); | 424 | p_drv = to_pcmcia_drv(dev->driver); |
457 | 425 | ||
426 | ds_dbg(1, "removing device %s\n", p_dev->dev.bus_id); | ||
427 | |||
458 | /* If we're removing the primary module driving a | 428 | /* If we're removing the primary module driving a |
459 | * pseudo multi-function card, we need to unbind | 429 | * pseudo multi-function card, we need to unbind |
460 | * all devices | 430 | * all devices |
@@ -587,8 +557,10 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
587 | 557 | ||
588 | mutex_lock(&device_add_lock); | 558 | mutex_lock(&device_add_lock); |
589 | 559 | ||
590 | /* max of 2 devices per card */ | 560 | ds_dbg(3, "adding device to %d, function %d\n", s->sock, function); |
591 | if (s->device_count == 2) | 561 | |
562 | /* max of 4 devices per card */ | ||
563 | if (s->device_count == 4) | ||
592 | goto err_put; | 564 | goto err_put; |
593 | 565 | ||
594 | p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL); | 566 | p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL); |
@@ -598,8 +570,6 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
598 | p_dev->socket = s; | 570 | p_dev->socket = s; |
599 | p_dev->device_no = (s->device_count++); | 571 | p_dev->device_no = (s->device_count++); |
600 | p_dev->func = function; | 572 | p_dev->func = function; |
601 | if (s->functions <= function) | ||
602 | s->functions = function + 1; | ||
603 | 573 | ||
604 | p_dev->dev.bus = &pcmcia_bus_type; | 574 | p_dev->dev.bus = &pcmcia_bus_type; |
605 | p_dev->dev.parent = s->dev.dev; | 575 | p_dev->dev.parent = s->dev.dev; |
@@ -610,8 +580,8 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
610 | if (!p_dev->devname) | 580 | if (!p_dev->devname) |
611 | goto err_free; | 581 | goto err_free; |
612 | sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); | 582 | sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); |
583 | ds_dbg(3, "devname is %s\n", p_dev->devname); | ||
613 | 584 | ||
614 | /* compat */ | ||
615 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 585 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
616 | 586 | ||
617 | /* | 587 | /* |
@@ -631,6 +601,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
631 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 601 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
632 | 602 | ||
633 | if (!p_dev->function_config) { | 603 | if (!p_dev->function_config) { |
604 | ds_dbg(3, "creating config_t for %s\n", p_dev->dev.bus_id); | ||
634 | p_dev->function_config = kzalloc(sizeof(struct config_t), | 605 | p_dev->function_config = kzalloc(sizeof(struct config_t), |
635 | GFP_KERNEL); | 606 | GFP_KERNEL); |
636 | if (!p_dev->function_config) | 607 | if (!p_dev->function_config) |
@@ -674,11 +645,16 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
674 | unsigned int no_funcs, i; | 645 | unsigned int no_funcs, i; |
675 | int ret = 0; | 646 | int ret = 0; |
676 | 647 | ||
677 | if (!(s->resource_setup_done)) | 648 | if (!(s->resource_setup_done)) { |
649 | ds_dbg(3, "no resources available, delaying card_add\n"); | ||
678 | return -EAGAIN; /* try again, but later... */ | 650 | return -EAGAIN; /* try again, but later... */ |
651 | } | ||
679 | 652 | ||
680 | if (pcmcia_validate_mem(s)) | 653 | if (pcmcia_validate_mem(s)) { |
654 | ds_dbg(3, "validating mem resources failed, " | ||
655 | "delaying card_add\n"); | ||
681 | return -EAGAIN; /* try again, but later... */ | 656 | return -EAGAIN; /* try again, but later... */ |
657 | } | ||
682 | 658 | ||
683 | ret = pccard_validate_cis(s, BIND_FN_ALL, &cisinfo); | 659 | ret = pccard_validate_cis(s, BIND_FN_ALL, &cisinfo); |
684 | if (ret || !cisinfo.Chains) { | 660 | if (ret || !cisinfo.Chains) { |
@@ -690,6 +666,7 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
690 | no_funcs = mfc.nfn; | 666 | no_funcs = mfc.nfn; |
691 | else | 667 | else |
692 | no_funcs = 1; | 668 | no_funcs = 1; |
669 | s->functions = no_funcs; | ||
693 | 670 | ||
694 | for (i=0; i < no_funcs; i++) | 671 | for (i=0; i < no_funcs; i++) |
695 | pcmcia_device_add(s, i); | 672 | pcmcia_device_add(s, i); |
@@ -698,39 +675,50 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
698 | } | 675 | } |
699 | 676 | ||
700 | 677 | ||
701 | static void pcmcia_delayed_add_pseudo_device(struct work_struct *work) | 678 | static void pcmcia_delayed_add_device(struct work_struct *work) |
702 | { | 679 | { |
703 | struct pcmcia_socket *s = | 680 | struct pcmcia_socket *s = |
704 | container_of(work, struct pcmcia_socket, device_add); | 681 | container_of(work, struct pcmcia_socket, device_add); |
705 | pcmcia_device_add(s, 0); | 682 | ds_dbg(1, "adding additional device to %d\n", s->sock); |
683 | pcmcia_device_add(s, s->pcmcia_state.mfc_pfc); | ||
706 | s->pcmcia_state.device_add_pending = 0; | 684 | s->pcmcia_state.device_add_pending = 0; |
685 | s->pcmcia_state.mfc_pfc = 0; | ||
707 | } | 686 | } |
708 | 687 | ||
709 | static int pcmcia_requery(struct device *dev, void * _data) | 688 | static int pcmcia_requery(struct device *dev, void * _data) |
710 | { | 689 | { |
711 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 690 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
712 | if (!p_dev->dev.driver) | 691 | if (!p_dev->dev.driver) { |
692 | ds_dbg(1, "update device information for %s\n", | ||
693 | p_dev->dev.bus_id); | ||
713 | pcmcia_device_query(p_dev); | 694 | pcmcia_device_query(p_dev); |
695 | } | ||
714 | 696 | ||
715 | return 0; | 697 | return 0; |
716 | } | 698 | } |
717 | 699 | ||
718 | static void pcmcia_bus_rescan(struct pcmcia_socket *skt) | 700 | static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis) |
719 | { | 701 | { |
720 | int no_devices=0; | 702 | int no_devices = 0; |
721 | int ret = 0; | 703 | int ret = 0; |
722 | unsigned long flags; | 704 | unsigned long flags; |
723 | 705 | ||
724 | /* must be called with skt_mutex held */ | 706 | /* must be called with skt_mutex held */ |
707 | ds_dbg(0, "re-scanning socket %d\n", skt->sock); | ||
708 | |||
725 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 709 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
726 | if (list_empty(&skt->devices_list)) | 710 | if (list_empty(&skt->devices_list)) |
727 | no_devices=1; | 711 | no_devices = 1; |
728 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 712 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
729 | 713 | ||
714 | /* If this is because of a CIS override, start over */ | ||
715 | if (new_cis && !no_devices) | ||
716 | pcmcia_card_remove(skt, NULL); | ||
717 | |||
730 | /* if no devices were added for this socket yet because of | 718 | /* if no devices were added for this socket yet because of |
731 | * missing resource information or other trouble, we need to | 719 | * missing resource information or other trouble, we need to |
732 | * do this now. */ | 720 | * do this now. */ |
733 | if (no_devices) { | 721 | if (no_devices || new_cis) { |
734 | ret = pcmcia_card_add(skt); | 722 | ret = pcmcia_card_add(skt); |
735 | if (ret) | 723 | if (ret) |
736 | return; | 724 | return; |
@@ -748,6 +736,97 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt) | |||
748 | printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n"); | 736 | printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n"); |
749 | } | 737 | } |
750 | 738 | ||
739 | #ifdef CONFIG_PCMCIA_LOAD_CIS | ||
740 | |||
741 | /** | ||
742 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken | ||
743 | * @dev - the pcmcia device which needs a CIS override | ||
744 | * @filename - requested filename in /lib/firmware/ | ||
745 | * | ||
746 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if | ||
747 | * the one provided by the card is broken. The firmware files reside in | ||
748 | * /lib/firmware/ in userspace. | ||
749 | */ | ||
750 | static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | ||
751 | { | ||
752 | struct pcmcia_socket *s = dev->socket; | ||
753 | const struct firmware *fw; | ||
754 | char path[20]; | ||
755 | int ret = -ENOMEM; | ||
756 | int no_funcs; | ||
757 | int old_funcs; | ||
758 | cisdump_t *cis; | ||
759 | cistpl_longlink_mfc_t mfc; | ||
760 | |||
761 | if (!filename) | ||
762 | return -EINVAL; | ||
763 | |||
764 | ds_dbg(1, "trying to load CIS file %s\n", filename); | ||
765 | |||
766 | if (strlen(filename) > 14) { | ||
767 | printk(KERN_WARNING "pcmcia: CIS filename is too long\n"); | ||
768 | return -EINVAL; | ||
769 | } | ||
770 | |||
771 | snprintf(path, 20, "%s", filename); | ||
772 | |||
773 | if (request_firmware(&fw, path, &dev->dev) == 0) { | ||
774 | if (fw->size >= CISTPL_MAX_CIS_SIZE) { | ||
775 | ret = -EINVAL; | ||
776 | printk(KERN_ERR "pcmcia: CIS override is too big\n"); | ||
777 | goto release; | ||
778 | } | ||
779 | |||
780 | cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL); | ||
781 | if (!cis) { | ||
782 | ret = -ENOMEM; | ||
783 | goto release; | ||
784 | } | ||
785 | |||
786 | cis->Length = fw->size + 1; | ||
787 | memcpy(cis->Data, fw->data, fw->size); | ||
788 | |||
789 | if (!pcmcia_replace_cis(s, cis)) | ||
790 | ret = 0; | ||
791 | else { | ||
792 | printk(KERN_ERR "pcmcia: CIS override failed\n"); | ||
793 | goto release; | ||
794 | } | ||
795 | |||
796 | |||
797 | /* update information */ | ||
798 | pcmcia_device_query(dev); | ||
799 | |||
800 | /* does this cis override add or remove functions? */ | ||
801 | old_funcs = s->functions; | ||
802 | |||
803 | if (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_LONGLINK_MFC, &mfc)) | ||
804 | no_funcs = mfc.nfn; | ||
805 | else | ||
806 | no_funcs = 1; | ||
807 | s->functions = no_funcs; | ||
808 | |||
809 | if (old_funcs > no_funcs) | ||
810 | pcmcia_card_remove(s, dev); | ||
811 | else if (no_funcs > old_funcs) | ||
812 | pcmcia_add_device_later(s, 1); | ||
813 | } | ||
814 | release: | ||
815 | release_firmware(fw); | ||
816 | |||
817 | return (ret); | ||
818 | } | ||
819 | |||
820 | #else /* !CONFIG_PCMCIA_LOAD_CIS */ | ||
821 | |||
822 | static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | ||
823 | { | ||
824 | return -ENODEV; | ||
825 | } | ||
826 | |||
827 | #endif | ||
828 | |||
829 | |||
751 | static inline int pcmcia_devmatch(struct pcmcia_device *dev, | 830 | static inline int pcmcia_devmatch(struct pcmcia_device *dev, |
752 | struct pcmcia_device_id *did) | 831 | struct pcmcia_device_id *did) |
753 | { | 832 | { |
@@ -814,11 +893,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
814 | * after it has re-checked that there is no possible module | 893 | * after it has re-checked that there is no possible module |
815 | * with a prod_id/manf_id/card_id match. | 894 | * with a prod_id/manf_id/card_id match. |
816 | */ | 895 | */ |
896 | ds_dbg(0, "skipping FUNC_ID match for %s until userspace " | ||
897 | "interaction\n", dev->dev.bus_id); | ||
817 | if (!dev->allow_func_id_match) | 898 | if (!dev->allow_func_id_match) |
818 | return 0; | 899 | return 0; |
819 | } | 900 | } |
820 | 901 | ||
821 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { | 902 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { |
903 | ds_dbg(0, "device %s needs a fake CIS\n", dev->dev.bus_id); | ||
822 | if (!dev->socket->fake_cis) | 904 | if (!dev->socket->fake_cis) |
823 | pcmcia_load_firmware(dev, did->cisfile); | 905 | pcmcia_load_firmware(dev, did->cisfile); |
824 | 906 | ||
@@ -848,13 +930,21 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { | |||
848 | 930 | ||
849 | #ifdef CONFIG_PCMCIA_IOCTL | 931 | #ifdef CONFIG_PCMCIA_IOCTL |
850 | /* matching by cardmgr */ | 932 | /* matching by cardmgr */ |
851 | if (p_dev->cardmgr == p_drv) | 933 | if (p_dev->cardmgr == p_drv) { |
934 | ds_dbg(0, "cardmgr matched %s to %s\n", dev->bus_id, | ||
935 | drv->name); | ||
852 | return 1; | 936 | return 1; |
937 | } | ||
853 | #endif | 938 | #endif |
854 | 939 | ||
855 | while (did && did->match_flags) { | 940 | while (did && did->match_flags) { |
856 | if (pcmcia_devmatch(p_dev, did)) | 941 | ds_dbg(3, "trying to match %s to %s\n", dev->bus_id, |
942 | drv->name); | ||
943 | if (pcmcia_devmatch(p_dev, did)) { | ||
944 | ds_dbg(0, "matched %s to %s\n", dev->bus_id, | ||
945 | drv->name); | ||
857 | return 1; | 946 | return 1; |
947 | } | ||
858 | did++; | 948 | did++; |
859 | } | 949 | } |
860 | 950 | ||
@@ -1045,6 +1135,8 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1045 | struct pcmcia_driver *p_drv = NULL; | 1135 | struct pcmcia_driver *p_drv = NULL; |
1046 | int ret = 0; | 1136 | int ret = 0; |
1047 | 1137 | ||
1138 | ds_dbg(2, "suspending %s\n", dev->bus_id); | ||
1139 | |||
1048 | if (dev->driver) | 1140 | if (dev->driver) |
1049 | p_drv = to_pcmcia_drv(dev->driver); | 1141 | p_drv = to_pcmcia_drv(dev->driver); |
1050 | 1142 | ||
@@ -1053,12 +1145,18 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1053 | 1145 | ||
1054 | if (p_drv->suspend) { | 1146 | if (p_drv->suspend) { |
1055 | ret = p_drv->suspend(p_dev); | 1147 | ret = p_drv->suspend(p_dev); |
1056 | if (ret) | 1148 | if (ret) { |
1149 | printk(KERN_ERR "pcmcia: device %s (driver %s) did " | ||
1150 | "not want to go to sleep (%d)\n", | ||
1151 | p_dev->devname, p_drv->drv.name, ret); | ||
1057 | goto out; | 1152 | goto out; |
1153 | } | ||
1058 | } | 1154 | } |
1059 | 1155 | ||
1060 | if (p_dev->device_no == p_dev->func) | 1156 | if (p_dev->device_no == p_dev->func) { |
1157 | ds_dbg(2, "releasing configuration for %s\n", dev->bus_id); | ||
1061 | pcmcia_release_configuration(p_dev); | 1158 | pcmcia_release_configuration(p_dev); |
1159 | } | ||
1062 | 1160 | ||
1063 | out: | 1161 | out: |
1064 | if (!ret) | 1162 | if (!ret) |
@@ -1073,6 +1171,8 @@ static int pcmcia_dev_resume(struct device * dev) | |||
1073 | struct pcmcia_driver *p_drv = NULL; | 1171 | struct pcmcia_driver *p_drv = NULL; |
1074 | int ret = 0; | 1172 | int ret = 0; |
1075 | 1173 | ||
1174 | ds_dbg(2, "resuming %s\n", dev->bus_id); | ||
1175 | |||
1076 | if (dev->driver) | 1176 | if (dev->driver) |
1077 | p_drv = to_pcmcia_drv(dev->driver); | 1177 | p_drv = to_pcmcia_drv(dev->driver); |
1078 | 1178 | ||
@@ -1080,6 +1180,7 @@ static int pcmcia_dev_resume(struct device * dev) | |||
1080 | goto out; | 1180 | goto out; |
1081 | 1181 | ||
1082 | if (p_dev->device_no == p_dev->func) { | 1182 | if (p_dev->device_no == p_dev->func) { |
1183 | ds_dbg(2, "requesting configuration for %s\n", dev->bus_id); | ||
1083 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); | 1184 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); |
1084 | if (ret) | 1185 | if (ret) |
1085 | goto out; | 1186 | goto out; |
@@ -1121,12 +1222,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data) | |||
1121 | 1222 | ||
1122 | static int pcmcia_bus_resume(struct pcmcia_socket *skt) | 1223 | static int pcmcia_bus_resume(struct pcmcia_socket *skt) |
1123 | { | 1224 | { |
1225 | ds_dbg(2, "resuming socket %d\n", skt->sock); | ||
1124 | bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); | 1226 | bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); |
1125 | return 0; | 1227 | return 0; |
1126 | } | 1228 | } |
1127 | 1229 | ||
1128 | static int pcmcia_bus_suspend(struct pcmcia_socket *skt) | 1230 | static int pcmcia_bus_suspend(struct pcmcia_socket *skt) |
1129 | { | 1231 | { |
1232 | ds_dbg(2, "suspending socket %d\n", skt->sock); | ||
1130 | if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, | 1233 | if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, |
1131 | pcmcia_bus_suspend_callback)) { | 1234 | pcmcia_bus_suspend_callback)) { |
1132 | pcmcia_bus_resume(skt); | 1235 | pcmcia_bus_resume(skt); |
@@ -1247,7 +1350,7 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev, | |||
1247 | init_waitqueue_head(&socket->queue); | 1350 | init_waitqueue_head(&socket->queue); |
1248 | #endif | 1351 | #endif |
1249 | INIT_LIST_HEAD(&socket->devices_list); | 1352 | INIT_LIST_HEAD(&socket->devices_list); |
1250 | INIT_WORK(&socket->device_add, pcmcia_delayed_add_pseudo_device); | 1353 | INIT_WORK(&socket->device_add, pcmcia_delayed_add_device); |
1251 | memset(&socket->pcmcia_state, 0, sizeof(u8)); | 1354 | memset(&socket->pcmcia_state, 0, sizeof(u8)); |
1252 | socket->device_count = 0; | 1355 | socket->device_count = 0; |
1253 | 1356 | ||
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 36fdaa58458c..3c22ac4625c2 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c | |||
@@ -398,7 +398,7 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
398 | static void pcc_interrupt_wrapper(u_long data) | 398 | static void pcc_interrupt_wrapper(u_long data) |
399 | { | 399 | { |
400 | debug(3, "m32r_cfc: pcc_interrupt_wrapper:\n"); | 400 | debug(3, "m32r_cfc: pcc_interrupt_wrapper:\n"); |
401 | pcc_interrupt(0, NULL, NULL); | 401 | pcc_interrupt(0, NULL); |
402 | init_timer(&poll_timer); | 402 | init_timer(&poll_timer); |
403 | poll_timer.expires = jiffies + poll_interval; | 403 | poll_timer.expires = jiffies + poll_interval; |
404 | add_timer(&poll_timer); | 404 | add_timer(&poll_timer); |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 310ede575caa..d077870c6731 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -594,7 +594,12 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
594 | 594 | ||
595 | err = ret = 0; | 595 | err = ret = 0; |
596 | 596 | ||
597 | if (cmd & IOC_IN) __copy_from_user((char *)buf, uarg, size); | 597 | if (cmd & IOC_IN) { |
598 | if (__copy_from_user((char *)buf, uarg, size)) { | ||
599 | err = -EFAULT; | ||
600 | goto free_out; | ||
601 | } | ||
602 | } | ||
598 | 603 | ||
599 | switch (cmd) { | 604 | switch (cmd) { |
600 | case DS_ADJUST_RESOURCE_INFO: | 605 | case DS_ADJUST_RESOURCE_INFO: |
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index a70f97fdbbdd..360c24896548 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -581,10 +581,10 @@ static irqreturn_t pd6729_test(int irq, void *dev) | |||
581 | return IRQ_HANDLED; | 581 | return IRQ_HANDLED; |
582 | } | 582 | } |
583 | 583 | ||
584 | static int pd6729_check_irq(int irq, int flags) | 584 | static int pd6729_check_irq(int irq) |
585 | { | 585 | { |
586 | if (request_irq(irq, pd6729_test, flags, "x", pd6729_test) != 0) | 586 | if (request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x", pd6729_test) |
587 | return -1; | 587 | != 0) return -1; |
588 | free_irq(irq, pd6729_test); | 588 | free_irq(irq, pd6729_test); |
589 | return 0; | 589 | return 0; |
590 | } | 590 | } |
@@ -610,7 +610,7 @@ static u_int __devinit pd6729_isa_scan(void) | |||
610 | 610 | ||
611 | /* just find interrupts that aren't in use */ | 611 | /* just find interrupts that aren't in use */ |
612 | for (i = 0; i < 16; i++) | 612 | for (i = 0; i < 16; i++) |
613 | if ((mask0 & (1 << i)) && (pd6729_check_irq(i, 0) == 0)) | 613 | if ((mask0 & (1 << i)) && (pd6729_check_irq(i) == 0)) |
614 | mask |= (1 << i); | 614 | mask |= (1 << i); |
615 | 615 | ||
616 | printk(KERN_INFO "pd6729: ISA irqs = "); | 616 | printk(KERN_INFO "pd6729: ISA irqs = "); |
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 933cd864a5c9..b005602d6b53 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -188,7 +188,7 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf, | |||
188 | (s->state & SOCKET_PRESENT) && | 188 | (s->state & SOCKET_PRESENT) && |
189 | !(s->state & SOCKET_CARDBUS)) { | 189 | !(s->state & SOCKET_CARDBUS)) { |
190 | if (try_module_get(s->callback->owner)) { | 190 | if (try_module_get(s->callback->owner)) { |
191 | s->callback->requery(s); | 191 | s->callback->requery(s, 0); |
192 | module_put(s->callback->owner); | 192 | module_put(s->callback->owner); |
193 | } | 193 | } |
194 | } | 194 | } |
@@ -325,7 +325,7 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz | |||
325 | if ((s->callback) && (s->state & SOCKET_PRESENT) && | 325 | if ((s->callback) && (s->state & SOCKET_PRESENT) && |
326 | !(s->state & SOCKET_CARDBUS)) { | 326 | !(s->state & SOCKET_CARDBUS)) { |
327 | if (try_module_get(s->callback->owner)) { | 327 | if (try_module_get(s->callback->owner)) { |
328 | s->callback->requery(s); | 328 | s->callback->requery(s, 1); |
329 | module_put(s->callback->owner); | 329 | module_put(s->callback->owner); |
330 | } | 330 | } |
331 | } | 331 | } |