aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci/hotplug/shpchp_hpc.c
diff options
context:
space:
mode:
authorTaku Izumi <izumi.taku@jp.fujitsu.com>2008-10-23 11:52:12 +0900
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-10-23 16:11:50 -0700
commitf98ca311f3a32e2adc229fecd6bf732db07fcca3 (patch)
tree70605c5063f72f93a08d350b0fcb66fd359b7996 /drivers/pci/hotplug/shpchp_hpc.c
parent388c8c16abafc2e74dff173b5de9ee519ea8d32f (diff)
PCI hotplug: shpchp: replace printk with dev_printk
This patch replaces printks within shpchp module with dev_printks. Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/hotplug/shpchp_hpc.c')
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c120
1 files changed, 64 insertions, 56 deletions
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index 7a0bff364cd..2b69a08326b 100644
--- a/drivers/pci/hotplug/shpchp_hpc.c
+++ b/drivers/pci/hotplug/shpchp_hpc.c
@@ -300,10 +300,10 @@ static inline int shpc_wait_cmd(struct controller *ctrl)
!is_ctrl_busy(ctrl), timeout);
if (!rc && is_ctrl_busy(ctrl)) {
retval = -EIO;
- err("Command not completed in 1000 msec\n");
+ ctrl_err(ctrl, "Command not completed in 1000 msec\n");
} else if (rc < 0) {
retval = -EINTR;
- info("Command was interrupted by a signal\n");
+ ctrl_info(ctrl, "Command was interrupted by a signal\n");
}
return retval;
@@ -320,15 +320,15 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
if (!shpc_poll_ctrl_busy(ctrl)) {
/* After 1 sec and and the controller is still busy */
- err("%s : Controller is still busy after 1 sec.\n",
- __func__);
+ ctrl_err(ctrl, "%s : Controller is still busy after 1 sec.\n",
+ __func__);
retval = -EBUSY;
goto out;
}
++t_slot;
temp_word = (t_slot << 8) | (cmd & 0xFF);
- dbg("%s: t_slot %x cmd %x\n", __func__, t_slot, cmd);
+ ctrl_dbg(ctrl, "%s: t_slot %x cmd %x\n", __func__, t_slot, cmd);
/* To make sure the Controller Busy bit is 0 before we send out the
* command.
@@ -344,8 +344,8 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
cmd_status = hpc_check_cmd_status(slot->ctrl);
if (cmd_status) {
- err("%s: Failed to issued command 0x%x (error code = %d)\n",
- __func__, cmd, cmd_status);
+ ctrl_err(ctrl, "%s: Failed to issued command 0x%x "
+ "(error code = %d)\n", __func__, cmd, cmd_status);
retval = -EIO;
}
out:
@@ -364,15 +364,15 @@ static int hpc_check_cmd_status(struct controller *ctrl)
break;
case 1:
retval = SWITCH_OPEN;
- err("%s: Switch opened!\n", __func__);
+ ctrl_err(ctrl, "%s: Switch opened!\n", __func__);
break;
case 2:
retval = INVALID_CMD;
- err("%s: Invalid HPC command!\n", __func__);
+ ctrl_err(ctrl, "%s: Invalid HPC command!\n", __func__);
break;
case 4:
retval = INVALID_SPEED_MODE;
- err("%s: Invalid bus speed/mode!\n", __func__);
+ ctrl_err(ctrl, "%s: Invalid bus speed/mode!\n", __func__);
break;
default:
retval = cmd_status;
@@ -483,8 +483,8 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value)
return -ENODEV;
}
- dbg("%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n",
- __func__, slot_reg, pcix_cap, m66_cap);
+ ctrl_dbg(ctrl, "%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n",
+ __func__, slot_reg, pcix_cap, m66_cap);
switch (pcix_cap) {
case 0x0:
@@ -509,7 +509,7 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value)
break;
}
- dbg("Adapter speed = %d\n", *value);
+ ctrl_dbg(ctrl, "Adapter speed = %d\n", *value);
return retval;
}
@@ -526,7 +526,7 @@ static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode)
retval = -1;
}
- dbg("Mode 1 ECC cap = %d\n", *mode);
+ ctrl_dbg(ctrl, "Mode 1 ECC cap = %d\n", *mode);
return retval;
}
@@ -629,7 +629,7 @@ static int hpc_power_on_slot(struct slot * slot)
retval = shpc_write_cmd(slot, slot->hp_slot, SET_SLOT_PWR);
if (retval)
- err("%s: Write command failed!\n", __func__);
+ ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__);
return retval;
}
@@ -642,7 +642,7 @@ static int hpc_slot_enable(struct slot * slot)
retval = shpc_write_cmd(slot, slot->hp_slot,
SET_SLOT_ENABLE | SET_PWR_BLINK | SET_ATTN_OFF);
if (retval)
- err("%s: Write command failed!\n", __func__);
+ ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__);
return retval;
}
@@ -655,7 +655,7 @@ static int hpc_slot_disable(struct slot * slot)
retval = shpc_write_cmd(slot, slot->hp_slot,
SET_SLOT_DISABLE | SET_PWR_OFF | SET_ATTN_ON);
if (retval)
- err("%s: Write command failed!\n", __func__);
+ ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__);
return retval;
}
@@ -719,7 +719,7 @@ static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value)
retval = shpc_write_cmd(slot, 0, cmd);
if (retval)
- err("%s: Write command failed!\n", __func__);
+ ctrl_err(ctrl, "%s: Write command failed!\n", __func__);
return retval;
}
@@ -735,7 +735,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id)
if (!intr_loc)
return IRQ_NONE;
- dbg("%s: intr_loc = %x\n",__func__, intr_loc);
+ ctrl_dbg(ctrl, "%s: intr_loc = %x\n", __func__, intr_loc);
if(!shpchp_poll_mode) {
/*
@@ -748,7 +748,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id)
shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int);
intr_loc2 = shpc_readl(ctrl, INTR_LOC);
- dbg("%s: intr_loc2 = %x\n",__func__, intr_loc2);
+ ctrl_dbg(ctrl, "%s: intr_loc2 = %x\n", __func__, intr_loc2);
}
if (intr_loc & CMD_INTR_PENDING) {
@@ -773,8 +773,8 @@ static irqreturn_t shpc_isr(int irq, void *dev_id)
continue;
slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot));
- dbg("%s: Slot %x with intr, slot register = %x\n",
- __func__, hp_slot, slot_reg);
+ ctrl_dbg(ctrl, "%s: Slot %x with intr, slot register = %x\n",
+ __func__, hp_slot, slot_reg);
if (slot_reg & MRL_CHANGE_DETECTED)
shpchp_handle_switch_change(hp_slot, ctrl);
@@ -843,7 +843,7 @@ static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value)
}
*value = bus_speed;
- dbg("Max bus speed = %d\n", bus_speed);
+ ctrl_dbg(ctrl, "Max bus speed = %d\n", bus_speed);
return retval;
}
@@ -911,7 +911,7 @@ static int hpc_get_cur_bus_speed (struct slot *slot, enum pci_bus_speed *value)
break;
}
- dbg("Current bus speed = %d\n", bus_speed);
+ ctrl_dbg(ctrl, "Current bus speed = %d\n", bus_speed);
return retval;
}
@@ -958,34 +958,38 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
} else {
ctrl->cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC);
if (!ctrl->cap_offset) {
- err("%s : cap_offset == 0\n", __func__);
+ ctrl_err(ctrl, "%s : cap_offset == 0\n", __func__);
goto abort;
}
- dbg("%s: cap_offset = %x\n", __func__, ctrl->cap_offset);
+ ctrl_dbg(ctrl, "%s: cap_offset = %x\n", __func__,
+ ctrl->cap_offset);
rc = shpc_indirect_read(ctrl, 0, &shpc_base_offset);
if (rc) {
- err("%s: cannot read base_offset\n", __func__);
+ ctrl_err(ctrl, "%s: cannot read base_offset\n",
+ __func__);
goto abort;
}
rc = shpc_indirect_read(ctrl, 3, &tempdword);
if (rc) {
- err("%s: cannot read slot config\n", __func__);
+ ctrl_err(ctrl, "%s: cannot read slot config\n",
+ __func__);
goto abort;
}
num_slots = tempdword & SLOT_NUM;
- dbg("%s: num_slots (indirect) %x\n", __func__, num_slots);
+ ctrl_dbg(ctrl, "%s: num_slots (indirect) %x\n",
+ __func__, num_slots);
for (i = 0; i < 9 + num_slots; i++) {
rc = shpc_indirect_read(ctrl, i, &tempdword);
if (rc) {
- err("%s: cannot read creg (index = %d)\n",
- __func__, i);
+ ctrl_err(ctrl, "%s: cannot read creg "
+ "(index = %d)\n", __func__, i);
goto abort;
}
- dbg("%s: offset %d: value %x\n", __func__,i,
- tempdword);
+ ctrl_dbg(ctrl, "%s: offset %d: value %x\n",
+ __func__, i, tempdword);
}
ctrl->mmio_base =
@@ -993,30 +997,31 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
ctrl->mmio_size = 0x24 + 0x4 * num_slots;
}
- info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor,
- pdev->subsystem_device);
+ ctrl_info(ctrl, "HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n",
+ pdev->vendor, pdev->device, pdev->subsystem_vendor,
+ pdev->subsystem_device);
rc = pci_enable_device(pdev);
if (rc) {
- err("%s: pci_enable_device failed\n", __func__);
+ ctrl_err(ctrl, "%s: pci_enable_device failed\n", __func__);
goto abort;
}
if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) {
- err("%s: cannot reserve MMIO region\n", __func__);
+ ctrl_err(ctrl, "%s: cannot reserve MMIO region\n", __func__);
rc = -1;
goto abort;
}
ctrl->creg = ioremap(ctrl->mmio_base, ctrl->mmio_size);
if (!ctrl->creg) {
- err("%s: cannot remap MMIO region %lx @ %lx\n", __func__,
- ctrl->mmio_size, ctrl->mmio_base);
+ ctrl_err(ctrl, "%s: cannot remap MMIO region %lx @ %lx\n",
+ __func__, ctrl->mmio_size, ctrl->mmio_base);
release_mem_region(ctrl->mmio_base, ctrl->mmio_size);
rc = -1;
goto abort;
}
- dbg("%s: ctrl->creg %p\n", __func__, ctrl->creg);
+ ctrl_dbg(ctrl, "%s: ctrl->creg %p\n", __func__, ctrl->creg);
mutex_init(&ctrl->crit_sect);
mutex_init(&ctrl->cmd_lock);
@@ -1035,21 +1040,21 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
/* Mask Global Interrupt Mask & Command Complete Interrupt Mask */
tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE);
- dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword);
+ ctrl_dbg(ctrl, "%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword);
tempdword |= (GLOBAL_INTR_MASK | GLOBAL_SERR_MASK |
COMMAND_INTR_MASK | ARBITER_SERR_MASK);
tempdword &= ~SERR_INTR_RSVDZ_MASK;
shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword);
tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE);
- dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword);
+ ctrl_dbg(ctrl, "%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword);
/* Mask the MRL sensor SERR Mask of individual slot in
* Slot SERR-INT Mask & clear all the existing event if any
*/
for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) {
slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot));
- dbg("%s: Default Logical Slot Register %d value %x\n", __func__,
- hp_slot, slot_reg);
+ ctrl_dbg(ctrl, "%s: Default Logical Slot Register %d "
+ "value %x\n", __func__, hp_slot, slot_reg);
slot_reg |= (PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK |
BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK |
CON_PFAULT_INTR_MASK | MRL_CHANGE_SERR_MASK |
@@ -1066,24 +1071,26 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
/* Installs the interrupt handler */
rc = pci_enable_msi(pdev);
if (rc) {
- info("Can't get msi for the hotplug controller\n");
- info("Use INTx for the hotplug controller\n");
+ ctrl_info(ctrl,
+ "Can't get msi for the hotplug controller\n");
+ ctrl_info(ctrl,
+ "Use INTx for the hotplug controller\n");
}
rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED,
MY_NAME, (void *)ctrl);
- dbg("%s: request_irq %d for hpc%d (returns %d)\n",
- __func__, ctrl->pci_dev->irq,
+ ctrl_dbg(ctrl, "%s: request_irq %d for hpc%d (returns %d)\n",
+ __func__, ctrl->pci_dev->irq,
atomic_read(&shpchp_num_controllers), rc);
if (rc) {
- err("Can't get irq %d for the hotplug controller\n",
- ctrl->pci_dev->irq);
+ ctrl_err(ctrl, "Can't get irq %d for the hotplug "
+ "controller\n", ctrl->pci_dev->irq);
goto abort_iounmap;
}
}
- dbg("%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n", __func__,
- pdev->bus->number, PCI_SLOT(pdev->devfn),
- PCI_FUNC(pdev->devfn), pdev->irq);
+ ctrl_dbg(ctrl, "%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n",
+ __func__, pdev->bus->number, PCI_SLOT(pdev->devfn),
+ PCI_FUNC(pdev->devfn), pdev->irq);
/*
* If this is the first controller to be initialized,
@@ -1102,8 +1109,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
*/
for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) {
slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot));
- dbg("%s: Default Logical Slot Register %d value %x\n", __func__,
- hp_slot, slot_reg);
+ ctrl_dbg(ctrl, "%s: Default Logical Slot Register %d "
+ "value %x\n", __func__, hp_slot, slot_reg);
slot_reg &= ~(PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK |
BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK |
CON_PFAULT_INTR_MASK | SLOT_REG_RSVDZ_MASK);
@@ -1116,7 +1123,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
SERR_INTR_RSVDZ_MASK);
shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword);
tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE);
- dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword);
+ ctrl_dbg(ctrl, "%s: SERR_INTR_ENABLE = %x\n",
+ __func__, tempdword);
}
return 0;