Skip to content

Commit

Permalink
pcmcia: use dev_dbg and dev_print in pd6729.c
Browse files Browse the repository at this point in the history
As suggested by Wolfram Sang <[email protected]>, use dev_dbg(),
and dev_{err,warn,info}() in pd6729.c, and add some "\n" suggested by
Komuro <[email protected]>. 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 <[email protected]>
Acked-by: Wolfram Sang <[email protected]>
Signed-off-by: Dominik Brodowski <[email protected]>
  • Loading branch information
Dominik Brodowski committed Nov 9, 2009
1 parent 9cb495b commit a7149f9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 40 deletions.
70 changes: 37 additions & 33 deletions drivers/pcmcia/pd6729.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev)

if (csc & I365_CSC_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)
Expand Down Expand Up @@ -331,52 +332,56 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */

if (state->flags & SS_PWR_AUTO) {
dprintk("Auto power\n");
dev_dbg(&sock->dev, "Auto power\n");
reg |= I365_PWR_AUTO; /* automatic power mngmnt */
}
if (state->flags & SS_OUTPUT_ENA) {
dprintk("Power Enabled\n");
dev_dbg(&sock->dev, "Power Enabled\n");
reg |= I365_PWR_OUT; /* enable power */
}

switch (state->Vcc) {
case 0:
break;
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);
reg |= I365_VCC_5V;
indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V);
break;
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);
reg |= I365_VCC_5V;
indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V);
break;
default:
dprintk("pd6729: pd6729_set_socket called with "
"invalid VCC power value: %i\n",
state->Vcc);
dev_dbg(&sock->dev,
"pd6729_set_socket called with invalid VCC power "
"value: %i\n", state->Vcc);
return -EINVAL;
}

switch (state->Vpp) {
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;
case 33:
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;
break;
case 120:
dprintk("setting Vpp to 12.0\n");
dev_dbg(&sock->dev, "setting Vpp to 12.0\n");
reg |= I365_VPP1_12V;
break;
default:
dprintk("pd6729: pd6729_set_socket called with invalid VPP power value: %i\n",
state->Vpp);
dev_dbg(&sock->dev, "pd6729: pd6729_set_socket called with "
"invalid VPP power value: %i\n", state->Vpp);
return -EINVAL;
}

Expand Down Expand Up @@ -438,15 +443,15 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock,

/* Check error conditions */
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;
}

/* Turn off the window before changing anything */
if (indirect_read(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);*/

/* write the new values */
Expand Down Expand Up @@ -478,12 +483,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock,

map = mem->map;
if (map > 4) {
printk("pd6729_set_mem_map: invalid map");
dev_warn(&sock->dev, "invalid map requested\n");
return -EINVAL;
}

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;
}

Expand Down Expand Up @@ -529,12 +534,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock,
if (mem->flags & MAP_WRPROT)
i |= I365_MEM_WRPROT;
if (mem->flags & MAP_ATTRIB) {
/* dprintk("requesting attribute memory for socket %i\n",
socket->number);*/
/* dev_dbg(&sock->dev, "requesting attribute memory for "
"socket %i\n", socket->number);*/
i |= I365_MEM_REG;
} else {
/* dprintk("requesting normal memory for socket %i\n",
socket->number);*/
/* dev_dbg(&sock->dev, "requesting normal memory for "
"socket %i\n", socket->number);*/
}
indirect_write16(socket, base + I365_W_OFF, i);

Expand Down Expand Up @@ -577,7 +582,7 @@ static struct pccard_operations pd6729_operations = {

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;
}

Expand Down Expand Up @@ -642,28 +647,28 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
goto err_out_free_mem;

if (!pci_resource_start(dev, 0)) {
printk(KERN_INFO "pd6729: refusing to load the driver "
"as the io_base is 0.\n");
dev_warn(&dev->dev, "refusing to load the driver as the "
"io_base is NULL.\n");
goto err_out_free_mem;
}

printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge "
"at 0x%llx on irq %d\n",
dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx "
"on irq %d\n",
(unsigned long long)pci_resource_start(dev, 0), dev->irq);
/*
* Since we have no memory BARs some firmware may not
* have had PCI_COMMAND_MEMORY enabled, yet the device needs it.
*/
pci_read_config_byte(dev, PCI_COMMAND, &configbyte);
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;
pci_write_config_byte(dev, PCI_COMMAND, configbyte);
}

ret = pci_request_regions(dev, "pd6729");
if (ret) {
printk(KERN_INFO "pd6729: pci request region failed.\n");
dev_warn(&dev->dev, "pci request region failed.\n");
goto err_out_disable;
}

Expand All @@ -672,7 +677,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,

mask = pd6729_isa_scan();
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;
}

Expand All @@ -697,8 +702,8 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
/* Register the interrupt handler */
if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED,
"pd6729", socket))) {
printk(KERN_ERR "pd6729: Failed to register irq %d, "
"aborting\n", dev->irq);
dev_err(&dev->dev, "Failed to register irq %d\n",
dev->irq);
goto err_out_free_res;
}
} else {
Expand All @@ -713,8 +718,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
for (i = 0; i < MAX_SOCKETS; i++) {
ret = pcmcia_register_socket(&socket[i].socket);
if (ret) {
printk(KERN_INFO "pd6729: pcmcia_register_socket "
"failed.\n");
dev_warn(&dev->dev, "pcmcia_register_socket failed.\n");
for (j = 0; j < i ; j++)
pcmcia_unregister_socket(&socket[j].socket);
goto err_out_free_res2;
Expand Down
7 changes: 0 additions & 7 deletions drivers/pcmcia/pd6729.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#ifndef _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 */
#define I365_DF_VS1 0x40 /* DF-step Voltage Sense */
#define I365_DF_VS2 0x80
Expand Down

0 comments on commit a7149f9

Please sign in to comment.