aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2013-09-13 01:14:21 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-09-30 13:46:12 -0400
commit2fb037b89a3125627f02c40af3e3d38c3228184b (patch)
tree0b34b36dc14bcd752e6b008ac410f31d3c7c7528
parent7b9844772237e34968ffd4b086d7b5ed36b30856 (diff)
ACPI / IPMI: Cleanup several acpi_ipmi_device members
This (trivial) patch: 1. Deletes a member of the acpi_ipmi_device, smi_data, which is not actually used. 2. Updates a member of the acpi_ipmi_device, pnp_dev, which is only used by dev_warn() invocations, so changes it to a struct device. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Reviewed-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpi_ipmi.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/acpi/acpi_ipmi.c b/drivers/acpi/acpi_ipmi.c
index b9da5ef39024..90d57c86db85 100644
--- a/drivers/acpi/acpi_ipmi.c
+++ b/drivers/acpi/acpi_ipmi.c
@@ -61,11 +61,10 @@ struct acpi_ipmi_device {
61 struct list_head tx_msg_list; 61 struct list_head tx_msg_list;
62 spinlock_t tx_msg_lock; 62 spinlock_t tx_msg_lock;
63 acpi_handle handle; 63 acpi_handle handle;
64 struct pnp_dev *pnp_dev; 64 struct device *dev;
65 ipmi_user_t user_interface; 65 ipmi_user_t user_interface;
66 int ipmi_ifnum; /* IPMI interface number */ 66 int ipmi_ifnum; /* IPMI interface number */
67 long curr_msgid; 67 long curr_msgid;
68 struct ipmi_smi_info smi_data;
69 bool dead; 68 bool dead;
70 struct kref kref; 69 struct kref kref;
71}; 70};
@@ -131,7 +130,7 @@ static struct ipmi_driver_data driver_data = {
131}; 130};
132 131
133static struct acpi_ipmi_device * 132static struct acpi_ipmi_device *
134ipmi_dev_alloc(int iface, struct ipmi_smi_info *smi_data, acpi_handle handle) 133ipmi_dev_alloc(int iface, struct device *dev, acpi_handle handle)
135{ 134{
136 struct acpi_ipmi_device *ipmi_device; 135 struct acpi_ipmi_device *ipmi_device;
137 int err; 136 int err;
@@ -147,14 +146,13 @@ ipmi_dev_alloc(int iface, struct ipmi_smi_info *smi_data, acpi_handle handle)
147 spin_lock_init(&ipmi_device->tx_msg_lock); 146 spin_lock_init(&ipmi_device->tx_msg_lock);
148 147
149 ipmi_device->handle = handle; 148 ipmi_device->handle = handle;
150 ipmi_device->pnp_dev = to_pnp_dev(get_device(smi_data->dev)); 149 ipmi_device->dev = get_device(dev);
151 memcpy(&ipmi_device->smi_data, smi_data, sizeof(struct ipmi_smi_info));
152 ipmi_device->ipmi_ifnum = iface; 150 ipmi_device->ipmi_ifnum = iface;
153 151
154 err = ipmi_create_user(iface, &driver_data.ipmi_hndlrs, 152 err = ipmi_create_user(iface, &driver_data.ipmi_hndlrs,
155 ipmi_device, &user); 153 ipmi_device, &user);
156 if (err) { 154 if (err) {
157 put_device(smi_data->dev); 155 put_device(dev);
158 kfree(ipmi_device); 156 kfree(ipmi_device);
159 return NULL; 157 return NULL;
160 } 158 }
@@ -166,7 +164,7 @@ ipmi_dev_alloc(int iface, struct ipmi_smi_info *smi_data, acpi_handle handle)
166static void ipmi_dev_release(struct acpi_ipmi_device *ipmi_device) 164static void ipmi_dev_release(struct acpi_ipmi_device *ipmi_device)
167{ 165{
168 ipmi_destroy_user(ipmi_device->user_interface); 166 ipmi_destroy_user(ipmi_device->user_interface);
169 put_device(ipmi_device->smi_data.dev); 167 put_device(ipmi_device->dev);
170 kfree(ipmi_device); 168 kfree(ipmi_device);
171} 169}
172 170
@@ -282,7 +280,7 @@ static int acpi_format_ipmi_request(struct acpi_ipmi_msg *tx_msg,
282 buffer = (struct acpi_ipmi_buffer *)value; 280 buffer = (struct acpi_ipmi_buffer *)value;
283 /* copy the tx message data */ 281 /* copy the tx message data */
284 if (buffer->length > ACPI_IPMI_MAX_MSG_LENGTH) { 282 if (buffer->length > ACPI_IPMI_MAX_MSG_LENGTH) {
285 dev_WARN_ONCE(&tx_msg->device->pnp_dev->dev, true, 283 dev_WARN_ONCE(tx_msg->device->dev, true,
286 "Unexpected request (msg len %d).\n", 284 "Unexpected request (msg len %d).\n",
287 buffer->length); 285 buffer->length);
288 return -EINVAL; 286 return -EINVAL;
@@ -389,11 +387,11 @@ static void ipmi_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data)
389 struct acpi_ipmi_device *ipmi_device = user_msg_data; 387 struct acpi_ipmi_device *ipmi_device = user_msg_data;
390 bool msg_found = false; 388 bool msg_found = false;
391 struct acpi_ipmi_msg *tx_msg, *temp; 389 struct acpi_ipmi_msg *tx_msg, *temp;
392 struct pnp_dev *pnp_dev = ipmi_device->pnp_dev; 390 struct device *dev = ipmi_device->dev;
393 unsigned long flags; 391 unsigned long flags;
394 392
395 if (msg->user != ipmi_device->user_interface) { 393 if (msg->user != ipmi_device->user_interface) {
396 dev_warn(&pnp_dev->dev, "Unexpected response is returned. " 394 dev_warn(dev, "Unexpected response is returned. "
397 "returned user %p, expected user %p\n", 395 "returned user %p, expected user %p\n",
398 msg->user, ipmi_device->user_interface); 396 msg->user, ipmi_device->user_interface);
399 goto out_msg; 397 goto out_msg;
@@ -409,14 +407,14 @@ static void ipmi_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data)
409 spin_unlock_irqrestore(&ipmi_device->tx_msg_lock, flags); 407 spin_unlock_irqrestore(&ipmi_device->tx_msg_lock, flags);
410 408
411 if (!msg_found) { 409 if (!msg_found) {
412 dev_warn(&pnp_dev->dev, "Unexpected response (msg id %ld) is " 410 dev_warn(dev, "Unexpected response (msg id %ld) is "
413 "returned.\n", msg->msgid); 411 "returned.\n", msg->msgid);
414 goto out_msg; 412 goto out_msg;
415 } 413 }
416 414
417 /* copy the response data to Rx_data buffer */ 415 /* copy the response data to Rx_data buffer */
418 if (msg->msg.data_len > ACPI_IPMI_MAX_MSG_LENGTH) { 416 if (msg->msg.data_len > ACPI_IPMI_MAX_MSG_LENGTH) {
419 dev_WARN_ONCE(&pnp_dev->dev, true, 417 dev_WARN_ONCE(dev, true,
420 "Unexpected response (msg len %d).\n", 418 "Unexpected response (msg len %d).\n",
421 msg->msg.data_len); 419 msg->msg.data_len);
422 goto out_comp; 420 goto out_comp;
@@ -426,7 +424,7 @@ static void ipmi_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data)
426 if (msg->recv_type == IPMI_RESPONSE_RECV_TYPE && 424 if (msg->recv_type == IPMI_RESPONSE_RECV_TYPE &&
427 msg->msg.data_len == 1) { 425 msg->msg.data_len == 1) {
428 if (msg->msg.data[0] == IPMI_TIMEOUT_COMPLETION_CODE) { 426 if (msg->msg.data[0] == IPMI_TIMEOUT_COMPLETION_CODE) {
429 dev_WARN_ONCE(&pnp_dev->dev, true, 427 dev_WARN_ONCE(dev, true,
430 "Unexpected response (timeout).\n"); 428 "Unexpected response (timeout).\n");
431 tx_msg->msg_done = ACPI_IPMI_TIMEOUT; 429 tx_msg->msg_done = ACPI_IPMI_TIMEOUT;
432 } 430 }
@@ -445,7 +443,6 @@ out_msg:
445static void ipmi_register_bmc(int iface, struct device *dev) 443static void ipmi_register_bmc(int iface, struct device *dev)
446{ 444{
447 struct acpi_ipmi_device *ipmi_device, *temp; 445 struct acpi_ipmi_device *ipmi_device, *temp;
448 struct pnp_dev *pnp_dev;
449 int err; 446 int err;
450 struct ipmi_smi_info smi_data; 447 struct ipmi_smi_info smi_data;
451 acpi_handle handle; 448 acpi_handle handle;
@@ -460,11 +457,10 @@ static void ipmi_register_bmc(int iface, struct device *dev)
460 handle = smi_data.addr_info.acpi_info.acpi_handle; 457 handle = smi_data.addr_info.acpi_info.acpi_handle;
461 if (!handle) 458 if (!handle)
462 goto err_ref; 459 goto err_ref;
463 pnp_dev = to_pnp_dev(smi_data.dev);
464 460
465 ipmi_device = ipmi_dev_alloc(iface, &smi_data, handle); 461 ipmi_device = ipmi_dev_alloc(iface, smi_data.dev, handle);
466 if (!ipmi_device) { 462 if (!ipmi_device) {
467 dev_warn(&pnp_dev->dev, "Can't create IPMI user interface\n"); 463 dev_warn(smi_data.dev, "Can't create IPMI user interface\n");
468 goto err_ref; 464 goto err_ref;
469 } 465 }
470 466