aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r--drivers/pcmcia/ds.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 55570d9e1e4c..749c2a16012c 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -26,7 +26,6 @@
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28 28
29#include <pcmcia/cs.h>
30#include <pcmcia/cistpl.h> 29#include <pcmcia/cistpl.h>
31#include <pcmcia/ds.h> 30#include <pcmcia/ds.h>
32#include <pcmcia/ss.h> 31#include <pcmcia/ss.h>
@@ -46,13 +45,13 @@ MODULE_LICENSE("GPL");
46 45
47static void pcmcia_check_driver(struct pcmcia_driver *p_drv) 46static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
48{ 47{
49 struct pcmcia_device_id *did = p_drv->id_table; 48 const struct pcmcia_device_id *did = p_drv->id_table;
50 unsigned int i; 49 unsigned int i;
51 u32 hash; 50 u32 hash;
52 51
53 if (!p_drv->probe || !p_drv->remove) 52 if (!p_drv->probe || !p_drv->remove)
54 printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback " 53 printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback "
55 "function\n", p_drv->drv.name); 54 "function\n", p_drv->name);
56 55
57 while (did && did->match_flags) { 56 while (did && did->match_flags) {
58 for (i = 0; i < 4; i++) { 57 for (i = 0; i < 4; i++) {
@@ -65,7 +64,7 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
65 64
66 printk(KERN_DEBUG "pcmcia: %s: invalid hash for " 65 printk(KERN_DEBUG "pcmcia: %s: invalid hash for "
67 "product string \"%s\": is 0x%x, should " 66 "product string \"%s\": is 0x%x, should "
68 "be 0x%x\n", p_drv->drv.name, did->prod_id[i], 67 "be 0x%x\n", p_drv->name, did->prod_id[i],
69 did->prod_id_hash[i], hash); 68 did->prod_id_hash[i], hash);
70 printk(KERN_DEBUG "pcmcia: see " 69 printk(KERN_DEBUG "pcmcia: see "
71 "Documentation/pcmcia/devicetable.txt for " 70 "Documentation/pcmcia/devicetable.txt for "
@@ -180,10 +179,11 @@ int pcmcia_register_driver(struct pcmcia_driver *driver)
180 /* initialize common fields */ 179 /* initialize common fields */
181 driver->drv.bus = &pcmcia_bus_type; 180 driver->drv.bus = &pcmcia_bus_type;
182 driver->drv.owner = driver->owner; 181 driver->drv.owner = driver->owner;
182 driver->drv.name = driver->name;
183 mutex_init(&driver->dynids.lock); 183 mutex_init(&driver->dynids.lock);
184 INIT_LIST_HEAD(&driver->dynids.list); 184 INIT_LIST_HEAD(&driver->dynids.list);
185 185
186 pr_debug("registering driver %s\n", driver->drv.name); 186 pr_debug("registering driver %s\n", driver->name);
187 187
188 error = driver_register(&driver->drv); 188 error = driver_register(&driver->drv);
189 if (error < 0) 189 if (error < 0)
@@ -203,7 +203,7 @@ EXPORT_SYMBOL(pcmcia_register_driver);
203 */ 203 */
204void pcmcia_unregister_driver(struct pcmcia_driver *driver) 204void pcmcia_unregister_driver(struct pcmcia_driver *driver)
205{ 205{
206 pr_debug("unregistering driver %s\n", driver->drv.name); 206 pr_debug("unregistering driver %s\n", driver->name);
207 driver_unregister(&driver->drv); 207 driver_unregister(&driver->drv);
208 pcmcia_free_dynids(driver); 208 pcmcia_free_dynids(driver);
209} 209}
@@ -264,7 +264,7 @@ static int pcmcia_device_probe(struct device *dev)
264 p_drv = to_pcmcia_drv(dev->driver); 264 p_drv = to_pcmcia_drv(dev->driver);
265 s = p_dev->socket; 265 s = p_dev->socket;
266 266
267 dev_dbg(dev, "trying to bind to %s\n", p_drv->drv.name); 267 dev_dbg(dev, "trying to bind to %s\n", p_drv->name);
268 268
269 if ((!p_drv->probe) || (!p_dev->function_config) || 269 if ((!p_drv->probe) || (!p_dev->function_config) ||
270 (!try_module_get(p_drv->owner))) { 270 (!try_module_get(p_drv->owner))) {
@@ -276,21 +276,28 @@ static int pcmcia_device_probe(struct device *dev)
276 ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, 276 ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG,
277 &cis_config); 277 &cis_config);
278 if (!ret) { 278 if (!ret) {
279 p_dev->conf.ConfigBase = cis_config.base; 279 p_dev->config_base = cis_config.base;
280 p_dev->conf.Present = cis_config.rmask[0]; 280 p_dev->config_regs = cis_config.rmask[0];
281 dev_dbg(dev, "base %x, regs %x", p_dev->config_base,
282 p_dev->config_regs);
281 } else { 283 } else {
282 dev_printk(KERN_INFO, dev, 284 dev_printk(KERN_INFO, dev,
283 "pcmcia: could not parse base and rmask0 of CIS\n"); 285 "pcmcia: could not parse base and rmask0 of CIS\n");
284 p_dev->conf.ConfigBase = 0; 286 p_dev->config_base = 0;
285 p_dev->conf.Present = 0; 287 p_dev->config_regs = 0;
286 } 288 }
287 289
288 ret = p_drv->probe(p_dev); 290 ret = p_drv->probe(p_dev);
289 if (ret) { 291 if (ret) {
290 dev_dbg(dev, "binding to %s failed with %d\n", 292 dev_dbg(dev, "binding to %s failed with %d\n",
291 p_drv->drv.name, ret); 293 p_drv->name, ret);
292 goto put_module; 294 goto put_module;
293 } 295 }
296 dev_dbg(dev, "%s bound: Vpp %d.%d, idx %x, IRQ %d", p_drv->name,
297 p_dev->vpp/10, p_dev->vpp%10, p_dev->config_index, p_dev->irq);
298 dev_dbg(dev, "resources: ioport %pR %pR iomem %pR %pR %pR",
299 p_dev->resource[0], p_dev->resource[1], p_dev->resource[2],
300 p_dev->resource[3], p_dev->resource[4]);
294 301
295 mutex_lock(&s->ops_mutex); 302 mutex_lock(&s->ops_mutex);
296 if ((s->pcmcia_pfc) && 303 if ((s->pcmcia_pfc) &&
@@ -374,13 +381,13 @@ static int pcmcia_device_remove(struct device *dev)
374 if (p_dev->_irq || p_dev->_io || p_dev->_locked) 381 if (p_dev->_irq || p_dev->_io || p_dev->_locked)
375 dev_printk(KERN_INFO, dev, 382 dev_printk(KERN_INFO, dev,
376 "pcmcia: driver %s did not release config properly\n", 383 "pcmcia: driver %s did not release config properly\n",
377 p_drv->drv.name); 384 p_drv->name);
378 385
379 for (i = 0; i < MAX_WIN; i++) 386 for (i = 0; i < MAX_WIN; i++)
380 if (p_dev->_win & CLIENT_WIN_REQ(i)) 387 if (p_dev->_win & CLIENT_WIN_REQ(i))
381 dev_printk(KERN_INFO, dev, 388 dev_printk(KERN_INFO, dev,
382 "pcmcia: driver %s did not release window properly\n", 389 "pcmcia: driver %s did not release window properly\n",
383 p_drv->drv.name); 390 p_drv->name);
384 391
385 /* references from pcmcia_probe_device */ 392 /* references from pcmcia_probe_device */
386 pcmcia_put_dev(p_dev); 393 pcmcia_put_dev(p_dev);
@@ -777,7 +784,7 @@ static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filenam
777 784
778 785
779static inline int pcmcia_devmatch(struct pcmcia_device *dev, 786static inline int pcmcia_devmatch(struct pcmcia_device *dev,
780 struct pcmcia_device_id *did) 787 const struct pcmcia_device_id *did)
781{ 788{
782 if (did->match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID) { 789 if (did->match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID) {
783 if ((!dev->has_manf_id) || (dev->manf_id != did->manf_id)) 790 if ((!dev->has_manf_id) || (dev->manf_id != did->manf_id))
@@ -883,7 +890,7 @@ static int pcmcia_bus_match(struct device *dev, struct device_driver *drv)
883{ 890{
884 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 891 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
885 struct pcmcia_driver *p_drv = to_pcmcia_drv(drv); 892 struct pcmcia_driver *p_drv = to_pcmcia_drv(drv);
886 struct pcmcia_device_id *did = p_drv->id_table; 893 const struct pcmcia_device_id *did = p_drv->id_table;
887 struct pcmcia_dynid *dynid; 894 struct pcmcia_dynid *dynid;
888 895
889 /* match dynamic devices first */ 896 /* match dynamic devices first */
@@ -1136,7 +1143,7 @@ static int pcmcia_dev_suspend(struct device *dev, pm_message_t state)
1136 dev_printk(KERN_ERR, dev, 1143 dev_printk(KERN_ERR, dev,
1137 "pcmcia: device %s (driver %s) did " 1144 "pcmcia: device %s (driver %s) did "
1138 "not want to go to sleep (%d)\n", 1145 "not want to go to sleep (%d)\n",
1139 p_dev->devname, p_drv->drv.name, ret); 1146 p_dev->devname, p_drv->name, ret);
1140 mutex_lock(&p_dev->socket->ops_mutex); 1147 mutex_lock(&p_dev->socket->ops_mutex);
1141 p_dev->suspended = 0; 1148 p_dev->suspended = 0;
1142 mutex_unlock(&p_dev->socket->ops_mutex); 1149 mutex_unlock(&p_dev->socket->ops_mutex);
@@ -1178,7 +1185,7 @@ static int pcmcia_dev_resume(struct device *dev)
1178 1185
1179 if (p_dev->device_no == p_dev->func) { 1186 if (p_dev->device_no == p_dev->func) {
1180 dev_dbg(dev, "requesting configuration\n"); 1187 dev_dbg(dev, "requesting configuration\n");
1181 ret = pcmcia_request_configuration(p_dev, &p_dev->conf); 1188 ret = pcmcia_enable_device(p_dev);
1182 if (ret) 1189 if (ret)
1183 goto out; 1190 goto out;
1184 } 1191 }