aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorTaku Izumi <izumi.taku@jp.fujitsu.com>2008-10-22 22:52:12 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-10-23 19:11:50 -0400
commitf98ca311f3a32e2adc229fecd6bf732db07fcca3 (patch)
tree70605c5063f72f93a08d350b0fcb66fd359b7996 /drivers/pci
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')
-rw-r--r--drivers/pci/hotplug/shpchp.h23
-rw-r--r--drivers/pci/hotplug/shpchp_core.c46
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c162
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c120
-rw-r--r--drivers/pci/hotplug/shpchp_pci.c32
5 files changed, 224 insertions, 159 deletions
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index 4d9fed00e1d0..0d48d38cbf41 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -59,6 +59,20 @@ extern struct workqueue_struct *shpchp_wq;
59#define warn(format, arg...) \ 59#define warn(format, arg...) \
60 printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) 60 printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
61 61
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
62#define SLOT_NAME_SIZE 10 76#define SLOT_NAME_SIZE 10
63struct slot { 77struct slot {
64 u8 bus; 78 u8 bus;
@@ -239,7 +253,7 @@ static inline struct slot *shpchp_find_slot(struct controller *ctrl, u8 device)
239 return slot; 253 return slot;
240 } 254 }
241 255
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);
243 return NULL; 257 return NULL;
244} 258}
245 259
@@ -273,7 +287,9 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
273 pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, &pcix_bridge_errors_reg); 287 pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, &pcix_bridge_errors_reg);
274 perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK; 288 perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK;
275 if (perr_set) { 289 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);
277 293
278 pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set); 294 pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set);
279 } 295 }
@@ -282,7 +298,8 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
282 pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg); 298 pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg);
283 rse_set = pcix_mem_base_reg & RSE_MASK; 299 rse_set = pcix_mem_base_reg & RSE_MASK;
284 if (rse_set) { 300 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__);
286 303
287 pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); 304 pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set);
288 } 305 }
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 7af9191df4d6..214633bf4abc 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -89,7 +89,8 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
89{ 89{
90 struct slot *slot = hotplug_slot->private; 90 struct slot *slot = hotplug_slot->private;
91 91
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));
93 94
94 kfree(slot->hotplug_slot->info); 95 kfree(slot->hotplug_slot->info);
95 kfree(slot->hotplug_slot); 96 kfree(slot->hotplug_slot);
@@ -135,13 +136,14 @@ static int init_slots(struct controller *ctrl)
135 snprintf(name, SLOT_NAME_SIZE, "%d", slot->number); 136 snprintf(name, SLOT_NAME_SIZE, "%d", slot->number);
136 hotplug_slot->ops = &shpchp_hotplug_slot_ops; 137 hotplug_slot->ops = &shpchp_hotplug_slot_ops;
137 138
138 dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " 139 ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x "
139 "slot_device_offset=%x\n", slot->bus, slot->device, 140 "slot_device_offset=%x\n", slot->bus, slot->device,
140 slot->hp_slot, slot->number, ctrl->slot_device_offset); 141 slot->hp_slot, slot->number, ctrl->slot_device_offset);
141 retval = pci_hp_register(slot->hotplug_slot, 142 retval = pci_hp_register(slot->hotplug_slot,
142 ctrl->pci_dev->subordinate, slot->device, name); 143 ctrl->pci_dev->subordinate, slot->device, name);
143 if (retval) { 144 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);
145 goto error_info; 147 goto error_info;
146 } 148 }
147 149
@@ -187,7 +189,8 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
187{ 189{
188 struct slot *slot = get_slot(hotplug_slot); 190 struct slot *slot = get_slot(hotplug_slot);
189 191
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));
191 194
192 hotplug_slot->info->attention_status = status; 195 hotplug_slot->info->attention_status = status;
193 slot->hpc_ops->set_attention_status(slot, status); 196 slot->hpc_ops->set_attention_status(slot, status);
@@ -199,7 +202,8 @@ static int enable_slot (struct hotplug_slot *hotplug_slot)
199{ 202{
200 struct slot *slot = get_slot(hotplug_slot); 203 struct slot *slot = get_slot(hotplug_slot);
201 204
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));
203 207
204 return shpchp_sysfs_enable_slot(slot); 208 return shpchp_sysfs_enable_slot(slot);
205} 209}
@@ -208,7 +212,8 @@ static int disable_slot (struct hotplug_slot *hotplug_slot)
208{ 212{
209 struct slot *slot = get_slot(hotplug_slot); 213 struct slot *slot = get_slot(hotplug_slot);
210 214
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));
212 217
213 return shpchp_sysfs_disable_slot(slot); 218 return shpchp_sysfs_disable_slot(slot);
214} 219}
@@ -218,7 +223,8 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
218 struct slot *slot = get_slot(hotplug_slot); 223 struct slot *slot = get_slot(hotplug_slot);
219 int retval; 224 int retval;
220 225
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));
222 228
223 retval = slot->hpc_ops->get_power_status(slot, value); 229 retval = slot->hpc_ops->get_power_status(slot, value);
224 if (retval < 0) 230 if (retval < 0)
@@ -232,7 +238,8 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
232 struct slot *slot = get_slot(hotplug_slot); 238 struct slot *slot = get_slot(hotplug_slot);
233 int retval; 239 int retval;
234 240
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));
236 243
237 retval = slot->hpc_ops->get_attention_status(slot, value); 244 retval = slot->hpc_ops->get_attention_status(slot, value);
238 if (retval < 0) 245 if (retval < 0)
@@ -246,7 +253,8 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
246 struct slot *slot = get_slot(hotplug_slot); 253 struct slot *slot = get_slot(hotplug_slot);
247 int retval; 254 int retval;
248 255
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));
250 258
251 retval = slot->hpc_ops->get_latch_status(slot, value); 259 retval = slot->hpc_ops->get_latch_status(slot, value);
252 if (retval < 0) 260 if (retval < 0)
@@ -260,7 +268,8 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
260 struct slot *slot = get_slot(hotplug_slot); 268 struct slot *slot = get_slot(hotplug_slot);
261 int retval; 269 int retval;
262 270
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));
264 273
265 retval = slot->hpc_ops->get_adapter_status(slot, value); 274 retval = slot->hpc_ops->get_adapter_status(slot, value);
266 if (retval < 0) 275 if (retval < 0)
@@ -275,7 +284,8 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
275 struct slot *slot = get_slot(hotplug_slot); 284 struct slot *slot = get_slot(hotplug_slot);
276 int retval; 285 int retval;
277 286
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));
279 289
280 retval = slot->hpc_ops->get_max_bus_speed(slot, value); 290 retval = slot->hpc_ops->get_max_bus_speed(slot, value);
281 if (retval < 0) 291 if (retval < 0)
@@ -289,7 +299,8 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp
289 struct slot *slot = get_slot(hotplug_slot); 299 struct slot *slot = get_slot(hotplug_slot);
290 int retval; 300 int retval;
291 301
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));
293 304
294 retval = slot->hpc_ops->get_cur_bus_speed(slot, value); 305 retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
295 if (retval < 0) 306 if (retval < 0)
@@ -320,15 +331,14 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
320 331
321 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); 332 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
322 if (!ctrl) { 333 if (!ctrl) {
323 err("%s : out of memory\n", __func__); 334 dev_err(&pdev->dev, "%s : out of memory\n", __func__);
324 goto err_out_none; 335 goto err_out_none;
325 } 336 }
326 INIT_LIST_HEAD(&ctrl->slot_list); 337 INIT_LIST_HEAD(&ctrl->slot_list);
327 338
328 rc = shpc_init(ctrl, pdev); 339 rc = shpc_init(ctrl, pdev);
329 if (rc) { 340 if (rc) {
330 dbg("%s: controller initialization failed\n", 341 ctrl_dbg(ctrl, "controller initialization failed\n");
331 SHPC_MODULE_NAME);
332 goto err_out_free_ctrl; 342 goto err_out_free_ctrl;
333 } 343 }
334 344
@@ -337,7 +347,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
337 /* Setup the slot information structures */ 347 /* Setup the slot information structures */
338 rc = init_slots(ctrl); 348 rc = init_slots(ctrl);
339 if (rc) { 349 if (rc) {
340 err("%s: slot initialization failed\n", SHPC_MODULE_NAME); 350 ctrl_err(ctrl, "slot initialization failed\n");
341 goto err_out_release_ctlr; 351 goto err_out_release_ctlr;
342 } 352 }
343 353
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index 919b1ee44313..c9049f17864e 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -62,7 +62,7 @@ u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
62 u32 event_type; 62 u32 event_type;
63 63
64 /* Attention Button Change */ 64 /* Attention Button Change */
65 dbg("shpchp: Attention button interrupt received.\n"); 65 ctrl_dbg(ctrl, "Attention button interrupt received.\n");
66 66
67 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 67 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
68 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); 68 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
@@ -70,7 +70,7 @@ u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
70 /* 70 /*
71 * Button pressed - See if need to TAKE ACTION!!! 71 * Button pressed - See if need to TAKE ACTION!!!
72 */ 72 */
73 info("Button pressed on Slot(%s)\n", slot_name(p_slot)); 73 ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot));
74 event_type = INT_BUTTON_PRESS; 74 event_type = INT_BUTTON_PRESS;
75 75
76 queue_interrupt_event(p_slot, event_type); 76 queue_interrupt_event(p_slot, event_type);
@@ -86,29 +86,29 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
86 u32 event_type; 86 u32 event_type;
87 87
88 /* Switch Change */ 88 /* Switch Change */
89 dbg("shpchp: Switch interrupt received.\n"); 89 ctrl_dbg(ctrl, "Switch interrupt received.\n");
90 90
91 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 91 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
92 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); 92 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
93 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 93 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
94 dbg("%s: Card present %x Power status %x\n", __func__, 94 ctrl_dbg(ctrl, "%s: Card present %x Power status %x\n",
95 p_slot->presence_save, p_slot->pwr_save); 95 __func__, p_slot->presence_save, p_slot->pwr_save);
96 96
97 if (getstatus) { 97 if (getstatus) {
98 /* 98 /*
99 * Switch opened 99 * Switch opened
100 */ 100 */
101 info("Latch open on Slot(%s)\n", slot_name(p_slot)); 101 ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot));
102 event_type = INT_SWITCH_OPEN; 102 event_type = INT_SWITCH_OPEN;
103 if (p_slot->pwr_save && p_slot->presence_save) { 103 if (p_slot->pwr_save && p_slot->presence_save) {
104 event_type = INT_POWER_FAULT; 104 event_type = INT_POWER_FAULT;
105 err("Surprise Removal of card\n"); 105 ctrl_err(ctrl, "Surprise Removal of card\n");
106 } 106 }
107 } else { 107 } else {
108 /* 108 /*
109 * Switch closed 109 * Switch closed
110 */ 110 */
111 info("Latch close on Slot(%s)\n", slot_name(p_slot)); 111 ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot));
112 event_type = INT_SWITCH_CLOSE; 112 event_type = INT_SWITCH_CLOSE;
113 } 113 }
114 114
@@ -123,7 +123,7 @@ u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
123 u32 event_type; 123 u32 event_type;
124 124
125 /* Presence Change */ 125 /* Presence Change */
126 dbg("shpchp: Presence/Notify input change.\n"); 126 ctrl_dbg(ctrl, "Presence/Notify input change.\n");
127 127
128 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 128 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
129 129
@@ -135,13 +135,15 @@ u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
135 /* 135 /*
136 * Card Present 136 * Card Present
137 */ 137 */
138 info("Card present on Slot(%s)\n", slot_name(p_slot)); 138 ctrl_info(ctrl, "Card present on Slot(%s)\n",
139 slot_name(p_slot));
139 event_type = INT_PRESENCE_ON; 140 event_type = INT_PRESENCE_ON;
140 } else { 141 } else {
141 /* 142 /*
142 * Not Present 143 * Not Present
143 */ 144 */
144 info("Card not present on Slot(%s)\n", slot_name(p_slot)); 145 ctrl_info(ctrl, "Card not present on Slot(%s)\n",
146 slot_name(p_slot));
145 event_type = INT_PRESENCE_OFF; 147 event_type = INT_PRESENCE_OFF;
146 } 148 }
147 149
@@ -156,7 +158,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
156 u32 event_type; 158 u32 event_type;
157 159
158 /* Power fault */ 160 /* Power fault */
159 dbg("shpchp: Power fault interrupt received.\n"); 161 ctrl_dbg(ctrl, "Power fault interrupt received.\n");
160 162
161 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 163 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
162 164
@@ -164,18 +166,19 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
164 /* 166 /*
165 * Power fault Cleared 167 * Power fault Cleared
166 */ 168 */
167 info("Power fault cleared on Slot(%s)\n", slot_name(p_slot)); 169 ctrl_info(ctrl, "Power fault cleared on Slot(%s)\n",
170 slot_name(p_slot));
168 p_slot->status = 0x00; 171 p_slot->status = 0x00;
169 event_type = INT_POWER_FAULT_CLEAR; 172 event_type = INT_POWER_FAULT_CLEAR;
170 } else { 173 } else {
171 /* 174 /*
172 * Power fault 175 * Power fault
173 */ 176 */
174 info("Power fault on Slot(%s)\n", slot_name(p_slot)); 177 ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot));
175 event_type = INT_POWER_FAULT; 178 event_type = INT_POWER_FAULT;
176 /* set power fault status for this board */ 179 /* set power fault status for this board */
177 p_slot->status = 0xFF; 180 p_slot->status = 0xFF;
178 info("power fault bit %x set\n", hp_slot); 181 ctrl_info(ctrl, "power fault bit %x set\n", hp_slot);
179 } 182 }
180 183
181 queue_interrupt_event(p_slot, event_type); 184 queue_interrupt_event(p_slot, event_type);
@@ -191,10 +194,10 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
191{ 194{
192 int rc = 0; 195 int rc = 0;
193 196
194 dbg("%s: change to speed %d\n", __func__, speed); 197 ctrl_dbg(ctrl, "%s: change to speed %d\n", __func__, speed);
195 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { 198 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) {
196 err("%s: Issue of set bus speed mode command failed\n", 199 ctrl_err(ctrl, "%s: Issue of set bus speed mode command "
197 __func__); 200 "failed\n", __func__);
198 return WRONG_BUS_FREQUENCY; 201 return WRONG_BUS_FREQUENCY;
199 } 202 }
200 return rc; 203 return rc;
@@ -212,8 +215,8 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
212 */ 215 */
213 if (flag) { 216 if (flag) {
214 if (asp < bsp) { 217 if (asp < bsp) {
215 err("%s: speed of bus %x and adapter %x mismatch\n", 218 ctrl_err(ctrl, "%s: speed of bus %x and adapter %x "
216 __func__, bsp, asp); 219 "mismatch\n", __func__, bsp, asp);
217 rc = WRONG_BUS_FREQUENCY; 220 rc = WRONG_BUS_FREQUENCY;
218 } 221 }
219 return rc; 222 return rc;
@@ -246,14 +249,14 @@ static int board_added(struct slot *p_slot)
246 249
247 hp_slot = p_slot->device - ctrl->slot_device_offset; 250 hp_slot = p_slot->device - ctrl->slot_device_offset;
248 251
249 dbg("%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", 252 ctrl_dbg(ctrl,
250 __func__, p_slot->device, 253 "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n",
251 ctrl->slot_device_offset, hp_slot); 254 __func__, p_slot->device, ctrl->slot_device_offset, hp_slot);
252 255
253 /* Power on slot without connecting to bus */ 256 /* Power on slot without connecting to bus */
254 rc = p_slot->hpc_ops->power_on_slot(p_slot); 257 rc = p_slot->hpc_ops->power_on_slot(p_slot);
255 if (rc) { 258 if (rc) {
256 err("%s: Failed to power on slot\n", __func__); 259 ctrl_err(ctrl, "%s: Failed to power on slot\n", __func__);
257 return -1; 260 return -1;
258 } 261 }
259 262
@@ -262,33 +265,36 @@ static int board_added(struct slot *p_slot)
262 return WRONG_BUS_FREQUENCY; 265 return WRONG_BUS_FREQUENCY;
263 266
264 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { 267 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) {
265 err("%s: Issue of set bus speed mode command failed\n", __func__); 268 ctrl_err(ctrl, "%s: Issue of set bus speed mode command"
269 " failed\n", __func__);
266 return WRONG_BUS_FREQUENCY; 270 return WRONG_BUS_FREQUENCY;
267 } 271 }
268 272
269 /* turn on board, blink green LED, turn off Amber LED */ 273 /* turn on board, blink green LED, turn off Amber LED */
270 if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { 274 if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) {
271 err("%s: Issue of Slot Enable command failed\n", __func__); 275 ctrl_err(ctrl, "%s: Issue of Slot Enable command"
276 " failed\n", __func__);
272 return rc; 277 return rc;
273 } 278 }
274 } 279 }
275 280
276 rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); 281 rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp);
277 if (rc) { 282 if (rc) {
278 err("%s: Can't get adapter speed or bus mode mismatch\n", 283 ctrl_err(ctrl, "%s: Can't get adapter speed or bus mode "
279 __func__); 284 "mismatch\n", __func__);
280 return WRONG_BUS_FREQUENCY; 285 return WRONG_BUS_FREQUENCY;
281 } 286 }
282 287
283 rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp); 288 rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp);
284 if (rc) { 289 if (rc) {
285 err("%s: Can't get bus operation speed\n", __func__); 290 ctrl_err(ctrl, "%s: Can't get bus operation speed\n", __func__);
286 return WRONG_BUS_FREQUENCY; 291 return WRONG_BUS_FREQUENCY;
287 } 292 }
288 293
289 rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp); 294 rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp);
290 if (rc) { 295 if (rc) {
291 err("%s: Can't get max bus operation speed\n", __func__); 296 ctrl_err(ctrl, "%s: Can't get max bus operation speed\n",
297 __func__);
292 msp = bsp; 298 msp = bsp;
293 } 299 }
294 300
@@ -296,9 +302,9 @@ static int board_added(struct slot *p_slot)
296 if (!list_empty(&ctrl->pci_dev->subordinate->devices)) 302 if (!list_empty(&ctrl->pci_dev->subordinate->devices))
297 slots_not_empty = 1; 303 slots_not_empty = 1;
298 304
299 dbg("%s: slots_not_empty %d, adapter_speed %d, bus_speed %d, " 305 ctrl_dbg(ctrl, "%s: slots_not_empty %d, adapter_speed %d, bus_speed %d,"
300 "max_bus_speed %d\n", __func__, slots_not_empty, asp, 306 " max_bus_speed %d\n", __func__, slots_not_empty, asp,
301 bsp, msp); 307 bsp, msp);
302 308
303 rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); 309 rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp);
304 if (rc) 310 if (rc)
@@ -306,26 +312,27 @@ static int board_added(struct slot *p_slot)
306 312
307 /* turn on board, blink green LED, turn off Amber LED */ 313 /* turn on board, blink green LED, turn off Amber LED */
308 if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { 314 if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) {
309 err("%s: Issue of Slot Enable command failed\n", __func__); 315 ctrl_err(ctrl, "%s: Issue of Slot Enable command failed\n",
316 __func__);
310 return rc; 317 return rc;
311 } 318 }
312 319
313 /* Wait for ~1 second */ 320 /* Wait for ~1 second */
314 msleep(1000); 321 msleep(1000);
315 322
316 dbg("%s: slot status = %x\n", __func__, p_slot->status); 323 ctrl_dbg(ctrl, "%s: slot status = %x\n", __func__, p_slot->status);
317 /* Check for a power fault */ 324 /* Check for a power fault */
318 if (p_slot->status == 0xFF) { 325 if (p_slot->status == 0xFF) {
319 /* power fault occurred, but it was benign */ 326 /* power fault occurred, but it was benign */
320 dbg("%s: power fault\n", __func__); 327 ctrl_dbg(ctrl, "%s: power fault\n", __func__);
321 rc = POWER_FAILURE; 328 rc = POWER_FAILURE;
322 p_slot->status = 0; 329 p_slot->status = 0;
323 goto err_exit; 330 goto err_exit;
324 } 331 }
325 332
326 if (shpchp_configure_device(p_slot)) { 333 if (shpchp_configure_device(p_slot)) {
327 err("Cannot add device at 0x%x:0x%x\n", p_slot->bus, 334 ctrl_err(ctrl, "Cannot add device at 0x%x:0x%x\n",
328 p_slot->device); 335 p_slot->bus, p_slot->device);
329 goto err_exit; 336 goto err_exit;
330 } 337 }
331 338
@@ -341,7 +348,8 @@ err_exit:
341 /* turn off slot, turn on Amber LED, turn off Green LED */ 348 /* turn off slot, turn on Amber LED, turn off Green LED */
342 rc = p_slot->hpc_ops->slot_disable(p_slot); 349 rc = p_slot->hpc_ops->slot_disable(p_slot);
343 if (rc) { 350 if (rc) {
344 err("%s: Issue of Slot Disable command failed\n", __func__); 351 ctrl_err(ctrl, "%s: Issue of Slot Disable command failed\n",
352 __func__);
345 return rc; 353 return rc;
346 } 354 }
347 355
@@ -365,7 +373,7 @@ static int remove_board(struct slot *p_slot)
365 hp_slot = p_slot->device - ctrl->slot_device_offset; 373 hp_slot = p_slot->device - ctrl->slot_device_offset;
366 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 374 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
367 375
368 dbg("In %s, hp_slot = %d\n", __func__, hp_slot); 376 ctrl_dbg(ctrl, "In %s, hp_slot = %d\n", __func__, hp_slot);
369 377
370 /* Change status to shutdown */ 378 /* Change status to shutdown */
371 if (p_slot->is_a_board) 379 if (p_slot->is_a_board)
@@ -374,13 +382,15 @@ static int remove_board(struct slot *p_slot)
374 /* turn off slot, turn on Amber LED, turn off Green LED */ 382 /* turn off slot, turn on Amber LED, turn off Green LED */
375 rc = p_slot->hpc_ops->slot_disable(p_slot); 383 rc = p_slot->hpc_ops->slot_disable(p_slot);
376 if (rc) { 384 if (rc) {
377 err("%s: Issue of Slot Disable command failed\n", __func__); 385 ctrl_err(ctrl, "%s: Issue of Slot Disable command failed\n",
386 __func__);
378 return rc; 387 return rc;
379 } 388 }
380 389
381 rc = p_slot->hpc_ops->set_attention_status(p_slot, 0); 390 rc = p_slot->hpc_ops->set_attention_status(p_slot, 0);
382 if (rc) { 391 if (rc) {
383 err("%s: Issue of Set Attention command failed\n", __func__); 392 ctrl_err(ctrl, "%s: Issue of Set Attention command failed\n",
393 __func__);
384 return rc; 394 return rc;
385 } 395 }
386 396
@@ -439,7 +449,8 @@ void shpchp_queue_pushbutton_work(struct work_struct *work)
439 449
440 info = kmalloc(sizeof(*info), GFP_KERNEL); 450 info = kmalloc(sizeof(*info), GFP_KERNEL);
441 if (!info) { 451 if (!info) {
442 err("%s: Cannot allocate memory\n", __func__); 452 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n",
453 __func__);
443 return; 454 return;
444 } 455 }
445 info->p_slot = p_slot; 456 info->p_slot = p_slot;
@@ -486,18 +497,19 @@ static int update_slot_info (struct slot *slot)
486static void handle_button_press_event(struct slot *p_slot) 497static void handle_button_press_event(struct slot *p_slot)
487{ 498{
488 u8 getstatus; 499 u8 getstatus;
500 struct controller *ctrl = p_slot->ctrl;
489 501
490 switch (p_slot->state) { 502 switch (p_slot->state) {
491 case STATIC_STATE: 503 case STATIC_STATE:
492 p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 504 p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
493 if (getstatus) { 505 if (getstatus) {
494 p_slot->state = BLINKINGOFF_STATE; 506 p_slot->state = BLINKINGOFF_STATE;
495 info("PCI slot #%s - powering off due to button " 507 ctrl_info(ctrl, "PCI slot #%s - powering off due to "
496 "press.\n", slot_name(p_slot)); 508 "button press.\n", slot_name(p_slot));
497 } else { 509 } else {
498 p_slot->state = BLINKINGON_STATE; 510 p_slot->state = BLINKINGON_STATE;
499 info("PCI slot #%s - powering on due to button " 511 ctrl_info(ctrl, "PCI slot #%s - powering on due to "
500 "press.\n", slot_name(p_slot)); 512 "button press.\n", slot_name(p_slot));
501 } 513 }
502 /* blink green LED and turn off amber */ 514 /* blink green LED and turn off amber */
503 p_slot->hpc_ops->green_led_blink(p_slot); 515 p_slot->hpc_ops->green_led_blink(p_slot);
@@ -512,16 +524,17 @@ static void handle_button_press_event(struct slot *p_slot)
512 * press the attention again before the 5 sec. limit 524 * press the attention again before the 5 sec. limit
513 * expires to cancel hot-add or hot-remove 525 * expires to cancel hot-add or hot-remove
514 */ 526 */
515 info("Button cancel on Slot(%s)\n", slot_name(p_slot)); 527 ctrl_info(ctrl, "Button cancel on Slot(%s)\n",
516 dbg("%s: button cancel\n", __func__); 528 slot_name(p_slot));
529 ctrl_dbg(ctrl, "%s: button cancel\n", __func__);
517 cancel_delayed_work(&p_slot->work); 530 cancel_delayed_work(&p_slot->work);
518 if (p_slot->state == BLINKINGOFF_STATE) 531 if (p_slot->state == BLINKINGOFF_STATE)
519 p_slot->hpc_ops->green_led_on(p_slot); 532 p_slot->hpc_ops->green_led_on(p_slot);
520 else 533 else
521 p_slot->hpc_ops->green_led_off(p_slot); 534 p_slot->hpc_ops->green_led_off(p_slot);
522 p_slot->hpc_ops->set_attention_status(p_slot, 0); 535 p_slot->hpc_ops->set_attention_status(p_slot, 0);
523 info("PCI slot #%s - action canceled due to button press\n", 536 ctrl_info(ctrl, "PCI slot #%s - action canceled due to "
524 slot_name(p_slot)); 537 "button press\n", slot_name(p_slot));
525 p_slot->state = STATIC_STATE; 538 p_slot->state = STATIC_STATE;
526 break; 539 break;
527 case POWEROFF_STATE: 540 case POWEROFF_STATE:
@@ -531,11 +544,12 @@ static void handle_button_press_event(struct slot *p_slot)
531 * this means that the previous attention button action 544 * this means that the previous attention button action
532 * to hot-add or hot-remove is undergoing 545 * to hot-add or hot-remove is undergoing
533 */ 546 */
534 info("Button ignore on Slot(%s)\n", slot_name(p_slot)); 547 ctrl_info(ctrl, "Button ignore on Slot(%s)\n",
548 slot_name(p_slot));
535 update_slot_info(p_slot); 549 update_slot_info(p_slot);
536 break; 550 break;
537 default: 551 default:
538 warn("Not a valid state\n"); 552 ctrl_warn(ctrl, "Not a valid state\n");
539 break; 553 break;
540 } 554 }
541} 555}
@@ -551,7 +565,7 @@ static void interrupt_event_handler(struct work_struct *work)
551 handle_button_press_event(p_slot); 565 handle_button_press_event(p_slot);
552 break; 566 break;
553 case INT_POWER_FAULT: 567 case INT_POWER_FAULT:
554 dbg("%s: power fault\n", __func__); 568 ctrl_dbg(p_slot->ctrl, "%s: power fault\n", __func__);
555 p_slot->hpc_ops->set_attention_status(p_slot, 1); 569 p_slot->hpc_ops->set_attention_status(p_slot, 1);
556 p_slot->hpc_ops->green_led_off(p_slot); 570 p_slot->hpc_ops->green_led_off(p_slot);
557 break; 571 break;
@@ -569,22 +583,24 @@ static int shpchp_enable_slot (struct slot *p_slot)
569{ 583{
570 u8 getstatus = 0; 584 u8 getstatus = 0;
571 int rc, retval = -ENODEV; 585 int rc, retval = -ENODEV;
586 struct controller *ctrl = p_slot->ctrl;
572 587
573 /* Check to see if (latch closed, card present, power off) */ 588 /* Check to see if (latch closed, card present, power off) */
574 mutex_lock(&p_slot->ctrl->crit_sect); 589 mutex_lock(&p_slot->ctrl->crit_sect);
575 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 590 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
576 if (rc || !getstatus) { 591 if (rc || !getstatus) {
577 info("No adapter on slot(%s)\n", slot_name(p_slot)); 592 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
578 goto out; 593 goto out;
579 } 594 }
580 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 595 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
581 if (rc || getstatus) { 596 if (rc || getstatus) {
582 info("Latch open on slot(%s)\n", slot_name(p_slot)); 597 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot));
583 goto out; 598 goto out;
584 } 599 }
585 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 600 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
586 if (rc || getstatus) { 601 if (rc || getstatus) {
587 info("Already enabled on slot(%s)\n", slot_name(p_slot)); 602 ctrl_info(ctrl, "Already enabled on slot(%s)\n",
603 slot_name(p_slot));
588 goto out; 604 goto out;
589 } 605 }
590 606
@@ -593,7 +609,7 @@ static int shpchp_enable_slot (struct slot *p_slot)
593 /* We have to save the presence info for these slots */ 609 /* We have to save the presence info for these slots */
594 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); 610 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
595 p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save)); 611 p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save));
596 dbg("%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); 612 ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save);
597 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 613 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
598 614
599 if(((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) || 615 if(((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) ||
@@ -624,6 +640,7 @@ static int shpchp_disable_slot (struct slot *p_slot)
624{ 640{
625 u8 getstatus = 0; 641 u8 getstatus = 0;
626 int rc, retval = -ENODEV; 642 int rc, retval = -ENODEV;
643 struct controller *ctrl = p_slot->ctrl;
627 644
628 if (!p_slot->ctrl) 645 if (!p_slot->ctrl)
629 return -ENODEV; 646 return -ENODEV;
@@ -633,17 +650,18 @@ static int shpchp_disable_slot (struct slot *p_slot)
633 650
634 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 651 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
635 if (rc || !getstatus) { 652 if (rc || !getstatus) {
636 info("No adapter on slot(%s)\n", slot_name(p_slot)); 653 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
637 goto out; 654 goto out;
638 } 655 }
639 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 656 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
640 if (rc || getstatus) { 657 if (rc || getstatus) {
641 info("Latch open on slot(%s)\n", slot_name(p_slot)); 658 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot));
642 goto out; 659 goto out;
643 } 660 }
644 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 661 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
645 if (rc || !getstatus) { 662 if (rc || !getstatus) {
646 info("Already disabled slot(%s)\n", slot_name(p_slot)); 663 ctrl_info(ctrl, "Already disabled slot(%s)\n",
664 slot_name(p_slot));
647 goto out; 665 goto out;
648 } 666 }
649 667
@@ -657,6 +675,7 @@ static int shpchp_disable_slot (struct slot *p_slot)
657int shpchp_sysfs_enable_slot(struct slot *p_slot) 675int shpchp_sysfs_enable_slot(struct slot *p_slot)
658{ 676{
659 int retval = -ENODEV; 677 int retval = -ENODEV;
678 struct controller *ctrl = p_slot->ctrl;
660 679
661 mutex_lock(&p_slot->lock); 680 mutex_lock(&p_slot->lock);
662 switch (p_slot->state) { 681 switch (p_slot->state) {
@@ -670,15 +689,17 @@ int shpchp_sysfs_enable_slot(struct slot *p_slot)
670 p_slot->state = STATIC_STATE; 689 p_slot->state = STATIC_STATE;
671 break; 690 break;
672 case POWERON_STATE: 691 case POWERON_STATE:
673 info("Slot %s is already in powering on state\n", 692 ctrl_info(ctrl, "Slot %s is already in powering on state\n",
674 slot_name(p_slot)); 693 slot_name(p_slot));
675 break; 694 break;
676 case BLINKINGOFF_STATE: 695 case BLINKINGOFF_STATE:
677 case POWEROFF_STATE: 696 case POWEROFF_STATE:
678 info("Already enabled on slot %s\n", slot_name(p_slot)); 697 ctrl_info(ctrl, "Already enabled on slot %s\n",
698 slot_name(p_slot));
679 break; 699 break;
680 default: 700 default:
681 err("Not a valid state on slot %s\n", slot_name(p_slot)); 701 ctrl_err(ctrl, "Not a valid state on slot %s\n",
702 slot_name(p_slot));
682 break; 703 break;
683 } 704 }
684 mutex_unlock(&p_slot->lock); 705 mutex_unlock(&p_slot->lock);
@@ -689,6 +710,7 @@ int shpchp_sysfs_enable_slot(struct slot *p_slot)
689int shpchp_sysfs_disable_slot(struct slot *p_slot) 710int shpchp_sysfs_disable_slot(struct slot *p_slot)
690{ 711{
691 int retval = -ENODEV; 712 int retval = -ENODEV;
713 struct controller *ctrl = p_slot->ctrl;
692 714
693 mutex_lock(&p_slot->lock); 715 mutex_lock(&p_slot->lock);
694 switch (p_slot->state) { 716 switch (p_slot->state) {
@@ -702,15 +724,17 @@ int shpchp_sysfs_disable_slot(struct slot *p_slot)
702 p_slot->state = STATIC_STATE; 724 p_slot->state = STATIC_STATE;
703 break; 725 break;
704 case POWEROFF_STATE: 726 case POWEROFF_STATE:
705 info("Slot %s is already in powering off state\n", 727 ctrl_info(ctrl, "Slot %s is already in powering off state\n",
706 slot_name(p_slot)); 728 slot_name(p_slot));
707 break; 729 break;
708 case BLINKINGON_STATE: 730 case BLINKINGON_STATE:
709 case POWERON_STATE: 731 case POWERON_STATE:
710 info("Already disabled on slot %s\n", slot_name(p_slot)); 732 ctrl_info(ctrl, "Already disabled on slot %s\n",
733 slot_name(p_slot));
711 break; 734 break;
712 default: 735 default:
713 err("Not a valid state on slot %s\n", slot_name(p_slot)); 736 ctrl_err(ctrl, "Not a valid state on slot %s\n",
737 slot_name(p_slot));
714 break; 738 break;
715 } 739 }
716 mutex_unlock(&p_slot->lock); 740 mutex_unlock(&p_slot->lock);
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index 7a0bff364cd4..2b69a08326b7 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)
300 !is_ctrl_busy(ctrl), timeout); 300 !is_ctrl_busy(ctrl), timeout);
301 if (!rc && is_ctrl_busy(ctrl)) { 301 if (!rc && is_ctrl_busy(ctrl)) {
302 retval = -EIO; 302 retval = -EIO;
303 err("Command not completed in 1000 msec\n"); 303 ctrl_err(ctrl, "Command not completed in 1000 msec\n");
304 } else if (rc < 0) { 304 } else if (rc < 0) {
305 retval = -EINTR; 305 retval = -EINTR;
306 info("Command was interrupted by a signal\n"); 306 ctrl_info(ctrl, "Command was interrupted by a signal\n");
307 } 307 }
308 308
309 return retval; 309 return retval;
@@ -320,15 +320,15 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
320 320
321 if (!shpc_poll_ctrl_busy(ctrl)) { 321 if (!shpc_poll_ctrl_busy(ctrl)) {
322 /* After 1 sec and and the controller is still busy */ 322 /* After 1 sec and and the controller is still busy */
323 err("%s : Controller is still busy after 1 sec.\n", 323 ctrl_err(ctrl, "%s : Controller is still busy after 1 sec.\n",
324 __func__); 324 __func__);
325 retval = -EBUSY; 325 retval = -EBUSY;
326 goto out; 326 goto out;
327 } 327 }
328 328
329 ++t_slot; 329 ++t_slot;
330 temp_word = (t_slot << 8) | (cmd & 0xFF); 330 temp_word = (t_slot << 8) | (cmd & 0xFF);
331 dbg("%s: t_slot %x cmd %x\n", __func__, t_slot, cmd); 331 ctrl_dbg(ctrl, "%s: t_slot %x cmd %x\n", __func__, t_slot, cmd);
332 332
333 /* To make sure the Controller Busy bit is 0 before we send out the 333 /* To make sure the Controller Busy bit is 0 before we send out the
334 * command. 334 * command.
@@ -344,8 +344,8 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
344 344
345 cmd_status = hpc_check_cmd_status(slot->ctrl); 345 cmd_status = hpc_check_cmd_status(slot->ctrl);
346 if (cmd_status) { 346 if (cmd_status) {
347 err("%s: Failed to issued command 0x%x (error code = %d)\n", 347 ctrl_err(ctrl, "%s: Failed to issued command 0x%x "
348 __func__, cmd, cmd_status); 348 "(error code = %d)\n", __func__, cmd, cmd_status);
349 retval = -EIO; 349 retval = -EIO;
350 } 350 }
351 out: 351 out:
@@ -364,15 +364,15 @@ static int hpc_check_cmd_status(struct controller *ctrl)
364 break; 364 break;
365 case 1: 365 case 1:
366 retval = SWITCH_OPEN; 366 retval = SWITCH_OPEN;
367 err("%s: Switch opened!\n", __func__); 367 ctrl_err(ctrl, "%s: Switch opened!\n", __func__);
368 break; 368 break;
369 case 2: 369 case 2:
370 retval = INVALID_CMD; 370 retval = INVALID_CMD;
371 err("%s: Invalid HPC command!\n", __func__); 371 ctrl_err(ctrl, "%s: Invalid HPC command!\n", __func__);
372 break; 372 break;
373 case 4: 373 case 4:
374 retval = INVALID_SPEED_MODE; 374 retval = INVALID_SPEED_MODE;
375 err("%s: Invalid bus speed/mode!\n", __func__); 375 ctrl_err(ctrl, "%s: Invalid bus speed/mode!\n", __func__);
376 break; 376 break;
377 default: 377 default:
378 retval = cmd_status; 378 retval = cmd_status;
@@ -483,8 +483,8 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value)
483 return -ENODEV; 483 return -ENODEV;
484 } 484 }
485 485
486 dbg("%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n", 486 ctrl_dbg(ctrl, "%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n",
487 __func__, slot_reg, pcix_cap, m66_cap); 487 __func__, slot_reg, pcix_cap, m66_cap);
488 488
489 switch (pcix_cap) { 489 switch (pcix_cap) {
490 case 0x0: 490 case 0x0:
@@ -509,7 +509,7 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value)
509 break; 509 break;
510 } 510 }
511 511
512 dbg("Adapter speed = %d\n", *value); 512 ctrl_dbg(ctrl, "Adapter speed = %d\n", *value);
513 return retval; 513 return retval;
514} 514}
515 515
@@ -526,7 +526,7 @@ static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode)
526 retval = -1; 526 retval = -1;
527 } 527 }
528 528
529 dbg("Mode 1 ECC cap = %d\n", *mode); 529 ctrl_dbg(ctrl, "Mode 1 ECC cap = %d\n", *mode);
530 return retval; 530 return retval;
531} 531}
532 532
@@ -629,7 +629,7 @@ static int hpc_power_on_slot(struct slot * slot)
629 629
630 retval = shpc_write_cmd(slot, slot->hp_slot, SET_SLOT_PWR); 630 retval = shpc_write_cmd(slot, slot->hp_slot, SET_SLOT_PWR);
631 if (retval) 631 if (retval)
632 err("%s: Write command failed!\n", __func__); 632 ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__);
633 633
634 return retval; 634 return retval;
635} 635}
@@ -642,7 +642,7 @@ static int hpc_slot_enable(struct slot * slot)
642 retval = shpc_write_cmd(slot, slot->hp_slot, 642 retval = shpc_write_cmd(slot, slot->hp_slot,
643 SET_SLOT_ENABLE | SET_PWR_BLINK | SET_ATTN_OFF); 643 SET_SLOT_ENABLE | SET_PWR_BLINK | SET_ATTN_OFF);
644 if (retval) 644 if (retval)
645 err("%s: Write command failed!\n", __func__); 645 ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__);
646 646
647 return retval; 647 return retval;
648} 648}
@@ -655,7 +655,7 @@ static int hpc_slot_disable(struct slot * slot)
655 retval = shpc_write_cmd(slot, slot->hp_slot, 655 retval = shpc_write_cmd(slot, slot->hp_slot,
656 SET_SLOT_DISABLE | SET_PWR_OFF | SET_ATTN_ON); 656 SET_SLOT_DISABLE | SET_PWR_OFF | SET_ATTN_ON);
657 if (retval) 657 if (retval)
658 err("%s: Write command failed!\n", __func__); 658 ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__);
659 659
660 return retval; 660 return retval;
661} 661}
@@ -719,7 +719,7 @@ static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value)
719 719
720 retval = shpc_write_cmd(slot, 0, cmd); 720 retval = shpc_write_cmd(slot, 0, cmd);
721 if (retval) 721 if (retval)
722 err("%s: Write command failed!\n", __func__); 722 ctrl_err(ctrl, "%s: Write command failed!\n", __func__);
723 723
724 return retval; 724 return retval;
725} 725}
@@ -735,7 +735,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id)
735 if (!intr_loc) 735 if (!intr_loc)
736 return IRQ_NONE; 736 return IRQ_NONE;
737 737
738 dbg("%s: intr_loc = %x\n",__func__, intr_loc); 738 ctrl_dbg(ctrl, "%s: intr_loc = %x\n", __func__, intr_loc);
739 739
740 if(!shpchp_poll_mode) { 740 if(!shpchp_poll_mode) {
741 /* 741 /*
@@ -748,7 +748,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id)
748 shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int); 748 shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int);
749 749
750 intr_loc2 = shpc_readl(ctrl, INTR_LOC); 750 intr_loc2 = shpc_readl(ctrl, INTR_LOC);
751 dbg("%s: intr_loc2 = %x\n",__func__, intr_loc2); 751 ctrl_dbg(ctrl, "%s: intr_loc2 = %x\n", __func__, intr_loc2);
752 } 752 }
753 753
754 if (intr_loc & CMD_INTR_PENDING) { 754 if (intr_loc & CMD_INTR_PENDING) {
@@ -773,8 +773,8 @@ static irqreturn_t shpc_isr(int irq, void *dev_id)
773 continue; 773 continue;
774 774
775 slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); 775 slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot));
776 dbg("%s: Slot %x with intr, slot register = %x\n", 776 ctrl_dbg(ctrl, "%s: Slot %x with intr, slot register = %x\n",
777 __func__, hp_slot, slot_reg); 777 __func__, hp_slot, slot_reg);
778 778
779 if (slot_reg & MRL_CHANGE_DETECTED) 779 if (slot_reg & MRL_CHANGE_DETECTED)
780 shpchp_handle_switch_change(hp_slot, ctrl); 780 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)
843 } 843 }
844 844
845 *value = bus_speed; 845 *value = bus_speed;
846 dbg("Max bus speed = %d\n", bus_speed); 846 ctrl_dbg(ctrl, "Max bus speed = %d\n", bus_speed);
847 847
848 return retval; 848 return retval;
849} 849}
@@ -911,7 +911,7 @@ static int hpc_get_cur_bus_speed (struct slot *slot, enum pci_bus_speed *value)
911 break; 911 break;
912 } 912 }
913 913
914 dbg("Current bus speed = %d\n", bus_speed); 914 ctrl_dbg(ctrl, "Current bus speed = %d\n", bus_speed);
915 return retval; 915 return retval;
916} 916}
917 917
@@ -958,34 +958,38 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
958 } else { 958 } else {
959 ctrl->cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC); 959 ctrl->cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC);
960 if (!ctrl->cap_offset) { 960 if (!ctrl->cap_offset) {
961 err("%s : cap_offset == 0\n", __func__); 961 ctrl_err(ctrl, "%s : cap_offset == 0\n", __func__);
962 goto abort; 962 goto abort;
963 } 963 }
964 dbg("%s: cap_offset = %x\n", __func__, ctrl->cap_offset); 964 ctrl_dbg(ctrl, "%s: cap_offset = %x\n", __func__,
965 ctrl->cap_offset);
965 966
966 rc = shpc_indirect_read(ctrl, 0, &shpc_base_offset); 967 rc = shpc_indirect_read(ctrl, 0, &shpc_base_offset);
967 if (rc) { 968 if (rc) {
968 err("%s: cannot read base_offset\n", __func__); 969 ctrl_err(ctrl, "%s: cannot read base_offset\n",
970 __func__);
969 goto abort; 971 goto abort;
970 } 972 }
971 973
972 rc = shpc_indirect_read(ctrl, 3, &tempdword); 974 rc = shpc_indirect_read(ctrl, 3, &tempdword);
973 if (rc) { 975 if (rc) {
974 err("%s: cannot read slot config\n", __func__); 976 ctrl_err(ctrl, "%s: cannot read slot config\n",
977 __func__);
975 goto abort; 978 goto abort;
976 } 979 }
977 num_slots = tempdword & SLOT_NUM; 980 num_slots = tempdword & SLOT_NUM;
978 dbg("%s: num_slots (indirect) %x\n", __func__, num_slots); 981 ctrl_dbg(ctrl, "%s: num_slots (indirect) %x\n",
982 __func__, num_slots);
979 983
980 for (i = 0; i < 9 + num_slots; i++) { 984 for (i = 0; i < 9 + num_slots; i++) {
981 rc = shpc_indirect_read(ctrl, i, &tempdword); 985 rc = shpc_indirect_read(ctrl, i, &tempdword);
982 if (rc) { 986 if (rc) {
983 err("%s: cannot read creg (index = %d)\n", 987 ctrl_err(ctrl, "%s: cannot read creg "
984 __func__, i); 988 "(index = %d)\n", __func__, i);
985 goto abort; 989 goto abort;
986 } 990 }
987 dbg("%s: offset %d: value %x\n", __func__,i, 991 ctrl_dbg(ctrl, "%s: offset %d: value %x\n",
988 tempdword); 992 __func__, i, tempdword);
989 } 993 }
990 994
991 ctrl->mmio_base = 995 ctrl->mmio_base =
@@ -993,30 +997,31 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
993 ctrl->mmio_size = 0x24 + 0x4 * num_slots; 997 ctrl->mmio_size = 0x24 + 0x4 * num_slots;
994 } 998 }
995 999
996 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor, 1000 ctrl_info(ctrl, "HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n",
997 pdev->subsystem_device); 1001 pdev->vendor, pdev->device, pdev->subsystem_vendor,
1002 pdev->subsystem_device);
998 1003
999 rc = pci_enable_device(pdev); 1004 rc = pci_enable_device(pdev);
1000 if (rc) { 1005 if (rc) {
1001 err("%s: pci_enable_device failed\n", __func__); 1006 ctrl_err(ctrl, "%s: pci_enable_device failed\n", __func__);
1002 goto abort; 1007 goto abort;
1003 } 1008 }
1004 1009
1005 if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) { 1010 if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) {
1006 err("%s: cannot reserve MMIO region\n", __func__); 1011 ctrl_err(ctrl, "%s: cannot reserve MMIO region\n", __func__);
1007 rc = -1; 1012 rc = -1;
1008 goto abort; 1013 goto abort;
1009 } 1014 }
1010 1015
1011 ctrl->creg = ioremap(ctrl->mmio_base, ctrl->mmio_size); 1016 ctrl->creg = ioremap(ctrl->mmio_base, ctrl->mmio_size);
1012 if (!ctrl->creg) { 1017 if (!ctrl->creg) {
1013 err("%s: cannot remap MMIO region %lx @ %lx\n", __func__, 1018 ctrl_err(ctrl, "%s: cannot remap MMIO region %lx @ %lx\n",
1014 ctrl->mmio_size, ctrl->mmio_base); 1019 __func__, ctrl->mmio_size, ctrl->mmio_base);
1015 release_mem_region(ctrl->mmio_base, ctrl->mmio_size); 1020 release_mem_region(ctrl->mmio_base, ctrl->mmio_size);
1016 rc = -1; 1021 rc = -1;
1017 goto abort; 1022 goto abort;
1018 } 1023 }
1019 dbg("%s: ctrl->creg %p\n", __func__, ctrl->creg); 1024 ctrl_dbg(ctrl, "%s: ctrl->creg %p\n", __func__, ctrl->creg);
1020 1025
1021 mutex_init(&ctrl->crit_sect); 1026 mutex_init(&ctrl->crit_sect);
1022 mutex_init(&ctrl->cmd_lock); 1027 mutex_init(&ctrl->cmd_lock);
@@ -1035,21 +1040,21 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
1035 1040
1036 /* Mask Global Interrupt Mask & Command Complete Interrupt Mask */ 1041 /* Mask Global Interrupt Mask & Command Complete Interrupt Mask */
1037 tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); 1042 tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE);
1038 dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); 1043 ctrl_dbg(ctrl, "%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword);
1039 tempdword |= (GLOBAL_INTR_MASK | GLOBAL_SERR_MASK | 1044 tempdword |= (GLOBAL_INTR_MASK | GLOBAL_SERR_MASK |
1040 COMMAND_INTR_MASK | ARBITER_SERR_MASK); 1045 COMMAND_INTR_MASK | ARBITER_SERR_MASK);
1041 tempdword &= ~SERR_INTR_RSVDZ_MASK; 1046 tempdword &= ~SERR_INTR_RSVDZ_MASK;
1042 shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); 1047 shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword);
1043 tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); 1048 tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE);
1044 dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); 1049 ctrl_dbg(ctrl, "%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword);
1045 1050
1046 /* Mask the MRL sensor SERR Mask of individual slot in 1051 /* Mask the MRL sensor SERR Mask of individual slot in
1047 * Slot SERR-INT Mask & clear all the existing event if any 1052 * Slot SERR-INT Mask & clear all the existing event if any
1048 */ 1053 */
1049 for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { 1054 for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) {
1050 slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); 1055 slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot));
1051 dbg("%s: Default Logical Slot Register %d value %x\n", __func__, 1056 ctrl_dbg(ctrl, "%s: Default Logical Slot Register %d "
1052 hp_slot, slot_reg); 1057 "value %x\n", __func__, hp_slot, slot_reg);
1053 slot_reg |= (PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | 1058 slot_reg |= (PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK |
1054 BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | 1059 BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK |
1055 CON_PFAULT_INTR_MASK | MRL_CHANGE_SERR_MASK | 1060 CON_PFAULT_INTR_MASK | MRL_CHANGE_SERR_MASK |
@@ -1066,24 +1071,26 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
1066 /* Installs the interrupt handler */ 1071 /* Installs the interrupt handler */
1067 rc = pci_enable_msi(pdev); 1072 rc = pci_enable_msi(pdev);
1068 if (rc) { 1073 if (rc) {
1069 info("Can't get msi for the hotplug controller\n"); 1074 ctrl_info(ctrl,
1070 info("Use INTx for the hotplug controller\n"); 1075 "Can't get msi for the hotplug controller\n");
1076 ctrl_info(ctrl,
1077 "Use INTx for the hotplug controller\n");
1071 } 1078 }
1072 1079
1073 rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED, 1080 rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED,
1074 MY_NAME, (void *)ctrl); 1081 MY_NAME, (void *)ctrl);
1075 dbg("%s: request_irq %d for hpc%d (returns %d)\n", 1082 ctrl_dbg(ctrl, "%s: request_irq %d for hpc%d (returns %d)\n",
1076 __func__, ctrl->pci_dev->irq, 1083 __func__, ctrl->pci_dev->irq,
1077 atomic_read(&shpchp_num_controllers), rc); 1084 atomic_read(&shpchp_num_controllers), rc);
1078 if (rc) { 1085 if (rc) {
1079 err("Can't get irq %d for the hotplug controller\n", 1086 ctrl_err(ctrl, "Can't get irq %d for the hotplug "
1080 ctrl->pci_dev->irq); 1087 "controller\n", ctrl->pci_dev->irq);
1081 goto abort_iounmap; 1088 goto abort_iounmap;
1082 } 1089 }
1083 } 1090 }
1084 dbg("%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n", __func__, 1091 ctrl_dbg(ctrl, "%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n",
1085 pdev->bus->number, PCI_SLOT(pdev->devfn), 1092 __func__, pdev->bus->number, PCI_SLOT(pdev->devfn),
1086 PCI_FUNC(pdev->devfn), pdev->irq); 1093 PCI_FUNC(pdev->devfn), pdev->irq);
1087 1094
1088 /* 1095 /*
1089 * If this is the first controller to be initialized, 1096 * If this is the first controller to be initialized,
@@ -1102,8 +1109,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
1102 */ 1109 */
1103 for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { 1110 for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) {
1104 slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); 1111 slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot));
1105 dbg("%s: Default Logical Slot Register %d value %x\n", __func__, 1112 ctrl_dbg(ctrl, "%s: Default Logical Slot Register %d "
1106 hp_slot, slot_reg); 1113 "value %x\n", __func__, hp_slot, slot_reg);
1107 slot_reg &= ~(PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | 1114 slot_reg &= ~(PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK |
1108 BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | 1115 BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK |
1109 CON_PFAULT_INTR_MASK | SLOT_REG_RSVDZ_MASK); 1116 CON_PFAULT_INTR_MASK | SLOT_REG_RSVDZ_MASK);
@@ -1116,7 +1123,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
1116 SERR_INTR_RSVDZ_MASK); 1123 SERR_INTR_RSVDZ_MASK);
1117 shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); 1124 shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword);
1118 tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); 1125 tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE);
1119 dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); 1126 ctrl_dbg(ctrl, "%s: SERR_INTR_ENABLE = %x\n",
1127 __func__, tempdword);
1120 } 1128 }
1121 1129
1122 return 0; 1130 return 0;
diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c
index 3fc4ec0eea0b..faecbfaa64f0 100644
--- a/drivers/pci/hotplug/shpchp_pci.c
+++ b/drivers/pci/hotplug/shpchp_pci.c
@@ -101,18 +101,20 @@ int __ref shpchp_configure_device(struct slot *p_slot)
101 struct pci_dev *dev; 101 struct pci_dev *dev;
102 struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; 102 struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
103 int num, fn; 103 int num, fn;
104 struct controller *ctrl = p_slot->ctrl;
104 105
105 dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); 106 dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0));
106 if (dev) { 107 if (dev) {
107 err("Device %s already exists at %x:%x, cannot hot-add\n", 108 ctrl_err(ctrl,
108 pci_name(dev), p_slot->bus, p_slot->device); 109 "Device %s already exists at %x:%x, cannot hot-add\n",
110 pci_name(dev), p_slot->bus, p_slot->device);
109 pci_dev_put(dev); 111 pci_dev_put(dev);
110 return -EINVAL; 112 return -EINVAL;
111 } 113 }
112 114
113 num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); 115 num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0));
114 if (num == 0) { 116 if (num == 0) {
115 err("No new device found\n"); 117 ctrl_err(ctrl, "No new device found\n");
116 return -ENODEV; 118 return -ENODEV;
117 } 119 }
118 120
@@ -121,8 +123,8 @@ int __ref shpchp_configure_device(struct slot *p_slot)
121 if (!dev) 123 if (!dev)
122 continue; 124 continue;
123 if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { 125 if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
124 err("Cannot hot-add display device %s\n", 126 ctrl_err(ctrl, "Cannot hot-add display device %s\n",
125 pci_name(dev)); 127 pci_name(dev));
126 pci_dev_put(dev); 128 pci_dev_put(dev);
127 continue; 129 continue;
128 } 130 }
@@ -138,14 +140,15 @@ int __ref shpchp_configure_device(struct slot *p_slot)
138 break; 140 break;
139 } 141 }
140 if (busnr >= end) { 142 if (busnr >= end) {
141 err("No free bus for hot-added bridge\n"); 143 ctrl_err(ctrl,
144 "No free bus for hot-added bridge\n");
142 pci_dev_put(dev); 145 pci_dev_put(dev);
143 continue; 146 continue;
144 } 147 }
145 child = pci_add_new_bus(parent, dev, busnr); 148 child = pci_add_new_bus(parent, dev, busnr);
146 if (!child) { 149 if (!child) {
147 err("Cannot add new bus for %s\n", 150 ctrl_err(ctrl, "Cannot add new bus for %s\n",
148 pci_name(dev)); 151 pci_name(dev));
149 pci_dev_put(dev); 152 pci_dev_put(dev);
150 continue; 153 continue;
151 } 154 }
@@ -168,8 +171,10 @@ int shpchp_unconfigure_device(struct slot *p_slot)
168 int j; 171 int j;
169 u8 bctl = 0; 172 u8 bctl = 0;
170 struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; 173 struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
174 struct controller *ctrl = p_slot->ctrl;
171 175
172 dbg("%s: bus/dev = %x/%x\n", __func__, p_slot->bus, p_slot->device); 176 ctrl_dbg(ctrl, "%s: bus/dev = %x/%x\n",
177 __func__, p_slot->bus, p_slot->device);
173 178
174 for (j=0; j<8 ; j++) { 179 for (j=0; j<8 ; j++) {
175 struct pci_dev* temp = pci_get_slot(parent, 180 struct pci_dev* temp = pci_get_slot(parent,
@@ -177,16 +182,17 @@ int shpchp_unconfigure_device(struct slot *p_slot)
177 if (!temp) 182 if (!temp)
178 continue; 183 continue;
179 if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { 184 if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
180 err("Cannot remove display device %s\n", 185 ctrl_err(ctrl, "Cannot remove display device %s\n",
181 pci_name(temp)); 186 pci_name(temp));
182 pci_dev_put(temp); 187 pci_dev_put(temp);
183 continue; 188 continue;
184 } 189 }
185 if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) { 190 if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
186 pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl); 191 pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl);
187 if (bctl & PCI_BRIDGE_CTL_VGA) { 192 if (bctl & PCI_BRIDGE_CTL_VGA) {
188 err("Cannot remove display device %s\n", 193 ctrl_err(ctrl,
189 pci_name(temp)); 194 "Cannot remove display device %s\n",
195 pci_name(temp));
190 pci_dev_put(temp); 196 pci_dev_put(temp);
191 continue; 197 continue;
192 } 198 }