From 7e50387bceda4d5542e4ba87097f69071b425fe5 Mon Sep 17 00:00:00 2001 From: Corey Minyard Date: Thu, 9 Oct 2014 07:20:32 -0500 Subject: ipmi: Move the address source to string to ipmi-generic code It was in the system interface driver, but is generic functionality. Signed-off-by: Corey Minyard --- include/linux/ipmi.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index 76d2acbfa7c6..47b8f8ddb2b1 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h @@ -278,6 +278,7 @@ enum ipmi_addr_src { SI_INVALID = 0, SI_HOTMOD, SI_HARDCODED, SI_SPMI, SI_ACPI, SI_SMBIOS, SI_PCI, SI_DEVICETREE, SI_DEFAULT }; +const char *ipmi_addr_src_to_str(enum ipmi_addr_src src); union ipmi_smi_info_union { /* -- cgit v1.2.3 From 5a0e10ec4a82ec9e1ab9b85a0f2c2893f7ffda25 Mon Sep 17 00:00:00 2001 From: Corey Minyard Date: Fri, 10 Oct 2014 22:11:05 -0500 Subject: ipmi: Remove useless sysfs_name parameters It was always "bmc", so just hardcode it. It makes no sense to pass that in. Signed-off-by: Corey Minyard --- drivers/char/ipmi/ipmi_msghandler.c | 34 +++++----------------------------- drivers/char/ipmi/ipmi_si_intf.c | 1 - include/linux/ipmi_smi.h | 1 - 3 files changed, 5 insertions(+), 31 deletions(-) (limited to 'include') diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 4539afa5b7f2..5b08b92c6441 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -342,7 +342,6 @@ struct ipmi_smi { struct bmc_device *bmc; char *my_dev_name; - char *sysfs_name; /* * This is the lower-layer's sender routine. Note that you @@ -2373,11 +2372,7 @@ static void ipmi_bmc_unregister(ipmi_smi_t intf) { struct bmc_device *bmc = intf->bmc; - if (intf->sysfs_name) { - sysfs_remove_link(&intf->si_dev->kobj, intf->sysfs_name); - kfree(intf->sysfs_name); - intf->sysfs_name = NULL; - } + sysfs_remove_link(&intf->si_dev->kobj, "bmc"); if (intf->my_dev_name) { sysfs_remove_link(&bmc->pdev.dev.kobj, intf->my_dev_name); kfree(intf->my_dev_name); @@ -2417,8 +2412,7 @@ out: return err; } -static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, - const char *sysfs_name) +static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum) { int rv; struct bmc_device *bmc = intf->bmc; @@ -2489,6 +2483,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, bmc->pdev.id = bmc->id.device_id; bmc->pdev.dev.release = release_bmc_device; bmc->pdev.dev.type = &bmc_device_type; + kref_init(&bmc->usecount); rv = platform_device_register(&bmc->pdev); mutex_unlock(&ipmidriver_mutex); @@ -2505,8 +2500,6 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, return rv; } - kref_init(&bmc->usecount); - rv = create_bmc_files(bmc); if (rv) { mutex_lock(&ipmidriver_mutex); @@ -2527,20 +2520,8 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, * create symlink from system interface device to bmc device * and back. */ - intf->sysfs_name = kstrdup(sysfs_name, GFP_KERNEL); - if (!intf->sysfs_name) { - rv = -ENOMEM; - printk(KERN_ERR - "ipmi_msghandler: allocate link to BMC: %d\n", - rv); - goto out_err; - } - - rv = sysfs_create_link(&intf->si_dev->kobj, - &bmc->pdev.dev.kobj, intf->sysfs_name); + rv = sysfs_create_link(&intf->si_dev->kobj, &bmc->pdev.dev.kobj, "bmc"); if (rv) { - kfree(intf->sysfs_name); - intf->sysfs_name = NULL; printk(KERN_ERR "ipmi_msghandler: Unable to create bmc symlink: %d\n", rv); @@ -2549,8 +2530,6 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, intf->my_dev_name = kasprintf(GFP_KERNEL, "ipmi%d", ifnum); if (!intf->my_dev_name) { - kfree(intf->sysfs_name); - intf->sysfs_name = NULL; rv = -ENOMEM; printk(KERN_ERR "ipmi_msghandler: allocate link from BMC: %d\n", @@ -2561,8 +2540,6 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, rv = sysfs_create_link(&bmc->pdev.dev.kobj, &intf->si_dev->kobj, intf->my_dev_name); if (rv) { - kfree(intf->sysfs_name); - intf->sysfs_name = NULL; kfree(intf->my_dev_name); intf->my_dev_name = NULL; printk(KERN_ERR @@ -2761,7 +2738,6 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, void *send_info, struct ipmi_device_id *device_id, struct device *si_dev, - const char *sysfs_name, unsigned char slave_addr) { int i, j; @@ -2895,7 +2871,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, if (rv == 0) rv = add_proc_entries(intf, i); - rv = ipmi_bmc_register(intf, i, sysfs_name); + rv = ipmi_bmc_register(intf, i); out: if (rv) { diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 337182b5c51a..f474ad8a7b8e 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -3429,7 +3429,6 @@ static int try_smi_init(struct smi_info *new_smi) new_smi, &new_smi->device_id, new_smi->dev, - "bmc", new_smi->slave_addr); if (rv) { dev_err(new_smi->dev, "Unable to register device: error %d\n", diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index bd349240d50e..6131845016d9 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h @@ -212,7 +212,6 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, void *send_info, struct ipmi_device_id *device_id, struct device *dev, - const char *sysfs_name, unsigned char slave_addr); /* -- cgit v1.2.3 From a11213fc36d29d42ab00d400796e98fc770c93b9 Mon Sep 17 00:00:00 2001 From: Corey Minyard Date: Fri, 10 Oct 2014 17:47:04 -0500 Subject: ipmi: Use the proper type for acpi_handle Minor cleanup, don't use a void pointer, use the right type. Signed-off-by: Corey Minyard --- include/linux/ipmi.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index 47b8f8ddb2b1..838dbfa3c331 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h @@ -37,6 +37,7 @@ #include #include +#include /* For acpi_handle */ struct module; struct device; @@ -281,13 +282,15 @@ enum ipmi_addr_src { const char *ipmi_addr_src_to_str(enum ipmi_addr_src src); union ipmi_smi_info_union { +#ifdef CONFIG_ACPI /* * the acpi_info element is defined for the SI_ACPI * address type */ struct { - void *acpi_handle; + acpi_handle acpi_handle; } acpi_info; +#endif }; struct ipmi_smi_info { -- cgit v1.2.3 From 99ab32f3b5d705be562b8c4d9dca7c1ae3dc2cdf Mon Sep 17 00:00:00 2001 From: Corey Minyard Date: Fri, 7 Nov 2014 07:57:31 -0600 Subject: ipmi: Remove the now unused priority from SMI sender Since the queue was moved into the message handler, the priority field is now irrelevant. Signed-off-by: Corey Minyard --- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- drivers/char/ipmi/ipmi_si_intf.c | 3 +-- include/linux/ipmi_smi.h | 9 ++++----- 3 files changed, 7 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index b705218fbbfa..5fa83f751378 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -1516,7 +1516,7 @@ static void smi_send(ipmi_smi_t intf, struct ipmi_smi_handlers *handlers, spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); if (smi_msg) - handlers->sender(intf->send_info, smi_msg, 0); + handlers->sender(intf->send_info, smi_msg); } /* @@ -3908,7 +3908,7 @@ static void smi_recv_tasklet(unsigned long val) if (!run_to_completion) spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); if (newmsg) - intf->handlers->sender(intf->send_info, newmsg, 0); + intf->handlers->sender(intf->send_info, newmsg); handle_new_recv_msgs(intf); } diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index d31a7fce2260..4f11301a0c42 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -892,8 +892,7 @@ static void check_start_timer_thread(struct smi_info *smi_info) } static void sender(void *send_info, - struct ipmi_smi_msg *msg, - int priority) + struct ipmi_smi_msg *msg) { struct smi_info *smi_info = send_info; enum si_sm_result result; diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 6131845016d9..0b1e569f5ff5 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h @@ -98,12 +98,11 @@ struct ipmi_smi_handlers { operation is not allowed to fail. If an error occurs, it should report back the error in a received message. It may do this in the current call context, since no write locks - are held when this is run. If the priority is > 0, the - message will go into a high-priority queue and be sent - first. Otherwise, it goes into a normal-priority queue. */ + are held when this is run. Message are delivered one at + a time by the message handler, a new message will not be + delivered until the previous message is returned. */ void (*sender)(void *send_info, - struct ipmi_smi_msg *msg, - int priority); + struct ipmi_smi_msg *msg); /* Called by the upper layer to request that we try to get events from the BMC we are attached to. */ -- cgit v1.2.3