aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 20:28:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 20:28:10 -0400
commit4c5811bf463b0ef82fabbd1708f8bb2d753aeb18 (patch)
treeff37d31217c3804ca05de21a55a9b5ca1ca818b2 /drivers/char/ipmi
parentf74b9444192c60603020c61d7915b72893137edc (diff)
parent9f15444fefdb33509132ff5c9be60cb315c44cb2 (diff)
Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6
* 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6: (21 commits) tty: serial: altera_jtaguart: Add device tree support tty: serial: altera_uart: Add devicetree support dt: eliminate of_platform_driver shim code dt: Eliminate of_platform_{,un}register_driver dt/serial: Eliminate users of of_platform_{,un}register_driver dt/usb: Eliminate users of of_platform_{,un}register_driver dt/video: Eliminate users of of_platform_{,un}register_driver dt/net: Eliminate users of of_platform_{,un}register_driver dt/sound: Eliminate users of of_platform_{,un}register_driver dt/spi: Eliminate users of of_platform_{,un}register_driver dt: uartlite: merge platform and of_platform driver bindings dt: xilinx_hwicap: merge platform and of_platform driver bindings ipmi: convert OF driver to platform driver leds/leds-gpio: merge platform_driver with of_platform_driver dt/sparc: Eliminate users of of_platform_{,un}register_driver dt/powerpc: Eliminate users of of_platform_{,un}register_driver dt/powerpc: move of_bus_type infrastructure to ibmebus drivercore/dt: add a match table pointer to struct device dt: Typo fix. altera_ps2: Add devicetree support ...
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c70
1 files changed, 23 insertions, 47 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 62787e30d508..c86d43b88e1e 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -66,13 +66,10 @@
66#include <linux/string.h> 66#include <linux/string.h>
67#include <linux/ctype.h> 67#include <linux/ctype.h>
68#include <linux/pnp.h> 68#include <linux/pnp.h>
69
70#ifdef CONFIG_PPC_OF
71#include <linux/of_device.h> 69#include <linux/of_device.h>
72#include <linux/of_platform.h> 70#include <linux/of_platform.h>
73#include <linux/of_address.h> 71#include <linux/of_address.h>
74#include <linux/of_irq.h> 72#include <linux/of_irq.h>
75#endif
76 73
77#define PFX "ipmi_si: " 74#define PFX "ipmi_si: "
78 75
@@ -116,13 +113,7 @@ static char *ipmi_addr_src_to_str[] = { NULL, "hotmod", "hardcoded", "SPMI",
116 113
117#define DEVICE_NAME "ipmi_si" 114#define DEVICE_NAME "ipmi_si"
118 115
119static struct platform_driver ipmi_driver = { 116static struct platform_driver ipmi_driver;
120 .driver = {
121 .name = DEVICE_NAME,
122 .bus = &platform_bus_type
123 }
124};
125
126 117
127/* 118/*
128 * Indexes into stats[] in smi_info below. 119 * Indexes into stats[] in smi_info below.
@@ -308,9 +299,6 @@ static int pci_registered;
308#ifdef CONFIG_ACPI 299#ifdef CONFIG_ACPI
309static int pnp_registered; 300static int pnp_registered;
310#endif 301#endif
311#ifdef CONFIG_PPC_OF
312static int of_registered;
313#endif
314 302
315static unsigned int kipmid_max_busy_us[SI_MAX_PARMS]; 303static unsigned int kipmid_max_busy_us[SI_MAX_PARMS];
316static int num_max_busy_us; 304static int num_max_busy_us;
@@ -1868,8 +1856,9 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
1868 return rv; 1856 return rv;
1869} 1857}
1870 1858
1871static void __devinit hardcode_find_bmc(void) 1859static int __devinit hardcode_find_bmc(void)
1872{ 1860{
1861 int ret = -ENODEV;
1873 int i; 1862 int i;
1874 struct smi_info *info; 1863 struct smi_info *info;
1875 1864
@@ -1879,7 +1868,7 @@ static void __devinit hardcode_find_bmc(void)
1879 1868
1880 info = smi_info_alloc(); 1869 info = smi_info_alloc();
1881 if (!info) 1870 if (!info)
1882 return; 1871 return -ENOMEM;
1883 1872
1884 info->addr_source = SI_HARDCODED; 1873 info->addr_source = SI_HARDCODED;
1885 printk(KERN_INFO PFX "probing via hardcoded address\n"); 1874 printk(KERN_INFO PFX "probing via hardcoded address\n");
@@ -1932,10 +1921,12 @@ static void __devinit hardcode_find_bmc(void)
1932 if (!add_smi(info)) { 1921 if (!add_smi(info)) {
1933 if (try_smi_init(info)) 1922 if (try_smi_init(info))
1934 cleanup_one_si(info); 1923 cleanup_one_si(info);
1924 ret = 0;
1935 } else { 1925 } else {
1936 kfree(info); 1926 kfree(info);
1937 } 1927 }
1938 } 1928 }
1929 return ret;
1939} 1930}
1940 1931
1941#ifdef CONFIG_ACPI 1932#ifdef CONFIG_ACPI
@@ -2563,11 +2554,9 @@ static struct pci_driver ipmi_pci_driver = {
2563}; 2554};
2564#endif /* CONFIG_PCI */ 2555#endif /* CONFIG_PCI */
2565 2556
2566 2557static int __devinit ipmi_probe(struct platform_device *dev)
2567#ifdef CONFIG_PPC_OF
2568static int __devinit ipmi_of_probe(struct platform_device *dev,
2569 const struct of_device_id *match)
2570{ 2558{
2559#ifdef CONFIG_OF
2571 struct smi_info *info; 2560 struct smi_info *info;
2572 struct resource resource; 2561 struct resource resource;
2573 const __be32 *regsize, *regspacing, *regshift; 2562 const __be32 *regsize, *regspacing, *regshift;
@@ -2577,6 +2566,9 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
2577 2566
2578 dev_info(&dev->dev, "probing via device tree\n"); 2567 dev_info(&dev->dev, "probing via device tree\n");
2579 2568
2569 if (!dev->dev.of_match)
2570 return -EINVAL;
2571
2580 ret = of_address_to_resource(np, 0, &resource); 2572 ret = of_address_to_resource(np, 0, &resource);
2581 if (ret) { 2573 if (ret) {
2582 dev_warn(&dev->dev, PFX "invalid address from OF\n"); 2574 dev_warn(&dev->dev, PFX "invalid address from OF\n");
@@ -2609,7 +2601,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
2609 return -ENOMEM; 2601 return -ENOMEM;
2610 } 2602 }
2611 2603
2612 info->si_type = (enum si_type) match->data; 2604 info->si_type = (enum si_type) dev->dev.of_match->data;
2613 info->addr_source = SI_DEVICETREE; 2605 info->addr_source = SI_DEVICETREE;
2614 info->irq_setup = std_irq_setup; 2606 info->irq_setup = std_irq_setup;
2615 2607
@@ -2640,13 +2632,15 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
2640 kfree(info); 2632 kfree(info);
2641 return -EBUSY; 2633 return -EBUSY;
2642 } 2634 }
2643 2635#endif
2644 return 0; 2636 return 0;
2645} 2637}
2646 2638
2647static int __devexit ipmi_of_remove(struct platform_device *dev) 2639static int __devexit ipmi_remove(struct platform_device *dev)
2648{ 2640{
2641#ifdef CONFIG_OF
2649 cleanup_one_si(dev_get_drvdata(&dev->dev)); 2642 cleanup_one_si(dev_get_drvdata(&dev->dev));
2643#endif
2650 return 0; 2644 return 0;
2651} 2645}
2652 2646
@@ -2661,16 +2655,15 @@ static struct of_device_id ipmi_match[] =
2661 {}, 2655 {},
2662}; 2656};
2663 2657
2664static struct of_platform_driver ipmi_of_platform_driver = { 2658static struct platform_driver ipmi_driver = {
2665 .driver = { 2659 .driver = {
2666 .name = "ipmi", 2660 .name = DEVICE_NAME,
2667 .owner = THIS_MODULE, 2661 .owner = THIS_MODULE,
2668 .of_match_table = ipmi_match, 2662 .of_match_table = ipmi_match,
2669 }, 2663 },
2670 .probe = ipmi_of_probe, 2664 .probe = ipmi_probe,
2671 .remove = __devexit_p(ipmi_of_remove), 2665 .remove = __devexit_p(ipmi_remove),
2672}; 2666};
2673#endif /* CONFIG_PPC_OF */
2674 2667
2675static int wait_for_msg_done(struct smi_info *smi_info) 2668static int wait_for_msg_done(struct smi_info *smi_info)
2676{ 2669{
@@ -3348,8 +3341,7 @@ static int __devinit init_ipmi_si(void)
3348 return 0; 3341 return 0;
3349 initialized = 1; 3342 initialized = 1;
3350 3343
3351 /* Register the device drivers. */ 3344 rv = platform_driver_register(&ipmi_driver);
3352 rv = driver_register(&ipmi_driver.driver);
3353 if (rv) { 3345 if (rv) {
3354 printk(KERN_ERR PFX "Unable to register driver: %d\n", rv); 3346 printk(KERN_ERR PFX "Unable to register driver: %d\n", rv);
3355 return rv; 3347 return rv;
@@ -3373,15 +3365,9 @@ static int __devinit init_ipmi_si(void)
3373 3365
3374 printk(KERN_INFO "IPMI System Interface driver.\n"); 3366 printk(KERN_INFO "IPMI System Interface driver.\n");
3375 3367
3376 hardcode_find_bmc();
3377
3378 /* If the user gave us a device, they presumably want us to use it */ 3368 /* If the user gave us a device, they presumably want us to use it */
3379 mutex_lock(&smi_infos_lock); 3369 if (!hardcode_find_bmc())
3380 if (!list_empty(&smi_infos)) {
3381 mutex_unlock(&smi_infos_lock);
3382 return 0; 3370 return 0;
3383 }
3384 mutex_unlock(&smi_infos_lock);
3385 3371
3386#ifdef CONFIG_PCI 3372#ifdef CONFIG_PCI
3387 rv = pci_register_driver(&ipmi_pci_driver); 3373 rv = pci_register_driver(&ipmi_pci_driver);
@@ -3404,11 +3390,6 @@ static int __devinit init_ipmi_si(void)
3404 spmi_find_bmc(); 3390 spmi_find_bmc();
3405#endif 3391#endif
3406 3392
3407#ifdef CONFIG_PPC_OF
3408 of_register_platform_driver(&ipmi_of_platform_driver);
3409 of_registered = 1;
3410#endif
3411
3412 /* We prefer devices with interrupts, but in the case of a machine 3393 /* We prefer devices with interrupts, but in the case of a machine
3413 with multiple BMCs we assume that there will be several instances 3394 with multiple BMCs we assume that there will be several instances
3414 of a given type so if we succeed in registering a type then also 3395 of a given type so if we succeed in registering a type then also
@@ -3556,17 +3537,12 @@ static void __exit cleanup_ipmi_si(void)
3556 pnp_unregister_driver(&ipmi_pnp_driver); 3537 pnp_unregister_driver(&ipmi_pnp_driver);
3557#endif 3538#endif
3558 3539
3559#ifdef CONFIG_PPC_OF 3540 platform_driver_unregister(&ipmi_driver);
3560 if (of_registered)
3561 of_unregister_platform_driver(&ipmi_of_platform_driver);
3562#endif
3563 3541
3564 mutex_lock(&smi_infos_lock); 3542 mutex_lock(&smi_infos_lock);
3565 list_for_each_entry_safe(e, tmp_e, &smi_infos, link) 3543 list_for_each_entry_safe(e, tmp_e, &smi_infos, link)
3566 cleanup_one_si(e); 3544 cleanup_one_si(e);
3567 mutex_unlock(&smi_infos_lock); 3545 mutex_unlock(&smi_infos_lock);
3568
3569 driver_unregister(&ipmi_driver.driver);
3570} 3546}
3571module_exit(cleanup_ipmi_si); 3547module_exit(cleanup_ipmi_si);
3572 3548