Skip to content

Commit f98ca31

Browse files
izumi777jbarnes993
authored andcommitted
PCI hotplug: shpchp: replace printk with dev_printk
This patch replaces printks within shpchp module with dev_printks. Signed-off-by: Taku Izumi <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
1 parent 388c8c1 commit f98ca31

File tree

5 files changed

+224
-159
lines changed

5 files changed

+224
-159
lines changed

drivers/pci/hotplug/shpchp.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ extern struct workqueue_struct *shpchp_wq;
5959
#define warn(format, arg...) \
6060
printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
6161

62+
#define ctrl_dbg(ctrl, format, arg...) \
63+
do { \
64+
if (shpchp_debug) \
65+
dev_printk(, &ctrl->pci_dev->dev, \
66+
format, ## arg); \
67+
} while (0)
68+
#define ctrl_err(ctrl, format, arg...) \
69+
dev_err(&ctrl->pci_dev->dev, format, ## arg)
70+
#define ctrl_info(ctrl, format, arg...) \
71+
dev_info(&ctrl->pci_dev->dev, format, ## arg)
72+
#define ctrl_warn(ctrl, format, arg...) \
73+
dev_warn(&ctrl->pci_dev->dev, format, ## arg)
74+
75+
6276
#define SLOT_NAME_SIZE 10
6377
struct slot {
6478
u8 bus;
@@ -239,7 +253,7 @@ static inline struct slot *shpchp_find_slot(struct controller *ctrl, u8 device)
239253
return slot;
240254
}
241255

242-
err("%s: slot (device=0x%x) not found\n", __func__, device);
256+
ctrl_err(ctrl, "%s: slot (device=0x%x) not found\n", __func__, device);
243257
return NULL;
244258
}
245259

@@ -273,7 +287,9 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
273287
pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, &pcix_bridge_errors_reg);
274288
perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK;
275289
if (perr_set) {
276-
dbg ("%s W1C: Bridge_Errors[ PERR_OBSERVED = %08X]\n",__func__ , perr_set);
290+
ctrl_dbg(p_slot->ctrl,
291+
"%s W1C: Bridge_Errors[ PERR_OBSERVED = %08X]\n",
292+
__func__ , perr_set);
277293

278294
pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set);
279295
}
@@ -282,7 +298,8 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
282298
pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg);
283299
rse_set = pcix_mem_base_reg & RSE_MASK;
284300
if (rse_set) {
285-
dbg ("%s W1C: Memory_Base_Limit[ RSE ]\n",__func__ );
301+
ctrl_dbg(p_slot->ctrl, "%s W1C: Memory_Base_Limit[ RSE ]\n",
302+
__func__);
286303

287304
pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set);
288305
}

drivers/pci/hotplug/shpchp_core.c

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

92-
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
92+
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
93+
__func__, slot_name(slot));
9394

9495
kfree(slot->hotplug_slot->info);
9596
kfree(slot->hotplug_slot);
@@ -135,13 +136,14 @@ static int init_slots(struct controller *ctrl)
135136
snprintf(name, SLOT_NAME_SIZE, "%d", slot->number);
136137
hotplug_slot->ops = &shpchp_hotplug_slot_ops;
137138

138-
dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x "
139-
"slot_device_offset=%x\n", slot->bus, slot->device,
140-
slot->hp_slot, slot->number, ctrl->slot_device_offset);
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);
141142
retval = pci_hp_register(slot->hotplug_slot,
142143
ctrl->pci_dev->subordinate, slot->device, name);
143144
if (retval) {
144-
err("pci_hp_register failed with error %d\n", retval);
145+
ctrl_err(ctrl, "pci_hp_register failed with error %d\n",
146+
retval);
145147
goto error_info;
146148
}
147149

@@ -187,7 +189,8 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
187189
{
188190
struct slot *slot = get_slot(hotplug_slot);
189191

190-
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
192+
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
193+
__func__, slot_name(slot));
191194

192195
hotplug_slot->info->attention_status = status;
193196
slot->hpc_ops->set_attention_status(slot, status);
@@ -199,7 +202,8 @@ static int enable_slot (struct hotplug_slot *hotplug_slot)
199202
{
200203
struct slot *slot = get_slot(hotplug_slot);
201204

202-
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
205+
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
206+
__func__, slot_name(slot));
203207

204208
return shpchp_sysfs_enable_slot(slot);
205209
}
@@ -208,7 +212,8 @@ static int disable_slot (struct hotplug_slot *hotplug_slot)
208212
{
209213
struct slot *slot = get_slot(hotplug_slot);
210214

211-
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
215+
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
216+
__func__, slot_name(slot));
212217

213218
return shpchp_sysfs_disable_slot(slot);
214219
}
@@ -218,7 +223,8 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
218223
struct slot *slot = get_slot(hotplug_slot);
219224
int retval;
220225

221-
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
226+
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
227+
__func__, slot_name(slot));
222228

223229
retval = slot->hpc_ops->get_power_status(slot, value);
224230
if (retval < 0)
@@ -232,7 +238,8 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
232238
struct slot *slot = get_slot(hotplug_slot);
233239
int retval;
234240

235-
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
241+
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
242+
__func__, slot_name(slot));
236243

237244
retval = slot->hpc_ops->get_attention_status(slot, value);
238245
if (retval < 0)
@@ -246,7 +253,8 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
246253
struct slot *slot = get_slot(hotplug_slot);
247254
int retval;
248255

249-
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
256+
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
257+
__func__, slot_name(slot));
250258

251259
retval = slot->hpc_ops->get_latch_status(slot, value);
252260
if (retval < 0)
@@ -260,7 +268,8 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
260268
struct slot *slot = get_slot(hotplug_slot);
261269
int retval;
262270

263-
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
271+
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
272+
__func__, slot_name(slot));
264273

265274
retval = slot->hpc_ops->get_adapter_status(slot, value);
266275
if (retval < 0)
@@ -275,7 +284,8 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
275284
struct slot *slot = get_slot(hotplug_slot);
276285
int retval;
277286

278-
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
287+
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
288+
__func__, slot_name(slot));
279289

280290
retval = slot->hpc_ops->get_max_bus_speed(slot, value);
281291
if (retval < 0)
@@ -289,7 +299,8 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp
289299
struct slot *slot = get_slot(hotplug_slot);
290300
int retval;
291301

292-
dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
302+
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
303+
__func__, slot_name(slot));
293304

294305
retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
295306
if (retval < 0)
@@ -320,15 +331,14 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
320331

321332
ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
322333
if (!ctrl) {
323-
err("%s : out of memory\n", __func__);
334+
dev_err(&pdev->dev, "%s : out of memory\n", __func__);
324335
goto err_out_none;
325336
}
326337
INIT_LIST_HEAD(&ctrl->slot_list);
327338

328339
rc = shpc_init(ctrl, pdev);
329340
if (rc) {
330-
dbg("%s: controller initialization failed\n",
331-
SHPC_MODULE_NAME);
341+
ctrl_dbg(ctrl, "controller initialization failed\n");
332342
goto err_out_free_ctrl;
333343
}
334344

@@ -337,7 +347,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
337347
/* Setup the slot information structures */
338348
rc = init_slots(ctrl);
339349
if (rc) {
340-
err("%s: slot initialization failed\n", SHPC_MODULE_NAME);
350+
ctrl_err(ctrl, "slot initialization failed\n");
341351
goto err_out_release_ctlr;
342352
}
343353

0 commit comments

Comments
 (0)