Skip to content

Commit 18b341b

Browse files
izumi777jbarnes993
authored andcommitted
PCI hotplug: pciehp: message refinement
This patch refines messages in pciehp 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 8113587 commit 18b341b

File tree

5 files changed

+78
-88
lines changed

5 files changed

+78
-88
lines changed

drivers/pci/hotplug/pciehp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
188188
return slot;
189189
}
190190

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

drivers/pci/hotplug/pciehp_core.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
184184
{
185185
struct slot *slot = hotplug_slot->private;
186186

187-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
187+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
188188
__func__, hotplug_slot_name(hotplug_slot));
189189

190190
kfree(hotplug_slot->info);
@@ -216,9 +216,11 @@ static int init_slots(struct controller *ctrl)
216216
slot->hotplug_slot = hotplug_slot;
217217
snprintf(name, SLOT_NAME_SIZE, "%u", slot->number);
218218

219-
ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x "
220-
"slot_device_offset=%x\n", slot->bus, slot->device,
221-
slot->hp_slot, slot->number, ctrl->slot_device_offset);
219+
ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x "
220+
"hp_slot=%x sun=%x slot_device_offset=%x\n",
221+
pci_domain_nr(ctrl->pci_dev->subordinate),
222+
slot->bus, slot->device, slot->hp_slot, slot->number,
223+
ctrl->slot_device_offset);
222224
retval = pci_hp_register(hotplug_slot,
223225
ctrl->pci_dev->subordinate,
224226
slot->device,
@@ -238,7 +240,7 @@ static int init_slots(struct controller *ctrl)
238240
&hotplug_slot_attr_lock.attr);
239241
if (retval) {
240242
pci_hp_deregister(hotplug_slot);
241-
ctrl_err(ctrl, "cannot create additional sysfs "
243+
ctrl_err(ctrl, "Cannot create additional sysfs "
242244
"entries\n");
243245
goto error_info;
244246
}
@@ -273,7 +275,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
273275
{
274276
struct slot *slot = hotplug_slot->private;
275277

276-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
278+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
277279
__func__, slot_name(slot));
278280

279281
hotplug_slot->info->attention_status = status;
@@ -289,7 +291,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
289291
{
290292
struct slot *slot = hotplug_slot->private;
291293

292-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
294+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
293295
__func__, slot_name(slot));
294296

295297
return pciehp_sysfs_enable_slot(slot);
@@ -300,7 +302,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
300302
{
301303
struct slot *slot = hotplug_slot->private;
302304

303-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
305+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
304306
__func__, slot_name(slot));
305307

306308
return pciehp_sysfs_disable_slot(slot);
@@ -311,7 +313,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
311313
struct slot *slot = hotplug_slot->private;
312314
int retval;
313315

314-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
316+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
315317
__func__, slot_name(slot));
316318

317319
retval = slot->hpc_ops->get_power_status(slot, value);
@@ -326,7 +328,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
326328
struct slot *slot = hotplug_slot->private;
327329
int retval;
328330

329-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
331+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
330332
__func__, slot_name(slot));
331333

332334
retval = slot->hpc_ops->get_attention_status(slot, value);
@@ -341,7 +343,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
341343
struct slot *slot = hotplug_slot->private;
342344
int retval;
343345

344-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
346+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
345347
__func__, slot_name(slot));
346348

347349
retval = slot->hpc_ops->get_latch_status(slot, value);
@@ -356,7 +358,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
356358
struct slot *slot = hotplug_slot->private;
357359
int retval;
358360

359-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
361+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
360362
__func__, slot_name(slot));
361363

362364
retval = slot->hpc_ops->get_adapter_status(slot, value);
@@ -372,7 +374,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
372374
struct slot *slot = hotplug_slot->private;
373375
int retval;
374376

375-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
377+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
376378
__func__, slot_name(slot));
377379

378380
retval = slot->hpc_ops->get_max_bus_speed(slot, value);
@@ -387,7 +389,7 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
387389
struct slot *slot = hotplug_slot->private;
388390
int retval;
389391

390-
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
392+
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
391393
__func__, slot_name(slot));
392394

393395
retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
@@ -414,7 +416,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
414416

415417
ctrl = pcie_init(dev);
416418
if (!ctrl) {
417-
dev_err(&dev->device, "controller initialization failed\n");
419+
dev_err(&dev->device, "Controller initialization failed\n");
418420
goto err_out_none;
419421
}
420422
set_service_data(dev, ctrl);
@@ -423,10 +425,10 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
423425
rc = init_slots(ctrl);
424426
if (rc) {
425427
if (rc == -EBUSY)
426-
ctrl_warn(ctrl, "slot already registered by another "
428+
ctrl_warn(ctrl, "Slot already registered by another "
427429
"hotplug driver\n");
428430
else
429-
ctrl_err(ctrl, "slot initialization failed\n");
431+
ctrl_err(ctrl, "Slot initialization failed\n");
430432
goto err_out_release_ctlr;
431433
}
432434

@@ -523,7 +525,7 @@ static int __init pcied_init(void)
523525
dbg("pcie_port_service_register = %d\n", retval);
524526
info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
525527
if (retval)
526-
dbg("%s: Failure to register service\n", __func__);
528+
dbg("Failure to register service\n");
527529
return retval;
528530
}
529531

drivers/pci/hotplug/pciehp_ctrl.c

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ u8 pciehp_handle_attention_button(struct slot *p_slot)
6161
struct controller *ctrl = p_slot->ctrl;
6262

6363
/* Attention Button Change */
64-
ctrl_dbg(ctrl, "Attention button interrupt received.\n");
64+
ctrl_dbg(ctrl, "Attention button interrupt received\n");
6565

6666
/*
6767
* Button pressed - See if need to TAKE ACTION!!!
@@ -81,7 +81,7 @@ u8 pciehp_handle_switch_change(struct slot *p_slot)
8181
struct controller *ctrl = p_slot->ctrl;
8282

8383
/* Switch Change */
84-
ctrl_dbg(ctrl, "Switch interrupt received.\n");
84+
ctrl_dbg(ctrl, "Switch interrupt received\n");
8585

8686
p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
8787
if (getstatus) {
@@ -110,7 +110,7 @@ u8 pciehp_handle_presence_change(struct slot *p_slot)
110110
struct controller *ctrl = p_slot->ctrl;
111111

112112
/* Presence Change */
113-
ctrl_dbg(ctrl, "Presence/Notify input change.\n");
113+
ctrl_dbg(ctrl, "Presence/Notify input change\n");
114114

115115
/* Switch is open, assume a presence change
116116
* Save the presence state
@@ -142,7 +142,7 @@ u8 pciehp_handle_power_fault(struct slot *p_slot)
142142
struct controller *ctrl = p_slot->ctrl;
143143

144144
/* power fault */
145-
ctrl_dbg(ctrl, "Power fault interrupt received.\n");
145+
ctrl_dbg(ctrl, "Power fault interrupt received\n");
146146

147147
if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) {
148148
/*
@@ -157,7 +157,7 @@ u8 pciehp_handle_power_fault(struct slot *p_slot)
157157
*/
158158
ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot));
159159
event_type = INT_POWER_FAULT;
160-
ctrl_info(ctrl, "power fault bit %x set\n", 0);
160+
ctrl_info(ctrl, "Power fault bit %x set\n", 0);
161161
}
162162

163163
queue_interrupt_event(p_slot, event_type);
@@ -175,8 +175,7 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
175175
if (POWER_CTRL(ctrl)) {
176176
if (pslot->hpc_ops->power_off_slot(pslot)) {
177177
ctrl_err(ctrl,
178-
"%s: Issue of Slot Power Off command failed\n",
179-
__func__);
178+
"Issue of Slot Power Off command failed\n");
180179
return;
181180
}
182181
}
@@ -193,8 +192,8 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
193192

194193
if (ATTN_LED(ctrl)) {
195194
if (pslot->hpc_ops->set_attention_status(pslot, 1)) {
196-
ctrl_err(ctrl, "%s: Issue of Set Attention "
197-
"Led command failed\n", __func__);
195+
ctrl_err(ctrl,
196+
"Issue of Set Attention Led command failed\n");
198197
return;
199198
}
200199
}
@@ -211,8 +210,9 @@ static int board_added(struct slot *p_slot)
211210
{
212211
int retval = 0;
213212
struct controller *ctrl = p_slot->ctrl;
213+
struct pci_bus *parent = ctrl->pci_dev->subordinate;
214214

215-
ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d ,%d\n",
215+
ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d, %d\n",
216216
__func__, p_slot->device, ctrl->slot_device_offset,
217217
p_slot->hp_slot);
218218

@@ -229,22 +229,22 @@ static int board_added(struct slot *p_slot)
229229
/* Check link training status */
230230
retval = p_slot->hpc_ops->check_lnk_status(ctrl);
231231
if (retval) {
232-
ctrl_err(ctrl, "%s: Failed to check link status\n", __func__);
232+
ctrl_err(ctrl, "Failed to check link status\n");
233233
set_slot_off(ctrl, p_slot);
234234
return retval;
235235
}
236236

237237
/* Check for a power fault */
238238
if (p_slot->hpc_ops->query_power_fault(p_slot)) {
239-
ctrl_dbg(ctrl, "%s: power fault detected\n", __func__);
239+
ctrl_dbg(ctrl, "Power fault detected\n");
240240
retval = POWER_FAILURE;
241241
goto err_exit;
242242
}
243243

244244
retval = pciehp_configure_device(p_slot);
245245
if (retval) {
246-
ctrl_err(ctrl, "Cannot add device 0x%x:%x\n",
247-
p_slot->bus, p_slot->device);
246+
ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n",
247+
pci_domain_nr(parent), p_slot->bus, p_slot->device);
248248
goto err_exit;
249249
}
250250

@@ -276,14 +276,14 @@ static int remove_board(struct slot *p_slot)
276276
if (retval)
277277
return retval;
278278

279-
ctrl_dbg(ctrl, "In %s, hp_slot = %d\n", __func__, p_slot->hp_slot);
279+
ctrl_dbg(ctrl, "%s: hp_slot = %d\n", __func__, p_slot->hp_slot);
280280

281281
if (POWER_CTRL(ctrl)) {
282282
/* power off slot */
283283
retval = p_slot->hpc_ops->power_off_slot(p_slot);
284284
if (retval) {
285-
ctrl_err(ctrl, "%s: Issue of Slot Disable command "
286-
"failed\n", __func__);
285+
ctrl_err(ctrl,
286+
"Issue of Slot Disable command failed\n");
287287
return retval;
288288
}
289289
}
@@ -324,8 +324,10 @@ static void pciehp_power_thread(struct work_struct *work)
324324
switch (p_slot->state) {
325325
case POWEROFF_STATE:
326326
mutex_unlock(&p_slot->lock);
327-
ctrl_dbg(p_slot->ctrl, "%s: disabling bus:device(%x:%x)\n",
328-
__func__, p_slot->bus, p_slot->device);
327+
ctrl_dbg(p_slot->ctrl,
328+
"Disabling domain:bus:device=%04x:%02x:%02x\n",
329+
pci_domain_nr(p_slot->ctrl->pci_dev->subordinate),
330+
p_slot->bus, p_slot->device);
329331
pciehp_disable_slot(p_slot);
330332
mutex_lock(&p_slot->lock);
331333
p_slot->state = STATIC_STATE;
@@ -433,7 +435,6 @@ static void handle_button_press_event(struct slot *p_slot)
433435
* expires to cancel hot-add or hot-remove
434436
*/
435437
ctrl_info(ctrl, "Button cancel on Slot(%s)\n", slot_name(p_slot));
436-
ctrl_dbg(ctrl, "%s: button cancel\n", __func__);
437438
cancel_delayed_work(&p_slot->work);
438439
if (p_slot->state == BLINKINGOFF_STATE) {
439440
if (PWR_LED(ctrl))
@@ -537,16 +538,15 @@ int pciehp_enable_slot(struct slot *p_slot)
537538

538539
rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
539540
if (rc || !getstatus) {
540-
ctrl_info(ctrl, "%s: no adapter on slot(%s)\n",
541-
__func__, slot_name(p_slot));
541+
ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
542542
mutex_unlock(&p_slot->ctrl->crit_sect);
543543
return -ENODEV;
544544
}
545545
if (MRL_SENS(p_slot->ctrl)) {
546546
rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
547547
if (rc || getstatus) {
548-
ctrl_info(ctrl, "%s: latch open on slot(%s)\n",
549-
__func__, slot_name(p_slot));
548+
ctrl_info(ctrl, "Latch open on slot(%s)\n",
549+
slot_name(p_slot));
550550
mutex_unlock(&p_slot->ctrl->crit_sect);
551551
return -ENODEV;
552552
}
@@ -555,8 +555,8 @@ int pciehp_enable_slot(struct slot *p_slot)
555555
if (POWER_CTRL(p_slot->ctrl)) {
556556
rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
557557
if (rc || getstatus) {
558-
ctrl_info(ctrl, "%s: already enabled on slot(%s)\n",
559-
__func__, slot_name(p_slot));
558+
ctrl_info(ctrl, "Already enabled on slot(%s)\n",
559+
slot_name(p_slot));
560560
mutex_unlock(&p_slot->ctrl->crit_sect);
561561
return -EINVAL;
562562
}
@@ -591,8 +591,8 @@ int pciehp_disable_slot(struct slot *p_slot)
591591
if (!HP_SUPR_RM(p_slot->ctrl)) {
592592
ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
593593
if (ret || !getstatus) {
594-
ctrl_info(ctrl, "%s: no adapter on slot(%s)\n",
595-
__func__, slot_name(p_slot));
594+
ctrl_info(ctrl, "No adapter on slot(%s)\n",
595+
slot_name(p_slot));
596596
mutex_unlock(&p_slot->ctrl->crit_sect);
597597
return -ENODEV;
598598
}
@@ -601,8 +601,8 @@ int pciehp_disable_slot(struct slot *p_slot)
601601
if (MRL_SENS(p_slot->ctrl)) {
602602
ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
603603
if (ret || getstatus) {
604-
ctrl_info(ctrl, "%s: latch open on slot(%s)\n",
605-
__func__, slot_name(p_slot));
604+
ctrl_info(ctrl, "Latch open on slot(%s)\n",
605+
slot_name(p_slot));
606606
mutex_unlock(&p_slot->ctrl->crit_sect);
607607
return -ENODEV;
608608
}
@@ -611,8 +611,8 @@ int pciehp_disable_slot(struct slot *p_slot)
611611
if (POWER_CTRL(p_slot->ctrl)) {
612612
ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
613613
if (ret || !getstatus) {
614-
ctrl_info(ctrl, "%s: already disabled slot(%s)\n",
615-
__func__, slot_name(p_slot));
614+
ctrl_info(ctrl, "Already disabled on slot(%s)\n",
615+
slot_name(p_slot));
616616
mutex_unlock(&p_slot->ctrl->crit_sect);
617617
return -EINVAL;
618618
}

0 commit comments

Comments
 (0)