pcmcia: use dev_dbg and dev_print in pd6729.c

As suggested by Wolfram Sang <w.sang@pengutronix.de>, use dev_dbg(),
and dev_{err,warn,info}() in pd6729.c, and add some "\n" suggested by
Komuro <komurojun-mbn@nifty.com>. In the ISR, use pr_devel() and
dev_vdbg() as they are only compiled if DEBUG (or, for dev_vdbg(),
VERBOSE_DEBUG) are set explicitly.

CC: Komuro <komurojun-mbn@nifty.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
Dominik Brodowski 2009-10-24 18:07:16 +02:00
parent 9cb495bb41
commit a7149f9a26
2 changed files with 37 additions and 40 deletions

View File

@ -213,7 +213,8 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev)
if (csc & I365_CSC_DETECT) { if (csc & I365_CSC_DETECT) {
events |= SS_DETECT; events |= SS_DETECT;
dprintk("Card detected in socket %i!\n", i); dev_vdbg(&socket[i].socket.dev,
"Card detected in socket %i!\n", i);
} }
if (indirect_read(&socket[i], I365_INTCTL) if (indirect_read(&socket[i], I365_INTCTL)
@ -331,11 +332,11 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */ reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */
if (state->flags & SS_PWR_AUTO) { if (state->flags & SS_PWR_AUTO) {
dprintk("Auto power\n"); dev_dbg(&sock->dev, "Auto power\n");
reg |= I365_PWR_AUTO; /* automatic power mngmnt */ reg |= I365_PWR_AUTO; /* automatic power mngmnt */
} }
if (state->flags & SS_OUTPUT_ENA) { if (state->flags & SS_OUTPUT_ENA) {
dprintk("Power Enabled\n"); dev_dbg(&sock->dev, "Power Enabled\n");
reg |= I365_PWR_OUT; /* enable power */ reg |= I365_PWR_OUT; /* enable power */
} }
@ -343,40 +344,44 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
case 0: case 0:
break; break;
case 33: case 33:
dprintk("setting voltage to Vcc to 3.3V on socket %i\n", dev_dbg(&sock->dev,
"setting voltage to Vcc to 3.3V on socket %i\n",
socket->number); socket->number);
reg |= I365_VCC_5V; reg |= I365_VCC_5V;
indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V);
break; break;
case 50: case 50:
dprintk("setting voltage to Vcc to 5V on socket %i\n", dev_dbg(&sock->dev,
"setting voltage to Vcc to 5V on socket %i\n",
socket->number); socket->number);
reg |= I365_VCC_5V; reg |= I365_VCC_5V;
indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V);
break; break;
default: default:
dprintk("pd6729: pd6729_set_socket called with " dev_dbg(&sock->dev,
"invalid VCC power value: %i\n", "pd6729_set_socket called with invalid VCC power "
state->Vcc); "value: %i\n", state->Vcc);
return -EINVAL; return -EINVAL;
} }
switch (state->Vpp) { switch (state->Vpp) {
case 0: case 0:
dprintk("not setting Vpp on socket %i\n", socket->number); dev_dbg(&sock->dev, "not setting Vpp on socket %i\n",
socket->number);
break; break;
case 33: case 33:
case 50: case 50:
dprintk("setting Vpp to Vcc for socket %i\n", socket->number); dev_dbg(&sock->dev, "setting Vpp to Vcc for socket %i\n",
socket->number);
reg |= I365_VPP1_5V; reg |= I365_VPP1_5V;
break; break;
case 120: case 120:
dprintk("setting Vpp to 12.0\n"); dev_dbg(&sock->dev, "setting Vpp to 12.0\n");
reg |= I365_VPP1_12V; reg |= I365_VPP1_12V;
break; break;
default: default:
dprintk("pd6729: pd6729_set_socket called with invalid VPP power value: %i\n", dev_dbg(&sock->dev, "pd6729: pd6729_set_socket called with "
state->Vpp); "invalid VPP power value: %i\n", state->Vpp);
return -EINVAL; return -EINVAL;
} }
@ -438,7 +443,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock,
/* Check error conditions */ /* Check error conditions */
if (map > 1) { if (map > 1) {
dprintk("pd6729_set_io_map with invalid map"); dev_dbg(&sock->dev, "pd6729_set_io_map with invalid map\n");
return -EINVAL; return -EINVAL;
} }
@ -446,7 +451,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock,
if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map)) if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map))
indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map)); indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map));
/* dprintk("set_io_map: Setting range to %x - %x\n", /* dev_dbg(&sock->dev, "set_io_map: Setting range to %x - %x\n",
io->start, io->stop);*/ io->start, io->stop);*/
/* write the new values */ /* write the new values */
@ -478,12 +483,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock,
map = mem->map; map = mem->map;
if (map > 4) { if (map > 4) {
printk("pd6729_set_mem_map: invalid map"); dev_warn(&sock->dev, "invalid map requested\n");
return -EINVAL; return -EINVAL;
} }
if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) { if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) {
printk("pd6729_set_mem_map: invalid address / speed"); dev_warn(&sock->dev, "invalid invalid address / speed\n");
return -EINVAL; return -EINVAL;
} }
@ -529,12 +534,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock,
if (mem->flags & MAP_WRPROT) if (mem->flags & MAP_WRPROT)
i |= I365_MEM_WRPROT; i |= I365_MEM_WRPROT;
if (mem->flags & MAP_ATTRIB) { if (mem->flags & MAP_ATTRIB) {
/* dprintk("requesting attribute memory for socket %i\n", /* dev_dbg(&sock->dev, "requesting attribute memory for "
socket->number);*/ "socket %i\n", socket->number);*/
i |= I365_MEM_REG; i |= I365_MEM_REG;
} else { } else {
/* dprintk("requesting normal memory for socket %i\n", /* dev_dbg(&sock->dev, "requesting normal memory for "
socket->number);*/ "socket %i\n", socket->number);*/
} }
indirect_write16(socket, base + I365_W_OFF, i); indirect_write16(socket, base + I365_W_OFF, i);
@ -577,7 +582,7 @@ static struct pccard_operations pd6729_operations = {
static irqreturn_t pd6729_test(int irq, void *dev) static irqreturn_t pd6729_test(int irq, void *dev)
{ {
dprintk("-> hit on irq %d\n", irq); pr_devel("-> hit on irq %d\n", irq);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -642,13 +647,13 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
goto err_out_free_mem; goto err_out_free_mem;
if (!pci_resource_start(dev, 0)) { if (!pci_resource_start(dev, 0)) {
printk(KERN_INFO "pd6729: refusing to load the driver " dev_warn(&dev->dev, "refusing to load the driver as the "
"as the io_base is 0.\n"); "io_base is NULL.\n");
goto err_out_free_mem; goto err_out_free_mem;
} }
printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx "
"at 0x%llx on irq %d\n", "on irq %d\n",
(unsigned long long)pci_resource_start(dev, 0), dev->irq); (unsigned long long)pci_resource_start(dev, 0), dev->irq);
/* /*
* Since we have no memory BARs some firmware may not * Since we have no memory BARs some firmware may not
@ -656,14 +661,14 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
*/ */
pci_read_config_byte(dev, PCI_COMMAND, &configbyte); pci_read_config_byte(dev, PCI_COMMAND, &configbyte);
if (!(configbyte & PCI_COMMAND_MEMORY)) { if (!(configbyte & PCI_COMMAND_MEMORY)) {
printk(KERN_DEBUG "pd6729: Enabling PCI_COMMAND_MEMORY.\n"); dev_dbg(&dev->dev, "pd6729: Enabling PCI_COMMAND_MEMORY.\n");
configbyte |= PCI_COMMAND_MEMORY; configbyte |= PCI_COMMAND_MEMORY;
pci_write_config_byte(dev, PCI_COMMAND, configbyte); pci_write_config_byte(dev, PCI_COMMAND, configbyte);
} }
ret = pci_request_regions(dev, "pd6729"); ret = pci_request_regions(dev, "pd6729");
if (ret) { if (ret) {
printk(KERN_INFO "pd6729: pci request region failed.\n"); dev_warn(&dev->dev, "pci request region failed.\n");
goto err_out_disable; goto err_out_disable;
} }
@ -672,7 +677,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
mask = pd6729_isa_scan(); mask = pd6729_isa_scan();
if (irq_mode == 0 && mask == 0) { if (irq_mode == 0 && mask == 0) {
printk(KERN_INFO "pd6729: no ISA interrupt is available.\n"); dev_warn(&dev->dev, "no ISA interrupt is available.\n");
goto err_out_free_res; goto err_out_free_res;
} }
@ -697,8 +702,8 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
/* Register the interrupt handler */ /* Register the interrupt handler */
if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED,
"pd6729", socket))) { "pd6729", socket))) {
printk(KERN_ERR "pd6729: Failed to register irq %d, " dev_err(&dev->dev, "Failed to register irq %d\n",
"aborting\n", dev->irq); dev->irq);
goto err_out_free_res; goto err_out_free_res;
} }
} else { } else {
@ -713,8 +718,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
for (i = 0; i < MAX_SOCKETS; i++) { for (i = 0; i < MAX_SOCKETS; i++) {
ret = pcmcia_register_socket(&socket[i].socket); ret = pcmcia_register_socket(&socket[i].socket);
if (ret) { if (ret) {
printk(KERN_INFO "pd6729: pcmcia_register_socket " dev_warn(&dev->dev, "pcmcia_register_socket failed.\n");
"failed.\n");
for (j = 0; j < i ; j++) for (j = 0; j < i ; j++)
pcmcia_unregister_socket(&socket[j].socket); pcmcia_unregister_socket(&socket[j].socket);
goto err_out_free_res2; goto err_out_free_res2;

View File

@ -1,13 +1,6 @@
#ifndef _INCLUDE_GUARD_PD6729_H_ #ifndef _INCLUDE_GUARD_PD6729_H_
#define _INCLUDE_GUARD_PD6729_H_ #define _INCLUDE_GUARD_PD6729_H_
/* Debuging defines */
#ifdef NOTRACE
#define dprintk(fmt, args...) printk(fmt , ## args)
#else
#define dprintk(fmt, args...) do {} while (0)
#endif
/* Flags for I365_GENCTL */ /* Flags for I365_GENCTL */
#define I365_DF_VS1 0x40 /* DF-step Voltage Sense */ #define I365_DF_VS1 0x40 /* DF-step Voltage Sense */
#define I365_DF_VS2 0x80 #define I365_DF_VS2 0x80