aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2017-09-18 14:26:33 -0400
committerCorey Minyard <cminyard@mvista.com>2017-09-28 13:26:04 -0400
commit106a846102b86a55359afaeec9b424928db7259c (patch)
tree7f38ca1923f97e1d501853435b8b27b0b7162664 /drivers
parent95e300c052fd9dbb05f289a912c138ed03320ec5 (diff)
ipmi: Clean up some print operations
Get rid of all printfs, using dev_xxx() if a device is available, pr_xxx() otherwise, and format long strings properly. Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c101
1 files changed, 45 insertions, 56 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 9d1eaf70f406..c29d46bef6b3 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -1392,8 +1392,8 @@ int ipmi_set_gets_events(ipmi_user_t user, bool val)
1392 list_move_tail(&msg->link, &msgs); 1392 list_move_tail(&msg->link, &msgs);
1393 intf->waiting_events_count = 0; 1393 intf->waiting_events_count = 0;
1394 if (intf->event_msg_printed) { 1394 if (intf->event_msg_printed) {
1395 printk(KERN_WARNING PFX "Event queue no longer" 1395 dev_warn(intf->si_dev,
1396 " full\n"); 1396 PFX "Event queue no longer full\n");
1397 intf->event_msg_printed = 0; 1397 intf->event_msg_printed = 0;
1398 } 1398 }
1399 1399
@@ -2137,7 +2137,8 @@ static void bmc_device_id_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
2137 if ((msg->addr.addr_type != IPMI_SYSTEM_INTERFACE_ADDR_TYPE) 2137 if ((msg->addr.addr_type != IPMI_SYSTEM_INTERFACE_ADDR_TYPE)
2138 || (msg->msg.netfn != IPMI_NETFN_APP_RESPONSE) 2138 || (msg->msg.netfn != IPMI_NETFN_APP_RESPONSE)
2139 || (msg->msg.cmd != IPMI_GET_DEVICE_ID_CMD)) { 2139 || (msg->msg.cmd != IPMI_GET_DEVICE_ID_CMD)) {
2140 pr_warn(PFX "invalid device_id msg: addr_type=%d netfn=%x cmd=%x\n", 2140 dev_warn(intf->si_dev,
2141 PFX "invalid device_id msg: addr_type=%d netfn=%x cmd=%x\n",
2141 msg->addr.addr_type, msg->msg.netfn, msg->msg.cmd); 2142 msg->addr.addr_type, msg->msg.netfn, msg->msg.cmd);
2142 return; 2143 return;
2143 } 2144 }
@@ -2145,7 +2146,8 @@ static void bmc_device_id_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
2145 rv = ipmi_demangle_device_id(msg->msg.netfn, msg->msg.cmd, 2146 rv = ipmi_demangle_device_id(msg->msg.netfn, msg->msg.cmd,
2146 msg->msg.data, msg->msg.data_len, &intf->bmc->fetch_id); 2147 msg->msg.data, msg->msg.data_len, &intf->bmc->fetch_id);
2147 if (rv) { 2148 if (rv) {
2148 pr_warn(PFX "device id demangle failed: %d\n", rv); 2149 dev_warn(intf->si_dev,
2150 PFX "device id demangle failed: %d\n", rv);
2149 intf->bmc->dyn_id_set = 0; 2151 intf->bmc->dyn_id_set = 0;
2150 } else { 2152 } else {
2151 /* 2153 /*
@@ -2978,12 +2980,12 @@ static int __ipmi_bmc_register(ipmi_smi_t intf,
2978 list_add_tail(&intf->bmc_link, &bmc->intfs); 2980 list_add_tail(&intf->bmc_link, &bmc->intfs);
2979 mutex_unlock(&bmc->dyn_mutex); 2981 mutex_unlock(&bmc->dyn_mutex);
2980 2982
2981 printk(KERN_INFO 2983 dev_info(intf->si_dev,
2982 "ipmi: interfacing existing BMC (man_id: 0x%6.6x," 2984 "ipmi: interfacing existing BMC (man_id: 0x%6.6x,"
2983 " prod_id: 0x%4.4x, dev_id: 0x%2.2x)\n", 2985 " prod_id: 0x%4.4x, dev_id: 0x%2.2x)\n",
2984 bmc->id.manufacturer_id, 2986 bmc->id.manufacturer_id,
2985 bmc->id.product_id, 2987 bmc->id.product_id,
2986 bmc->id.device_id); 2988 bmc->id.device_id);
2987 } else { 2989 } else {
2988 bmc = kzalloc(sizeof(*bmc), GFP_KERNEL); 2990 bmc = kzalloc(sizeof(*bmc), GFP_KERNEL);
2989 if (!bmc) { 2991 if (!bmc) {
@@ -3018,15 +3020,14 @@ static int __ipmi_bmc_register(ipmi_smi_t intf,
3018 3020
3019 rv = platform_device_register(&bmc->pdev); 3021 rv = platform_device_register(&bmc->pdev);
3020 if (rv) { 3022 if (rv) {
3021 printk(KERN_ERR 3023 dev_err(intf->si_dev,
3022 "ipmi_msghandler:" 3024 PFX " Unable to register bmc device: %d\n",
3023 " Unable to register bmc device: %d\n", 3025 rv);
3024 rv);
3025 goto out_list_del; 3026 goto out_list_del;
3026 } 3027 }
3027 3028
3028 dev_info(intf->si_dev, "Found new BMC (man_id: 0x%6.6x, " 3029 dev_info(intf->si_dev,
3029 "prod_id: 0x%4.4x, dev_id: 0x%2.2x)\n", 3030 "Found new BMC (man_id: 0x%6.6x, prod_id: 0x%4.4x, dev_id: 0x%2.2x)\n",
3030 bmc->id.manufacturer_id, 3031 bmc->id.manufacturer_id,
3031 bmc->id.product_id, 3032 bmc->id.product_id,
3032 bmc->id.device_id); 3033 bmc->id.device_id);
@@ -3038,9 +3039,8 @@ static int __ipmi_bmc_register(ipmi_smi_t intf,
3038 */ 3039 */
3039 rv = sysfs_create_link(&intf->si_dev->kobj, &bmc->pdev.dev.kobj, "bmc"); 3040 rv = sysfs_create_link(&intf->si_dev->kobj, &bmc->pdev.dev.kobj, "bmc");
3040 if (rv) { 3041 if (rv) {
3041 printk(KERN_ERR 3042 dev_err(intf->si_dev,
3042 "ipmi_msghandler: Unable to create bmc symlink: %d\n", 3043 PFX "Unable to create bmc symlink: %d\n", rv);
3043 rv);
3044 goto out_put_bmc; 3044 goto out_put_bmc;
3045 } 3045 }
3046 3046
@@ -3049,9 +3049,8 @@ static int __ipmi_bmc_register(ipmi_smi_t intf,
3049 intf->my_dev_name = kasprintf(GFP_KERNEL, "ipmi%d", intf_num); 3049 intf->my_dev_name = kasprintf(GFP_KERNEL, "ipmi%d", intf_num);
3050 if (!intf->my_dev_name) { 3050 if (!intf->my_dev_name) {
3051 rv = -ENOMEM; 3051 rv = -ENOMEM;
3052 printk(KERN_ERR 3052 dev_err(intf->si_dev,
3053 "ipmi_msghandler: allocate link from BMC: %d\n", 3053 PFX "Unable to allocate link from BMC: %d\n", rv);
3054 rv);
3055 goto out_unlink1; 3054 goto out_unlink1;
3056 } 3055 }
3057 3056
@@ -3060,10 +3059,8 @@ static int __ipmi_bmc_register(ipmi_smi_t intf,
3060 if (rv) { 3059 if (rv) {
3061 kfree(intf->my_dev_name); 3060 kfree(intf->my_dev_name);
3062 intf->my_dev_name = NULL; 3061 intf->my_dev_name = NULL;
3063 printk(KERN_ERR 3062 dev_err(intf->si_dev,
3064 "ipmi_msghandler:" 3063 PFX "Unable to create symlink to bmc: %d\n", rv);
3065 " Unable to create symlink to bmc: %d\n",
3066 rv);
3067 goto out_free_my_dev_name; 3064 goto out_free_my_dev_name;
3068 } 3065 }
3069 3066
@@ -3146,11 +3143,9 @@ static void guid_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
3146 3143
3147 if (msg->msg.data_len < 17) { 3144 if (msg->msg.data_len < 17) {
3148 bmc->dyn_guid_set = 0; 3145 bmc->dyn_guid_set = 0;
3149 printk(KERN_WARNING PFX 3146 dev_warn(intf->si_dev,
3150 "guid_handler: The GUID response from the BMC was too" 3147 PFX "The GUID response from the BMC was too short, it was %d but should have been 17. Assuming GUID is not available.\n",
3151 " short, it was %d but should have been 17. Assuming" 3148 msg->msg.data_len);
3152 " GUID is not available.\n",
3153 msg->msg.data_len);
3154 goto out; 3149 goto out;
3155 } 3150 }
3156 3151
@@ -3272,9 +3267,9 @@ channel_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
3272 3267
3273 if (rv) { 3268 if (rv) {
3274 /* Got an error somehow, just give up. */ 3269 /* Got an error somehow, just give up. */
3275 printk(KERN_WARNING PFX 3270 dev_warn(intf->si_dev,
3276 "Error sending channel information for channel" 3271 PFX "Error sending channel information for channel %d: %d\n",
3277 " %d: %d\n", intf->curr_channel, rv); 3272 intf->curr_channel, rv);
3278 3273
3279 intf->channel_list = intf->wchannels + set; 3274 intf->channel_list = intf->wchannels + set;
3280 intf->channels_ready = true; 3275 intf->channels_ready = true;
@@ -4170,8 +4165,8 @@ static int handle_read_event_rsp(ipmi_smi_t intf,
4170 * There's too many things in the queue, discard this 4165 * There's too many things in the queue, discard this
4171 * message. 4166 * message.
4172 */ 4167 */
4173 printk(KERN_WARNING PFX "Event queue full, discarding" 4168 dev_warn(intf->si_dev,
4174 " incoming events\n"); 4169 PFX "Event queue full, discarding incoming events\n");
4175 intf->event_msg_printed = 1; 4170 intf->event_msg_printed = 1;
4176 } 4171 }
4177 4172
@@ -4189,11 +4184,8 @@ static int handle_bmc_rsp(ipmi_smi_t intf,
4189 4184
4190 recv_msg = (struct ipmi_recv_msg *) msg->user_data; 4185 recv_msg = (struct ipmi_recv_msg *) msg->user_data;
4191 if (recv_msg == NULL) { 4186 if (recv_msg == NULL) {
4192 printk(KERN_WARNING 4187 dev_warn(intf->si_dev,
4193 "IPMI message received with no owner. This\n" 4188 "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");
4194 "could be because of a malformed message, or\n"
4195 "because of a hardware error. Contact your\n"
4196 "hardware vender for assistance\n");
4197 return 0; 4189 return 0;
4198 } 4190 }
4199 4191
@@ -4247,9 +4239,9 @@ static int handle_one_recv_msg(ipmi_smi_t intf,
4247#endif 4239#endif
4248 if (msg->rsp_size < 2) { 4240 if (msg->rsp_size < 2) {
4249 /* Message is too small to be correct. */ 4241 /* Message is too small to be correct. */
4250 printk(KERN_WARNING PFX "BMC returned to small a message" 4242 dev_warn(intf->si_dev,
4251 " for netfn %x cmd %x, got %d bytes\n", 4243 PFX "BMC returned to small a message for netfn %x cmd %x, got %d bytes\n",
4252 (msg->data[0] >> 2) | 1, msg->data[1], msg->rsp_size); 4244 (msg->data[0] >> 2) | 1, msg->data[1], msg->rsp_size);
4253 4245
4254 /* Generate an error response for the message. */ 4246 /* Generate an error response for the message. */
4255 msg->rsp[0] = msg->data[0] | (1 << 2); 4247 msg->rsp[0] = msg->data[0] | (1 << 2);
@@ -4262,10 +4254,10 @@ static int handle_one_recv_msg(ipmi_smi_t intf,
4262 * The NetFN and Command in the response is not even 4254 * The NetFN and Command in the response is not even
4263 * marginally correct. 4255 * marginally correct.
4264 */ 4256 */
4265 printk(KERN_WARNING PFX "BMC returned incorrect response," 4257 dev_warn(intf->si_dev,
4266 " expected netfn %x cmd %x, got netfn %x cmd %x\n", 4258 PFX "BMC returned incorrect response, expected netfn %x cmd %x, got netfn %x cmd %x\n",
4267 (msg->data[0] >> 2) | 1, msg->data[1], 4259 (msg->data[0] >> 2) | 1, msg->data[1],
4268 msg->rsp[0] >> 2, msg->rsp[1]); 4260 msg->rsp[0] >> 2, msg->rsp[1]);
4269 4261
4270 /* Generate an error response for the message. */ 4262 /* Generate an error response for the message. */
4271 msg->rsp[0] = msg->data[0] | (1 << 2); 4263 msg->rsp[0] = msg->data[0] | (1 << 2);
@@ -5164,17 +5156,16 @@ static int ipmi_init_msghandler(void)
5164 5156
5165 rv = driver_register(&ipmidriver.driver); 5157 rv = driver_register(&ipmidriver.driver);
5166 if (rv) { 5158 if (rv) {
5167 printk(KERN_ERR PFX "Could not register IPMI driver\n"); 5159 pr_err(PFX "Could not register IPMI driver\n");
5168 return rv; 5160 return rv;
5169 } 5161 }
5170 5162
5171 printk(KERN_INFO "ipmi message handler version " 5163 pr_info("ipmi message handler version " IPMI_DRIVER_VERSION "\n");
5172 IPMI_DRIVER_VERSION "\n");
5173 5164
5174#ifdef CONFIG_IPMI_PROC_INTERFACE 5165#ifdef CONFIG_IPMI_PROC_INTERFACE
5175 proc_ipmi_root = proc_mkdir("ipmi", NULL); 5166 proc_ipmi_root = proc_mkdir("ipmi", NULL);
5176 if (!proc_ipmi_root) { 5167 if (!proc_ipmi_root) {
5177 printk(KERN_ERR PFX "Unable to create IPMI proc dir"); 5168 pr_err(PFX "Unable to create IPMI proc dir");
5178 driver_unregister(&ipmidriver.driver); 5169 driver_unregister(&ipmidriver.driver);
5179 return -ENOMEM; 5170 return -ENOMEM;
5180 } 5171 }
@@ -5230,12 +5221,10 @@ static void __exit cleanup_ipmi(void)
5230 /* Check for buffer leaks. */ 5221 /* Check for buffer leaks. */
5231 count = atomic_read(&smi_msg_inuse_count); 5222 count = atomic_read(&smi_msg_inuse_count);
5232 if (count != 0) 5223 if (count != 0)
5233 printk(KERN_WARNING PFX "SMI message count %d at exit\n", 5224 pr_warn(PFX "SMI message count %d at exit\n", count);
5234 count);
5235 count = atomic_read(&recv_msg_inuse_count); 5225 count = atomic_read(&recv_msg_inuse_count);
5236 if (count != 0) 5226 if (count != 0)
5237 printk(KERN_WARNING PFX "recv message count %d at exit\n", 5227 pr_warn(PFX "recv message count %d at exit\n", count);
5238 count);
5239} 5228}
5240module_exit(cleanup_ipmi); 5229module_exit(cleanup_ipmi);
5241 5230