Commit bb2a08c0 authored by Corey Minyard's avatar Corey Minyard

ipmi_si: Clean up printks

Convert them to pr_xxx or dev_xxx.
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent 1abf71ee
...@@ -1764,7 +1764,7 @@ static int parse_str(const struct hotmod_vals *v, int *val, char *name, ...@@ -1764,7 +1764,7 @@ static int parse_str(const struct hotmod_vals *v, int *val, char *name,
s = strchr(*curr, ','); s = strchr(*curr, ',');
if (!s) { if (!s) {
printk(KERN_WARNING PFX "No hotmod %s given.\n", name); pr_warn(PFX "No hotmod %s given.\n", name);
return -EINVAL; return -EINVAL;
} }
*s = '\0'; *s = '\0';
...@@ -1777,7 +1777,7 @@ static int parse_str(const struct hotmod_vals *v, int *val, char *name, ...@@ -1777,7 +1777,7 @@ static int parse_str(const struct hotmod_vals *v, int *val, char *name,
} }
} }
printk(KERN_WARNING PFX "Invalid hotmod %s '%s'\n", name, *curr); pr_warn(PFX "Invalid hotmod %s '%s'\n", name, *curr);
return -EINVAL; return -EINVAL;
} }
...@@ -1788,16 +1788,12 @@ static int check_hotmod_int_op(const char *curr, const char *option, ...@@ -1788,16 +1788,12 @@ static int check_hotmod_int_op(const char *curr, const char *option,
if (strcmp(curr, name) == 0) { if (strcmp(curr, name) == 0) {
if (!option) { if (!option) {
printk(KERN_WARNING PFX pr_warn(PFX "No option given for '%s'\n", curr);
"No option given for '%s'\n",
curr);
return -EINVAL; return -EINVAL;
} }
*val = simple_strtoul(option, &n, 0); *val = simple_strtoul(option, &n, 0);
if ((*n != '\0') || (*option == '\0')) { if ((*n != '\0') || (*option == '\0')) {
printk(KERN_WARNING PFX pr_warn(PFX "Bad option given for '%s'\n", curr);
"Bad option given for '%s'\n",
curr);
return -EINVAL; return -EINVAL;
} }
return 1; return 1;
...@@ -1877,8 +1873,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp) ...@@ -1877,8 +1873,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
} }
addr = simple_strtoul(curr, &n, 0); addr = simple_strtoul(curr, &n, 0);
if ((*n != '\0') || (*curr == '\0')) { if ((*n != '\0') || (*curr == '\0')) {
printk(KERN_WARNING PFX "Invalid hotmod address" pr_warn(PFX "Invalid hotmod address '%s'\n", curr);
" '%s'\n", curr);
break; break;
} }
...@@ -1921,9 +1916,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp) ...@@ -1921,9 +1916,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
continue; continue;
rv = -EINVAL; rv = -EINVAL;
printk(KERN_WARNING PFX pr_warn(PFX "Invalid hotmod option '%s'\n", curr);
"Invalid hotmod option '%s'\n",
curr);
goto out; goto out;
} }
...@@ -2003,7 +1996,7 @@ static int hardcode_find_bmc(void) ...@@ -2003,7 +1996,7 @@ static int hardcode_find_bmc(void)
return -ENOMEM; return -ENOMEM;
info->addr_source = SI_HARDCODED; info->addr_source = SI_HARDCODED;
printk(KERN_INFO PFX "probing via hardcoded address\n"); pr_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;
...@@ -2012,8 +2005,7 @@ static int hardcode_find_bmc(void) ...@@ -2012,8 +2005,7 @@ static int 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 PFX "Interface type specified " pr_warn(PFX "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);
continue; continue;
...@@ -2030,9 +2022,8 @@ static int hardcode_find_bmc(void) ...@@ -2030,9 +2022,8 @@ static int 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 PFX "Interface type specified " pr_warn(PFX "Interface type specified for interface %d, but port and address were not set or set to zero.\n",
"for interface %d, but port and address were " i);
"not set or set to zero.\n", i);
kfree(info); kfree(info);
continue; continue;
} }
...@@ -2173,18 +2164,18 @@ static int try_init_spmi(struct SPMITable *spmi) ...@@ -2173,18 +2164,18 @@ static int try_init_spmi(struct SPMITable *spmi)
int rv; int rv;
if (spmi->IPMIlegacy != 1) { if (spmi->IPMIlegacy != 1) {
printk(KERN_INFO PFX "Bad SPMI legacy %d\n", spmi->IPMIlegacy); pr_info(PFX "Bad SPMI legacy %d\n", spmi->IPMIlegacy);
return -ENODEV; return -ENODEV;
} }
info = smi_info_alloc(); info = smi_info_alloc();
if (!info) { if (!info) {
printk(KERN_ERR PFX "Could not allocate SI data (3)\n"); pr_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"); pr_info(PFX "probing via SPMI\n");
/* Figure out the interface type. */ /* Figure out the interface type. */
switch (spmi->InterfaceType) { switch (spmi->InterfaceType) {
...@@ -2201,7 +2192,7 @@ static int try_init_spmi(struct SPMITable *spmi) ...@@ -2201,7 +2192,7 @@ static int try_init_spmi(struct SPMITable *spmi)
kfree(info); kfree(info);
return -EIO; return -EIO;
default: default:
printk(KERN_INFO PFX "Unknown ACPI/SPMI SI type %d\n", pr_info(PFX "Unknown ACPI/SPMI SI type %d\n",
spmi->InterfaceType); spmi->InterfaceType);
kfree(info); kfree(info);
return -EIO; return -EIO;
...@@ -2238,7 +2229,7 @@ static int try_init_spmi(struct SPMITable *spmi) ...@@ -2238,7 +2229,7 @@ static 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 PFX "Unknown ACPI I/O Address type\n"); pr_warn(PFX "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;
...@@ -2356,12 +2347,12 @@ static void try_init_dmi(struct dmi_ipmi_data *ipmi_data) ...@@ -2356,12 +2347,12 @@ static void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
info = smi_info_alloc(); info = smi_info_alloc();
if (!info) { if (!info) {
printk(KERN_ERR PFX "Could not allocate SI data\n"); pr_err(PFX "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"); pr_info(PFX "probing via SMBIOS\n");
switch (ipmi_data->type) { switch (ipmi_data->type) {
case 0x01: /* KCS */ case 0x01: /* KCS */
...@@ -2391,7 +2382,7 @@ static void try_init_dmi(struct dmi_ipmi_data *ipmi_data) ...@@ -2391,7 +2382,7 @@ static void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
default: default:
kfree(info); kfree(info);
printk(KERN_WARNING PFX "Unknown SMBIOS I/O Address type: %d\n", pr_warn(PFX "Unknown SMBIOS I/O Address type: %d\n",
ipmi_data->addr_space); ipmi_data->addr_space);
return; return;
} }
...@@ -3141,9 +3132,7 @@ static int try_enable_event_buffer(struct smi_info *smi_info) ...@@ -3141,9 +3132,7 @@ 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 PFX "Error getting response from get" pr_warn(PFX "Error getting response from get global enables command, the event buffer is not enabled.\n");
" global enables command, the event buffer is not"
" enabled.\n");
goto out; goto out;
} }
...@@ -3154,8 +3143,7 @@ static int try_enable_event_buffer(struct smi_info *smi_info) ...@@ -3154,8 +3143,7 @@ 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 PFX "Invalid return from get global" pr_warn(PFX "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;
} }
...@@ -3173,9 +3161,7 @@ static int try_enable_event_buffer(struct smi_info *smi_info) ...@@ -3173,9 +3161,7 @@ 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 PFX "Error getting response from set" pr_warn(PFX "Error getting response from set global, enables command, the event buffer is not enabled.\n");
" global, enables command, the event buffer is not"
" enabled.\n");
goto out; goto out;
} }
...@@ -3185,8 +3171,7 @@ static int try_enable_event_buffer(struct smi_info *smi_info) ...@@ -3185,8 +3171,7 @@ 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 PFX "Invalid return from get global," pr_warn(PFX "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;
} }
...@@ -3474,17 +3459,18 @@ static int add_smi(struct smi_info *new_smi) ...@@ -3474,17 +3459,18 @@ static int add_smi(struct smi_info *new_smi)
{ {
int rv = 0; int rv = 0;
printk(KERN_INFO PFX "Adding %s-specified %s state machine",
ipmi_addr_src_to_str(new_smi->addr_source),
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"); pr_info(PFX "%s-specified %s state machine: duplicate\n",
ipmi_addr_src_to_str(new_smi->addr_source),
si_to_str[new_smi->si_type]);
rv = -EBUSY; rv = -EBUSY;
goto out_err; goto out_err;
} }
printk(KERN_CONT "\n"); pr_info(PFX "Adding %s-specified %s state machine\n",
ipmi_addr_src_to_str(new_smi->addr_source),
si_to_str[new_smi->si_type]);
/* So we know not to free it unless we have allocated one. */ /* So we know not to free it unless we have allocated one. */
new_smi->intf = NULL; new_smi->intf = NULL;
...@@ -3504,9 +3490,7 @@ static int try_smi_init(struct smi_info *new_smi) ...@@ -3504,9 +3490,7 @@ static int try_smi_init(struct smi_info *new_smi)
int i; int i;
char *init_name = NULL; char *init_name = NULL;
printk(KERN_INFO PFX "Trying %s-specified %s state" pr_info(PFX "Trying %s-specified %s state machine at %s address 0x%lx, slave address 0x%x, irq %d\n",
" machine at %s address 0x%lx, slave address 0x%x,"
" irq %d\n",
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],
addr_space_to_str[new_smi->io.addr_type], addr_space_to_str[new_smi->io.addr_type],
...@@ -3555,8 +3539,7 @@ static int try_smi_init(struct smi_info *new_smi) ...@@ -3555,8 +3539,7 @@ 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 PFX pr_err(PFX "Could not allocate state machine memory\n");
"Could not allocate state machine memory\n");
rv = -ENOMEM; rv = -ENOMEM;
goto out_err; goto out_err;
} }
...@@ -3566,14 +3549,14 @@ static int try_smi_init(struct smi_info *new_smi) ...@@ -3566,14 +3549,14 @@ 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 PFX "Could not set up I/O space\n"); dev_err(new_smi->dev, "Could not set up I/O space\n");
goto out_err; goto out_err;
} }
/* 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 PFX "Interface detection failed\n"); dev_err(new_smi->dev, "Interface detection failed\n");
rv = -ENODEV; rv = -ENODEV;
goto out_err; goto out_err;
} }
...@@ -3585,8 +3568,7 @@ static int try_smi_init(struct smi_info *new_smi) ...@@ -3585,8 +3568,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 PFX "There appears to be no BMC" dev_err(new_smi->dev, "There appears to be no BMC at this location\n");
" at this location\n");
goto out_err; goto out_err;
} }
...@@ -3628,9 +3610,8 @@ static int try_smi_init(struct smi_info *new_smi) ...@@ -3628,9 +3610,8 @@ static int try_smi_init(struct smi_info *new_smi)
if (new_smi->pdev) { if (new_smi->pdev) {
rv = platform_device_add(new_smi->pdev); rv = platform_device_add(new_smi->pdev);
if (rv) { if (rv) {
printk(KERN_ERR PFX dev_err(new_smi->dev,
"Unable to register system interface device:" "Unable to register system interface device: %d\n",
" %d\n",
rv); rv);
goto out_err; goto out_err;
} }
...@@ -3748,8 +3729,7 @@ static int init_ipmi_si(void) ...@@ -3748,8 +3729,7 @@ static int init_ipmi_si(void)
if (si_tryplatform) { if (si_tryplatform) {
rv = platform_driver_register(&ipmi_driver); rv = platform_driver_register(&ipmi_driver);
if (rv) { if (rv) {
printk(KERN_ERR PFX "Unable to register " pr_err(PFX "Unable to register driver: %d\n", rv);
"driver: %d\n", rv);
return rv; return rv;
} }
} }
...@@ -3769,7 +3749,7 @@ static int init_ipmi_si(void) ...@@ -3769,7 +3749,7 @@ static int init_ipmi_si(void)
} }
} }
printk(KERN_INFO "IPMI System Interface driver.\n"); pr_info("IPMI System Interface driver.\n");
/* If the user gave us a device, they presumably want us to use it */ /* If the user gave us a device, they presumably want us to use it */
if (!hardcode_find_bmc()) if (!hardcode_find_bmc())
...@@ -3779,8 +3759,7 @@ static int init_ipmi_si(void) ...@@ -3779,8 +3759,7 @@ static int init_ipmi_si(void)
if (si_trypci) { if (si_trypci) {
rv = pci_register_driver(&ipmi_pci_driver); rv = pci_register_driver(&ipmi_pci_driver);
if (rv) if (rv)
printk(KERN_ERR PFX "Unable to register " pr_err(PFX "Unable to register PCI driver: %d\n", rv);
"PCI driver: %d\n", rv);
else else
pci_registered = true; pci_registered = true;
} }
...@@ -3842,8 +3821,7 @@ static int init_ipmi_si(void) ...@@ -3842,8 +3821,7 @@ static int init_ipmi_si(void)
if (unload_when_empty && list_empty(&smi_infos)) { if (unload_when_empty && list_empty(&smi_infos)) {
mutex_unlock(&smi_infos_lock); mutex_unlock(&smi_infos_lock);
cleanup_ipmi_si(); cleanup_ipmi_si();
printk(KERN_WARNING PFX pr_warn(PFX "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);
......
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