Commit 7f2feec1 authored by Taku Izumi's avatar Taku Izumi Committed by Jesse Barnes

PCI: pciehp: replace printk with dev_printk

This patch replaces printks within pciehp module with dev_printks.
Signed-off-by: default avatarTaku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 83e9ad54
...@@ -57,6 +57,19 @@ extern struct workqueue_struct *pciehp_wq; ...@@ -57,6 +57,19 @@ extern struct workqueue_struct *pciehp_wq;
#define warn(format, arg...) \ #define warn(format, arg...) \
printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
#define ctrl_dbg(ctrl, format, arg...) \
do { \
if (pciehp_debug) \
dev_printk(, &ctrl->pcie->device, \
format, ## arg); \
} while (0)
#define ctrl_err(ctrl, format, arg...) \
dev_err(&ctrl->pcie->device, format, ## arg)
#define ctrl_info(ctrl, format, arg...) \
dev_info(&ctrl->pcie->device, format, ## arg)
#define ctrl_warn(ctrl, format, arg...) \
dev_warn(&ctrl->pcie->device, format, ## arg)
#define SLOT_NAME_SIZE 10 #define SLOT_NAME_SIZE 10
struct slot { struct slot {
u8 bus; u8 bus;
...@@ -171,7 +184,7 @@ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) ...@@ -171,7 +184,7 @@ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
return slot; return slot;
} }
err("%s: slot (device=0x%x) not found\n", __func__, device); ctrl_err(ctrl, "%s: slot (device=0x%x) not found\n", __func__, device);
return NULL; return NULL;
} }
......
...@@ -144,9 +144,10 @@ set_lock_exit: ...@@ -144,9 +144,10 @@ set_lock_exit:
* sysfs interface which allows the user to toggle the Electro Mechanical * sysfs interface which allows the user to toggle the Electro Mechanical
* Interlock. Valid values are either 0 or 1. 0 == unlock, 1 == lock * Interlock. Valid values are either 0 or 1. 0 == unlock, 1 == lock
*/ */
static ssize_t lock_write_file(struct hotplug_slot *slot, const char *buf, static ssize_t lock_write_file(struct hotplug_slot *hotplug_slot,
size_t count) const char *buf, size_t count)
{ {
struct slot *slot = hotplug_slot->private;
unsigned long llock; unsigned long llock;
u8 lock; u8 lock;
int retval = 0; int retval = 0;
...@@ -157,10 +158,11 @@ static ssize_t lock_write_file(struct hotplug_slot *slot, const char *buf, ...@@ -157,10 +158,11 @@ static ssize_t lock_write_file(struct hotplug_slot *slot, const char *buf,
switch (lock) { switch (lock) {
case 0: case 0:
case 1: case 1:
retval = set_lock_status(slot, lock); retval = set_lock_status(hotplug_slot, lock);
break; break;
default: default:
err ("%d is an invalid lock value\n", lock); ctrl_err(slot->ctrl, "%d is an invalid lock value\n",
lock);
retval = -EINVAL; retval = -EINVAL;
} }
if (retval) if (retval)
...@@ -180,7 +182,10 @@ static struct hotplug_slot_attribute hotplug_slot_attr_lock = { ...@@ -180,7 +182,10 @@ static struct hotplug_slot_attribute hotplug_slot_attr_lock = {
*/ */
static void release_slot(struct hotplug_slot *hotplug_slot) static void release_slot(struct hotplug_slot *hotplug_slot)
{ {
dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); struct slot *slot = hotplug_slot->private;
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
__func__, hotplug_slot->name);
kfree(hotplug_slot->info); kfree(hotplug_slot->info);
kfree(hotplug_slot); kfree(hotplug_slot);
...@@ -215,7 +220,7 @@ static int init_slots(struct controller *ctrl) ...@@ -215,7 +220,7 @@ static int init_slots(struct controller *ctrl)
get_adapter_status(hotplug_slot, &info->adapter_status); get_adapter_status(hotplug_slot, &info->adapter_status);
slot->hotplug_slot = hotplug_slot; slot->hotplug_slot = hotplug_slot;
dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x "
"slot_device_offset=%x\n", slot->bus, slot->device, "slot_device_offset=%x\n", slot->bus, slot->device,
slot->hp_slot, slot->number, ctrl->slot_device_offset); slot->hp_slot, slot->number, ctrl->slot_device_offset);
duplicate_name: duplicate_name:
...@@ -233,9 +238,11 @@ duplicate_name: ...@@ -233,9 +238,11 @@ duplicate_name:
if (len < SLOT_NAME_SIZE) if (len < SLOT_NAME_SIZE)
goto duplicate_name; goto duplicate_name;
else else
err("duplicate slot name overflow\n"); ctrl_err(ctrl, "duplicate slot name "
"overflow\n");
} }
err("pci_hp_register failed with error %d\n", retval); ctrl_err(ctrl, "pci_hp_register failed with error %d\n",
retval);
goto error_info; goto error_info;
} }
/* create additional sysfs entries */ /* create additional sysfs entries */
...@@ -244,7 +251,8 @@ duplicate_name: ...@@ -244,7 +251,8 @@ duplicate_name:
&hotplug_slot_attr_lock.attr); &hotplug_slot_attr_lock.attr);
if (retval) { if (retval) {
pci_hp_deregister(hotplug_slot); pci_hp_deregister(hotplug_slot);
err("cannot create additional sysfs entries\n"); ctrl_err(ctrl, "cannot create additional sysfs "
"entries\n");
goto error_info; goto error_info;
} }
} }
...@@ -278,7 +286,8 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) ...@@ -278,7 +286,8 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
__func__, hotplug_slot->name);
hotplug_slot->info->attention_status = status; hotplug_slot->info->attention_status = status;
...@@ -293,7 +302,8 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) ...@@ -293,7 +302,8 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
__func__, hotplug_slot->name);
return pciehp_sysfs_enable_slot(slot); return pciehp_sysfs_enable_slot(slot);
} }
...@@ -303,7 +313,8 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) ...@@ -303,7 +313,8 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
__func__, hotplug_slot->name);
return pciehp_sysfs_disable_slot(slot); return pciehp_sysfs_disable_slot(slot);
} }
...@@ -313,7 +324,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -313,7 +324,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval; int retval;
dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
__func__, hotplug_slot->name);
retval = slot->hpc_ops->get_power_status(slot, value); retval = slot->hpc_ops->get_power_status(slot, value);
if (retval < 0) if (retval < 0)
...@@ -327,7 +339,8 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -327,7 +339,8 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval; int retval;
dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
__func__, hotplug_slot->name);
retval = slot->hpc_ops->get_attention_status(slot, value); retval = slot->hpc_ops->get_attention_status(slot, value);
if (retval < 0) if (retval < 0)
...@@ -341,7 +354,8 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -341,7 +354,8 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval; int retval;
dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
__func__, hotplug_slot->name);
retval = slot->hpc_ops->get_latch_status(slot, value); retval = slot->hpc_ops->get_latch_status(slot, value);
if (retval < 0) if (retval < 0)
...@@ -355,7 +369,8 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -355,7 +369,8 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval; int retval;
dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
__func__, hotplug_slot->name);
retval = slot->hpc_ops->get_adapter_status(slot, value); retval = slot->hpc_ops->get_adapter_status(slot, value);
if (retval < 0) if (retval < 0)
...@@ -370,7 +385,8 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, ...@@ -370,7 +385,8 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval; int retval;
dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
__func__, hotplug_slot->name);
retval = slot->hpc_ops->get_max_bus_speed(slot, value); retval = slot->hpc_ops->get_max_bus_speed(slot, value);
if (retval < 0) if (retval < 0)
...@@ -384,7 +400,8 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe ...@@ -384,7 +400,8 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval; int retval;
dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
__func__, hotplug_slot->name);
retval = slot->hpc_ops->get_cur_bus_speed(slot, value); retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
if (retval < 0) if (retval < 0)
...@@ -402,14 +419,15 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ ...@@ -402,14 +419,15 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
struct pci_dev *pdev = dev->port; struct pci_dev *pdev = dev->port;
if (pciehp_force) if (pciehp_force)
dbg("Bypassing BIOS check for pciehp use on %s\n", dev_info(&dev->device,
"Bypassing BIOS check for pciehp use on %s\n",
pci_name(pdev)); pci_name(pdev));
else if (pciehp_get_hp_hw_control_from_firmware(pdev)) else if (pciehp_get_hp_hw_control_from_firmware(pdev))
goto err_out_none; goto err_out_none;
ctrl = pcie_init(dev); ctrl = pcie_init(dev);
if (!ctrl) { if (!ctrl) {
dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME); dev_err(&dev->device, "controller initialization failed\n");
goto err_out_none; goto err_out_none;
} }
set_service_data(dev, ctrl); set_service_data(dev, ctrl);
...@@ -418,11 +436,10 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ ...@@ -418,11 +436,10 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
rc = init_slots(ctrl); rc = init_slots(ctrl);
if (rc) { if (rc) {
if (rc == -EBUSY) if (rc == -EBUSY)
warn("%s: slot already registered by another " ctrl_warn(ctrl, "slot already registered by another "
"hotplug driver\n", PCIE_MODULE_NAME); "hotplug driver\n");
else else
err("%s: slot initialization failed\n", ctrl_err(ctrl, "slot initialization failed\n");
PCIE_MODULE_NAME);
goto err_out_release_ctlr; goto err_out_release_ctlr;
} }
...@@ -461,13 +478,13 @@ static void pciehp_remove (struct pcie_device *dev) ...@@ -461,13 +478,13 @@ static void pciehp_remove (struct pcie_device *dev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int pciehp_suspend (struct pcie_device *dev, pm_message_t state) static int pciehp_suspend (struct pcie_device *dev, pm_message_t state)
{ {
printk("%s ENTRY\n", __func__); dev_info(&dev->device, "%s ENTRY\n", __func__);
return 0; return 0;
} }
static int pciehp_resume (struct pcie_device *dev) static int pciehp_resume (struct pcie_device *dev)
{ {
printk("%s ENTRY\n", __func__); dev_info(&dev->device, "%s ENTRY\n", __func__);
if (pciehp_force) { if (pciehp_force) {
struct controller *ctrl = get_service_data(dev); struct controller *ctrl = get_service_data(dev);
struct slot *t_slot; struct slot *t_slot;
......
This diff is collapsed.
This diff is collapsed.
...@@ -198,10 +198,12 @@ int pciehp_configure_device(struct slot *p_slot) ...@@ -198,10 +198,12 @@ int pciehp_configure_device(struct slot *p_slot)
struct pci_dev *dev; struct pci_dev *dev;
struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
int num, fn; int num, fn;
struct controller *ctrl = p_slot->ctrl;
dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0));
if (dev) { if (dev) {
err("Device %s already exists at %x:%x, cannot hot-add\n", ctrl_err(ctrl,
"Device %s already exists at %x:%x, cannot hot-add\n",
pci_name(dev), p_slot->bus, p_slot->device); pci_name(dev), p_slot->bus, p_slot->device);
pci_dev_put(dev); pci_dev_put(dev);
return -EINVAL; return -EINVAL;
...@@ -209,7 +211,7 @@ int pciehp_configure_device(struct slot *p_slot) ...@@ -209,7 +211,7 @@ int pciehp_configure_device(struct slot *p_slot)
num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0));
if (num == 0) { if (num == 0) {
err("No new device found\n"); ctrl_err(ctrl, "No new device found\n");
return -ENODEV; return -ENODEV;
} }
...@@ -218,7 +220,7 @@ int pciehp_configure_device(struct slot *p_slot) ...@@ -218,7 +220,7 @@ int pciehp_configure_device(struct slot *p_slot)
if (!dev) if (!dev)
continue; continue;
if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
err("Cannot hot-add display device %s\n", ctrl_err(ctrl, "Cannot hot-add display device %s\n",
pci_name(dev)); pci_name(dev));
pci_dev_put(dev); pci_dev_put(dev);
continue; continue;
...@@ -244,9 +246,10 @@ int pciehp_unconfigure_device(struct slot *p_slot) ...@@ -244,9 +246,10 @@ int pciehp_unconfigure_device(struct slot *p_slot)
u8 presence = 0; u8 presence = 0;
struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
u16 command; u16 command;
struct controller *ctrl = p_slot->ctrl;
dbg("%s: bus/dev = %x/%x\n", __func__, p_slot->bus, ctrl_dbg(ctrl, "%s: bus/dev = %x/%x\n", __func__,
p_slot->device); p_slot->bus, p_slot->device);
ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence);
if (ret) if (ret)
presence = 0; presence = 0;
...@@ -257,7 +260,7 @@ int pciehp_unconfigure_device(struct slot *p_slot) ...@@ -257,7 +260,7 @@ int pciehp_unconfigure_device(struct slot *p_slot)
if (!temp) if (!temp)
continue; continue;
if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
err("Cannot remove display device %s\n", ctrl_err(ctrl, "Cannot remove display device %s\n",
pci_name(temp)); pci_name(temp));
pci_dev_put(temp); pci_dev_put(temp);
continue; continue;
...@@ -265,7 +268,8 @@ int pciehp_unconfigure_device(struct slot *p_slot) ...@@ -265,7 +268,8 @@ int pciehp_unconfigure_device(struct slot *p_slot)
if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) { if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) {
pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl); pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl);
if (bctl & PCI_BRIDGE_CTL_VGA) { if (bctl & PCI_BRIDGE_CTL_VGA) {
err("Cannot remove display device %s\n", ctrl_err(ctrl,
"Cannot remove display device %s\n",
pci_name(temp)); pci_name(temp));
pci_dev_put(temp); pci_dev_put(temp);
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment