* Software Foundation; version 2 of the License.
*/
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
#include <linux/module.h>
#include "tpci200.h"
struct tpci200_board *tpci200;
int found = 0;
- if (dev == NULL) {
- pr_info("Slot doesn't exist.\n");
+ if (dev == NULL)
return NULL;
- }
list_for_each_entry(tpci200, &tpci200_list, list) {
if (tpci200->number == dev->bus_nr) {
}
if (!found) {
- pr_err("Carrier not found\n");
+ dev_err(&dev->dev, "Carrier not found\n");
return NULL;
}
if (dev->slot >= TPCI200_NB_SLOT) {
- pr_info("Slot [%d:%d] doesn't exist! Last tpci200 slot is %d.\n",
- dev->bus_nr, dev->slot, TPCI200_NB_SLOT-1);
+ dev_info(&dev->dev,
+ "Slot [%d:%d] doesn't exist! Last tpci200 slot is %d.\n",
+ dev->bus_nr, dev->slot, TPCI200_NB_SLOT-1);
return NULL;
}
addr = &dev->mem_space;
break;
default:
- pr_err("Slot [%d:%d] space number %d doesn't exist !\n",
- dev->bus_nr, dev->slot, space);
+ dev_err(&dev->dev,
+ "Slot [%d:%d] space number %d doesn't exist !\n",
+ dev->bus_nr, dev->slot, space);
return NULL;
break;
}
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 -EINVAL;
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 -EINVAL;
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;
}
*value = __tpci200_read16(addr->address, offset);
return -EINVAL;
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 -EINVAL;
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 -EINVAL;
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 -EINVAL;
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;
}
if (unhandled_ints) {
for (i = 0; i < TPCI200_NB_SLOT; 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",
- tpci200->number, i);
+ dev_info(&tpci200->slots[i].dev->dev,
+ "No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n",
+ tpci200->number, i);
reg_value = readw(
tpci200->info->interface_regs +
control_reg[i]);
res = pci_request_region(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR,
"Carrier IP interface registers");
if (res) {
- pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !",
- tpci200->info->pdev->bus->number,
- tpci200->info->pdev->devfn);
+ dev_err(&tpci200->info->pdev->dev,
+ "(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !",
+ tpci200->info->pdev->bus->number,
+ tpci200->info->pdev->devfn);
goto out_disable_pci;
}
TPCI200_IO_ID_INT_SPACES_BAR,
"Carrier IO ID INT space");
if (res) {
- pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 3 !",
- tpci200->info->pdev->bus->number,
- tpci200->info->pdev->devfn);
+ dev_err(&tpci200->info->pdev->dev,
+ "(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 3 !",
+ tpci200->info->pdev->bus->number,
+ tpci200->info->pdev->devfn);
goto out_release_ip_space;
}
res = pci_request_region(tpci200->info->pdev, TPCI200_MEM8_SPACE_BAR,
"Carrier MEM space");
if (res) {
- pr_err("(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!",
- tpci200->info->pdev->bus->number,
- tpci200->info->pdev->devfn);
+ dev_err(&tpci200->info->pdev->dev,
+ "(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!",
+ tpci200->info->pdev->bus->number,
+ tpci200->info->pdev->devfn);
goto out_release_ioid_int_space;
}
tpci200_interrupt, IRQF_SHARED,
KBUILD_MODNAME, (void *) tpci200);
if (res) {
- pr_err("(bn 0x%X, sn 0x%X) unable to register IRQ !",
- tpci200->info->pdev->bus->number,
- tpci200->info->pdev->devfn);
+ dev_err(&tpci200->info->pdev->dev,
+ "(bn 0x%X, sn 0x%X) unable to register IRQ !",
+ tpci200->info->pdev->bus->number,
+ tpci200->info->pdev->devfn);
goto out_release_ioid_int_space;
}
switch (space) {
case IPACK_IO_SPACE:
if (dev->io_space.address == NULL) {
- pr_info("Slot [%d:%d] IO space not mapped !\n",
- dev->bus_nr, dev->slot);
+ dev_info(&dev->dev,
+ "Slot [%d:%d] IO space not mapped !\n",
+ dev->bus_nr, dev->slot);
goto out_unlock;
}
virt_addr_space = &dev->io_space;
break;
case IPACK_ID_SPACE:
if (dev->id_space.address == NULL) {
- pr_info("Slot [%d:%d] ID space not mapped !\n",
- dev->bus_nr, dev->slot);
+ dev_info(&dev->dev,
+ "Slot [%d:%d] ID space not mapped !\n",
+ dev->bus_nr, dev->slot);
goto out_unlock;
}
virt_addr_space = &dev->id_space;
break;
case IPACK_MEM_SPACE:
if (dev->mem_space.address == NULL) {
- pr_info("Slot [%d:%d] MEM space not mapped !\n",
- dev->bus_nr, dev->slot);
+ dev_info(&dev->dev,
+ "Slot [%d:%d] MEM space not mapped !\n",
+ dev->bus_nr, dev->slot);
goto out_unlock;
}
virt_addr_space = &dev->mem_space;
break;
default:
- pr_err("Slot [%d:%d] space number %d doesn't exist !\n",
- dev->bus_nr, dev->slot, space);
+ dev_err(&dev->dev,
+ "Slot [%d:%d] space number %d doesn't exist !\n",
+ dev->bus_nr, dev->slot, space);
mutex_unlock(&tpci200->mutex);
return -EINVAL;
}
switch (space) {
case IPACK_IO_SPACE:
if (dev->io_space.address != NULL) {
- pr_err("Slot [%d:%d] IO space already mapped !\n",
- tpci200->number, dev->slot);
+ dev_err(&dev->dev,
+ "Slot [%d:%d] IO space already mapped !\n",
+ tpci200->number, dev->slot);
res = -EINVAL;
goto out_unlock;
}
break;
case IPACK_ID_SPACE:
if (dev->id_space.address != NULL) {
- pr_err("Slot [%d:%d] ID space already mapped !\n",
- tpci200->number, dev->slot);
+ dev_err(&dev->dev,
+ "Slot [%d:%d] ID space already mapped !\n",
+ tpci200->number, dev->slot);
res = -EINVAL;
goto out_unlock;
}
break;
case IPACK_MEM_SPACE:
if (dev->mem_space.address != NULL) {
- pr_err("Slot [%d:%d] MEM space already mapped !\n",
- tpci200->number, dev->slot);
+ dev_err(&dev->dev,
+ "Slot [%d:%d] MEM space already mapped !\n",
+ tpci200->number, dev->slot);
res = -EINVAL;
goto out_unlock;
}
virt_addr_space = &dev->mem_space;
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->bus_nr, dev->slot, memory_size,
- tpci200->slots[dev->slot].mem_phys.size);
+ dev_err(&dev->dev,
+ "Slot [%d:%d] request is 0x%X memory, only 0x%X available !\n",
+ dev->bus_nr, dev->slot, memory_size,
+ tpci200->slots[dev->slot].mem_phys.size);
res = -EINVAL;
goto out_unlock;
}
size_to_map = memory_size;
break;
default:
- pr_err("Slot [%d:%d] space %d doesn't exist !\n",
- tpci200->number, dev->slot, space);
+ dev_err(&dev->dev, "Slot [%d:%d] space %d doesn't exist !\n",
+ tpci200->number, dev->slot, space);
res = -EINVAL;
goto out_unlock;
break;
}
if (tpci200->slots[dev->slot].irq != NULL) {
- pr_err("Slot [%d:%d] IRQ already registered !\n", dev->bus_nr,
- dev->slot);
+ dev_err(&dev->dev,
+ "Slot [%d:%d] IRQ already registered !\n", dev->bus_nr,
+ dev->slot);
res = -EINVAL;
goto out_unlock;
}
slot_irq = kzalloc(sizeof(struct slot_irq), GFP_KERNEL);
if (slot_irq == NULL) {
- pr_err("Slot [%d:%d] unable to allocate memory for IRQ !\n",
- dev->bus_nr, dev->slot);
+ dev_err(&dev->dev,
+ "Slot [%d:%d] unable to allocate memory for IRQ !\n",
+ dev->bus_nr, dev->slot);
res = -ENOMEM;
goto out_unlock;
}
/* register the device and initialize it */
ret = tpci200_install(tpci200);
if (ret) {
- pr_err("Error during tpci200 install !\n");
+ dev_err(&pdev->dev, "Error during tpci200 install !\n");
kfree(tpci200->info);
kfree(tpci200);
return -ENODEV;
TPCI200_NB_SLOT,
&tpci200_bus_ops);
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);
kfree(tpci200->info);
kfree(tpci200);