Commit 445e2cbd authored by Joe Perches's avatar Joe Perches Committed by Corey Minyard

ipmi: msghandler: Add and use pr_fmt and dev_fmt, remove PFX

Standardize the prefixing of output messages using the pr_fmt and dev_fmt
mechanisms instead of a separate #define PFX

Miscellanea:

o Because this message prefix is very long, use a non-standard define
  of #define pr_fmt(fmt) "%s" fmt, "IPMI message handler: "
  which removes ~170 bytes of object code in an x86-64 defconfig with ipmi
  (with even more object code reduction on 32 bit compilations)
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent 05c3d056
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
* Copyright 2002 MontaVista Software Inc. * Copyright 2002 MontaVista Software Inc.
*/ */
#define pr_fmt(fmt) "%s" fmt, "IPMI message handler: "
#define dev_fmt pr_fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/poll.h> #include <linux/poll.h>
...@@ -30,8 +33,6 @@ ...@@ -30,8 +33,6 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/uuid.h> #include <linux/uuid.h>
#define PFX "IPMI message handler: "
#define IPMI_DRIVER_VERSION "39.2" #define IPMI_DRIVER_VERSION "39.2"
static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void); static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void);
...@@ -1474,8 +1475,7 @@ int ipmi_set_gets_events(struct ipmi_user *user, bool val) ...@@ -1474,8 +1475,7 @@ int ipmi_set_gets_events(struct ipmi_user *user, bool val)
list_move_tail(&msg->link, &msgs); list_move_tail(&msg->link, &msgs);
intf->waiting_events_count = 0; intf->waiting_events_count = 0;
if (intf->event_msg_printed) { if (intf->event_msg_printed) {
dev_warn(intf->si_dev, dev_warn(intf->si_dev, "Event queue no longer full\n");
PFX "Event queue no longer full\n");
intf->event_msg_printed = 0; intf->event_msg_printed = 0;
} }
...@@ -2276,7 +2276,7 @@ static void bmc_device_id_handler(struct ipmi_smi *intf, ...@@ -2276,7 +2276,7 @@ static void bmc_device_id_handler(struct ipmi_smi *intf,
|| (msg->msg.netfn != IPMI_NETFN_APP_RESPONSE) || (msg->msg.netfn != IPMI_NETFN_APP_RESPONSE)
|| (msg->msg.cmd != IPMI_GET_DEVICE_ID_CMD)) { || (msg->msg.cmd != IPMI_GET_DEVICE_ID_CMD)) {
dev_warn(intf->si_dev, dev_warn(intf->si_dev,
PFX "invalid device_id msg: addr_type=%d netfn=%x cmd=%x\n", "invalid device_id msg: addr_type=%d netfn=%x cmd=%x\n",
msg->addr.addr_type, msg->msg.netfn, msg->msg.cmd); msg->addr.addr_type, msg->msg.netfn, msg->msg.cmd);
return; return;
} }
...@@ -2284,8 +2284,7 @@ static void bmc_device_id_handler(struct ipmi_smi *intf, ...@@ -2284,8 +2284,7 @@ static void bmc_device_id_handler(struct ipmi_smi *intf,
rv = ipmi_demangle_device_id(msg->msg.netfn, msg->msg.cmd, rv = ipmi_demangle_device_id(msg->msg.netfn, msg->msg.cmd,
msg->msg.data, msg->msg.data_len, &intf->bmc->fetch_id); msg->msg.data, msg->msg.data_len, &intf->bmc->fetch_id);
if (rv) { if (rv) {
dev_warn(intf->si_dev, dev_warn(intf->si_dev, "device id demangle failed: %d\n", rv);
PFX "device id demangle failed: %d\n", rv);
intf->bmc->dyn_id_set = 0; intf->bmc->dyn_id_set = 0;
} else { } else {
/* /*
...@@ -2908,8 +2907,7 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, ...@@ -2908,8 +2907,7 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
mutex_unlock(&bmc->dyn_mutex); mutex_unlock(&bmc->dyn_mutex);
dev_info(intf->si_dev, dev_info(intf->si_dev,
"ipmi: interfacing existing BMC (man_id: 0x%6.6x," "interfacing existing 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);
...@@ -2948,7 +2946,7 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, ...@@ -2948,7 +2946,7 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
rv = platform_device_register(&bmc->pdev); rv = platform_device_register(&bmc->pdev);
if (rv) { if (rv) {
dev_err(intf->si_dev, dev_err(intf->si_dev,
PFX " Unable to register bmc device: %d\n", "Unable to register bmc device: %d\n",
rv); rv);
goto out_list_del; goto out_list_del;
} }
...@@ -2966,8 +2964,7 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, ...@@ -2966,8 +2964,7 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
*/ */
rv = sysfs_create_link(&intf->si_dev->kobj, &bmc->pdev.dev.kobj, "bmc"); rv = sysfs_create_link(&intf->si_dev->kobj, &bmc->pdev.dev.kobj, "bmc");
if (rv) { if (rv) {
dev_err(intf->si_dev, dev_err(intf->si_dev, "Unable to create bmc symlink: %d\n", rv);
PFX "Unable to create bmc symlink: %d\n", rv);
goto out_put_bmc; goto out_put_bmc;
} }
...@@ -2976,8 +2973,8 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, ...@@ -2976,8 +2973,8 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
intf->my_dev_name = kasprintf(GFP_KERNEL, "ipmi%d", intf_num); intf->my_dev_name = kasprintf(GFP_KERNEL, "ipmi%d", intf_num);
if (!intf->my_dev_name) { if (!intf->my_dev_name) {
rv = -ENOMEM; rv = -ENOMEM;
dev_err(intf->si_dev, dev_err(intf->si_dev, "Unable to allocate link from BMC: %d\n",
PFX "Unable to allocate link from BMC: %d\n", rv); rv);
goto out_unlink1; goto out_unlink1;
} }
...@@ -2986,8 +2983,8 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, ...@@ -2986,8 +2983,8 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
if (rv) { if (rv) {
kfree(intf->my_dev_name); kfree(intf->my_dev_name);
intf->my_dev_name = NULL; intf->my_dev_name = NULL;
dev_err(intf->si_dev, dev_err(intf->si_dev, "Unable to create symlink to bmc: %d\n",
PFX "Unable to create symlink to bmc: %d\n", rv); rv);
goto out_free_my_dev_name; goto out_free_my_dev_name;
} }
...@@ -3071,7 +3068,7 @@ static void guid_handler(struct ipmi_smi *intf, struct ipmi_recv_msg *msg) ...@@ -3071,7 +3068,7 @@ static void guid_handler(struct ipmi_smi *intf, struct ipmi_recv_msg *msg)
if (msg->msg.data_len < 17) { if (msg->msg.data_len < 17) {
bmc->dyn_guid_set = 0; bmc->dyn_guid_set = 0;
dev_warn(intf->si_dev, dev_warn(intf->si_dev,
PFX "The GUID response from the BMC was too short, it was %d but should have been 17. Assuming GUID is not available.\n", "The GUID response from the BMC was too short, it was %d but should have been 17. Assuming GUID is not available.\n",
msg->msg.data_len); msg->msg.data_len);
goto out; goto out;
} }
...@@ -3195,7 +3192,7 @@ channel_handler(struct ipmi_smi *intf, struct ipmi_recv_msg *msg) ...@@ -3195,7 +3192,7 @@ channel_handler(struct ipmi_smi *intf, struct ipmi_recv_msg *msg)
if (rv) { if (rv) {
/* Got an error somehow, just give up. */ /* Got an error somehow, just give up. */
dev_warn(intf->si_dev, dev_warn(intf->si_dev,
PFX "Error sending channel information for channel %d: %d\n", "Error sending channel information for channel %d: %d\n",
intf->curr_channel, rv); intf->curr_channel, rv);
intf->channel_list = intf->wchannels + set; intf->channel_list = intf->wchannels + set;
...@@ -4075,7 +4072,7 @@ static int handle_read_event_rsp(struct ipmi_smi *intf, ...@@ -4075,7 +4072,7 @@ static int handle_read_event_rsp(struct ipmi_smi *intf,
* message. * message.
*/ */
dev_warn(intf->si_dev, dev_warn(intf->si_dev,
PFX "Event queue full, discarding incoming events\n"); "Event queue full, discarding incoming events\n");
intf->event_msg_printed = 1; intf->event_msg_printed = 1;
} }
...@@ -4094,7 +4091,7 @@ static int handle_bmc_rsp(struct ipmi_smi *intf, ...@@ -4094,7 +4091,7 @@ static int handle_bmc_rsp(struct ipmi_smi *intf,
recv_msg = (struct ipmi_recv_msg *) msg->user_data; recv_msg = (struct ipmi_recv_msg *) msg->user_data;
if (recv_msg == NULL) { if (recv_msg == NULL) {
dev_warn(intf->si_dev, dev_warn(intf->si_dev,
"IPMI message received with no owner. This could be because of a malformed message, or because of a hardware error. Contact your hardware vender for assistance\n"); "IPMI message received with no owner. This could be because of a malformed message, or because of a hardware error. Contact your hardware vendor for assistance.\n");
return 0; return 0;
} }
...@@ -4130,7 +4127,7 @@ static int handle_one_recv_msg(struct ipmi_smi *intf, ...@@ -4130,7 +4127,7 @@ static int handle_one_recv_msg(struct ipmi_smi *intf,
if (msg->rsp_size < 2) { if (msg->rsp_size < 2) {
/* Message is too small to be correct. */ /* Message is too small to be correct. */
dev_warn(intf->si_dev, dev_warn(intf->si_dev,
PFX "BMC returned to small a message for netfn %x cmd %x, got %d bytes\n", "BMC returned too small a message for netfn %x cmd %x, got %d bytes\n",
(msg->data[0] >> 2) | 1, msg->data[1], msg->rsp_size); (msg->data[0] >> 2) | 1, msg->data[1], msg->rsp_size);
/* Generate an error response for the message. */ /* Generate an error response for the message. */
...@@ -4145,7 +4142,7 @@ static int handle_one_recv_msg(struct ipmi_smi *intf, ...@@ -4145,7 +4142,7 @@ static int handle_one_recv_msg(struct ipmi_smi *intf,
* marginally correct. * marginally correct.
*/ */
dev_warn(intf->si_dev, dev_warn(intf->si_dev,
PFX "BMC returned incorrect response, expected netfn %x cmd %x, got netfn %x cmd %x\n", "BMC returned incorrect response, expected netfn %x cmd %x, got netfn %x cmd %x\n",
(msg->data[0] >> 2) | 1, msg->data[1], (msg->data[0] >> 2) | 1, msg->data[1],
msg->rsp[0] >> 2, msg->rsp[1]); msg->rsp[0] >> 2, msg->rsp[1]);
...@@ -5035,11 +5032,11 @@ static int ipmi_init_msghandler(void) ...@@ -5035,11 +5032,11 @@ static int ipmi_init_msghandler(void)
rv = driver_register(&ipmidriver.driver); rv = driver_register(&ipmidriver.driver);
if (rv) { if (rv) {
pr_err(PFX "Could not register IPMI driver\n"); pr_err("Could not register IPMI driver\n");
return rv; return rv;
} }
pr_info("ipmi message handler version " IPMI_DRIVER_VERSION "\n"); pr_info("version " IPMI_DRIVER_VERSION "\n");
timer_setup(&ipmi_timer, ipmi_timeout, 0); timer_setup(&ipmi_timer, ipmi_timeout, 0);
mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
...@@ -5086,10 +5083,10 @@ static void __exit cleanup_ipmi(void) ...@@ -5086,10 +5083,10 @@ static void __exit cleanup_ipmi(void)
/* Check for buffer leaks. */ /* Check for buffer leaks. */
count = atomic_read(&smi_msg_inuse_count); count = atomic_read(&smi_msg_inuse_count);
if (count != 0) if (count != 0)
pr_warn(PFX "SMI message count %d at exit\n", count); pr_warn("SMI message count %d at exit\n", count);
count = atomic_read(&recv_msg_inuse_count); count = atomic_read(&recv_msg_inuse_count);
if (count != 0) if (count != 0)
pr_warn(PFX "recv message count %d at exit\n", count); pr_warn("recv message count %d at exit\n", count);
} }
module_exit(cleanup_ipmi); module_exit(cleanup_ipmi);
......
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