aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi/ipmi_si_intf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/ipmi/ipmi_si_intf.c')
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 7bd7c45b53ef..22abd188fe12 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -320,6 +320,7 @@ static int unload_when_empty = 1;
320static int add_smi(struct smi_info *smi); 320static int add_smi(struct smi_info *smi);
321static int try_smi_init(struct smi_info *smi); 321static int try_smi_init(struct smi_info *smi);
322static void cleanup_one_si(struct smi_info *to_clean); 322static void cleanup_one_si(struct smi_info *to_clean);
323static void cleanup_ipmi_si(void);
323 324
324static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list); 325static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list);
325static int register_xaction_notifier(struct notifier_block *nb) 326static int register_xaction_notifier(struct notifier_block *nb)
@@ -1665,6 +1666,17 @@ static int check_hotmod_int_op(const char *curr, const char *option,
1665 return 0; 1666 return 0;
1666} 1667}
1667 1668
1669static struct smi_info *smi_info_alloc(void)
1670{
1671 struct smi_info *info = kzalloc(sizeof(*info), GFP_KERNEL);
1672
1673 if (info) {
1674 spin_lock_init(&info->si_lock);
1675 spin_lock_init(&info->msg_lock);
1676 }
1677 return info;
1678}
1679
1668static int hotmod_handler(const char *val, struct kernel_param *kp) 1680static int hotmod_handler(const char *val, struct kernel_param *kp)
1669{ 1681{
1670 char *str = kstrdup(val, GFP_KERNEL); 1682 char *str = kstrdup(val, GFP_KERNEL);
@@ -1779,7 +1791,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
1779 } 1791 }
1780 1792
1781 if (op == HM_ADD) { 1793 if (op == HM_ADD) {
1782 info = kzalloc(sizeof(*info), GFP_KERNEL); 1794 info = smi_info_alloc();
1783 if (!info) { 1795 if (!info) {
1784 rv = -ENOMEM; 1796 rv = -ENOMEM;
1785 goto out; 1797 goto out;
@@ -1844,7 +1856,7 @@ static __devinit void hardcode_find_bmc(void)
1844 if (!ports[i] && !addrs[i]) 1856 if (!ports[i] && !addrs[i])
1845 continue; 1857 continue;
1846 1858
1847 info = kzalloc(sizeof(*info), GFP_KERNEL); 1859 info = smi_info_alloc();
1848 if (!info) 1860 if (!info)
1849 return; 1861 return;
1850 1862
@@ -2028,7 +2040,7 @@ static __devinit int try_init_spmi(struct SPMITable *spmi)
2028 return -ENODEV; 2040 return -ENODEV;
2029 } 2041 }
2030 2042
2031 info = kzalloc(sizeof(*info), GFP_KERNEL); 2043 info = smi_info_alloc();
2032 if (!info) { 2044 if (!info) {
2033 printk(KERN_ERR PFX "Could not allocate SI data (3)\n"); 2045 printk(KERN_ERR PFX "Could not allocate SI data (3)\n");
2034 return -ENOMEM; 2046 return -ENOMEM;
@@ -2138,7 +2150,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
2138 if (!acpi_dev) 2150 if (!acpi_dev)
2139 return -ENODEV; 2151 return -ENODEV;
2140 2152
2141 info = kzalloc(sizeof(*info), GFP_KERNEL); 2153 info = smi_info_alloc();
2142 if (!info) 2154 if (!info)
2143 return -ENOMEM; 2155 return -ENOMEM;
2144 2156
@@ -2319,7 +2331,7 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
2319{ 2331{
2320 struct smi_info *info; 2332 struct smi_info *info;
2321 2333
2322 info = kzalloc(sizeof(*info), GFP_KERNEL); 2334 info = smi_info_alloc();
2323 if (!info) { 2335 if (!info) {
2324 printk(KERN_ERR PFX "Could not allocate SI data\n"); 2336 printk(KERN_ERR PFX "Could not allocate SI data\n");
2325 return; 2337 return;
@@ -2426,7 +2438,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
2426 int class_type = pdev->class & PCI_ERMC_CLASSCODE_TYPE_MASK; 2438 int class_type = pdev->class & PCI_ERMC_CLASSCODE_TYPE_MASK;
2427 struct smi_info *info; 2439 struct smi_info *info;
2428 2440
2429 info = kzalloc(sizeof(*info), GFP_KERNEL); 2441 info = smi_info_alloc();
2430 if (!info) 2442 if (!info)
2431 return -ENOMEM; 2443 return -ENOMEM;
2432 2444
@@ -2567,7 +2579,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
2567 return -EINVAL; 2579 return -EINVAL;
2568 } 2580 }
2569 2581
2570 info = kzalloc(sizeof(*info), GFP_KERNEL); 2582 info = smi_info_alloc();
2571 2583
2572 if (!info) { 2584 if (!info) {
2573 dev_err(&dev->dev, 2585 dev_err(&dev->dev,
@@ -3014,7 +3026,7 @@ static __devinit void default_find_bmc(void)
3014 if (check_legacy_ioport(ipmi_defaults[i].port)) 3026 if (check_legacy_ioport(ipmi_defaults[i].port))
3015 continue; 3027 continue;
3016#endif 3028#endif
3017 info = kzalloc(sizeof(*info), GFP_KERNEL); 3029 info = smi_info_alloc();
3018 if (!info) 3030 if (!info)
3019 return; 3031 return;
3020 3032
@@ -3139,9 +3151,6 @@ static int try_smi_init(struct smi_info *new_smi)
3139 goto out_err; 3151 goto out_err;
3140 } 3152 }
3141 3153
3142 spin_lock_init(&(new_smi->si_lock));
3143 spin_lock_init(&(new_smi->msg_lock));
3144
3145 /* Do low-level detection first. */ 3154 /* Do low-level detection first. */
3146 if (new_smi->handlers->detect(new_smi->si_sm)) { 3155 if (new_smi->handlers->detect(new_smi->si_sm)) {
3147 if (new_smi->addr_source) 3156 if (new_smi->addr_source)
@@ -3428,16 +3437,7 @@ static __devinit int init_ipmi_si(void)
3428 mutex_lock(&smi_infos_lock); 3437 mutex_lock(&smi_infos_lock);
3429 if (unload_when_empty && list_empty(&smi_infos)) { 3438 if (unload_when_empty && list_empty(&smi_infos)) {
3430 mutex_unlock(&smi_infos_lock); 3439 mutex_unlock(&smi_infos_lock);
3431#ifdef CONFIG_PCI 3440 cleanup_ipmi_si();
3432 if (pci_registered)
3433 pci_unregister_driver(&ipmi_pci_driver);
3434#endif
3435
3436#ifdef CONFIG_PPC_OF
3437 if (of_registered)
3438 of_unregister_platform_driver(&ipmi_of_platform_driver);
3439#endif
3440 driver_unregister(&ipmi_driver.driver);
3441 printk(KERN_WARNING PFX 3441 printk(KERN_WARNING PFX
3442 "Unable to find any System Interface(s)\n"); 3442 "Unable to find any System Interface(s)\n");
3443 return -ENODEV; 3443 return -ENODEV;