pcmcia: use dynamic debug instead of custom infrastructure

Use the generic "dynamic debug" infrastructure instead of
CONIG_PCMCIA_DEBUG in the PCMCIA core (pcmcia.ko and pcmcia_core.ko). To
enable debugging, enable CONFIG_DYNAMIC_DEBUG, mount debugfs and

$ echo -n 'module pcmcia_core +p' > /sys/kernel/debug/dynamic_debug/control

for the complete module "pcmcia_core", for example. For more detailled
instructions, please see Documentation/dynamic-debug-howto.txt

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
Dominik Brodowski 2009-10-23 12:51:28 +02:00
parent 18a7a19b37
commit d50dbec3ce
7 changed files with 100 additions and 174 deletions

View file

@ -91,7 +91,7 @@ static u_int xlate_rom_addr(void __iomem *b, u_int addr)
static void cb_release_cis_mem(struct pcmcia_socket * s)
{
if (s->cb_cis_virt) {
cs_dbg(s, 1, "cb_release_cis_mem()\n");
dev_dbg(&s->dev, "cb_release_cis_mem()\n");
iounmap(s->cb_cis_virt);
s->cb_cis_virt = NULL;
s->cb_cis_res = NULL;
@ -132,7 +132,7 @@ int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void
struct pci_dev *dev;
struct resource *res;
cs_dbg(s, 3, "read_cb_mem(%d, %#x, %u)\n", space, addr, len);
dev_dbg(&s->dev, "read_cb_mem(%d, %#x, %u)\n", space, addr, len);
dev = pci_get_slot(s->cb_dev->subordinate, 0);
if (!dev)

View file

@ -138,7 +138,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
void __iomem *sys, *end;
unsigned char *buf = ptr;
cs_dbg(s, 3, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len);
dev_dbg(&s->dev, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len);
if (attr & IS_INDIRECT) {
/* Indirect accesses use a bunch of special registers at fixed
@ -190,7 +190,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
addr = 0;
}
}
cs_dbg(s, 3, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n",
dev_dbg(&s->dev, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n",
*(u_char *)(ptr+0), *(u_char *)(ptr+1),
*(u_char *)(ptr+2), *(u_char *)(ptr+3));
return 0;
@ -204,7 +204,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
void __iomem *sys, *end;
unsigned char *buf = ptr;
cs_dbg(s, 3, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len);
dev_dbg(&s->dev, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len);
if (attr & IS_INDIRECT) {
/* Indirect accesses use a bunch of special registers at fixed
@ -584,7 +584,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
ofs += link[1] + 2;
}
if (i == MAX_TUPLES) {
cs_dbg(s, 1, "cs: overrun in pcmcia_get_next_tuple\n");
dev_dbg(&s->dev, "cs: overrun in pcmcia_get_next_tuple\n");
return -ENOSPC;
}
@ -1440,7 +1440,7 @@ int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse)
break;
}
if (ret)
__cs_dbg(0, "parse_tuple failed %d\n", ret);
pr_debug("parse_tuple failed %d\n", ret);
return ret;
}
EXPORT_SYMBOL(pcmcia_parse_tuple);

View file

@ -61,17 +61,6 @@ INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */
/* Access speed for attribute memory windows */
INT_MODULE_PARM(cis_speed, 300); /* ns */
#ifdef CONFIG_PCMCIA_DEBUG
static int pc_debug;
module_param(pc_debug, int, 0644);
int cs_debug_level(int level)
{
return pc_debug > level;
}
#endif
socket_state_t dead_socket = {
.csc_mask = SS_DETECT,
@ -182,7 +171,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops)
return -EINVAL;
cs_dbg(socket, 0, "pcmcia_register_socket(0x%p)\n", socket->ops);
dev_dbg(&socket->dev, "pcmcia_register_socket(0x%p)\n", socket->ops);
spin_lock_init(&socket->lock);
@ -274,7 +263,7 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket)
if (!socket)
return;
cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops);
dev_dbg(&socket->dev, "pcmcia_unregister_socket(0x%p)\n", socket->ops);
if (socket->thread)
kthread_stop(socket->thread);
@ -327,7 +316,7 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
if (s->state & SOCKET_CARDBUS)
return 0;
cs_dbg(s, 1, "send_event(event %d, pri %d, callback 0x%p)\n",
dev_dbg(&s->dev, "send_event(event %d, pri %d, callback 0x%p)\n",
event, priority, s->callback);
if (!s->callback)
@ -344,7 +333,7 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
static void socket_remove_drivers(struct pcmcia_socket *skt)
{
cs_dbg(skt, 4, "remove_drivers\n");
dev_dbg(&skt->dev, "remove_drivers\n");
send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
}
@ -353,7 +342,7 @@ static int socket_reset(struct pcmcia_socket *skt)
{
int status, i;
cs_dbg(skt, 4, "reset\n");
dev_dbg(&skt->dev, "reset\n");
skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET;
skt->ops->set_socket(skt, &skt->socket);
@ -375,7 +364,7 @@ static int socket_reset(struct pcmcia_socket *skt)
msleep(unreset_check * 10);
}
cs_err(skt, "time out after reset.\n");
dev_printk(KERN_ERR, &skt->dev, "time out after reset.\n");
return -ETIMEDOUT;
}
@ -389,7 +378,7 @@ static void socket_shutdown(struct pcmcia_socket *s)
{
int status;
cs_dbg(s, 4, "shutdown\n");
dev_dbg(&s->dev, "shutdown\n");
socket_remove_drivers(s);
s->state &= SOCKET_INUSE | SOCKET_PRESENT;
@ -424,7 +413,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
{
int status, i;
cs_dbg(skt, 4, "setup\n");
dev_dbg(&skt->dev, "setup\n");
skt->ops->get_status(skt, &status);
if (!(status & SS_DETECT))
@ -444,13 +433,15 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
}
if (status & SS_PENDING) {
cs_err(skt, "voltage interrogation timed out.\n");
dev_printk(KERN_ERR, &skt->dev,
"voltage interrogation timed out.\n");
return -ETIMEDOUT;
}
if (status & SS_CARDBUS) {
if (!(skt->features & SS_CAP_CARDBUS)) {
cs_err(skt, "cardbus cards are not supported.\n");
dev_printk(KERN_ERR, &skt->dev,
"cardbus cards are not supported.\n");
return -EINVAL;
}
skt->state |= SOCKET_CARDBUS;
@ -464,7 +455,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
else if (!(status & SS_XVCARD))
skt->socket.Vcc = skt->socket.Vpp = 50;
else {
cs_err(skt, "unsupported voltage key.\n");
dev_printk(KERN_ERR, &skt->dev, "unsupported voltage key.\n");
return -EIO;
}
@ -481,7 +472,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
skt->ops->get_status(skt, &status);
if (!(status & SS_POWERON)) {
cs_err(skt, "unable to apply power.\n");
dev_printk(KERN_ERR, &skt->dev, "unable to apply power.\n");
return -EIO;
}
@ -501,7 +492,7 @@ static int socket_insert(struct pcmcia_socket *skt)
{
int ret;
cs_dbg(skt, 4, "insert\n");
dev_dbg(&skt->dev, "insert\n");
if (!cs_socket_get(skt))
return -ENODEV;
@ -521,7 +512,7 @@ static int socket_insert(struct pcmcia_socket *skt)
skt->state |= SOCKET_CARDBUS_CONFIG;
}
#endif
cs_dbg(skt, 4, "insert done\n");
dev_dbg(&skt->dev, "insert done\n");
send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
} else {
@ -573,7 +564,7 @@ static int socket_resume(struct pcmcia_socket *skt)
* FIXME: need a better check here for cardbus cards.
*/
if (verify_cis_cache(skt) != 0) {
cs_dbg(skt, 4, "cis mismatch - different card\n");
dev_dbg(&skt->dev, "cis mismatch - different card\n");
socket_remove_drivers(skt);
destroy_cis_cache(skt);
/*
@ -584,7 +575,7 @@ static int socket_resume(struct pcmcia_socket *skt)
msleep(200);
send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
} else {
cs_dbg(skt, 4, "cis matches cache\n");
dev_dbg(&skt->dev, "cis matches cache\n");
send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
}
} else {
@ -706,7 +697,7 @@ static int pccardd(void *__skt)
void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
{
unsigned long flags;
cs_dbg(s, 4, "parse_events: events %08x\n", events);
dev_dbg(&s->dev, "parse_events: events %08x\n", events);
if (s->thread) {
spin_lock_irqsave(&s->thread_lock, flags);
s->thread_events |= events;
@ -756,7 +747,7 @@ int pcmcia_reset_card(struct pcmcia_socket *skt)
{
int ret;
cs_dbg(skt, 1, "resetting socket\n");
dev_dbg(&skt->dev, "resetting socket\n");
mutex_lock(&skt->skt_mutex);
do {
@ -801,7 +792,7 @@ int pcmcia_suspend_card(struct pcmcia_socket *skt)
{
int ret;
cs_dbg(skt, 1, "suspending socket\n");
dev_dbg(&skt->dev, "suspending socket\n");
mutex_lock(&skt->skt_mutex);
do {
@ -831,7 +822,7 @@ int pcmcia_resume_card(struct pcmcia_socket *skt)
{
int ret;
cs_dbg(skt, 1, "waking up socket\n");
dev_dbg(&skt->dev, "waking up socket\n");
mutex_lock(&skt->skt_mutex);
do {
@ -859,7 +850,7 @@ int pcmcia_eject_card(struct pcmcia_socket *skt)
{
int ret;
cs_dbg(skt, 1, "user eject request\n");
dev_dbg(&skt->dev, "user eject request\n");
mutex_lock(&skt->skt_mutex);
do {
@ -888,7 +879,7 @@ int pcmcia_insert_card(struct pcmcia_socket *skt)
{
int ret;
cs_dbg(skt, 1, "user insert request\n");
dev_dbg(&skt->dev, "user insert request\n");
mutex_lock(&skt->skt_mutex);
do {

View file

@ -107,28 +107,6 @@ static inline void cs_socket_put(struct pcmcia_socket *skt)
}
}
#ifdef CONFIG_PCMCIA_DEBUG
extern int cs_debug_level(int);
#define cs_dbg(skt, lvl, fmt, arg...) do { \
if (cs_debug_level(lvl)) \
dev_printk(KERN_DEBUG, &skt->dev, \
"cs: " fmt, ## arg); \
} while (0)
#define __cs_dbg(lvl, fmt, arg...) do { \
if (cs_debug_level(lvl)) \
printk(KERN_DEBUG \
"cs: " fmt, ## arg); \
} while (0)
#else
#define cs_dbg(skt, lvl, fmt, arg...) do { } while (0)
#define __cs_dbg(lvl, fmt, arg...) do { } while (0)
#endif
#define cs_err(skt, fmt, arg...) \
dev_printk(KERN_ERR, &skt->dev, "cs: " fmt, ## arg)
/*
* Stuff internal to module "pcmcia_core":

View file

@ -41,23 +41,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION("PCMCIA Driver Services");
MODULE_LICENSE("GPL");
#ifdef CONFIG_PCMCIA_DEBUG
int ds_pc_debug;
module_param_named(pc_debug, ds_pc_debug, int, 0644);
#define ds_dbg(lvl, fmt, arg...) do { \
if (ds_pc_debug > (lvl)) \
printk(KERN_DEBUG "ds: " fmt , ## arg); \
} while (0)
#define ds_dev_dbg(lvl, dev, fmt, arg...) do { \
if (ds_pc_debug > (lvl)) \
dev_printk(KERN_DEBUG, dev, "ds: " fmt , ## arg); \
} while (0)
#else
#define ds_dbg(lvl, fmt, arg...) do { } while (0)
#define ds_dev_dbg(lvl, dev, fmt, arg...) do { } while (0)
#endif
spinlock_t pcmcia_dev_list_lock;
@ -303,7 +286,7 @@ int pcmcia_register_driver(struct pcmcia_driver *driver)
spin_lock_init(&driver->dynids.lock);
INIT_LIST_HEAD(&driver->dynids.list);
ds_dbg(3, "registering driver %s\n", driver->drv.name);
pr_debug("registering driver %s\n", driver->drv.name);
error = driver_register(&driver->drv);
if (error < 0)
@ -323,7 +306,7 @@ EXPORT_SYMBOL(pcmcia_register_driver);
*/
void pcmcia_unregister_driver(struct pcmcia_driver *driver)
{
ds_dbg(3, "unregistering driver %s\n", driver->drv.name);
pr_debug("unregistering driver %s\n", driver->drv.name);
driver_unregister(&driver->drv);
pcmcia_free_dynids(driver);
}
@ -350,14 +333,14 @@ void pcmcia_put_dev(struct pcmcia_device *p_dev)
static void pcmcia_release_function(struct kref *ref)
{
struct config_t *c = container_of(ref, struct config_t, ref);
ds_dbg(1, "releasing config_t\n");
pr_debug("releasing config_t\n");
kfree(c);
}
static void pcmcia_release_dev(struct device *dev)
{
struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
ds_dev_dbg(1, dev, "releasing device\n");
dev_dbg(dev, "releasing device\n");
pcmcia_put_socket(p_dev->socket);
kfree(p_dev->devname);
kref_put(&p_dev->function_config->ref, pcmcia_release_function);
@ -367,7 +350,7 @@ static void pcmcia_release_dev(struct device *dev)
static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc)
{
if (!s->pcmcia_state.device_add_pending) {
ds_dev_dbg(1, &s->dev, "scheduling to add %s secondary"
dev_dbg(&s->dev, "scheduling to add %s secondary"
" device to %d\n", mfc ? "mfc" : "pfc", s->sock);
s->pcmcia_state.device_add_pending = 1;
s->pcmcia_state.mfc_pfc = mfc;
@ -405,7 +388,7 @@ static int pcmcia_device_probe(struct device * dev)
*/
did = dev_get_drvdata(&p_dev->dev);
ds_dev_dbg(1, dev, "trying to bind to %s\n", p_drv->drv.name);
dev_dbg(dev, "trying to bind to %s\n", p_drv->drv.name);
if ((!p_drv->probe) || (!p_dev->function_config) ||
(!try_module_get(p_drv->owner))) {
@ -428,7 +411,7 @@ static int pcmcia_device_probe(struct device * dev)
ret = p_drv->probe(p_dev);
if (ret) {
ds_dev_dbg(1, dev, "binding to %s failed with %d\n",
dev_dbg(dev, "binding to %s failed with %d\n",
p_drv->drv.name, ret);
goto put_module;
}
@ -456,7 +439,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
struct pcmcia_device *tmp;
unsigned long flags;
ds_dev_dbg(2, leftover ? &leftover->dev : &s->dev,
dev_dbg(leftover ? &leftover->dev : &s->dev,
"pcmcia_card_remove(%d) %s\n", s->sock,
leftover ? leftover->devname : "");
@ -475,7 +458,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
p_dev->_removed=1;
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
ds_dev_dbg(2, &p_dev->dev, "unregistering device\n");
dev_dbg(&p_dev->dev, "unregistering device\n");
device_unregister(&p_dev->dev);
}
@ -492,7 +475,7 @@ static int pcmcia_device_remove(struct device * dev)
p_dev = to_pcmcia_dev(dev);
p_drv = to_pcmcia_drv(dev->driver);
ds_dev_dbg(1, dev, "removing device\n");
dev_dbg(dev, "removing device\n");
/* If we're removing the primary module driving a
* pseudo multi-function card, we need to unbind
@ -572,7 +555,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
}
if (!pccard_read_tuple(p_dev->socket, p_dev->func,
CISTPL_DEVICE_GEO, devgeo)) {
ds_dev_dbg(0, &p_dev->dev,
dev_dbg(&p_dev->dev,
"mem device geometry probably means "
"FUNCID_MEMORY\n");
p_dev->func_id = CISTPL_FUNCID_MEMORY;
@ -628,7 +611,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
mutex_lock(&device_add_lock);
ds_dbg(3, "adding device to %d, function %d\n", s->sock, function);
pr_debug("adding device to %d, function %d\n", s->sock, function);
/* max of 4 devices per card */
if (s->device_count == 4)
@ -654,7 +637,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
p_dev->devname = kasprintf(GFP_KERNEL, "pcmcia%s", dev_name(&p_dev->dev));
if (!p_dev->devname)
goto err_free;
ds_dev_dbg(3, &p_dev->dev, "devname is %s\n", p_dev->devname);
dev_dbg(&p_dev->dev, "devname is %s\n", p_dev->devname);
spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
@ -677,7 +660,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
if (!p_dev->function_config) {
ds_dev_dbg(3, &p_dev->dev, "creating config_t\n");
dev_dbg(&p_dev->dev, "creating config_t\n");
p_dev->function_config = kzalloc(sizeof(struct config_t),
GFP_KERNEL);
if (!p_dev->function_config)
@ -722,20 +705,20 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
int ret = 0;
if (!(s->resource_setup_done)) {
ds_dev_dbg(3, &s->dev,
dev_dbg(&s->dev,
"no resources available, delaying card_add\n");
return -EAGAIN; /* try again, but later... */
}
if (pcmcia_validate_mem(s)) {
ds_dev_dbg(3, &s->dev, "validating mem resources failed, "
dev_dbg(&s->dev, "validating mem resources failed, "
"delaying card_add\n");
return -EAGAIN; /* try again, but later... */
}
ret = pccard_validate_cis(s, &no_chains);
if (ret || !no_chains) {
ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n");
dev_dbg(&s->dev, "invalid CIS or invalid resources\n");
return -ENODEV;
}
@ -756,7 +739,7 @@ static void pcmcia_delayed_add_device(struct work_struct *work)
{
struct pcmcia_socket *s =
container_of(work, struct pcmcia_socket, device_add);
ds_dev_dbg(1, &s->dev, "adding additional device to %d\n", s->sock);
dev_dbg(&s->dev, "adding additional device to %d\n", s->sock);
pcmcia_device_add(s, s->pcmcia_state.mfc_pfc);
s->pcmcia_state.device_add_pending = 0;
s->pcmcia_state.mfc_pfc = 0;
@ -766,7 +749,7 @@ static int pcmcia_requery(struct device *dev, void * _data)
{
struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
if (!p_dev->dev.driver) {
ds_dev_dbg(1, dev, "update device information\n");
dev_dbg(dev, "update device information\n");
pcmcia_device_query(p_dev);
}
@ -780,7 +763,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis)
unsigned long flags;
/* must be called with skt_mutex held */
ds_dev_dbg(0, &skt->dev, "re-scanning socket %d\n", skt->sock);
dev_dbg(&skt->dev, "re-scanning socket %d\n", skt->sock);
spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
if (list_empty(&skt->devices_list))
@ -835,7 +818,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
if (!filename)
return -EINVAL;
ds_dev_dbg(1, &dev->dev, "trying to load CIS file %s\n", filename);
dev_dbg(&dev->dev, "trying to load CIS file %s\n", filename);
if (request_firmware(&fw, filename, &dev->dev) == 0) {
if (fw->size >= CISTPL_MAX_CIS_SIZE) {
@ -953,14 +936,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
* after it has re-checked that there is no possible module
* with a prod_id/manf_id/card_id match.
*/
ds_dev_dbg(0, &dev->dev,
dev_dbg(&dev->dev,
"skipping FUNC_ID match until userspace interaction\n");
if (!dev->allow_func_id_match)
return 0;
}
if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) {
ds_dev_dbg(0, &dev->dev, "device needs a fake CIS\n");
dev_dbg(&dev->dev, "device needs a fake CIS\n");
if (!dev->socket->fake_cis)
pcmcia_load_firmware(dev, did->cisfile);
@ -992,9 +975,9 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
/* match dynamic devices first */
spin_lock(&p_drv->dynids.lock);
list_for_each_entry(dynid, &p_drv->dynids.list, node) {
ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name);
dev_dbg(dev, "trying to match to %s\n", drv->name);
if (pcmcia_devmatch(p_dev, &dynid->id)) {
ds_dev_dbg(0, dev, "matched to %s\n", drv->name);
dev_dbg(dev, "matched to %s\n", drv->name);
spin_unlock(&p_drv->dynids.lock);
return 1;
}
@ -1004,15 +987,15 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
#ifdef CONFIG_PCMCIA_IOCTL
/* matching by cardmgr */
if (p_dev->cardmgr == p_drv) {
ds_dev_dbg(0, dev, "cardmgr matched to %s\n", drv->name);
dev_dbg(dev, "cardmgr matched to %s\n", drv->name);
return 1;
}
#endif
while (did && did->match_flags) {
ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name);
dev_dbg(dev, "trying to match to %s\n", drv->name);
if (pcmcia_devmatch(p_dev, did)) {
ds_dev_dbg(0, dev, "matched to %s\n", drv->name);
dev_dbg(dev, "matched to %s\n", drv->name);
return 1;
}
did++;
@ -1218,7 +1201,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
if (p_dev->suspended)
return 0;
ds_dev_dbg(2, dev, "suspending\n");
dev_dbg(dev, "suspending\n");
if (dev->driver)
p_drv = to_pcmcia_drv(dev->driver);
@ -1238,7 +1221,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
}
if (p_dev->device_no == p_dev->func) {
ds_dev_dbg(2, dev, "releasing configuration\n");
dev_dbg(dev, "releasing configuration\n");
pcmcia_release_configuration(p_dev);
}
@ -1258,7 +1241,7 @@ static int pcmcia_dev_resume(struct device * dev)
if (!p_dev->suspended)
return 0;
ds_dev_dbg(2, dev, "resuming\n");
dev_dbg(dev, "resuming\n");
if (dev->driver)
p_drv = to_pcmcia_drv(dev->driver);
@ -1267,7 +1250,7 @@ static int pcmcia_dev_resume(struct device * dev)
goto out;
if (p_dev->device_no == p_dev->func) {
ds_dev_dbg(2, dev, "requesting configuration\n");
dev_dbg(dev, "requesting configuration\n");
ret = pcmcia_request_configuration(p_dev, &p_dev->conf);
if (ret)
goto out;
@ -1309,14 +1292,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data)
static int pcmcia_bus_resume(struct pcmcia_socket *skt)
{
ds_dev_dbg(2, &skt->dev, "resuming socket %d\n", skt->sock);
dev_dbg(&skt->dev, "resuming socket %d\n", skt->sock);
bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback);
return 0;
}
static int pcmcia_bus_suspend(struct pcmcia_socket *skt)
{
ds_dev_dbg(2, &skt->dev, "suspending socket %d\n", skt->sock);
dev_dbg(&skt->dev, "suspending socket %d\n", skt->sock);
if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt,
pcmcia_bus_suspend_callback)) {
pcmcia_bus_resume(skt);
@ -1348,7 +1331,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
return -ENODEV;
}
ds_dev_dbg(1, &skt->dev, "ds_event(0x%06x, %d, 0x%p)\n",
dev_dbg(&skt->dev, "ds_event(0x%06x, %d, 0x%p)\n",
event, priority, skt);
switch (event) {

View file

@ -58,17 +58,6 @@ typedef struct user_info_t {
} user_info_t;
#ifdef CONFIG_PCMCIA_DEBUG
extern int ds_pc_debug;
#define ds_dbg(lvl, fmt, arg...) do { \
if (ds_pc_debug >= lvl) \
printk(KERN_DEBUG "ds: " fmt , ## arg); \
} while (0)
#else
#define ds_dbg(lvl, fmt, arg...) do { } while (0)
#endif
static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s,
unsigned int function)
{
@ -431,7 +420,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
if (!s)
return -EINVAL;
ds_dbg(2, "bind_request(%d, '%s')\n", s->sock,
pr_debug("bind_request(%d, '%s')\n", s->sock,
(char *)bind_info->dev_info);
p_drv = get_pcmcia_driver(&bind_info->dev_info);
@ -623,7 +612,7 @@ static int ds_open(struct inode *inode, struct file *file)
static int warning_printed = 0;
int ret = 0;
ds_dbg(0, "ds_open(socket %d)\n", i);
pr_debug("ds_open(socket %d)\n", i);
lock_kernel();
s = pcmcia_get_socket_by_nr(i);
@ -685,7 +674,7 @@ static int ds_release(struct inode *inode, struct file *file)
struct pcmcia_socket *s;
user_info_t *user, **link;
ds_dbg(0, "ds_release(socket %d)\n", iminor(inode));
pr_debug("ds_release(socket %d)\n", iminor(inode));
user = file->private_data;
if (CHECK_USER(user))
@ -719,7 +708,7 @@ static ssize_t ds_read(struct file *file, char __user *buf,
user_info_t *user;
int ret;
ds_dbg(2, "ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode));
pr_debug("ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode));
if (count < 4)
return -EINVAL;
@ -744,7 +733,7 @@ static ssize_t ds_read(struct file *file, char __user *buf,
static ssize_t ds_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
ds_dbg(2, "ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode));
pr_debug("ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode));
if (count != 4)
return -EINVAL;
@ -762,7 +751,7 @@ static u_int ds_poll(struct file *file, poll_table *wait)
struct pcmcia_socket *s;
user_info_t *user;
ds_dbg(2, "ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode));
pr_debug("ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode));
user = file->private_data;
if (CHECK_USER(user))
@ -790,7 +779,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
ds_ioctl_arg_t *buf;
user_info_t *user;
ds_dbg(2, "ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg);
pr_debug("ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg);
user = file->private_data;
if (CHECK_USER(user))
@ -809,13 +798,13 @@ static int ds_ioctl(struct inode * inode, struct file * file,
if (cmd & IOC_IN) {
if (!access_ok(VERIFY_READ, uarg, size)) {
ds_dbg(3, "ds_ioctl(): verify_read = %d\n", -EFAULT);
pr_debug("ds_ioctl(): verify_read = %d\n", -EFAULT);
return -EFAULT;
}
}
if (cmd & IOC_OUT) {
if (!access_ok(VERIFY_WRITE, uarg, size)) {
ds_dbg(3, "ds_ioctl(): verify_write = %d\n", -EFAULT);
pr_debug("ds_ioctl(): verify_write = %d\n", -EFAULT);
return -EFAULT;
}
}
@ -962,7 +951,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
}
if ((err == 0) && (ret != 0)) {
ds_dbg(2, "ds_ioctl: ret = %d\n", ret);
pr_debug("ds_ioctl: ret = %d\n", ret);
switch (ret) {
case -ENODEV:
case -EINVAL:

View file

@ -44,21 +44,6 @@ static u8 pcmcia_used_irq[NR_IRQS];
#endif
#ifdef CONFIG_PCMCIA_DEBUG
extern int ds_pc_debug;
#define ds_dbg(skt, lvl, fmt, arg...) do { \
if (ds_pc_debug >= lvl) \
dev_printk(KERN_DEBUG, &skt->dev, \
"pcmcia_resource: " fmt, \
## arg); \
} while (0)
#else
#define ds_dbg(skt, lvl, fmt, arg...) do { } while (0)
#endif
/** alloc_io_space
*
* Special stuff for managing IO windows, because they are scarce
@ -73,14 +58,14 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr,
align = (*base) ? (lines ? 1<<lines : 0) : 1;
if (align && (align < num)) {
if (*base) {
ds_dbg(s, 0, "odd IO request: num %#x align %#x\n",
dev_dbg(&s->dev, "odd IO request: num %#x align %#x\n",
num, align);
align = 0;
} else
while (align && (align < num)) align <<= 1;
}
if (*base & ~(align-1)) {
ds_dbg(s, 0, "odd IO request: base %#x align %#x\n",
dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n",
*base, align);
align = 0;
}
@ -253,12 +238,12 @@ int pcmcia_map_mem_page(window_handle_t win, memreq_t *req)
return -EINVAL;
s = win->sock;
if (req->Page != 0) {
ds_dbg(s, 0, "failure: requested page is zero\n");
dev_dbg(&s->dev, "failure: requested page is zero\n");
return -EINVAL;
}
win->ctl.card_start = req->CardOffset;
if (s->ops->set_mem_map(s, &win->ctl) != 0) {
ds_dbg(s, 0, "failed to set_mem_map\n");
dev_dbg(&s->dev, "failed to set_mem_map\n");
return -EIO;
}
return 0;
@ -296,7 +281,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
}
if (mod->Attributes & CONF_VCC_CHANGE_VALID) {
ds_dbg(s, 0, "changing Vcc is not allowed at this time\n");
dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n");
return -EINVAL;
}
@ -304,7 +289,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) &&
(mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
if (mod->Vpp1 != mod->Vpp2) {
ds_dbg(s, 0, "Vpp1 and Vpp2 must be the same\n");
dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n");
return -EINVAL;
}
s->socket.Vpp = mod->Vpp1;
@ -315,7 +300,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
}
} else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) ||
(mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
ds_dbg(s, 0, "changing Vcc is not allowed at this time\n");
dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n");
return -EINVAL;
}
@ -426,11 +411,11 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
if (c->state & CONFIG_LOCKED)
return -EACCES;
if (c->irq.Attributes != req->Attributes) {
ds_dbg(s, 0, "IRQ attributes must match assigned ones\n");
dev_dbg(&s->dev, "IRQ attributes must match assigned ones\n");
return -EINVAL;
}
if (s->irq.AssignedIRQ != req->AssignedIRQ) {
ds_dbg(s, 0, "IRQ must match assigned one\n");
dev_dbg(&s->dev, "IRQ must match assigned one\n");
return -EINVAL;
}
if (--s->irq.Config == 0) {
@ -493,7 +478,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
return -ENODEV;
if (req->IntType & INT_CARDBUS) {
ds_dbg(p_dev->socket, 0, "IntType may not be INT_CARDBUS\n");
dev_dbg(&s->dev, "IntType may not be INT_CARDBUS\n");
return -EINVAL;
}
c = p_dev->function_config;
@ -619,31 +604,31 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
if (c->state & CONFIG_LOCKED)
return -EACCES;
if (c->state & CONFIG_IO_REQ) {
ds_dbg(s, 0, "IO already configured\n");
dev_dbg(&s->dev, "IO already configured\n");
return -EBUSY;
}
if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) {
ds_dbg(s, 0, "bad attribute setting for IO region 1\n");
dev_dbg(&s->dev, "bad attribute setting for IO region 1\n");
return -EINVAL;
}
if ((req->NumPorts2 > 0) &&
(req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) {
ds_dbg(s, 0, "bad attribute setting for IO region 2\n");
dev_dbg(&s->dev, "bad attribute setting for IO region 2\n");
return -EINVAL;
}
ds_dbg(s, 1, "trying to allocate resource 1\n");
dev_dbg(&s->dev, "trying to allocate resource 1\n");
if (alloc_io_space(s, req->Attributes1, &req->BasePort1,
req->NumPorts1, req->IOAddrLines)) {
ds_dbg(s, 0, "allocation of resource 1 failed\n");
dev_dbg(&s->dev, "allocation of resource 1 failed\n");
return -EBUSY;
}
if (req->NumPorts2) {
ds_dbg(s, 1, "trying to allocate resource 2\n");
dev_dbg(&s->dev, "trying to allocate resource 2\n");
if (alloc_io_space(s, req->Attributes2, &req->BasePort2,
req->NumPorts2, req->IOAddrLines)) {
ds_dbg(s, 0, "allocation of resource 2 failed\n");
dev_dbg(&s->dev, "allocation of resource 2 failed\n");
release_io_space(s, req->BasePort1, req->NumPorts1);
return -EBUSY;
}
@ -687,7 +672,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
if (c->state & CONFIG_LOCKED)
return -EACCES;
if (c->state & CONFIG_IRQ_REQ) {
ds_dbg(s, 0, "IRQ already configured\n");
dev_dbg(&s->dev, "IRQ already configured\n");
return -EBUSY;
}
@ -798,7 +783,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
if (!(s->state & SOCKET_PRESENT))
return -ENODEV;
if (req->Attributes & (WIN_PAGED | WIN_SHARED)) {
ds_dbg(s, 0, "bad attribute setting for iomem region\n");
dev_dbg(&s->dev, "bad attribute setting for iomem region\n");
return -EINVAL;
}
@ -809,12 +794,12 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
(req->Attributes & WIN_STRICT_ALIGN)) ?
req->Size : s->map_size);
if (req->Size & (s->map_size-1)) {
ds_dbg(s, 0, "invalid map size\n");
dev_dbg(&s->dev, "invalid map size\n");
return -EINVAL;
}
if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) ||
(req->Base & (align-1))) {
ds_dbg(s, 0, "invalid base address\n");
dev_dbg(&s->dev, "invalid base address\n");
return -EINVAL;
}
if (req->Base)
@ -824,7 +809,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
for (w = 0; w < MAX_WIN; w++)
if (!(s->state & SOCKET_WIN_REQ(w))) break;
if (w == MAX_WIN) {
ds_dbg(s, 0, "all windows are used already\n");
dev_dbg(&s->dev, "all windows are used already\n");
return -EINVAL;
}
@ -838,7 +823,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
win->ctl.res = pcmcia_find_mem_region(req->Base, req->Size, align,
(req->Attributes & WIN_MAP_BELOW_1MB), s);
if (!win->ctl.res) {
ds_dbg(s, 0, "allocating mem region failed\n");
dev_dbg(&s->dev, "allocating mem region failed\n");
return -EINVAL;
}
}
@ -858,7 +843,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
win->ctl.flags |= MAP_USE_WAIT;
win->ctl.card_start = 0;
if (s->ops->set_mem_map(s, &win->ctl) != 0) {
ds_dbg(s, 0, "failed to set memory mapping\n");
dev_dbg(&s->dev, "failed to set memory mapping\n");
return -EIO;
}
s->state |= SOCKET_WIN_REQ(w);