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>
This commit is contained in:
Samuel Iglesias Gonsalvez 2012-05-25 13:08:12 +02:00 committed by Greg Kroah-Hartman
parent 20cf700824
commit a23d320370
1 changed files with 70 additions and 56 deletions

View File

@ -11,8 +11,6 @@
* Software Foundation; version 2 of the License. * Software Foundation; version 2 of the License.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include "tpci200.h" #include "tpci200.h"
@ -36,10 +34,8 @@ static struct tpci200_board *check_slot(struct ipack_device *dev)
struct tpci200_board *tpci200; struct tpci200_board *tpci200;
int found = 0; int found = 0;
if (dev == NULL) { if (dev == NULL)
pr_info("Slot doesn't exist.\n");
return NULL; return NULL;
}
list_for_each_entry(tpci200, &tpci200_list, list) { list_for_each_entry(tpci200, &tpci200_list, list) {
if (tpci200->number == dev->bus_nr) { if (tpci200->number == dev->bus_nr) {
@ -49,13 +45,14 @@ static struct tpci200_board *check_slot(struct ipack_device *dev)
} }
if (!found) { if (!found) {
pr_err("Carrier not found\n"); dev_err(&dev->dev, "Carrier not found\n");
return NULL; return NULL;
} }
if (dev->slot >= TPCI200_NB_SLOT) { if (dev->slot >= TPCI200_NB_SLOT) {
pr_info("Slot [%d:%d] doesn't exist! Last tpci200 slot is %d.\n", dev_info(&dev->dev,
dev->bus_nr, dev->slot, TPCI200_NB_SLOT-1); "Slot [%d:%d] doesn't exist! Last tpci200 slot is %d.\n",
dev->bus_nr, dev->slot, TPCI200_NB_SLOT-1);
return NULL; return NULL;
} }
@ -116,14 +113,15 @@ static struct ipack_addr_space *get_slot_address_space(struct ipack_device *dev,
addr = &dev->mem_space; addr = &dev->mem_space;
break; break;
default: default:
pr_err("Slot [%d:%d] space number %d doesn't exist !\n", dev_err(&dev->dev,
dev->bus_nr, dev->slot, space); "Slot [%d:%d] space number %d doesn't exist !\n",
dev->bus_nr, dev->slot, space);
return NULL; return NULL;
break; break;
} }
if ((addr->size == 0) || (addr->address == NULL)) { if ((addr->size == 0) || (addr->address == NULL)) {
pr_err("Error, slot space not mapped !\n"); dev_err(&dev->dev, "Error, slot space not mapped !\n");
return NULL; return NULL;
} }
@ -145,7 +143,7 @@ static int tpci200_read8(struct ipack_device *dev, int space,
return -EINVAL; return -EINVAL;
if (offset >= addr->size) { if (offset >= addr->size) {
pr_err("Error, slot space offset error !\n"); dev_err(&dev->dev, "Error, slot space offset error !\n");
return -EFAULT; return -EFAULT;
} }
@ -169,7 +167,7 @@ static int tpci200_read16(struct ipack_device *dev, int space,
return -EINVAL; return -EINVAL;
if ((offset+2) >= addr->size) { if ((offset+2) >= addr->size) {
pr_err("Error, slot space offset error !\n"); dev_err(&dev->dev, "Error, slot space offset error !\n");
return -EFAULT; return -EFAULT;
} }
*value = __tpci200_read16(addr->address, offset); *value = __tpci200_read16(addr->address, offset);
@ -192,7 +190,7 @@ static int tpci200_read32(struct ipack_device *dev, int space,
return -EINVAL; return -EINVAL;
if ((offset+4) >= addr->size) { if ((offset+4) >= addr->size) {
pr_err("Error, slot space offset error !\n"); dev_err(&dev->dev, "Error, slot space offset error !\n");
return -EFAULT; return -EFAULT;
} }
@ -216,7 +214,7 @@ static int tpci200_write8(struct ipack_device *dev, int space,
return -EINVAL; return -EINVAL;
if (offset >= addr->size) { if (offset >= addr->size) {
pr_err("Error, slot space offset error !\n"); dev_err(&dev->dev, "Error, slot space offset error !\n");
return -EFAULT; return -EFAULT;
} }
@ -240,7 +238,7 @@ static int tpci200_write16(struct ipack_device *dev, int space,
return -EINVAL; return -EINVAL;
if ((offset+2) >= addr->size) { if ((offset+2) >= addr->size) {
pr_err("Error, slot space offset error !\n"); dev_err(&dev->dev, "Error, slot space offset error !\n");
return -EFAULT; return -EFAULT;
} }
@ -264,7 +262,7 @@ static int tpci200_write32(struct ipack_device *dev, int space,
return -EINVAL; return -EINVAL;
if ((offset+4) >= addr->size) { if ((offset+4) >= addr->size) {
pr_err("Error, slot space offset error !\n"); dev_err(&dev->dev, "Error, slot space offset error !\n");
return -EFAULT; return -EFAULT;
} }
@ -338,8 +336,9 @@ static irqreturn_t tpci200_interrupt(int irq, void *dev_id)
if (unhandled_ints) { if (unhandled_ints) {
for (i = 0; i < TPCI200_NB_SLOT; i++) { for (i = 0; i < TPCI200_NB_SLOT; i++) {
if (unhandled_ints & ((TPCI200_INT0_EN | TPCI200_INT1_EN) << (2*i))) { if (unhandled_ints & ((TPCI200_INT0_EN | TPCI200_INT1_EN) << (2*i))) {
pr_info("No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n", dev_info(&tpci200->slots[i].dev->dev,
tpci200->number, i); "No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n",
tpci200->number, i);
reg_value = readw( reg_value = readw(
tpci200->info->interface_regs + tpci200->info->interface_regs +
control_reg[i]); control_reg[i]);
@ -371,9 +370,10 @@ static int tpci200_register(struct tpci200_board *tpci200)
res = pci_request_region(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR, res = pci_request_region(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR,
"Carrier IP interface registers"); "Carrier IP interface registers");
if (res) { if (res) {
pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !", dev_err(&tpci200->info->pdev->dev,
tpci200->info->pdev->bus->number, "(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !",
tpci200->info->pdev->devfn); tpci200->info->pdev->bus->number,
tpci200->info->pdev->devfn);
goto out_disable_pci; goto out_disable_pci;
} }
@ -382,9 +382,10 @@ static int tpci200_register(struct tpci200_board *tpci200)
TPCI200_IO_ID_INT_SPACES_BAR, TPCI200_IO_ID_INT_SPACES_BAR,
"Carrier IO ID INT space"); "Carrier IO ID INT space");
if (res) { if (res) {
pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 3 !", dev_err(&tpci200->info->pdev->dev,
tpci200->info->pdev->bus->number, "(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 3 !",
tpci200->info->pdev->devfn); tpci200->info->pdev->bus->number,
tpci200->info->pdev->devfn);
goto out_release_ip_space; goto out_release_ip_space;
} }
@ -392,9 +393,10 @@ static int tpci200_register(struct tpci200_board *tpci200)
res = pci_request_region(tpci200->info->pdev, TPCI200_MEM8_SPACE_BAR, res = pci_request_region(tpci200->info->pdev, TPCI200_MEM8_SPACE_BAR,
"Carrier MEM space"); "Carrier MEM space");
if (res) { if (res) {
pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!", dev_err(&tpci200->info->pdev->dev,
tpci200->info->pdev->bus->number, "(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!",
tpci200->info->pdev->devfn); tpci200->info->pdev->bus->number,
tpci200->info->pdev->devfn);
goto out_release_ioid_int_space; goto out_release_ioid_int_space;
} }
@ -452,9 +454,10 @@ static int tpci200_register(struct tpci200_board *tpci200)
tpci200_interrupt, IRQF_SHARED, tpci200_interrupt, IRQF_SHARED,
KBUILD_MODNAME, (void *) tpci200); KBUILD_MODNAME, (void *) tpci200);
if (res) { if (res) {
pr_err("(bn 0x%X, sn 0x%X) unable to register IRQ !", dev_err(&tpci200->info->pdev->dev,
tpci200->info->pdev->bus->number, "(bn 0x%X, sn 0x%X) unable to register IRQ !",
tpci200->info->pdev->devfn); tpci200->info->pdev->bus->number,
tpci200->info->pdev->devfn);
goto out_release_ioid_int_space; goto out_release_ioid_int_space;
} }
@ -555,31 +558,35 @@ static int tpci200_slot_unmap_space(struct ipack_device *dev, int space)
switch (space) { switch (space) {
case IPACK_IO_SPACE: case IPACK_IO_SPACE:
if (dev->io_space.address == NULL) { if (dev->io_space.address == NULL) {
pr_info("Slot [%d:%d] IO space not mapped !\n", dev_info(&dev->dev,
dev->bus_nr, dev->slot); "Slot [%d:%d] IO space not mapped !\n",
dev->bus_nr, dev->slot);
goto out_unlock; goto out_unlock;
} }
virt_addr_space = &dev->io_space; virt_addr_space = &dev->io_space;
break; break;
case IPACK_ID_SPACE: case IPACK_ID_SPACE:
if (dev->id_space.address == NULL) { if (dev->id_space.address == NULL) {
pr_info("Slot [%d:%d] ID space not mapped !\n", dev_info(&dev->dev,
dev->bus_nr, dev->slot); "Slot [%d:%d] ID space not mapped !\n",
dev->bus_nr, dev->slot);
goto out_unlock; goto out_unlock;
} }
virt_addr_space = &dev->id_space; virt_addr_space = &dev->id_space;
break; break;
case IPACK_MEM_SPACE: case IPACK_MEM_SPACE:
if (dev->mem_space.address == NULL) { if (dev->mem_space.address == NULL) {
pr_info("Slot [%d:%d] MEM space not mapped !\n", dev_info(&dev->dev,
dev->bus_nr, dev->slot); "Slot [%d:%d] MEM space not mapped !\n",
dev->bus_nr, dev->slot);
goto out_unlock; goto out_unlock;
} }
virt_addr_space = &dev->mem_space; virt_addr_space = &dev->mem_space;
break; break;
default: default:
pr_err("Slot [%d:%d] space number %d doesn't exist !\n", dev_err(&dev->dev,
dev->bus_nr, dev->slot, space); "Slot [%d:%d] space number %d doesn't exist !\n",
dev->bus_nr, dev->slot, space);
mutex_unlock(&tpci200->mutex); mutex_unlock(&tpci200->mutex);
return -EINVAL; return -EINVAL;
} }
@ -639,8 +646,9 @@ static int tpci200_slot_map_space(struct ipack_device *dev,
switch (space) { switch (space) {
case IPACK_IO_SPACE: case IPACK_IO_SPACE:
if (dev->io_space.address != NULL) { if (dev->io_space.address != NULL) {
pr_err("Slot [%d:%d] IO space already mapped !\n", dev_err(&dev->dev,
tpci200->number, dev->slot); "Slot [%d:%d] IO space already mapped !\n",
tpci200->number, dev->slot);
res = -EINVAL; res = -EINVAL;
goto out_unlock; goto out_unlock;
} }
@ -651,8 +659,9 @@ static int tpci200_slot_map_space(struct ipack_device *dev,
break; break;
case IPACK_ID_SPACE: case IPACK_ID_SPACE:
if (dev->id_space.address != NULL) { if (dev->id_space.address != NULL) {
pr_err("Slot [%d:%d] ID space already mapped !\n", dev_err(&dev->dev,
tpci200->number, dev->slot); "Slot [%d:%d] ID space already mapped !\n",
tpci200->number, dev->slot);
res = -EINVAL; res = -EINVAL;
goto out_unlock; goto out_unlock;
} }
@ -663,17 +672,19 @@ static int tpci200_slot_map_space(struct ipack_device *dev,
break; break;
case IPACK_MEM_SPACE: case IPACK_MEM_SPACE:
if (dev->mem_space.address != NULL) { if (dev->mem_space.address != NULL) {
pr_err("Slot [%d:%d] MEM space already mapped !\n", dev_err(&dev->dev,
tpci200->number, dev->slot); "Slot [%d:%d] MEM space already mapped !\n",
tpci200->number, dev->slot);
res = -EINVAL; res = -EINVAL;
goto out_unlock; goto out_unlock;
} }
virt_addr_space = &dev->mem_space; virt_addr_space = &dev->mem_space;
if (memory_size > tpci200->slots[dev->slot].mem_phys.size) { if (memory_size > tpci200->slots[dev->slot].mem_phys.size) {
pr_err("Slot [%d:%d] request is 0x%X memory, only 0x%X available !\n", dev_err(&dev->dev,
dev->bus_nr, dev->slot, memory_size, "Slot [%d:%d] request is 0x%X memory, only 0x%X available !\n",
tpci200->slots[dev->slot].mem_phys.size); dev->bus_nr, dev->slot, memory_size,
tpci200->slots[dev->slot].mem_phys.size);
res = -EINVAL; res = -EINVAL;
goto out_unlock; goto out_unlock;
} }
@ -682,8 +693,8 @@ static int tpci200_slot_map_space(struct ipack_device *dev,
size_to_map = memory_size; size_to_map = memory_size;
break; break;
default: default:
pr_err("Slot [%d:%d] space %d doesn't exist !\n", dev_err(&dev->dev, "Slot [%d:%d] space %d doesn't exist !\n",
tpci200->number, dev->slot, space); tpci200->number, dev->slot, space);
res = -EINVAL; res = -EINVAL;
goto out_unlock; goto out_unlock;
break; break;
@ -718,16 +729,18 @@ static int tpci200_request_irq(struct ipack_device *dev, int vector,
} }
if (tpci200->slots[dev->slot].irq != NULL) { if (tpci200->slots[dev->slot].irq != NULL) {
pr_err("Slot [%d:%d] IRQ already registered !\n", dev->bus_nr, dev_err(&dev->dev,
dev->slot); "Slot [%d:%d] IRQ already registered !\n", dev->bus_nr,
dev->slot);
res = -EINVAL; res = -EINVAL;
goto out_unlock; goto out_unlock;
} }
slot_irq = kzalloc(sizeof(struct slot_irq), GFP_KERNEL); slot_irq = kzalloc(sizeof(struct slot_irq), GFP_KERNEL);
if (slot_irq == NULL) { if (slot_irq == NULL) {
pr_err("Slot [%d:%d] unable to allocate memory for IRQ !\n", dev_err(&dev->dev,
dev->bus_nr, dev->slot); "Slot [%d:%d] unable to allocate memory for IRQ !\n",
dev->bus_nr, dev->slot);
res = -ENOMEM; res = -ENOMEM;
goto out_unlock; goto out_unlock;
} }
@ -824,7 +837,7 @@ static int tpci200_pciprobe(struct pci_dev *pdev,
/* register the device and initialize it */ /* register the device and initialize it */
ret = tpci200_install(tpci200); ret = tpci200_install(tpci200);
if (ret) { if (ret) {
pr_err("Error during tpci200 install !\n"); dev_err(&pdev->dev, "Error during tpci200 install !\n");
kfree(tpci200->info); kfree(tpci200->info);
kfree(tpci200); kfree(tpci200);
return -ENODEV; return -ENODEV;
@ -835,7 +848,8 @@ static int tpci200_pciprobe(struct pci_dev *pdev,
TPCI200_NB_SLOT, TPCI200_NB_SLOT,
&tpci200_bus_ops); &tpci200_bus_ops);
if (!tpci200->info->ipack_bus) { if (!tpci200->info->ipack_bus) {
pr_err("error registering the carrier on ipack driver\n"); dev_err(&pdev->dev,
"error registering the carrier on ipack driver\n");
tpci200_uninstall(tpci200); tpci200_uninstall(tpci200);
kfree(tpci200->info); kfree(tpci200->info);
kfree(tpci200); kfree(tpci200);