Skip to content

Commit

Permalink
PCI hotplug: shpchp: message refinement
Browse files Browse the repository at this point in the history
This patch refines messages in shpchp module.  The main changes are as
follows:

 - remove the trailing "."
 - remove __func__ as much as possible
 - capitalize the first letter of messages
 - show PCI device address including its domain

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
Taku Izumi authored and Jesse Barnes committed Oct 23, 2008
1 parent f98ca31 commit be7bce2
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 98 deletions.
9 changes: 4 additions & 5 deletions drivers/pci/hotplug/shpchp.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static inline struct slot *shpchp_find_slot(struct controller *ctrl, u8 device)
return slot;
}

ctrl_err(ctrl, "%s: slot (device=0x%x) not found\n", __func__, device);
ctrl_err(ctrl, "Slot (device=0x%02x) not found\n", device);
return NULL;
}

Expand Down Expand Up @@ -288,8 +288,8 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK;
if (perr_set) {
ctrl_dbg(p_slot->ctrl,
"%s W1C: Bridge_Errors[ PERR_OBSERVED = %08X]\n",
__func__ , perr_set);
"Bridge_Errors[ PERR_OBSERVED = %08X] (W1C)\n",
perr_set);

pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set);
}
Expand All @@ -298,8 +298,7 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg);
rse_set = pcix_mem_base_reg & RSE_MASK;
if (rse_set) {
ctrl_dbg(p_slot->ctrl, "%s W1C: Memory_Base_Limit[ RSE ]\n",
__func__);
ctrl_dbg(p_slot->ctrl, "Memory_Base_Limit[ RSE ] (W1C)\n");

pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set);
}
Expand Down
34 changes: 18 additions & 16 deletions drivers/pci/hotplug/shpchp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
{
struct slot *slot = hotplug_slot->private;

ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

kfree(slot->hotplug_slot->info);
Expand Down Expand Up @@ -136,9 +136,11 @@ static int init_slots(struct controller *ctrl)
snprintf(name, SLOT_NAME_SIZE, "%d", slot->number);
hotplug_slot->ops = &shpchp_hotplug_slot_ops;

ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x "
"slot_device_offset=%x\n", slot->bus, slot->device,
slot->hp_slot, slot->number, ctrl->slot_device_offset);
ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x "
"hp_slot=%x sun=%x slot_device_offset=%x\n",
pci_domain_nr(ctrl->pci_dev->subordinate),
slot->bus, slot->device, slot->hp_slot, slot->number,
ctrl->slot_device_offset);
retval = pci_hp_register(slot->hotplug_slot,
ctrl->pci_dev->subordinate, slot->device, name);
if (retval) {
Expand Down Expand Up @@ -189,7 +191,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
{
struct slot *slot = get_slot(hotplug_slot);

ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

hotplug_slot->info->attention_status = status;
Expand All @@ -202,7 +204,7 @@ static int enable_slot (struct hotplug_slot *hotplug_slot)
{
struct slot *slot = get_slot(hotplug_slot);

ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

return shpchp_sysfs_enable_slot(slot);
Expand All @@ -212,7 +214,7 @@ static int disable_slot (struct hotplug_slot *hotplug_slot)
{
struct slot *slot = get_slot(hotplug_slot);

ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

return shpchp_sysfs_disable_slot(slot);
Expand All @@ -223,7 +225,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = get_slot(hotplug_slot);
int retval;

ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = slot->hpc_ops->get_power_status(slot, value);
Expand All @@ -238,7 +240,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = get_slot(hotplug_slot);
int retval;

ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = slot->hpc_ops->get_attention_status(slot, value);
Expand All @@ -253,7 +255,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = get_slot(hotplug_slot);
int retval;

ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = slot->hpc_ops->get_latch_status(slot, value);
Expand All @@ -268,7 +270,7 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = get_slot(hotplug_slot);
int retval;

ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = slot->hpc_ops->get_adapter_status(slot, value);
Expand All @@ -284,7 +286,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
struct slot *slot = get_slot(hotplug_slot);
int retval;

ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = slot->hpc_ops->get_max_bus_speed(slot, value);
Expand All @@ -299,7 +301,7 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp
struct slot *slot = get_slot(hotplug_slot);
int retval;

ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
Expand Down Expand Up @@ -331,14 +333,14 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
if (!ctrl) {
dev_err(&pdev->dev, "%s : out of memory\n", __func__);
dev_err(&pdev->dev, "%s: Out of memory\n", __func__);
goto err_out_none;
}
INIT_LIST_HEAD(&ctrl->slot_list);

rc = shpc_init(ctrl, pdev);
if (rc) {
ctrl_dbg(ctrl, "controller initialization failed\n");
ctrl_dbg(ctrl, "Controller initialization failed\n");
goto err_out_free_ctrl;
}

Expand All @@ -347,7 +349,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* Setup the slot information structures */
rc = init_slots(ctrl);
if (rc) {
ctrl_err(ctrl, "slot initialization failed\n");
ctrl_err(ctrl, "Slot initialization failed\n");
goto err_out_release_ctlr;
}

Expand Down
54 changes: 25 additions & 29 deletions drivers/pci/hotplug/shpchp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
u32 event_type;

/* Attention Button Change */
ctrl_dbg(ctrl, "Attention button interrupt received.\n");
ctrl_dbg(ctrl, "Attention button interrupt received\n");

p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
Expand All @@ -86,13 +86,13 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
u32 event_type;

/* Switch Change */
ctrl_dbg(ctrl, "Switch interrupt received.\n");
ctrl_dbg(ctrl, "Switch interrupt received\n");

p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
ctrl_dbg(ctrl, "%s: Card present %x Power status %x\n",
__func__, p_slot->presence_save, p_slot->pwr_save);
ctrl_dbg(ctrl, "Card present %x Power status %x\n",
p_slot->presence_save, p_slot->pwr_save);

if (getstatus) {
/*
Expand Down Expand Up @@ -123,7 +123,7 @@ u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
u32 event_type;

/* Presence Change */
ctrl_dbg(ctrl, "Presence/Notify input change.\n");
ctrl_dbg(ctrl, "Presence/Notify input change\n");

p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);

Expand Down Expand Up @@ -158,7 +158,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
u32 event_type;

/* Power fault */
ctrl_dbg(ctrl, "Power fault interrupt received.\n");
ctrl_dbg(ctrl, "Power fault interrupt received\n");

p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);

Expand All @@ -178,7 +178,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
event_type = INT_POWER_FAULT;
/* set power fault status for this board */
p_slot->status = 0xFF;
ctrl_info(ctrl, "power fault bit %x set\n", hp_slot);
ctrl_info(ctrl, "Power fault bit %x set\n", hp_slot);
}

queue_interrupt_event(p_slot, event_type);
Expand All @@ -194,7 +194,7 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
{
int rc = 0;

ctrl_dbg(ctrl, "%s: change to speed %d\n", __func__, speed);
ctrl_dbg(ctrl, "Change speed to %d\n", speed);
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) {
ctrl_err(ctrl, "%s: Issue of set bus speed mode command "
"failed\n", __func__);
Expand All @@ -215,8 +215,8 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
*/
if (flag) {
if (asp < bsp) {
ctrl_err(ctrl, "%s: speed of bus %x and adapter %x "
"mismatch\n", __func__, bsp, asp);
ctrl_err(ctrl, "Speed of bus %x and adapter %x "
"mismatch\n", bsp, asp);
rc = WRONG_BUS_FREQUENCY;
}
return rc;
Expand Down Expand Up @@ -246,6 +246,7 @@ static int board_added(struct slot *p_slot)
int rc = 0;
enum pci_bus_speed asp, bsp, msp;
struct controller *ctrl = p_slot->ctrl;
struct pci_bus *parent = ctrl->pci_dev->subordinate;

hp_slot = p_slot->device - ctrl->slot_device_offset;

Expand All @@ -256,7 +257,7 @@ static int board_added(struct slot *p_slot)
/* Power on slot without connecting to bus */
rc = p_slot->hpc_ops->power_on_slot(p_slot);
if (rc) {
ctrl_err(ctrl, "%s: Failed to power on slot\n", __func__);
ctrl_err(ctrl, "Failed to power on slot\n");
return -1;
}

Expand All @@ -272,29 +273,27 @@ static int board_added(struct slot *p_slot)

/* turn on board, blink green LED, turn off Amber LED */
if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) {
ctrl_err(ctrl, "%s: Issue of Slot Enable command"
" failed\n", __func__);
ctrl_err(ctrl, "Issue of Slot Enable command failed\n");
return rc;
}
}

rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp);
if (rc) {
ctrl_err(ctrl, "%s: Can't get adapter speed or bus mode "
"mismatch\n", __func__);
ctrl_err(ctrl, "Can't get adapter speed or "
"bus mode mismatch\n");
return WRONG_BUS_FREQUENCY;
}

rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp);
if (rc) {
ctrl_err(ctrl, "%s: Can't get bus operation speed\n", __func__);
ctrl_err(ctrl, "Can't get bus operation speed\n");
return WRONG_BUS_FREQUENCY;
}

rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp);
if (rc) {
ctrl_err(ctrl, "%s: Can't get max bus operation speed\n",
__func__);
ctrl_err(ctrl, "Can't get max bus operation speed\n");
msp = bsp;
}

Expand All @@ -312,8 +311,7 @@ static int board_added(struct slot *p_slot)

/* turn on board, blink green LED, turn off Amber LED */
if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) {
ctrl_err(ctrl, "%s: Issue of Slot Enable command failed\n",
__func__);
ctrl_err(ctrl, "Issue of Slot Enable command failed\n");
return rc;
}

Expand All @@ -324,15 +322,15 @@ static int board_added(struct slot *p_slot)
/* Check for a power fault */
if (p_slot->status == 0xFF) {
/* power fault occurred, but it was benign */
ctrl_dbg(ctrl, "%s: power fault\n", __func__);
ctrl_dbg(ctrl, "%s: Power fault\n", __func__);
rc = POWER_FAILURE;
p_slot->status = 0;
goto err_exit;
}

if (shpchp_configure_device(p_slot)) {
ctrl_err(ctrl, "Cannot add device at 0x%x:0x%x\n",
p_slot->bus, p_slot->device);
ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n",
pci_domain_nr(parent), p_slot->bus, p_slot->device);
goto err_exit;
}

Expand Down Expand Up @@ -373,7 +371,7 @@ static int remove_board(struct slot *p_slot)
hp_slot = p_slot->device - ctrl->slot_device_offset;
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);

ctrl_dbg(ctrl, "In %s, hp_slot = %d\n", __func__, hp_slot);
ctrl_dbg(ctrl, "%s: hp_slot = %d\n", __func__, hp_slot);

/* Change status to shutdown */
if (p_slot->is_a_board)
Expand All @@ -389,8 +387,7 @@ static int remove_board(struct slot *p_slot)

rc = p_slot->hpc_ops->set_attention_status(p_slot, 0);
if (rc) {
ctrl_err(ctrl, "%s: Issue of Set Attention command failed\n",
__func__);
ctrl_err(ctrl, "Issue of Set Attention command failed\n");
return rc;
}

Expand Down Expand Up @@ -526,7 +523,6 @@ static void handle_button_press_event(struct slot *p_slot)
*/
ctrl_info(ctrl, "Button cancel on Slot(%s)\n",
slot_name(p_slot));
ctrl_dbg(ctrl, "%s: button cancel\n", __func__);
cancel_delayed_work(&p_slot->work);
if (p_slot->state == BLINKINGOFF_STATE)
p_slot->hpc_ops->green_led_on(p_slot);
Expand Down Expand Up @@ -565,7 +561,7 @@ static void interrupt_event_handler(struct work_struct *work)
handle_button_press_event(p_slot);
break;
case INT_POWER_FAULT:
ctrl_dbg(p_slot->ctrl, "%s: power fault\n", __func__);
ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__);
p_slot->hpc_ops->set_attention_status(p_slot, 1);
p_slot->hpc_ops->green_led_off(p_slot);
break;
Expand Down Expand Up @@ -660,7 +656,7 @@ static int shpchp_disable_slot (struct slot *p_slot)
}
rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (rc || !getstatus) {
ctrl_info(ctrl, "Already disabled slot(%s)\n",
ctrl_info(ctrl, "Already disabled on slot(%s)\n",
slot_name(p_slot));
goto out;
}
Expand Down
Loading

0 comments on commit be7bce2

Please sign in to comment.