2525 *
2626 */
2727
28+ #define pr_fmt (fmt ) "acpiphp_ibm: " fmt
29+
2830#include <linux/init.h>
2931#include <linux/slab.h>
3032#include <linux/module.h>
4345#define DRIVER_AUTHOR "Irene Zubarev <
[email protected] >, Vernon Mauery <
[email protected] >"
4446#define DRIVER_DESC "ACPI Hot Plug PCI Controller Driver IBM extension"
4547
46- static bool debug ;
4748
4849MODULE_AUTHOR (DRIVER_AUTHOR );
4950MODULE_DESCRIPTION (DRIVER_DESC );
5051MODULE_LICENSE ("GPL" );
5152MODULE_VERSION (DRIVER_VERSION );
52- module_param (debug , bool , 0644 );
53- MODULE_PARM_DESC (debug , " Debugging mode enabled or not" );
54- #define MY_NAME "acpiphp_ibm"
55-
56- #undef dbg
57- #define dbg (format , arg ...) \
58- do { \
59- if (debug) \
60- printk(KERN_DEBUG "%s: " format, \
61- MY_NAME , ## arg); \
62- } while (0)
6353
6454#define FOUND_APCI 0x61504349
6555/* these are the names for the IBM ACPI pseudo-device */
@@ -189,7 +179,7 @@ static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status)
189179
190180 ibm_slot = ibm_slot_from_id (hpslot_to_sun (slot ));
191181
192- dbg ("%s: set slot %d (%d) attention status to %d\n" , __func__ ,
182+ pr_debug ("%s: set slot %d (%d) attention status to %d\n" , __func__ ,
193183 ibm_slot -> slot .slot_num , ibm_slot -> slot .slot_id ,
194184 (status ? 1 : 0 ));
195185
@@ -202,10 +192,10 @@ static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status)
202192
203193 stat = acpi_evaluate_integer (ibm_acpi_handle , "APLS" , & params , & rc );
204194 if (ACPI_FAILURE (stat )) {
205- err ("APLS evaluation failed: 0x%08x\n" , stat );
195+ pr_err ("APLS evaluation failed: 0x%08x\n" , stat );
206196 return - ENODEV ;
207197 } else if (!rc ) {
208- err ("APLS method failed: 0x%08llx\n" , rc );
198+ pr_err ("APLS method failed: 0x%08llx\n" , rc );
209199 return - ERANGE ;
210200 }
211201 return 0 ;
@@ -234,7 +224,7 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status)
234224 else
235225 * status = 0 ;
236226
237- dbg ("%s: get slot %d (%d) attention status is %d\n" , __func__ ,
227+ pr_debug ("%s: get slot %d (%d) attention status is %d\n" , __func__ ,
238228 ibm_slot -> slot .slot_num , ibm_slot -> slot .slot_id ,
239229 * status );
240230
@@ -266,10 +256,10 @@ static void ibm_handle_events(acpi_handle handle, u32 event, void *context)
266256 u8 subevent = event & 0xf0 ;
267257 struct notification * note = context ;
268258
269- dbg ("%s: Received notification %02x\n" , __func__ , event );
259+ pr_debug ("%s: Received notification %02x\n" , __func__ , event );
270260
271261 if (subevent == 0x80 ) {
272- dbg ("%s: generationg bus event\n" , __func__ );
262+ pr_debug ("%s: generationg bus event\n" , __func__ );
273263 acpi_bus_generate_netlink_event (note -> device -> pnp .device_class ,
274264 dev_name (& note -> device -> dev ),
275265 note -> event , detail );
@@ -301,21 +291,21 @@ static int ibm_get_table_from_acpi(char **bufp)
301291
302292 status = acpi_evaluate_object (ibm_acpi_handle , "APCI" , NULL , & buffer );
303293 if (ACPI_FAILURE (status )) {
304- err ("%s: APCI evaluation failed\n" , __func__ );
294+ pr_err ("%s: APCI evaluation failed\n" , __func__ );
305295 return - ENODEV ;
306296 }
307297
308298 package = (union acpi_object * ) buffer .pointer ;
309299 if (!(package ) ||
310300 (package -> type != ACPI_TYPE_PACKAGE ) ||
311301 !(package -> package .elements )) {
312- err ("%s: Invalid APCI object\n" , __func__ );
302+ pr_err ("%s: Invalid APCI object\n" , __func__ );
313303 goto read_table_done ;
314304 }
315305
316306 for (size = 0 , i = 0 ; i < package -> package .count ; i ++ ) {
317307 if (package -> package .elements [i ].type != ACPI_TYPE_BUFFER ) {
318- err ("%s: Invalid APCI element %d\n" , __func__ , i );
308+ pr_err ("%s: Invalid APCI element %d\n" , __func__ , i );
319309 goto read_table_done ;
320310 }
321311 size += package -> package .elements [i ].buffer .length ;
@@ -325,7 +315,7 @@ static int ibm_get_table_from_acpi(char **bufp)
325315 goto read_table_done ;
326316
327317 lbuf = kzalloc (size , GFP_KERNEL );
328- dbg ("%s: element count: %i, ASL table size: %i, &table = 0x%p\n" ,
318+ pr_debug ("%s: element count: %i, ASL table size: %i, &table = 0x%p\n" ,
329319 __func__ , package -> package .count , size , lbuf );
330320
331321 if (lbuf ) {
@@ -370,8 +360,8 @@ static ssize_t ibm_read_apci_table(struct file *filp, struct kobject *kobj,
370360{
371361 int bytes_read = - EINVAL ;
372362 char * table = NULL ;
373-
374- dbg ("%s: pos = %d, size = %zd\n" , __func__ , (int )pos , size );
363+
364+ pr_debug ("%s: pos = %d, size = %zd\n" , __func__ , (int )pos , size );
375365
376366 if (pos == 0 ) {
377367 bytes_read = ibm_get_table_from_acpi (& table );
@@ -403,15 +393,15 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
403393
404394 status = acpi_get_object_info (handle , & info );
405395 if (ACPI_FAILURE (status )) {
406- err ("%s: Failed to get device information status=0x%x\n" ,
396+ pr_err ("%s: Failed to get device information status=0x%x\n" ,
407397 __func__ , status );
408398 return retval ;
409399 }
410400
411401 if (info -> current_status && (info -> valid & ACPI_VALID_HID ) &&
412402 (!strcmp (info -> hardware_id .string , IBM_HARDWARE_ID1 ) ||
413403 !strcmp (info -> hardware_id .string , IBM_HARDWARE_ID2 ))) {
414- dbg ("found hardware: %s, handle: %p\n" ,
404+ pr_debug ("found hardware: %s, handle: %p\n" ,
415405 info -> hardware_id .string , handle );
416406 * phandle = handle ;
417407 /* returning non-zero causes the search to stop
@@ -432,18 +422,18 @@ static int __init ibm_acpiphp_init(void)
432422 struct acpi_device * device ;
433423 struct kobject * sysdir = & pci_slots_kset -> kobj ;
434424
435- dbg ("%s\n" , __func__ );
425+ pr_debug ("%s\n" , __func__ );
436426
437427 if (acpi_walk_namespace (ACPI_TYPE_DEVICE , ACPI_ROOT_OBJECT ,
438428 ACPI_UINT32_MAX , ibm_find_acpi_device , NULL ,
439429 & ibm_acpi_handle , NULL ) != FOUND_APCI ) {
440- err ("%s: acpi_walk_namespace failed\n" , __func__ );
430+ pr_err ("%s: acpi_walk_namespace failed\n" , __func__ );
441431 retval = - ENODEV ;
442432 goto init_return ;
443433 }
444- dbg ("%s: found IBM aPCI device\n" , __func__ );
434+ pr_debug ("%s: found IBM aPCI device\n" , __func__ );
445435 if (acpi_bus_get_device (ibm_acpi_handle , & device )) {
446- err ("%s: acpi_bus_get_device failed\n" , __func__ );
436+ pr_err ("%s: acpi_bus_get_device failed\n" , __func__ );
447437 retval = - ENODEV ;
448438 goto init_return ;
449439 }
@@ -457,7 +447,7 @@ static int __init ibm_acpiphp_init(void)
457447 ACPI_DEVICE_NOTIFY , ibm_handle_events ,
458448 & ibm_note );
459449 if (ACPI_FAILURE (status )) {
460- err ("%s: Failed to register notification handler\n" ,
450+ pr_err ("%s: Failed to register notification handler\n" ,
461451 __func__ );
462452 retval = - EBUSY ;
463453 goto init_cleanup ;
@@ -479,17 +469,17 @@ static void __exit ibm_acpiphp_exit(void)
479469 acpi_status status ;
480470 struct kobject * sysdir = & pci_slots_kset -> kobj ;
481471
482- dbg ("%s\n" , __func__ );
472+ pr_debug ("%s\n" , __func__ );
483473
484474 if (acpiphp_unregister_attention (& ibm_attention_info ))
485- err ("%s: attention info deregistration failed" , __func__ );
475+ pr_err ("%s: attention info deregistration failed" , __func__ );
486476
487477 status = acpi_remove_notify_handler (
488478 ibm_acpi_handle ,
489479 ACPI_DEVICE_NOTIFY ,
490480 ibm_handle_events );
491481 if (ACPI_FAILURE (status ))
492- err ("%s: Notification handler removal failed\n" , __func__ );
482+ pr_err ("%s: Notification handler removal failed\n" , __func__ );
493483 /* remove the /sys entries */
494484 sysfs_remove_bin_file (sysdir , & ibm_apci_table_attr );
495485}
0 commit comments