ipmi: update driver to use dev_printk and its constructs

Update core IPMI driver printk()'s with dev_printk(), and its constructs,
to provide additional device topology information.

An example of the additional device topology for a PNP device -
  ipmi_si 00:02: probing via ACPI
  ipmi_si 00:02: [io  0x0ca2-0x0ca3] regsize 1 spacing 1 irq 0
  ipmi_si 00:02: Found new BMC (man_id: 0x00000b, prod_id: 0x0000, ...
  ipmi_si 00:02: IPMI kcs interface initialized

and for a PCI device -
  ipmi_si 0000:01:04.6: probing via PCI
  ipmi_si 0000:01:04.6: PCI INT A -> GSI 21 (level, low) -> IRQ 21
  ipmi_si 0000:01:04.6: [mem 0xf1ef0000-0xf1ef00ff] regsize 1 spaci...
  ipmi_si 0000:01:04.6: IPMI kcs interface initialized

[minyard@acm.org: rework to fix rejects, extended it a bit]
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Myron Stowe <myron.stowe@hp.com>
Signed-off-by: Corey Minyard <minyard@acm.org>
Cc: Zhao Yakui <yakui.zhao@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Myron Stowe 2010-05-26 14:43:52 -07:00 committed by Linus Torvalds
parent 8c8eae2742
commit 279fbd0c5d
2 changed files with 107 additions and 127 deletions

View file

@ -2505,12 +2505,11 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum,
return rv; return rv;
} }
printk(KERN_INFO dev_info(intf->si_dev, "Found new BMC (man_id: 0x%6.6x, "
"ipmi: Found new BMC (man_id: 0x%6.6x, " "prod_id: 0x%4.4x, dev_id: 0x%2.2x)\n",
" prod_id: 0x%4.4x, dev_id: 0x%2.2x)\n", bmc->id.manufacturer_id,
bmc->id.manufacturer_id, bmc->id.product_id,
bmc->id.product_id, bmc->id.device_id);
bmc->id.device_id);
} }
/* /*

View file

@ -588,9 +588,8 @@ static void handle_transaction_done(struct smi_info *smi_info)
smi_info->handlers->get_result(smi_info->si_sm, msg, 3); smi_info->handlers->get_result(smi_info->si_sm, msg, 3);
if (msg[2] != 0) { if (msg[2] != 0) {
/* Error clearing flags */ /* Error clearing flags */
printk(KERN_WARNING dev_warn(smi_info->dev,
"ipmi_si: Error clearing flags: %2.2x\n", "Error clearing flags: %2.2x\n", msg[2]);
msg[2]);
} }
if (smi_info->si_state == SI_CLEARING_FLAGS_THEN_SET_IRQ) if (smi_info->si_state == SI_CLEARING_FLAGS_THEN_SET_IRQ)
start_enable_irq(smi_info); start_enable_irq(smi_info);
@ -682,9 +681,8 @@ static void handle_transaction_done(struct smi_info *smi_info)
/* We got the flags from the SMI, now handle them. */ /* We got the flags from the SMI, now handle them. */
smi_info->handlers->get_result(smi_info->si_sm, msg, 4); smi_info->handlers->get_result(smi_info->si_sm, msg, 4);
if (msg[2] != 0) { if (msg[2] != 0) {
printk(KERN_WARNING dev_warn(smi_info->dev, "Could not enable interrupts"
"ipmi_si: Could not enable interrupts" ", failed get, using polled mode.\n");
", failed get, using polled mode.\n");
smi_info->si_state = SI_NORMAL; smi_info->si_state = SI_NORMAL;
} else { } else {
msg[0] = (IPMI_NETFN_APP_REQUEST << 2); msg[0] = (IPMI_NETFN_APP_REQUEST << 2);
@ -705,13 +703,11 @@ static void handle_transaction_done(struct smi_info *smi_info)
/* We got the flags from the SMI, now handle them. */ /* We got the flags from the SMI, now handle them. */
smi_info->handlers->get_result(smi_info->si_sm, msg, 4); smi_info->handlers->get_result(smi_info->si_sm, msg, 4);
if (msg[2] != 0) { if (msg[2] != 0)
printk(KERN_WARNING dev_warn(smi_info->dev, "Could not enable interrupts"
"ipmi_si: Could not enable interrupts" ", failed set, using polled mode.\n");
", failed set, using polled mode.\n"); else
} else {
smi_info->interrupt_disabled = 0; smi_info->interrupt_disabled = 0;
}
smi_info->si_state = SI_NORMAL; smi_info->si_state = SI_NORMAL;
break; break;
} }
@ -723,9 +719,8 @@ static void handle_transaction_done(struct smi_info *smi_info)
/* We got the flags from the SMI, now handle them. */ /* We got the flags from the SMI, now handle them. */
smi_info->handlers->get_result(smi_info->si_sm, msg, 4); smi_info->handlers->get_result(smi_info->si_sm, msg, 4);
if (msg[2] != 0) { if (msg[2] != 0) {
printk(KERN_WARNING dev_warn(smi_info->dev, "Could not disable interrupts"
"ipmi_si: Could not disable interrupts" ", failed get.\n");
", failed get.\n");
smi_info->si_state = SI_NORMAL; smi_info->si_state = SI_NORMAL;
} else { } else {
msg[0] = (IPMI_NETFN_APP_REQUEST << 2); msg[0] = (IPMI_NETFN_APP_REQUEST << 2);
@ -747,9 +742,8 @@ static void handle_transaction_done(struct smi_info *smi_info)
/* We got the flags from the SMI, now handle them. */ /* We got the flags from the SMI, now handle them. */
smi_info->handlers->get_result(smi_info->si_sm, msg, 4); smi_info->handlers->get_result(smi_info->si_sm, msg, 4);
if (msg[2] != 0) { if (msg[2] != 0) {
printk(KERN_WARNING dev_warn(smi_info->dev, "Could not disable interrupts"
"ipmi_si: Could not disable interrupts" ", failed set.\n");
", failed set.\n");
} }
smi_info->si_state = SI_NORMAL; smi_info->si_state = SI_NORMAL;
break; break;
@ -1167,10 +1161,10 @@ static int smi_start_processing(void *send_info,
new_smi->thread = kthread_run(ipmi_thread, new_smi, new_smi->thread = kthread_run(ipmi_thread, new_smi,
"kipmi%d", new_smi->intf_num); "kipmi%d", new_smi->intf_num);
if (IS_ERR(new_smi->thread)) { if (IS_ERR(new_smi->thread)) {
printk(KERN_NOTICE "ipmi_si_intf: Could not start" dev_notice(new_smi->dev, "Could not start"
" kernel thread due to error %ld, only using" " kernel thread due to error %ld, only using"
" timers to drive the interface\n", " timers to drive the interface\n",
PTR_ERR(new_smi->thread)); PTR_ERR(new_smi->thread));
new_smi->thread = NULL; new_smi->thread = NULL;
} }
} }
@ -1331,14 +1325,13 @@ static int std_irq_setup(struct smi_info *info)
DEVICE_NAME, DEVICE_NAME,
info); info);
if (rv) { if (rv) {
printk(KERN_WARNING dev_warn(info->dev, "%s unable to claim interrupt %d,"
"ipmi_si: %s unable to claim interrupt %d," " running polled\n",
" running polled\n", DEVICE_NAME, info->irq);
DEVICE_NAME, info->irq);
info->irq = 0; info->irq = 0;
} else { } else {
info->irq_cleanup = std_irq_cleanup; info->irq_cleanup = std_irq_cleanup;
printk(" Using irq %d\n", info->irq); dev_info(info->dev, "Using irq %d\n", info->irq);
} }
return rv; return rv;
@ -1429,8 +1422,8 @@ static int port_setup(struct smi_info *info)
info->io.outputb = port_outl; info->io.outputb = port_outl;
break; break;
default: default:
printk(KERN_WARNING "ipmi_si: Invalid register size: %d\n", dev_warn(info->dev, "Invalid register size: %d\n",
info->io.regsize); info->io.regsize);
return -EINVAL; return -EINVAL;
} }
@ -1552,8 +1545,8 @@ static int mem_setup(struct smi_info *info)
break; break;
#endif #endif
default: default:
printk(KERN_WARNING "ipmi_si: Invalid register size: %d\n", dev_warn(info->dev, "Invalid register size: %d\n",
info->io.regsize); info->io.regsize);
return -EINVAL; return -EINVAL;
} }
@ -1839,6 +1832,7 @@ static __devinit void hardcode_find_bmc(void)
return; return;
info->addr_source = SI_HARDCODED; info->addr_source = SI_HARDCODED;
printk(KERN_INFO PFX "probing via hardcoded address\n");
if (!si_type[i] || strcmp(si_type[i], "kcs") == 0) { if (!si_type[i] || strcmp(si_type[i], "kcs") == 0) {
info->si_type = SI_KCS; info->si_type = SI_KCS;
@ -1847,8 +1841,7 @@ static __devinit void hardcode_find_bmc(void)
} else if (strcmp(si_type[i], "bt") == 0) { } else if (strcmp(si_type[i], "bt") == 0) {
info->si_type = SI_BT; info->si_type = SI_BT;
} else { } else {
printk(KERN_WARNING printk(KERN_WARNING PFX "Interface type specified "
"ipmi_si: Interface type specified "
"for interface %d, was invalid: %s\n", "for interface %d, was invalid: %s\n",
i, si_type[i]); i, si_type[i]);
kfree(info); kfree(info);
@ -1866,11 +1859,9 @@ static __devinit void hardcode_find_bmc(void)
info->io.addr_data = addrs[i]; info->io.addr_data = addrs[i];
info->io.addr_type = IPMI_MEM_ADDR_SPACE; info->io.addr_type = IPMI_MEM_ADDR_SPACE;
} else { } else {
printk(KERN_WARNING printk(KERN_WARNING PFX "Interface type specified "
"ipmi_si: Interface type specified " "for interface %d, but port and address were "
"for interface %d, " "not set or set to zero.\n", i);
"but port and address were not set or "
"set to zero.\n", i);
kfree(info); kfree(info);
continue; continue;
} }
@ -1950,15 +1941,13 @@ static int acpi_gpe_irq_setup(struct smi_info *info)
&ipmi_acpi_gpe, &ipmi_acpi_gpe,
info); info);
if (status != AE_OK) { if (status != AE_OK) {
printk(KERN_WARNING dev_warn(info->dev, "%s unable to claim ACPI GPE %d,"
"ipmi_si: %s unable to claim ACPI GPE %d," " running polled\n", DEVICE_NAME, info->irq);
" running polled\n",
DEVICE_NAME, info->irq);
info->irq = 0; info->irq = 0;
return -EINVAL; return -EINVAL;
} else { } else {
info->irq_cleanup = acpi_gpe_irq_cleanup; info->irq_cleanup = acpi_gpe_irq_cleanup;
printk(" Using ACPI GPE %d\n", info->irq); dev_info(info->dev, "Using ACPI GPE %d\n", info->irq);
return 0; return 0;
} }
} }
@ -2016,8 +2005,8 @@ static __devinit int try_init_spmi(struct SPMITable *spmi)
u8 addr_space; u8 addr_space;
if (spmi->IPMIlegacy != 1) { if (spmi->IPMIlegacy != 1) {
printk(KERN_INFO "IPMI: Bad SPMI legacy %d\n", spmi->IPMIlegacy); printk(KERN_INFO PFX "Bad SPMI legacy %d\n", spmi->IPMIlegacy);
return -ENODEV; return -ENODEV;
} }
if (spmi->addr.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) if (spmi->addr.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
@ -2027,11 +2016,12 @@ static __devinit int try_init_spmi(struct SPMITable *spmi)
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) { if (!info) {
printk(KERN_ERR "ipmi_si: Could not allocate SI data (3)\n"); printk(KERN_ERR PFX "Could not allocate SI data (3)\n");
return -ENOMEM; return -ENOMEM;
} }
info->addr_source = SI_SPMI; info->addr_source = SI_SPMI;
printk(KERN_INFO PFX "probing via SPMI\n");
/* Figure out the interface type. */ /* Figure out the interface type. */
switch (spmi->InterfaceType) { switch (spmi->InterfaceType) {
@ -2045,8 +2035,8 @@ static __devinit int try_init_spmi(struct SPMITable *spmi)
info->si_type = SI_BT; info->si_type = SI_BT;
break; break;
default: default:
printk(KERN_INFO "ipmi_si: Unknown ACPI/SPMI SI type %d\n", printk(KERN_INFO PFX "Unknown ACPI/SPMI SI type %d\n",
spmi->InterfaceType); spmi->InterfaceType);
kfree(info); kfree(info);
return -EIO; return -EIO;
} }
@ -2082,8 +2072,7 @@ static __devinit int try_init_spmi(struct SPMITable *spmi)
info->io.addr_type = IPMI_IO_ADDR_SPACE; info->io.addr_type = IPMI_IO_ADDR_SPACE;
} else { } else {
kfree(info); kfree(info);
printk(KERN_WARNING printk(KERN_WARNING PFX "Unknown ACPI I/O Address type\n");
"ipmi_si: Unknown ACPI I/O Address type\n");
return -EIO; return -EIO;
} }
info->io.addr_data = spmi->addr.address; info->io.addr_data = spmi->addr.address;
@ -2120,6 +2109,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
{ {
struct acpi_device *acpi_dev; struct acpi_device *acpi_dev;
struct smi_info *info; struct smi_info *info;
struct resource *res;
acpi_handle handle; acpi_handle handle;
acpi_status status; acpi_status status;
unsigned long long tmp; unsigned long long tmp;
@ -2133,6 +2123,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
return -ENOMEM; return -ENOMEM;
info->addr_source = SI_ACPI; info->addr_source = SI_ACPI;
printk(KERN_INFO PFX "probing via ACPI\n");
handle = acpi_dev->handle; handle = acpi_dev->handle;
@ -2152,22 +2143,26 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
info->si_type = SI_BT; info->si_type = SI_BT;
break; break;
default: default:
dev_info(&dev->dev, "unknown interface type %lld\n", tmp); dev_info(&dev->dev, "unknown IPMI type %lld\n", tmp);
goto err_free; goto err_free;
} }
if (pnp_port_valid(dev, 0)) { res = pnp_get_resource(dev, IORESOURCE_IO, 0);
if (res) {
info->io_setup = port_setup; info->io_setup = port_setup;
info->io.addr_type = IPMI_IO_ADDR_SPACE; info->io.addr_type = IPMI_IO_ADDR_SPACE;
info->io.addr_data = pnp_port_start(dev, 0);
} else if (pnp_mem_valid(dev, 0)) {
info->io_setup = mem_setup;
info->io.addr_type = IPMI_MEM_ADDR_SPACE;
info->io.addr_data = pnp_mem_start(dev, 0);
} else { } else {
res = pnp_get_resource(dev, IORESOURCE_MEM, 0);
if (res) {
info->io_setup = mem_setup;
info->io.addr_type = IPMI_MEM_ADDR_SPACE;
}
}
if (!res) {
dev_err(&dev->dev, "no I/O or memory address\n"); dev_err(&dev->dev, "no I/O or memory address\n");
goto err_free; goto err_free;
} }
info->io.addr_data = res->start;
info->io.regspacing = DEFAULT_REGSPACING; info->io.regspacing = DEFAULT_REGSPACING;
info->io.regsize = DEFAULT_REGSPACING; info->io.regsize = DEFAULT_REGSPACING;
@ -2186,6 +2181,10 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
info->dev = &dev->dev; info->dev = &dev->dev;
pnp_set_drvdata(dev, info); pnp_set_drvdata(dev, info);
dev_info(info->dev, "%pR regsize %d spacing %d irq %d\n",
res, info->io.regsize, info->io.regspacing,
info->irq);
return add_smi(info); return add_smi(info);
err_free: err_free:
@ -2291,12 +2290,12 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) { if (!info) {
printk(KERN_ERR printk(KERN_ERR PFX "Could not allocate SI data\n");
"ipmi_si: Could not allocate SI data\n");
return; return;
} }
info->addr_source = SI_SMBIOS; info->addr_source = SI_SMBIOS;
printk(KERN_INFO PFX "probing via SMBIOS\n");
switch (ipmi_data->type) { switch (ipmi_data->type) {
case 0x01: /* KCS */ case 0x01: /* KCS */
@ -2326,8 +2325,7 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
default: default:
kfree(info); kfree(info);
printk(KERN_WARNING printk(KERN_WARNING PFX "Unknown SMBIOS I/O Address type: %d\n",
"ipmi_si: Unknown SMBIOS I/O Address type: %d.\n",
ipmi_data->addr_space); ipmi_data->addr_space);
return; return;
} }
@ -2396,6 +2394,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
return -ENOMEM; return -ENOMEM;
info->addr_source = SI_PCI; info->addr_source = SI_PCI;
dev_info(&pdev->dev, "probing via PCI");
switch (class_type) { switch (class_type) {
case PCI_ERMC_CLASSCODE_TYPE_SMIC: case PCI_ERMC_CLASSCODE_TYPE_SMIC:
@ -2412,15 +2411,13 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
default: default:
kfree(info); kfree(info);
printk(KERN_INFO "ipmi_si: %s: Unknown IPMI type: %d\n", dev_info(&pdev->dev, "Unknown IPMI type: %d\n", class_type);
pci_name(pdev), class_type);
return -ENOMEM; return -ENOMEM;
} }
rv = pci_enable_device(pdev); rv = pci_enable_device(pdev);
if (rv) { if (rv) {
printk(KERN_ERR "ipmi_si: %s: couldn't enable PCI device\n", dev_err(&pdev->dev, "couldn't enable PCI device\n");
pci_name(pdev));
kfree(info); kfree(info);
return rv; return rv;
} }
@ -2448,6 +2445,10 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
info->dev = &pdev->dev; info->dev = &pdev->dev;
pci_set_drvdata(pdev, info); pci_set_drvdata(pdev, info);
dev_info(&pdev->dev, "%pR regsize %d spacing %d irq %d\n",
&pdev->resource[0], info->io.regsize, info->io.regspacing,
info->irq);
return add_smi(info); return add_smi(info);
} }
@ -2500,7 +2501,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev,
int ret; int ret;
int proplen; int proplen;
dev_info(&dev->dev, PFX "probing via device tree\n"); dev_info(&dev->dev, "probing via device tree\n");
ret = of_address_to_resource(np, 0, &resource); ret = of_address_to_resource(np, 0, &resource);
if (ret) { if (ret) {
@ -2530,7 +2531,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev,
if (!info) { if (!info) {
dev_err(&dev->dev, dev_err(&dev->dev,
PFX "could not allocate memory for OF probe\n"); "could not allocate memory for OF probe\n");
return -ENOMEM; return -ENOMEM;
} }
@ -2555,7 +2556,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev,
info->irq = irq_of_parse_and_map(dev->dev.of_node, 0); info->irq = irq_of_parse_and_map(dev->dev.of_node, 0);
info->dev = &dev->dev; info->dev = &dev->dev;
dev_dbg(&dev->dev, "addr 0x%lx regsize %d spacing %d irq %x\n", dev_dbg(&dev->dev, "addr 0x%lx regsize %d spacing %d irq %d\n",
info->io.addr_data, info->io.regsize, info->io.regspacing, info->io.addr_data, info->io.regsize, info->io.regspacing,
info->irq); info->irq);
@ -2670,9 +2671,8 @@ static int try_enable_event_buffer(struct smi_info *smi_info)
rv = wait_for_msg_done(smi_info); rv = wait_for_msg_done(smi_info);
if (rv) { if (rv) {
printk(KERN_WARNING printk(KERN_WARNING PFX "Error getting response from get"
"ipmi_si: Error getting response from get global," " global enables command, the event buffer is not"
" enables command, the event buffer is not"
" enabled.\n"); " enabled.\n");
goto out; goto out;
} }
@ -2684,10 +2684,8 @@ static int try_enable_event_buffer(struct smi_info *smi_info)
resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 ||
resp[1] != IPMI_GET_BMC_GLOBAL_ENABLES_CMD || resp[1] != IPMI_GET_BMC_GLOBAL_ENABLES_CMD ||
resp[2] != 0) { resp[2] != 0) {
printk(KERN_WARNING printk(KERN_WARNING PFX "Invalid return from get global"
"ipmi_si: Invalid return from get global" " enables command, cannot enable the event buffer.\n");
" enables command, cannot enable the event"
" buffer.\n");
rv = -EINVAL; rv = -EINVAL;
goto out; goto out;
} }
@ -2703,9 +2701,8 @@ static int try_enable_event_buffer(struct smi_info *smi_info)
rv = wait_for_msg_done(smi_info); rv = wait_for_msg_done(smi_info);
if (rv) { if (rv) {
printk(KERN_WARNING printk(KERN_WARNING PFX "Error getting response from set"
"ipmi_si: Error getting response from set global," " global, enables command, the event buffer is not"
" enables command, the event buffer is not"
" enabled.\n"); " enabled.\n");
goto out; goto out;
} }
@ -2716,10 +2713,8 @@ static int try_enable_event_buffer(struct smi_info *smi_info)
if (resp_len < 3 || if (resp_len < 3 ||
resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 ||
resp[1] != IPMI_SET_BMC_GLOBAL_ENABLES_CMD) { resp[1] != IPMI_SET_BMC_GLOBAL_ENABLES_CMD) {
printk(KERN_WARNING printk(KERN_WARNING PFX "Invalid return from get global,"
"ipmi_si: Invalid return from get global," "enables command, not enable the event buffer.\n");
"enables command, not enable the event"
" buffer.\n");
rv = -EINVAL; rv = -EINVAL;
goto out; goto out;
} }
@ -2993,7 +2988,7 @@ static __devinit void default_find_bmc(void)
if (add_smi(info) == 0) { if (add_smi(info) == 0) {
if ((try_smi_init(info)) == 0) { if ((try_smi_init(info)) == 0) {
/* Found one... */ /* Found one... */
printk(KERN_INFO "ipmi_si: Found default %s" printk(KERN_INFO PFX "Found default %s"
" state machine at %s address 0x%lx\n", " state machine at %s address 0x%lx\n",
si_to_str[info->si_type], si_to_str[info->si_type],
addr_space_to_str[info->io.addr_type], addr_space_to_str[info->io.addr_type],
@ -3022,12 +3017,12 @@ static int add_smi(struct smi_info *new_smi)
{ {
int rv = 0; int rv = 0;
printk(KERN_INFO "ipmi_si: Adding %s-specified %s state machine", printk(KERN_INFO PFX "Adding %s-specified %s state machine",
ipmi_addr_src_to_str[new_smi->addr_source], ipmi_addr_src_to_str[new_smi->addr_source],
si_to_str[new_smi->si_type]); si_to_str[new_smi->si_type]);
mutex_lock(&smi_infos_lock); mutex_lock(&smi_infos_lock);
if (!is_new_interface(new_smi)) { if (!is_new_interface(new_smi)) {
printk(KERN_CONT ": duplicate interface\n"); printk(KERN_CONT PFX "duplicate interface\n");
rv = -EBUSY; rv = -EBUSY;
goto out_err; goto out_err;
} }
@ -3051,7 +3046,7 @@ static int try_smi_init(struct smi_info *new_smi)
int rv = 0; int rv = 0;
int i; int i;
printk(KERN_INFO "ipmi_si: Trying %s-specified %s state" printk(KERN_INFO PFX "Trying %s-specified %s state"
" machine at %s address 0x%lx, slave address 0x%x," " machine at %s address 0x%lx, slave address 0x%x,"
" irq %d\n", " irq %d\n",
ipmi_addr_src_to_str[new_smi->addr_source], ipmi_addr_src_to_str[new_smi->addr_source],
@ -3082,7 +3077,8 @@ static int try_smi_init(struct smi_info *new_smi)
/* Allocate the state machine's data and initialize it. */ /* Allocate the state machine's data and initialize it. */
new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL); new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL);
if (!new_smi->si_sm) { if (!new_smi->si_sm) {
printk(KERN_ERR "Could not allocate state machine memory\n"); printk(KERN_ERR PFX
"Could not allocate state machine memory\n");
rv = -ENOMEM; rv = -ENOMEM;
goto out_err; goto out_err;
} }
@ -3092,7 +3088,7 @@ static int try_smi_init(struct smi_info *new_smi)
/* Now that we know the I/O size, we can set up the I/O. */ /* Now that we know the I/O size, we can set up the I/O. */
rv = new_smi->io_setup(new_smi); rv = new_smi->io_setup(new_smi);
if (rv) { if (rv) {
printk(KERN_ERR "Could not set up I/O space\n"); printk(KERN_ERR PFX "Could not set up I/O space\n");
goto out_err; goto out_err;
} }
@ -3102,8 +3098,7 @@ static int try_smi_init(struct smi_info *new_smi)
/* Do low-level detection first. */ /* Do low-level detection first. */
if (new_smi->handlers->detect(new_smi->si_sm)) { if (new_smi->handlers->detect(new_smi->si_sm)) {
if (new_smi->addr_source) if (new_smi->addr_source)
printk(KERN_INFO "ipmi_si: Interface detection" printk(KERN_INFO PFX "Interface detection failed\n");
" failed\n");
rv = -ENODEV; rv = -ENODEV;
goto out_err; goto out_err;
} }
@ -3115,7 +3110,7 @@ static int try_smi_init(struct smi_info *new_smi)
rv = try_get_dev_id(new_smi); rv = try_get_dev_id(new_smi);
if (rv) { if (rv) {
if (new_smi->addr_source) if (new_smi->addr_source)
printk(KERN_INFO "ipmi_si: There appears to be no BMC" printk(KERN_INFO PFX "There appears to be no BMC"
" at this location\n"); " at this location\n");
goto out_err; goto out_err;
} }
@ -3157,9 +3152,8 @@ static int try_smi_init(struct smi_info *new_smi)
new_smi->pdev = platform_device_alloc("ipmi_si", new_smi->pdev = platform_device_alloc("ipmi_si",
new_smi->intf_num); new_smi->intf_num);
if (!new_smi->pdev) { if (!new_smi->pdev) {
printk(KERN_ERR printk(KERN_ERR PFX
"ipmi_si_intf:" "Unable to allocate platform device\n");
" Unable to allocate platform device\n");
goto out_err; goto out_err;
} }
new_smi->dev = &new_smi->pdev->dev; new_smi->dev = &new_smi->pdev->dev;
@ -3167,9 +3161,8 @@ static int try_smi_init(struct smi_info *new_smi)
rv = platform_device_add(new_smi->pdev); rv = platform_device_add(new_smi->pdev);
if (rv) { if (rv) {
printk(KERN_ERR printk(KERN_ERR PFX
"ipmi_si_intf:" "Unable to register system interface device:"
" Unable to register system interface device:"
" %d\n", " %d\n",
rv); rv);
goto out_err; goto out_err;
@ -3184,9 +3177,8 @@ static int try_smi_init(struct smi_info *new_smi)
"bmc", "bmc",
new_smi->slave_addr); new_smi->slave_addr);
if (rv) { if (rv) {
printk(KERN_ERR dev_err(new_smi->dev, "Unable to register device: error %d\n",
"ipmi_si: Unable to register device: error %d\n", rv);
rv);
goto out_err_stop_timer; goto out_err_stop_timer;
} }
@ -3194,9 +3186,7 @@ static int try_smi_init(struct smi_info *new_smi)
type_file_read_proc, type_file_read_proc,
new_smi); new_smi);
if (rv) { if (rv) {
printk(KERN_ERR dev_err(new_smi->dev, "Unable to create proc entry: %d\n", rv);
"ipmi_si: Unable to create proc entry: %d\n",
rv);
goto out_err_stop_timer; goto out_err_stop_timer;
} }
@ -3204,9 +3194,7 @@ static int try_smi_init(struct smi_info *new_smi)
stat_file_read_proc, stat_file_read_proc,
new_smi); new_smi);
if (rv) { if (rv) {
printk(KERN_ERR dev_err(new_smi->dev, "Unable to create proc entry: %d\n", rv);
"ipmi_si: Unable to create proc entry: %d\n",
rv);
goto out_err_stop_timer; goto out_err_stop_timer;
} }
@ -3214,14 +3202,12 @@ static int try_smi_init(struct smi_info *new_smi)
param_read_proc, param_read_proc,
new_smi); new_smi);
if (rv) { if (rv) {
printk(KERN_ERR dev_err(new_smi->dev, "Unable to create proc entry: %d\n", rv);
"ipmi_si: Unable to create proc entry: %d\n",
rv);
goto out_err_stop_timer; goto out_err_stop_timer;
} }
printk(KERN_INFO "IPMI %s interface initialized\n", dev_info(new_smi->dev, "IPMI %s interface initialized\n",
si_to_str[new_smi->si_type]); si_to_str[new_smi->si_type]);
return 0; return 0;
@ -3287,9 +3273,7 @@ static __devinit int init_ipmi_si(void)
/* Register the device drivers. */ /* Register the device drivers. */
rv = driver_register(&ipmi_driver.driver); rv = driver_register(&ipmi_driver.driver);
if (rv) { if (rv) {
printk(KERN_ERR printk(KERN_ERR PFX "Unable to register driver: %d\n", rv);
"init_ipmi_si: Unable to register driver: %d\n",
rv);
return rv; return rv;
} }
@ -3324,9 +3308,7 @@ static __devinit int init_ipmi_si(void)
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
rv = pci_register_driver(&ipmi_pci_driver); rv = pci_register_driver(&ipmi_pci_driver);
if (rv) if (rv)
printk(KERN_ERR printk(KERN_ERR PFX "Unable to register PCI driver: %d\n", rv);
"init_ipmi_si: Unable to register PCI driver: %d\n",
rv);
#endif #endif
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
@ -3403,8 +3385,8 @@ static __devinit int init_ipmi_si(void)
of_unregister_platform_driver(&ipmi_of_platform_driver); of_unregister_platform_driver(&ipmi_of_platform_driver);
#endif #endif
driver_unregister(&ipmi_driver.driver); driver_unregister(&ipmi_driver.driver);
printk(KERN_WARNING printk(KERN_WARNING PFX
"ipmi_si: Unable to find any System Interface(s)\n"); "Unable to find any System Interface(s)\n");
return -ENODEV; return -ENODEV;
} else { } else {
mutex_unlock(&smi_infos_lock); mutex_unlock(&smi_infos_lock);
@ -3463,8 +3445,7 @@ static void cleanup_one_si(struct smi_info *to_clean)
rv = ipmi_unregister_smi(to_clean->intf); rv = ipmi_unregister_smi(to_clean->intf);
if (rv) { if (rv) {
printk(KERN_ERR printk(KERN_ERR PFX "Unable to unregister device: errno=%d\n",
"ipmi_si: Unable to unregister device: errno=%d\n",
rv); rv);
} }