diff options
| author | Lan Tianyu <tianyu.lan@intel.com> | 2013-09-24 20:11:48 -0400 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-09-25 19:00:51 -0400 |
| commit | bd950799d9510cac994fad2ea020767fe878b84b (patch) | |
| tree | fe9f572e98acaa7894bbe779e19fe00a3a33379d | |
| parent | b8cac70afe983f0c48a0296bbb7a6177e99fbbb9 (diff) | |
PCI: acpiphp: Convert to dynamic debug
This patch is to use pr_debug/info/warn/err to replace acpiphp debug
functions and remove module's debug param.
User interface change: before this patch, boot with the "acpiphp.debug"
kernel parameter to turn on debug. After this patch, set
CONFIG_DYNAMIC_DEBUG=y and boot with "acpiphp.dyndebug=+p" instead.
See Documentation/dynamic-debug-howto.txt.
[bhelgaas: changelog]
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
| -rw-r--r-- | drivers/pci/hotplug/acpiphp.h | 10 | ||||
| -rw-r--r-- | drivers/pci/hotplug/acpiphp_core.c | 37 | ||||
| -rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 23 |
3 files changed, 30 insertions, 40 deletions
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index f4e028924667..26100f510b10 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
| @@ -39,16 +39,6 @@ | |||
| 39 | #include <linux/mutex.h> | 39 | #include <linux/mutex.h> |
| 40 | #include <linux/pci_hotplug.h> | 40 | #include <linux/pci_hotplug.h> |
| 41 | 41 | ||
| 42 | #define dbg(format, arg...) \ | ||
| 43 | do { \ | ||
| 44 | if (acpiphp_debug) \ | ||
| 45 | printk(KERN_DEBUG "%s: " format, \ | ||
| 46 | MY_NAME , ## arg); \ | ||
| 47 | } while (0) | ||
| 48 | #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME , ## arg) | ||
| 49 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) | ||
| 50 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) | ||
| 51 | |||
| 52 | struct acpiphp_context; | 42 | struct acpiphp_context; |
| 53 | struct acpiphp_bridge; | 43 | struct acpiphp_bridge; |
| 54 | struct acpiphp_slot; | 44 | struct acpiphp_slot; |
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index bf2203ef1308..8650d39db392 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
| @@ -31,6 +31,8 @@ | |||
| 31 | * | 31 | * |
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | #define pr_fmt(fmt) "acpiphp: " fmt | ||
| 35 | |||
| 34 | #include <linux/init.h> | 36 | #include <linux/init.h> |
| 35 | #include <linux/module.h> | 37 | #include <linux/module.h> |
| 36 | #include <linux/moduleparam.h> | 38 | #include <linux/moduleparam.h> |
| @@ -43,12 +45,9 @@ | |||
| 43 | #include <linux/smp.h> | 45 | #include <linux/smp.h> |
| 44 | #include "acpiphp.h" | 46 | #include "acpiphp.h" |
| 45 | 47 | ||
| 46 | #define MY_NAME "acpiphp" | ||
| 47 | |||
| 48 | /* name size which is used for entries in pcihpfs */ | 48 | /* name size which is used for entries in pcihpfs */ |
| 49 | #define SLOT_NAME_SIZE 21 /* {_SUN} */ | 49 | #define SLOT_NAME_SIZE 21 /* {_SUN} */ |
| 50 | 50 | ||
| 51 | bool acpiphp_debug; | ||
| 52 | bool acpiphp_disabled; | 51 | bool acpiphp_disabled; |
| 53 | 52 | ||
| 54 | /* local variables */ | 53 | /* local variables */ |
| @@ -61,9 +60,7 @@ static struct acpiphp_attention_info *attention_info; | |||
| 61 | MODULE_AUTHOR(DRIVER_AUTHOR); | 60 | MODULE_AUTHOR(DRIVER_AUTHOR); |
| 62 | MODULE_DESCRIPTION(DRIVER_DESC); | 61 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 63 | MODULE_LICENSE("GPL"); | 62 | MODULE_LICENSE("GPL"); |
| 64 | MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); | ||
| 65 | MODULE_PARM_DESC(disable, "disable acpiphp driver"); | 63 | MODULE_PARM_DESC(disable, "disable acpiphp driver"); |
| 66 | module_param_named(debug, acpiphp_debug, bool, 0644); | ||
| 67 | module_param_named(disable, acpiphp_disabled, bool, 0444); | 64 | module_param_named(disable, acpiphp_disabled, bool, 0444); |
| 68 | 65 | ||
| 69 | /* export the attention callback registration methods */ | 66 | /* export the attention callback registration methods */ |
| @@ -139,7 +136,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) | |||
| 139 | { | 136 | { |
| 140 | struct slot *slot = hotplug_slot->private; | 137 | struct slot *slot = hotplug_slot->private; |
| 141 | 138 | ||
| 142 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); | 139 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
| 143 | 140 | ||
| 144 | /* enable the specified slot */ | 141 | /* enable the specified slot */ |
| 145 | return acpiphp_enable_slot(slot->acpi_slot); | 142 | return acpiphp_enable_slot(slot->acpi_slot); |
| @@ -156,7 +153,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
| 156 | { | 153 | { |
| 157 | struct slot *slot = hotplug_slot->private; | 154 | struct slot *slot = hotplug_slot->private; |
| 158 | 155 | ||
| 159 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); | 156 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
| 160 | 157 | ||
| 161 | /* disable the specified slot */ | 158 | /* disable the specified slot */ |
| 162 | return acpiphp_disable_and_eject_slot(slot->acpi_slot); | 159 | return acpiphp_disable_and_eject_slot(slot->acpi_slot); |
| @@ -176,8 +173,9 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
| 176 | { | 173 | { |
| 177 | int retval = -ENODEV; | 174 | int retval = -ENODEV; |
| 178 | 175 | ||
| 179 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot_name(hotplug_slot)); | 176 | pr_debug("%s - physical_slot = %s\n", __func__, |
| 180 | 177 | hotplug_slot_name(hotplug_slot)); | |
| 178 | |||
| 181 | if (attention_info && try_module_get(attention_info->owner)) { | 179 | if (attention_info && try_module_get(attention_info->owner)) { |
| 182 | retval = attention_info->set_attn(hotplug_slot, status); | 180 | retval = attention_info->set_attn(hotplug_slot, status); |
| 183 | module_put(attention_info->owner); | 181 | module_put(attention_info->owner); |
| @@ -199,7 +197,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
| 199 | { | 197 | { |
| 200 | struct slot *slot = hotplug_slot->private; | 198 | struct slot *slot = hotplug_slot->private; |
| 201 | 199 | ||
| 202 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); | 200 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
| 203 | 201 | ||
| 204 | *value = acpiphp_get_power_status(slot->acpi_slot); | 202 | *value = acpiphp_get_power_status(slot->acpi_slot); |
| 205 | 203 | ||
| @@ -221,7 +219,8 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
| 221 | { | 219 | { |
| 222 | int retval = -EINVAL; | 220 | int retval = -EINVAL; |
| 223 | 221 | ||
| 224 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot_name(hotplug_slot)); | 222 | pr_debug("%s - physical_slot = %s\n", __func__, |
| 223 | hotplug_slot_name(hotplug_slot)); | ||
| 225 | 224 | ||
| 226 | if (attention_info && try_module_get(attention_info->owner)) { | 225 | if (attention_info && try_module_get(attention_info->owner)) { |
| 227 | retval = attention_info->get_attn(hotplug_slot, value); | 226 | retval = attention_info->get_attn(hotplug_slot, value); |
| @@ -244,7 +243,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
| 244 | { | 243 | { |
| 245 | struct slot *slot = hotplug_slot->private; | 244 | struct slot *slot = hotplug_slot->private; |
| 246 | 245 | ||
| 247 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); | 246 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
| 248 | 247 | ||
| 249 | *value = acpiphp_get_latch_status(slot->acpi_slot); | 248 | *value = acpiphp_get_latch_status(slot->acpi_slot); |
| 250 | 249 | ||
| @@ -264,7 +263,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
| 264 | { | 263 | { |
| 265 | struct slot *slot = hotplug_slot->private; | 264 | struct slot *slot = hotplug_slot->private; |
| 266 | 265 | ||
| 267 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); | 266 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
| 268 | 267 | ||
| 269 | *value = acpiphp_get_adapter_status(slot->acpi_slot); | 268 | *value = acpiphp_get_adapter_status(slot->acpi_slot); |
| 270 | 269 | ||
| @@ -279,7 +278,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
| 279 | { | 278 | { |
| 280 | struct slot *slot = hotplug_slot->private; | 279 | struct slot *slot = hotplug_slot->private; |
| 281 | 280 | ||
| 282 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); | 281 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
| 283 | 282 | ||
| 284 | kfree(slot->hotplug_slot); | 283 | kfree(slot->hotplug_slot); |
| 285 | kfree(slot); | 284 | kfree(slot); |
| @@ -322,11 +321,11 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot, | |||
| 322 | if (retval == -EBUSY) | 321 | if (retval == -EBUSY) |
| 323 | goto error_hpslot; | 322 | goto error_hpslot; |
| 324 | if (retval) { | 323 | if (retval) { |
| 325 | err("pci_hp_register failed with error %d\n", retval); | 324 | pr_err("pci_hp_register failed with error %d\n", retval); |
| 326 | goto error_hpslot; | 325 | goto error_hpslot; |
| 327 | } | 326 | } |
| 328 | 327 | ||
| 329 | info("Slot [%s] registered\n", slot_name(slot)); | 328 | pr_info("Slot [%s] registered\n", slot_name(slot)); |
| 330 | 329 | ||
| 331 | return 0; | 330 | return 0; |
| 332 | error_hpslot: | 331 | error_hpslot: |
| @@ -343,17 +342,17 @@ void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | |||
| 343 | struct slot *slot = acpiphp_slot->slot; | 342 | struct slot *slot = acpiphp_slot->slot; |
| 344 | int retval = 0; | 343 | int retval = 0; |
| 345 | 344 | ||
| 346 | info("Slot [%s] unregistered\n", slot_name(slot)); | 345 | pr_info("Slot [%s] unregistered\n", slot_name(slot)); |
| 347 | 346 | ||
| 348 | |||
