Skip to content

Commit f2e6cf7

Browse files
JoePerchesDominik Brodowski
authored andcommitted
pcmcia: Convert dev_printk to dev_<level>
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]>
1 parent 3ce3c1c commit f2e6cf7

File tree

9 files changed

+126
-155
lines changed

9 files changed

+126
-155
lines changed

drivers/char/pcmcia/cm4040_cs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,8 @@ static int reader_config(struct pcmcia_device *link, int devno)
532532

533533
fail_rc = pcmcia_enable_device(link);
534534
if (fail_rc != 0) {
535-
dev_printk(KERN_INFO, &link->dev,
536-
"pcmcia_enable_device failed 0x%x\n",
537-
fail_rc);
535+
dev_info(&link->dev, "pcmcia_enable_device failed 0x%x\n",
536+
fail_rc);
538537
goto cs_release;
539538
}
540539

drivers/pcmcia/cistpl.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ static void __iomem *set_cis_map(struct pcmcia_socket *s,
9494
mem->res = pcmcia_find_mem_region(0, s->map_size,
9595
s->map_size, 0, s);
9696
if (mem->res == NULL) {
97-
dev_printk(KERN_NOTICE, &s->dev,
98-
"cs: unable to map card memory!\n");
97+
dev_notice(&s->dev, "cs: unable to map card memory!\n");
9998
return NULL;
10099
}
101100
s->cis_virt = NULL;
@@ -381,8 +380,7 @@ int verify_cis_cache(struct pcmcia_socket *s)
381380

382381
buf = kmalloc(256, GFP_KERNEL);
383382
if (buf == NULL) {
384-
dev_printk(KERN_WARNING, &s->dev,
385-
"no memory for verifying CIS\n");
383+
dev_warn(&s->dev, "no memory for verifying CIS\n");
386384
return -ENOMEM;
387385
}
388386
mutex_lock(&s->ops_mutex);
@@ -414,14 +412,14 @@ int pcmcia_replace_cis(struct pcmcia_socket *s,
414412
const u8 *data, const size_t len)
415413
{
416414
if (len > CISTPL_MAX_CIS_SIZE) {
417-
dev_printk(KERN_WARNING, &s->dev, "replacement CIS too big\n");
415+
dev_warn(&s->dev, "replacement CIS too big\n");
418416
return -EINVAL;
419417
}
420418
mutex_lock(&s->ops_mutex);
421419
kfree(s->fake_cis);
422420
s->fake_cis = kmalloc(len, GFP_KERNEL);
423421
if (s->fake_cis == NULL) {
424-
dev_printk(KERN_WARNING, &s->dev, "no memory to replace CIS\n");
422+
dev_warn(&s->dev, "no memory to replace CIS\n");
425423
mutex_unlock(&s->ops_mutex);
426424
return -ENOMEM;
427425
}

drivers/pcmcia/cs.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
177177

178178
wait_for_completion(&socket->thread_done);
179179
if (!socket->thread) {
180-
dev_printk(KERN_WARNING, &socket->dev,
181-
"PCMCIA: warning: socket thread did not start\n");
180+
dev_warn(&socket->dev,
181+
"PCMCIA: warning: socket thread did not start\n");
182182
return -EIO;
183183
}
184184

@@ -275,7 +275,7 @@ static int socket_reset(struct pcmcia_socket *skt)
275275
msleep(unreset_check * 10);
276276
}
277277

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

@@ -325,8 +325,8 @@ static void socket_shutdown(struct pcmcia_socket *s)
325325

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

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

358358
if (status & SS_PENDING) {
359-
dev_printk(KERN_ERR, &skt->dev,
360-
"voltage interrogation timed out.\n");
359+
dev_err(&skt->dev, "voltage interrogation timed out\n");
361360
return -ETIMEDOUT;
362361
}
363362

364363
if (status & SS_CARDBUS) {
365364
if (!(skt->features & SS_CAP_CARDBUS)) {
366-
dev_printk(KERN_ERR, &skt->dev,
367-
"cardbus cards are not supported.\n");
365+
dev_err(&skt->dev, "cardbus cards are not supported\n");
368366
return -EINVAL;
369367
}
370368
skt->state |= SOCKET_CARDBUS;
@@ -379,7 +377,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
379377
else if (!(status & SS_XVCARD))
380378
skt->socket.Vcc = skt->socket.Vpp = 50;
381379
else {
382-
dev_printk(KERN_ERR, &skt->dev, "unsupported voltage key.\n");
380+
dev_err(&skt->dev, "unsupported voltage key\n");
383381
return -EIO;
384382
}
385383

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

397395
skt->ops->get_status(skt, &status);
398396
if (!(status & SS_POWERON)) {
399-
dev_printk(KERN_ERR, &skt->dev, "unable to apply power.\n");
397+
dev_err(&skt->dev, "unable to apply power\n");
400398
return -EIO;
401399
}
402400

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

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

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

559556
static void socket_remove(struct pcmcia_socket *skt)
560557
{
561-
dev_printk(KERN_NOTICE, &skt->dev,
562-
"pccard: card ejected from slot %d\n", skt->sock);
558+
dev_notice(&skt->dev, "pccard: card ejected from slot %d\n", skt->sock);
563559
socket_shutdown(skt);
564560
}
565561

@@ -605,8 +601,7 @@ static int pccardd(void *__skt)
605601
/* register with the device core */
606602
ret = device_register(&skt->dev);
607603
if (ret) {
608-
dev_printk(KERN_WARNING, &skt->dev,
609-
"PCMCIA: unable to register socket\n");
604+
dev_warn(&skt->dev, "PCMCIA: unable to register socket\n");
610605
skt->thread = NULL;
611606
complete(&skt->thread_done);
612607
return 0;

drivers/pcmcia/ds.c

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ static int pcmcia_device_probe(struct device *dev)
284284
dev_dbg(dev, "base %x, regs %x", p_dev->config_base,
285285
p_dev->config_regs);
286286
} else {
287-
dev_printk(KERN_INFO, dev,
288-
"pcmcia: could not parse base and rmask0 of CIS\n");
287+
dev_info(dev,
288+
"pcmcia: could not parse base and rmask0 of CIS\n");
289289
p_dev->config_base = 0;
290290
p_dev->config_regs = 0;
291291
}
@@ -382,15 +382,15 @@ static int pcmcia_device_remove(struct device *dev)
382382

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

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

395395
/* references from pcmcia_probe_device */
396396
pcmcia_put_dev(p_dev);
@@ -578,8 +578,7 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,
578578

579579
mutex_unlock(&s->ops_mutex);
580580

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

585584
pcmcia_device_query(p_dev);
@@ -745,16 +744,14 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char *filename)
745744
if (request_firmware(&fw, filename, &dev->dev) == 0) {
746745
if (fw->size >= CISTPL_MAX_CIS_SIZE) {
747746
ret = -EINVAL;
748-
dev_printk(KERN_ERR, &dev->dev,
749-
"pcmcia: CIS override is too big\n");
747+
dev_err(&dev->dev, "pcmcia: CIS override is too big\n");
750748
goto release;
751749
}
752750

753751
if (!pcmcia_replace_cis(s, fw->data, fw->size))
754752
ret = 0;
755753
else {
756-
dev_printk(KERN_ERR, &dev->dev,
757-
"pcmcia: CIS override failed\n");
754+
dev_err(&dev->dev, "pcmcia: CIS override failed\n");
758755
goto release;
759756
}
760757

@@ -1149,10 +1146,9 @@ static int pcmcia_dev_suspend(struct device *dev, pm_message_t state)
11491146
if (p_drv->suspend) {
11501147
ret = p_drv->suspend(p_dev);
11511148
if (ret) {
1152-
dev_printk(KERN_ERR, dev,
1153-
"pcmcia: device %s (driver %s) did "
1154-
"not want to go to sleep (%d)\n",
1155-
p_dev->devname, p_drv->name, ret);
1149+
dev_err(dev,
1150+
"pcmcia: device %s (driver %s) did not want to go to sleep (%d)\n",
1151+
p_dev->devname, p_drv->name, ret);
11561152
mutex_lock(&p_dev->socket->ops_mutex);
11571153
p_dev->suspended = 0;
11581154
mutex_unlock(&p_dev->socket->ops_mutex);
@@ -1343,14 +1339,13 @@ static int pcmcia_bus_add_socket(struct device *dev,
13431339

13441340
socket = pcmcia_get_socket(socket);
13451341
if (!socket) {
1346-
dev_printk(KERN_ERR, dev,
1347-
"PCMCIA obtaining reference to socket failed\n");
1342+
dev_err(dev, "PCMCIA obtaining reference to socket failed\n");
13481343
return -ENODEV;
13491344
}
13501345

13511346
ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr);
13521347
if (ret) {
1353-
dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n");
1348+
dev_err(dev, "PCMCIA registration failed\n");
13541349
pcmcia_put_socket(socket);
13551350
return ret;
13561351
}
@@ -1362,7 +1357,7 @@ static int pcmcia_bus_add_socket(struct device *dev,
13621357

13631358
ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback);
13641359
if (ret) {
1365-
dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n");
1360+
dev_err(dev, "PCMCIA registration failed\n");
13661361
pcmcia_put_socket(socket);
13671362
return ret;
13681363
}

drivers/pcmcia/pcmcia_cis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
4444

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

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

drivers/pcmcia/pcmcia_resource.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,7 @@ int pcmcia_enable_device(struct pcmcia_device *p_dev)
508508
s->socket.Vpp = p_dev->vpp;
509509
if (s->ops->set_socket(s, &s->socket)) {
510510
mutex_unlock(&s->ops_mutex);
511-
dev_printk(KERN_WARNING, &p_dev->dev,
512-
"Unable to set socket state\n");
511+
dev_warn(&p_dev->dev, "Unable to set socket state\n");
513512
return -EINVAL;
514513
}
515514

@@ -736,13 +735,11 @@ __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
736735
ret = request_irq(p_dev->irq, handler, 0, p_dev->devname, p_dev->priv);
737736
if (ret) {
738737
ret = pcmcia_request_irq(p_dev, handler);
739-
dev_printk(KERN_WARNING, &p_dev->dev, "pcmcia: "
740-
"request for exclusive IRQ could not be fulfilled.\n");
741-
dev_printk(KERN_WARNING, &p_dev->dev, "pcmcia: the driver "
742-
"needs updating to supported shared IRQ lines.\n");
738+
dev_warn(&p_dev->dev, "pcmcia: request for exclusive IRQ could not be fulfilled\n");
739+
dev_warn(&p_dev->dev, "pcmcia: the driver needs updating to supported shared IRQ lines\n");
743740
}
744741
if (ret)
745-
dev_printk(KERN_INFO, &p_dev->dev, "request_irq() failed\n");
742+
dev_info(&p_dev->dev, "request_irq() failed\n");
746743
else
747744
p_dev->_irq = 1;
748745

0 commit comments

Comments
 (0)