Skip to content

Commit a23d320

Browse files
samueliggregkh
authored andcommitted
Staging: ipack/bridges/tpci200: change pr_* usage for dev_* functions
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 20cf700 commit a23d320

1 file changed

Lines changed: 70 additions & 56 deletions

File tree

‎drivers/staging/ipack/bridges/tpci200.c‎

Lines changed: 70 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
* Software Foundation; version 2 of the License.
1212
*/
1313

14-
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15-
1614
#include <linux/module.h>
1715
#include "tpci200.h"
1816

@@ -36,10 +34,8 @@ static struct tpci200_board *check_slot(struct ipack_device *dev)
3634
struct tpci200_board *tpci200;
3735
int found = 0;
3836

39-
if (dev == NULL) {
40-
pr_info("Slot doesn't exist.\n");
37+
if (dev == NULL)
4138
return NULL;
42-
}
4339

4440
list_for_each_entry(tpci200, &tpci200_list, list) {
4541
if (tpci200->number == dev->bus_nr) {
@@ -49,13 +45,14 @@ static struct tpci200_board *check_slot(struct ipack_device *dev)
4945
}
5046

5147
if (!found) {
52-
pr_err("Carrier not found\n");
48+
dev_err(&dev->dev, "Carrier not found\n");
5349
return NULL;
5450
}
5551

5652
if (dev->slot >= TPCI200_NB_SLOT) {
57-
pr_info("Slot [%d:%d] doesn't exist! Last tpci200 slot is %d.\n",
58-
dev->bus_nr, dev->slot, TPCI200_NB_SLOT-1);
53+
dev_info(&dev->dev,
54+
"Slot [%d:%d] doesn't exist! Last tpci200 slot is %d.\n",
55+
dev->bus_nr, dev->slot, TPCI200_NB_SLOT-1);
5956
return NULL;
6057
}
6158

@@ -116,14 +113,15 @@ static struct ipack_addr_space *get_slot_address_space(struct ipack_device *dev,
116113
addr = &dev->mem_space;
117114
break;
118115
default:
119-
pr_err("Slot [%d:%d] space number %d doesn't exist !\n",
120-
dev->bus_nr, dev->slot, space);
116+
dev_err(&dev->dev,
117+
"Slot [%d:%d] space number %d doesn't exist !\n",
118+
dev->bus_nr, dev->slot, space);
121119
return NULL;
122120
break;
123121
}
124122

125123
if ((addr->size == 0) || (addr->address == NULL)) {
126-
pr_err("Error, slot space not mapped !\n");
124+
dev_err(&dev->dev, "Error, slot space not mapped !\n");
127125
return NULL;
128126
}
129127

@@ -145,7 +143,7 @@ static int tpci200_read8(struct ipack_device *dev, int space,
145143
return -EINVAL;
146144

147145
if (offset >= addr->size) {
148-
pr_err("Error, slot space offset error !\n");
146+
dev_err(&dev->dev, "Error, slot space offset error !\n");
149147
return -EFAULT;
150148
}
151149

@@ -169,7 +167,7 @@ static int tpci200_read16(struct ipack_device *dev, int space,
169167
return -EINVAL;
170168

171169
if ((offset+2) >= addr->size) {
172-
pr_err("Error, slot space offset error !\n");
170+
dev_err(&dev->dev, "Error, slot space offset error !\n");
173171
return -EFAULT;
174172
}
175173
*value = __tpci200_read16(addr->address, offset);
@@ -192,7 +190,7 @@ static int tpci200_read32(struct ipack_device *dev, int space,
192190
return -EINVAL;
193191

194192
if ((offset+4) >= addr->size) {
195-
pr_err("Error, slot space offset error !\n");
193+
dev_err(&dev->dev, "Error, slot space offset error !\n");
196194
return -EFAULT;
197195
}
198196

@@ -216,7 +214,7 @@ static int tpci200_write8(struct ipack_device *dev, int space,
216214
return -EINVAL;
217215

218216
if (offset >= addr->size) {
219-
pr_err("Error, slot space offset error !\n");
217+
dev_err(&dev->dev, "Error, slot space offset error !\n");
220218
return -EFAULT;
221219
}
222220

@@ -240,7 +238,7 @@ static int tpci200_write16(struct ipack_device *dev, int space,
240238
return -EINVAL;
241239

242240
if ((offset+2) >= addr->size) {
243-
pr_err("Error, slot space offset error !\n");
241+
dev_err(&dev->dev, "Error, slot space offset error !\n");
244242
return -EFAULT;
245243
}
246244

@@ -264,7 +262,7 @@ static int tpci200_write32(struct ipack_device *dev, int space,
264262
return -EINVAL;
265263

266264
if ((offset+4) >= addr->size) {
267-
pr_err("Error, slot space offset error !\n");
265+
dev_err(&dev->dev, "Error, slot space offset error !\n");
268266
return -EFAULT;
269267
}
270268

@@ -338,8 +336,9 @@ static irqreturn_t tpci200_interrupt(int irq, void *dev_id)
338336
if (unhandled_ints) {
339337
for (i = 0; i < TPCI200_NB_SLOT; i++) {
340338
if (unhandled_ints & ((TPCI200_INT0_EN | TPCI200_INT1_EN) << (2*i))) {
341-
pr_info("No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n",
342-
tpci200->number, i);
339+
dev_info(&tpci200->slots[i].dev->dev,
340+
"No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n",
341+
tpci200->number, i);
343342
reg_value = readw(
344343
tpci200->info->interface_regs +
345344
control_reg[i]);
@@ -371,9 +370,10 @@ static int tpci200_register(struct tpci200_board *tpci200)
371370
res = pci_request_region(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR,
372371
"Carrier IP interface registers");
373372
if (res) {
374-
pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !",
375-
tpci200->info->pdev->bus->number,
376-
tpci200->info->pdev->devfn);
373+
dev_err(&tpci200->info->pdev->dev,
374+
"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !",
375+
tpci200->info->pdev->bus->number,
376+
tpci200->info->pdev->devfn);
377377
goto out_disable_pci;
378378
}
379379

@@ -382,19 +382,21 @@ static int tpci200_register(struct tpci200_board *tpci200)
382382
TPCI200_IO_ID_INT_SPACES_BAR,
383383
"Carrier IO ID INT space");
384384
if (res) {
385-
pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 3 !",
386-
tpci200->info->pdev->bus->number,
387-
tpci200->info->pdev->devfn);
385+
dev_err(&tpci200->info->pdev->dev,
386+
"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 3 !",
387+
tpci200->info->pdev->bus->number,
388+
tpci200->info->pdev->devfn);
388389
goto out_release_ip_space;
389390
}
390391

391392
/* Request MEM space (Bar 4) */
392393
res = pci_request_region(tpci200->info->pdev, TPCI200_MEM8_SPACE_BAR,
393394
"Carrier MEM space");
394395
if (res) {
395-
pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!",
396-
tpci200->info->pdev->bus->number,
397-
tpci200->info->pdev->devfn);
396+
dev_err(&tpci200->info->pdev->dev,
397+
"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!",
398+
tpci200->info->pdev->bus->number,
399+
tpci200->info->pdev->devfn);
398400
goto out_release_ioid_int_space;
399401
}
400402

@@ -452,9 +454,10 @@ static int tpci200_register(struct tpci200_board *tpci200)
452454
tpci200_interrupt, IRQF_SHARED,
453455
KBUILD_MODNAME, (void *) tpci200);
454456
if (res) {
455-
pr_err("(bn 0x%X, sn 0x%X) unable to register IRQ !",
456-
tpci200->info->pdev->bus->number,
457-
tpci200->info->pdev->devfn);
457+
dev_err(&tpci200->info->pdev->dev,
458+
"(bn 0x%X, sn 0x%X) unable to register IRQ !",
459+
tpci200->info->pdev->bus->number,
460+
tpci200->info->pdev->devfn);
458461
goto out_release_ioid_int_space;
459462
}
460463

@@ -555,31 +558,35 @@ static int tpci200_slot_unmap_space(struct ipack_device *dev, int space)
555558
switch (space) {
556559
case IPACK_IO_SPACE:
557560
if (dev->io_space.address == NULL) {
558-
pr_info("Slot [%d:%d] IO space not mapped !\n",
559-
dev->bus_nr, dev->slot);
561+
dev_info(&dev->dev,
562+
"Slot [%d:%d] IO space not mapped !\n",
563+
dev->bus_nr, dev->slot);
560564
goto out_unlock;
561565
}
562566
virt_addr_space = &dev->io_space;
563567
break;
564568
case IPACK_ID_SPACE:
565569
if (dev->id_space.address == NULL) {
566-
pr_info("Slot [%d:%d] ID space not mapped !\n",
567-
dev->bus_nr, dev->slot);
570+
dev_info(&dev->dev,
571+
"Slot [%d:%d] ID space not mapped !\n",
572+
dev->bus_nr, dev->slot);
568573
goto out_unlock;
569574
}
570575
virt_addr_space = &dev->id_space;
571576
break;
572577
case IPACK_MEM_SPACE:
573578
if (dev->mem_space.address == NULL) {
574-
pr_info("Slot [%d:%d] MEM space not mapped !\n",
575-
dev->bus_nr, dev->slot);
579+
dev_info(&dev->dev,
580+
"Slot [%d:%d] MEM space not mapped !\n",
581+
dev->bus_nr, dev->slot);
576582
goto out_unlock;
577583
}
578584
virt_addr_space = &dev->mem_space;
579585
break;
580586
default:
581-
pr_err("Slot [%d:%d] space number %d doesn't exist !\n",
582-
dev->bus_nr, dev->slot, space);
587+
dev_err(&dev->dev,
588+
"Slot [%d:%d] space number %d doesn't exist !\n",
589+
dev->bus_nr, dev->slot, space);
583590
mutex_unlock(&tpci200->mutex);
584591
return -EINVAL;
585592
}
@@ -639,8 +646,9 @@ static int tpci200_slot_map_space(struct ipack_device *dev,
639646
switch (space) {
640647
case IPACK_IO_SPACE:
641648
if (dev->io_space.address != NULL) {
642-
pr_err("Slot [%d:%d] IO space already mapped !\n",
643-
tpci200->number, dev->slot);
649+
dev_err(&dev->dev,
650+
"Slot [%d:%d] IO space already mapped !\n",
651+
tpci200->number, dev->slot);
644652
res = -EINVAL;
645653
goto out_unlock;
646654
}
@@ -651,8 +659,9 @@ static int tpci200_slot_map_space(struct ipack_device *dev,
651659
break;
652660
case IPACK_ID_SPACE:
653661
if (dev->id_space.address != NULL) {
654-
pr_err("Slot [%d:%d] ID space already mapped !\n",
655-
tpci200->number, dev->slot);
662+
dev_err(&dev->dev,
663+
"Slot [%d:%d] ID space already mapped !\n",
664+
tpci200->number, dev->slot);
656665
res = -EINVAL;
657666
goto out_unlock;
658667
}
@@ -663,17 +672,19 @@ static int tpci200_slot_map_space(struct ipack_device *dev,
663672
break;
664673
case IPACK_MEM_SPACE:
665674
if (dev->mem_space.address != NULL) {
666-
pr_err("Slot [%d:%d] MEM space already mapped !\n",
667-
tpci200->number, dev->slot);
675+
dev_err(&dev->dev,
676+
"Slot [%d:%d] MEM space already mapped !\n",
677+
tpci200->number, dev->slot);
668678
res = -EINVAL;
669679
goto out_unlock;
670680
}
671681
virt_addr_space = &dev->mem_space;
672682

673683
if (memory_size > tpci200->slots[dev->slot].mem_phys.size) {
674-
pr_err("Slot [%d:%d] request is 0x%X memory, only 0x%X available !\n",
675-
dev->bus_nr, dev->slot, memory_size,
676-
tpci200->slots[dev->slot].mem_phys.size);
684+
dev_err(&dev->dev,
685+
"Slot [%d:%d] request is 0x%X memory, only 0x%X available !\n",
686+
dev->bus_nr, dev->slot, memory_size,
687+
tpci200->slots[dev->slot].mem_phys.size);
677688
res = -EINVAL;
678689
goto out_unlock;
679690
}
@@ -682,8 +693,8 @@ static int tpci200_slot_map_space(struct ipack_device *dev,
682693
size_to_map = memory_size;
683694
break;
684695
default:
685-
pr_err("Slot [%d:%d] space %d doesn't exist !\n",
686-
tpci200->number, dev->slot, space);
696+
dev_err(&dev->dev, "Slot [%d:%d] space %d doesn't exist !\n",
697+
tpci200->number, dev->slot, space);
687698
res = -EINVAL;
688699
goto out_unlock;
689700
break;
@@ -718,16 +729,18 @@ static int tpci200_request_irq(struct ipack_device *dev, int vector,
718729
}
719730

720731
if (tpci200->slots[dev->slot].irq != NULL) {
721-
pr_err("Slot [%d:%d] IRQ already registered !\n", dev->bus_nr,
722-
dev->slot);
732+
dev_err(&dev->dev,
733+
"Slot [%d:%d] IRQ already registered !\n", dev->bus_nr,
734+
dev->slot);
723735
res = -EINVAL;
724736
goto out_unlock;
725737
}
726738

727739
slot_irq = kzalloc(sizeof(struct slot_irq), GFP_KERNEL);
728740
if (slot_irq == NULL) {
729-
pr_err("Slot [%d:%d] unable to allocate memory for IRQ !\n",
730-
dev->bus_nr, dev->slot);
741+
dev_err(&dev->dev,
742+
"Slot [%d:%d] unable to allocate memory for IRQ !\n",
743+
dev->bus_nr, dev->slot);
731744
res = -ENOMEM;
732745
goto out_unlock;
733746
}
@@ -824,7 +837,7 @@ static int tpci200_pciprobe(struct pci_dev *pdev,
824837
/* register the device and initialize it */
825838
ret = tpci200_install(tpci200);
826839
if (ret) {
827-
pr_err("Error during tpci200 install !\n");
840+
dev_err(&pdev->dev, "Error during tpci200 install !\n");
828841
kfree(tpci200->info);
829842
kfree(tpci200);
830843
return -ENODEV;
@@ -835,7 +848,8 @@ static int tpci200_pciprobe(struct pci_dev *pdev,
835848
TPCI200_NB_SLOT,
836849
&tpci200_bus_ops);
837850
if (!tpci200->info->ipack_bus) {
838-
pr_err("error registering the carrier on ipack driver\n");
851+
dev_err(&pdev->dev,
852+
"error registering the carrier on ipack driver\n");
839853
tpci200_uninstall(tpci200);
840854
kfree(tpci200->info);
841855
kfree(tpci200);

0 commit comments

Comments
 (0)