Skip to content

Commit

Permalink
pcmcia: Convert dev_printk to dev_<level>
Browse files Browse the repository at this point in the history
Reduce object size a little by using dev_<level>
calls instead of dev_printk(KERN_<LEVEL>.

Other miscellanea:

o Coalesce formats
o Realign arguments
o Use pr_cont instead of naked printk
  reorder test to use "%s\n"

Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Dominik Brodowski <[email protected]>
  • Loading branch information
JoePerches authored and Dominik Brodowski committed May 30, 2015
1 parent 3ce3c1c commit f2e6cf7
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 155 deletions.
5 changes: 2 additions & 3 deletions drivers/char/pcmcia/cm4040_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,8 @@ static int reader_config(struct pcmcia_device *link, int devno)

fail_rc = pcmcia_enable_device(link);
if (fail_rc != 0) {
dev_printk(KERN_INFO, &link->dev,
"pcmcia_enable_device failed 0x%x\n",
fail_rc);
dev_info(&link->dev, "pcmcia_enable_device failed 0x%x\n",
fail_rc);
goto cs_release;
}

Expand Down
10 changes: 4 additions & 6 deletions drivers/pcmcia/cistpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ static void __iomem *set_cis_map(struct pcmcia_socket *s,
mem->res = pcmcia_find_mem_region(0, s->map_size,
s->map_size, 0, s);
if (mem->res == NULL) {
dev_printk(KERN_NOTICE, &s->dev,
"cs: unable to map card memory!\n");
dev_notice(&s->dev, "cs: unable to map card memory!\n");
return NULL;
}
s->cis_virt = NULL;
Expand Down Expand Up @@ -381,8 +380,7 @@ int verify_cis_cache(struct pcmcia_socket *s)

buf = kmalloc(256, GFP_KERNEL);
if (buf == NULL) {
dev_printk(KERN_WARNING, &s->dev,
"no memory for verifying CIS\n");
dev_warn(&s->dev, "no memory for verifying CIS\n");
return -ENOMEM;
}
mutex_lock(&s->ops_mutex);
Expand Down Expand Up @@ -414,14 +412,14 @@ int pcmcia_replace_cis(struct pcmcia_socket *s,
const u8 *data, const size_t len)
{
if (len > CISTPL_MAX_CIS_SIZE) {
dev_printk(KERN_WARNING, &s->dev, "replacement CIS too big\n");
dev_warn(&s->dev, "replacement CIS too big\n");
return -EINVAL;
}
mutex_lock(&s->ops_mutex);
kfree(s->fake_cis);
s->fake_cis = kmalloc(len, GFP_KERNEL);
if (s->fake_cis == NULL) {
dev_printk(KERN_WARNING, &s->dev, "no memory to replace CIS\n");
dev_warn(&s->dev, "no memory to replace CIS\n");
mutex_unlock(&s->ops_mutex);
return -ENOMEM;
}
Expand Down
29 changes: 12 additions & 17 deletions drivers/pcmcia/cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)

wait_for_completion(&socket->thread_done);
if (!socket->thread) {
dev_printk(KERN_WARNING, &socket->dev,
"PCMCIA: warning: socket thread did not start\n");
dev_warn(&socket->dev,
"PCMCIA: warning: socket thread did not start\n");
return -EIO;
}

Expand Down Expand Up @@ -275,7 +275,7 @@ static int socket_reset(struct pcmcia_socket *skt)
msleep(unreset_check * 10);
}

dev_printk(KERN_ERR, &skt->dev, "time out after reset.\n");
dev_err(&skt->dev, "time out after reset\n");
return -ETIMEDOUT;
}

Expand Down Expand Up @@ -325,8 +325,8 @@ static void socket_shutdown(struct pcmcia_socket *s)

s->ops->get_status(s, &status);
if (status & SS_POWERON) {
dev_printk(KERN_ERR, &s->dev,
"*** DANGER *** unable to remove socket power\n");
dev_err(&s->dev,
"*** DANGER *** unable to remove socket power\n");
}

s->state &= ~SOCKET_INUSE;
Expand Down Expand Up @@ -356,15 +356,13 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
}

if (status & SS_PENDING) {
dev_printk(KERN_ERR, &skt->dev,
"voltage interrogation timed out.\n");
dev_err(&skt->dev, "voltage interrogation timed out\n");
return -ETIMEDOUT;
}

if (status & SS_CARDBUS) {
if (!(skt->features & SS_CAP_CARDBUS)) {
dev_printk(KERN_ERR, &skt->dev,
"cardbus cards are not supported.\n");
dev_err(&skt->dev, "cardbus cards are not supported\n");
return -EINVAL;
}
skt->state |= SOCKET_CARDBUS;
Expand All @@ -379,7 +377,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 {
dev_printk(KERN_ERR, &skt->dev, "unsupported voltage key.\n");
dev_err(&skt->dev, "unsupported voltage key\n");
return -EIO;
}

Expand All @@ -396,7 +394,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)

skt->ops->get_status(skt, &status);
if (!(status & SS_POWERON)) {
dev_printk(KERN_ERR, &skt->dev, "unable to apply power.\n");
dev_err(&skt->dev, "unable to apply power\n");
return -EIO;
}

Expand Down Expand Up @@ -429,8 +427,7 @@ static int socket_insert(struct pcmcia_socket *skt)
if (ret == 0) {
skt->state |= SOCKET_PRESENT;

dev_printk(KERN_NOTICE, &skt->dev,
"pccard: %s card inserted into slot %d\n",
dev_notice(&skt->dev, "pccard: %s card inserted into slot %d\n",
(skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA",
skt->sock);

Expand Down Expand Up @@ -558,8 +555,7 @@ static int socket_resume(struct pcmcia_socket *skt)

static void socket_remove(struct pcmcia_socket *skt)
{
dev_printk(KERN_NOTICE, &skt->dev,
"pccard: card ejected from slot %d\n", skt->sock);
dev_notice(&skt->dev, "pccard: card ejected from slot %d\n", skt->sock);
socket_shutdown(skt);
}

Expand Down Expand Up @@ -605,8 +601,7 @@ static int pccardd(void *__skt)
/* register with the device core */
ret = device_register(&skt->dev);
if (ret) {
dev_printk(KERN_WARNING, &skt->dev,
"PCMCIA: unable to register socket\n");
dev_warn(&skt->dev, "PCMCIA: unable to register socket\n");
skt->thread = NULL;
complete(&skt->thread_done);
return 0;
Expand Down
39 changes: 17 additions & 22 deletions drivers/pcmcia/ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ static int pcmcia_device_probe(struct device *dev)
dev_dbg(dev, "base %x, regs %x", p_dev->config_base,
p_dev->config_regs);
} else {
dev_printk(KERN_INFO, dev,
"pcmcia: could not parse base and rmask0 of CIS\n");
dev_info(dev,
"pcmcia: could not parse base and rmask0 of CIS\n");
p_dev->config_base = 0;
p_dev->config_regs = 0;
}
Expand Down Expand Up @@ -382,15 +382,15 @@ static int pcmcia_device_remove(struct device *dev)

/* check for proper unloading */
if (p_dev->_irq || p_dev->_io || p_dev->_locked)
dev_printk(KERN_INFO, dev,
"pcmcia: driver %s did not release config properly\n",
p_drv->name);
dev_info(dev,
"pcmcia: driver %s did not release config properly\n",
p_drv->name);

for (i = 0; i < MAX_WIN; i++)
if (p_dev->_win & CLIENT_WIN_REQ(i))
dev_printk(KERN_INFO, dev,
"pcmcia: driver %s did not release window properly\n",
p_drv->name);
dev_info(dev,
"pcmcia: driver %s did not release window properly\n",
p_drv->name);

/* references from pcmcia_probe_device */
pcmcia_put_dev(p_dev);
Expand Down Expand Up @@ -578,8 +578,7 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,

mutex_unlock(&s->ops_mutex);

dev_printk(KERN_NOTICE, &p_dev->dev,
"pcmcia: registering new device %s (IRQ: %d)\n",
dev_notice(&p_dev->dev, "pcmcia: registering new device %s (IRQ: %d)\n",
p_dev->devname, p_dev->irq);

pcmcia_device_query(p_dev);
Expand Down Expand Up @@ -745,16 +744,14 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char *filename)
if (request_firmware(&fw, filename, &dev->dev) == 0) {
if (fw->size >= CISTPL_MAX_CIS_SIZE) {
ret = -EINVAL;
dev_printk(KERN_ERR, &dev->dev,
"pcmcia: CIS override is too big\n");
dev_err(&dev->dev, "pcmcia: CIS override is too big\n");
goto release;
}

if (!pcmcia_replace_cis(s, fw->data, fw->size))
ret = 0;
else {
dev_printk(KERN_ERR, &dev->dev,
"pcmcia: CIS override failed\n");
dev_err(&dev->dev, "pcmcia: CIS override failed\n");
goto release;
}

Expand Down Expand Up @@ -1149,10 +1146,9 @@ static int pcmcia_dev_suspend(struct device *dev, pm_message_t state)
if (p_drv->suspend) {
ret = p_drv->suspend(p_dev);
if (ret) {
dev_printk(KERN_ERR, dev,
"pcmcia: device %s (driver %s) did "
"not want to go to sleep (%d)\n",
p_dev->devname, p_drv->name, ret);
dev_err(dev,
"pcmcia: device %s (driver %s) did not want to go to sleep (%d)\n",
p_dev->devname, p_drv->name, ret);
mutex_lock(&p_dev->socket->ops_mutex);
p_dev->suspended = 0;
mutex_unlock(&p_dev->socket->ops_mutex);
Expand Down Expand Up @@ -1343,14 +1339,13 @@ static int pcmcia_bus_add_socket(struct device *dev,

socket = pcmcia_get_socket(socket);
if (!socket) {
dev_printk(KERN_ERR, dev,
"PCMCIA obtaining reference to socket failed\n");
dev_err(dev, "PCMCIA obtaining reference to socket failed\n");
return -ENODEV;
}

ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr);
if (ret) {
dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n");
dev_err(dev, "PCMCIA registration failed\n");
pcmcia_put_socket(socket);
return ret;
}
Expand All @@ -1362,7 +1357,7 @@ static int pcmcia_bus_add_socket(struct device *dev,

ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback);
if (ret) {
dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n");
dev_err(dev, "PCMCIA registration failed\n");
pcmcia_put_socket(socket);
return ret;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/pcmcia/pcmcia_cis.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,

buf = kmalloc(256, GFP_KERNEL);
if (buf == NULL) {
dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n");
dev_warn(&s->dev, "no memory to read tuple\n");
return -ENOMEM;
}
tuple.DesiredTuple = code;
Expand Down Expand Up @@ -94,7 +94,7 @@ int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,

buf = kzalloc(256, GFP_KERNEL);
if (buf == NULL) {
dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n");
dev_warn(&s->dev, "no memory to read tuple\n");
return -ENOMEM;
}

Expand Down
11 changes: 4 additions & 7 deletions drivers/pcmcia/pcmcia_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,7 @@ int pcmcia_enable_device(struct pcmcia_device *p_dev)
s->socket.Vpp = p_dev->vpp;
if (s->ops->set_socket(s, &s->socket)) {
mutex_unlock(&s->ops_mutex);
dev_printk(KERN_WARNING, &p_dev->dev,
"Unable to set socket state\n");
dev_warn(&p_dev->dev, "Unable to set socket state\n");
return -EINVAL;
}

Expand Down Expand Up @@ -736,13 +735,11 @@ __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
ret = request_irq(p_dev->irq, handler, 0, p_dev->devname, p_dev->priv);
if (ret) {
ret = pcmcia_request_irq(p_dev, handler);
dev_printk(KERN_WARNING, &p_dev->dev, "pcmcia: "
"request for exclusive IRQ could not be fulfilled.\n");
dev_printk(KERN_WARNING, &p_dev->dev, "pcmcia: the driver "
"needs updating to supported shared IRQ lines.\n");
dev_warn(&p_dev->dev, "pcmcia: request for exclusive IRQ could not be fulfilled\n");
dev_warn(&p_dev->dev, "pcmcia: the driver needs updating to supported shared IRQ lines\n");
}
if (ret)
dev_printk(KERN_INFO, &p_dev->dev, "request_irq() failed\n");
dev_info(&p_dev->dev, "request_irq() failed\n");
else
p_dev->_irq = 1;

Expand Down
Loading

0 comments on commit f2e6cf7

Please sign in to comment.