Skip to content

Commit be7bce2

Browse files
izumi777jbarnes993
authored andcommitted
PCI hotplug: shpchp: message refinement
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 <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
1 parent f98ca31 commit be7bce2

File tree

5 files changed

+86
-98
lines changed

5 files changed

+86
-98
lines changed

drivers/pci/hotplug/shpchp.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static inline struct slot *shpchp_find_slot(struct controller *ctrl, u8 device)
253253
return slot;
254254
}
255255

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

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

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

304303
pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set);
305304
}

drivers/pci/hotplug/shpchp_core.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
8989
{
9090
struct slot *slot = hotplug_slot->private;
9191

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

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

139-
ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x "
140-
"slot_device_offset=%x\n", slot->bus, slot->device,
141-
slot->hp_slot, slot->number, ctrl->slot_device_offset);
139+
ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x "
140+
"hp_slot=%x sun=%x slot_device_offset=%x\n",
141+
pci_domain_nr(ctrl->pci_dev->subordinate),
142+
slot->bus, slot->device, slot->hp_slot, slot->number,
143+
ctrl->slot_device_offset);
142144
retval = pci_hp_register(slot->hotplug_slot,
143145
ctrl->pci_dev->subordinate, slot->device, name);
144146
if (retval) {
@@ -189,7 +191,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
189191
{
190192
struct slot *slot = get_slot(hotplug_slot);
191193

192-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
194+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
193195
__func__, slot_name(slot));
194196

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

205-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
207+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
206208
__func__, slot_name(slot));
207209

208210
return shpchp_sysfs_enable_slot(slot);
@@ -212,7 +214,7 @@ static int disable_slot (struct hotplug_slot *hotplug_slot)
212214
{
213215
struct slot *slot = get_slot(hotplug_slot);
214216

215-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
217+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
216218
__func__, slot_name(slot));
217219

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

226-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
228+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
227229
__func__, slot_name(slot));
228230

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

241-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
243+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
242244
__func__, slot_name(slot));
243245

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

256-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
258+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
257259
__func__, slot_name(slot));
258260

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

271-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
273+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
272274
__func__, slot_name(slot));
273275

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

287-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
289+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
288290
__func__, slot_name(slot));
289291

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

302-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
304+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
303305
__func__, slot_name(slot));
304306

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

332334
ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
333335
if (!ctrl) {
334-
dev_err(&pdev->dev, "%s : out of memory\n", __func__);
336+
dev_err(&pdev->dev, "%s: Out of memory\n", __func__);
335337
goto err_out_none;
336338
}
337339
INIT_LIST_HEAD(&ctrl->slot_list);
338340

339341
rc = shpc_init(ctrl, pdev);
340342
if (rc) {
341-
ctrl_dbg(ctrl, "controller initialization failed\n");
343+
ctrl_dbg(ctrl, "Controller initialization failed\n");
342344
goto err_out_free_ctrl;
343345
}
344346

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

drivers/pci/hotplug/shpchp_ctrl.c

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
6262
u32 event_type;
6363

6464
/* Attention Button Change */
65-
ctrl_dbg(ctrl, "Attention button interrupt received.\n");
65+
ctrl_dbg(ctrl, "Attention button interrupt received\n");
6666

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

8888
/* Switch Change */
89-
ctrl_dbg(ctrl, "Switch interrupt received.\n");
89+
ctrl_dbg(ctrl, "Switch interrupt received\n");
9090

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

9797
if (getstatus) {
9898
/*
@@ -123,7 +123,7 @@ u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
123123
u32 event_type;
124124

125125
/* Presence Change */
126-
ctrl_dbg(ctrl, "Presence/Notify input change.\n");
126+
ctrl_dbg(ctrl, "Presence/Notify input change\n");
127127

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

@@ -158,7 +158,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
158158
u32 event_type;
159159

160160
/* Power fault */
161-
ctrl_dbg(ctrl, "Power fault interrupt received.\n");
161+
ctrl_dbg(ctrl, "Power fault interrupt received\n");
162162

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

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

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

197-
ctrl_dbg(ctrl, "%s: change to speed %d\n", __func__, speed);
197+
ctrl_dbg(ctrl, "Change speed to %d\n", speed);
198198
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) {
199199
ctrl_err(ctrl, "%s: Issue of set bus speed mode command "
200200
"failed\n", __func__);
@@ -215,8 +215,8 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
215215
*/
216216
if (flag) {
217217
if (asp < bsp) {
218-
ctrl_err(ctrl, "%s: speed of bus %x and adapter %x "
219-
"mismatch\n", __func__, bsp, asp);
218+
ctrl_err(ctrl, "Speed of bus %x and adapter %x "
219+
"mismatch\n", bsp, asp);
220220
rc = WRONG_BUS_FREQUENCY;
221221
}
222222
return rc;
@@ -246,6 +246,7 @@ static int board_added(struct slot *p_slot)
246246
int rc = 0;
247247
enum pci_bus_speed asp, bsp, msp;
248248
struct controller *ctrl = p_slot->ctrl;
249+
struct pci_bus *parent = ctrl->pci_dev->subordinate;
249250

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

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

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

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

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

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

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

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

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

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

333331
if (shpchp_configure_device(p_slot)) {
334-
ctrl_err(ctrl, "Cannot add device at 0x%x:0x%x\n",
335-
p_slot->bus, p_slot->device);
332+
ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n",
333+
pci_domain_nr(parent), p_slot->bus, p_slot->device);
336334
goto err_exit;
337335
}
338336

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

376-
ctrl_dbg(ctrl, "In %s, hp_slot = %d\n", __func__, hp_slot);
374+
ctrl_dbg(ctrl, "%s: hp_slot = %d\n", __func__, hp_slot);
377375

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

390388
rc = p_slot->hpc_ops->set_attention_status(p_slot, 0);
391389
if (rc) {
392-
ctrl_err(ctrl, "%s: Issue of Set Attention command failed\n",
393-
__func__);
390+
ctrl_err(ctrl, "Issue of Set Attention command failed\n");
394391
return rc;
395392
}
396393

@@ -526,7 +523,6 @@ static void handle_button_press_event(struct slot *p_slot)
526523
*/
527524
ctrl_info(ctrl, "Button cancel on Slot(%s)\n",
528525
slot_name(p_slot));
529-
ctrl_dbg(ctrl, "%s: button cancel\n", __func__);
530526
cancel_delayed_work(&p_slot->work);
531527
if (p_slot->state == BLINKINGOFF_STATE)
532528
p_slot->hpc_ops->green_led_on(p_slot);
@@ -565,7 +561,7 @@ static void interrupt_event_handler(struct work_struct *work)
565561
handle_button_press_event(p_slot);
566562
break;
567563
case INT_POWER_FAULT:
568-
ctrl_dbg(p_slot->ctrl, "%s: power fault\n", __func__);
564+
ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__);
569565
p_slot->hpc_ops->set_attention_status(p_slot, 1);
570566
p_slot->hpc_ops->green_led_off(p_slot);
571567
break;
@@ -660,7 +656,7 @@ static int shpchp_disable_slot (struct slot *p_slot)
660656
}
661657
rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
662658
if (rc || !getstatus) {
663-
ctrl_info(ctrl, "Already disabled slot(%s)\n",
659+
ctrl_info(ctrl, "Already disabled on slot(%s)\n",
664660
slot_name(p_slot));
665661
goto out;
666662
}

0 commit comments

Comments
 (0)