aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
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
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')
-rw-r--r--drivers/char/hw_random/n2-drv.c16
-rw-r--r--drivers/char/hw_random/pasemi-rng.c9
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c70
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c129
4 files changed, 83 insertions, 141 deletions
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index a3f5e381e746..43ac61978d8b 100644
--- a/drivers/char/hw_random/n2-drv.c
+++ b/drivers/char/hw_random/n2-drv.c
@@ -619,15 +619,17 @@ static void __devinit n2rng_driver_version(void)
619 pr_info("%s", version); 619 pr_info("%s", version);
620} 620}
621 621
622static int __devinit n2rng_probe(struct platform_device *op, 622static int __devinit n2rng_probe(struct platform_device *op)
623 const struct of_device_id *match)
624{ 623{
625 int victoria_falls = (match->data != NULL); 624 int victoria_falls;
626 int err = -ENOMEM; 625 int err = -ENOMEM;
627 struct n2rng *np; 626 struct n2rng *np;
628 627
629 n2rng_driver_version(); 628 if (!op->dev.of_match)
629 return -EINVAL;
630 victoria_falls = (op->dev.of_match->data != NULL);
630 631
632 n2rng_driver_version();
631 np = kzalloc(sizeof(*np), GFP_KERNEL); 633 np = kzalloc(sizeof(*np), GFP_KERNEL);
632 if (!np) 634 if (!np)
633 goto out; 635 goto out;
@@ -750,7 +752,7 @@ static const struct of_device_id n2rng_match[] = {
750}; 752};
751MODULE_DEVICE_TABLE(of, n2rng_match); 753MODULE_DEVICE_TABLE(of, n2rng_match);
752 754
753static struct of_platform_driver n2rng_driver = { 755static struct platform_driver n2rng_driver = {
754 .driver = { 756 .driver = {
755 .name = "n2rng", 757 .name = "n2rng",
756 .owner = THIS_MODULE, 758 .owner = THIS_MODULE,
@@ -762,12 +764,12 @@ static struct of_platform_driver n2rng_driver = {
762 764
763static int __init n2rng_init(void) 765static int __init n2rng_init(void)
764{ 766{
765 return of_register_platform_driver(&n2rng_driver); 767 return platform_driver_register(&n2rng_driver);
766} 768}
767 769
768static void __exit n2rng_exit(void) 770static void __exit n2rng_exit(void)
769{ 771{
770 of_unregister_platform_driver(&n2rng_driver); 772 platform_driver_unregister(&n2rng_driver);
771} 773}
772 774
773module_init(n2rng_init); 775module_init(n2rng_init);
diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c
index a31c830ca8cd..1d504815e6db 100644
--- a/drivers/char/hw_random/pasemi-rng.c
+++ b/drivers/char/hw_random/pasemi-rng.c
@@ -94,8 +94,7 @@ static struct hwrng pasemi_rng = {
94 .data_read = pasemi_rng_data_read, 94 .data_read = pasemi_rng_data_read,
95}; 95};
96 96
97static int __devinit rng_probe(struct platform_device *ofdev, 97static int __devinit rng_probe(struct platform_device *ofdev)
98 const struct of_device_id *match)
99{ 98{
100 void __iomem *rng_regs; 99 void __iomem *rng_regs;
101 struct device_node *rng_np = ofdev->dev.of_node; 100 struct device_node *rng_np = ofdev->dev.of_node;
@@ -139,7 +138,7 @@ static struct of_device_id rng_match[] = {
139 { }, 138 { },
140}; 139};
141 140
142static struct of_platform_driver rng_driver = { 141static struct platform_driver rng_driver = {
143 .driver = { 142 .driver = {
144 .name = "pasemi-rng", 143 .name = "pasemi-rng",
145 .owner = THIS_MODULE, 144 .owner = THIS_MODULE,
@@ -151,13 +150,13 @@ static struct of_platform_driver rng_driver = {
151 150
152static int __init rng_init(void) 151static int __init rng_init(void)
153{ 152{
154 return of_register_platform_driver(&rng_driver); 153 return platform_driver_register(&rng_driver);
155} 154}
156module_init(rng_init); 155module_init(rng_init);
157 156
158static void __exit rng_exit(void) 157static void __exit rng_exit(void)
159{ 158{
160 of_unregister_platform_driver(&rng_driver); 159 platform_driver_unregister(&rng_driver);
161} 160}
162module_exit(rng_exit); 161module_exit(rng_exit);
163 162
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
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 9f2272e6de1c..d3c9d755ed98 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -714,20 +714,29 @@ static int __devexit hwicap_remove(struct device *dev)
714 return 0; /* success */ 714 return 0; /* success */
715} 715}
716 716
717static int __devinit hwicap_drv_probe(struct platform_device *pdev) 717#ifdef CONFIG_OF
718static int __devinit hwicap_of_probe(struct platform_device *op)
718{ 719{
719 struct resource *res; 720 struct resource res;
720 const struct config_registers *regs; 721 const unsigned int *id;
721 const char *family; 722 const char *family;
723 int rc;
724 const struct hwicap_driver_config *config = op->dev.of_match->data;
725 const struct config_registers *regs;
722 726
723 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 727
724 if (!res) 728 rc = of_address_to_resource(op->dev.of_node, 0, &res);
725 return -ENODEV; 729 if (rc) {
730 dev_err(&op->dev, "invalid address\n");
731 return rc;
732 }
733
734 id = of_get_property(op->dev.of_node, "port-number", NULL);
726 735
727 /* It's most likely that we're using V4, if the family is not 736 /* It's most likely that we're using V4, if the family is not
728 specified */ 737 specified */
729 regs = &v4_config_registers; 738 regs = &v4_config_registers;
730 family = pdev->dev.platform_data; 739 family = of_get_property(op->dev.of_node, "xlnx,family", NULL);
731 740
732 if (family) { 741 if (family) {
733 if (!strcmp(family, "virtex2p")) { 742 if (!strcmp(family, "virtex2p")) {
@@ -738,54 +747,33 @@ static int __devinit hwicap_drv_probe(struct platform_device *pdev)
738 regs = &v5_config_registers; 747 regs = &v5_config_registers;
739 } 748 }
740 } 749 }
741 750 return hwicap_setup(&op->dev, id ? *id : -1, &res, config,
742 return hwicap_setup(&pdev->dev, pdev->id, res, 751 regs);
743 &buffer_icap_config, regs);
744} 752}
745 753#else
746static int __devexit hwicap_drv_remove(struct platform_device *pdev) 754static inline int hwicap_of_probe(struct platform_device *op)
747{ 755{
748 return hwicap_remove(&pdev->dev); 756 return -EINVAL;
749} 757}
758#endif /* CONFIG_OF */
750 759
751static struct platform_driver hwicap_platform_driver = { 760static int __devinit hwicap_drv_probe(struct platform_device *pdev)
752 .probe = hwicap_drv_probe,
753 .remove = hwicap_drv_remove,
754 .driver = {
755 .owner = THIS_MODULE,
756 .name = DRIVER_NAME,
757 },
758};
759
760/* ---------------------------------------------------------------------
761 * OF bus binding
762 */
763
764#if defined(CONFIG_OF)
765static int __devinit
766hwicap_of_probe(struct platform_device *op, const struct of_device_id *match)
767{ 761{
768 struct resource res; 762 struct resource *res;
769 const unsigned int *id;
770 const char *family;
771 int rc;
772 const struct hwicap_driver_config *config = match->data;
773 const struct config_registers *regs; 763 const struct config_registers *regs;
764 const char *family;
774 765
775 dev_dbg(&op->dev, "hwicap_of_probe(%p, %p)\n", op, match); 766 if (pdev->dev.of_match)
776 767 return hwicap_of_probe(pdev);
777 rc = of_address_to_resource(op->dev.of_node, 0, &res);
778 if (rc) {
779 dev_err(&op->dev, "invalid address\n");
780 return rc;
781 }
782 768
783 id = of_get_property(op->dev.of_node, "port-number", NULL); 769 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
770 if (!res)
771 return -ENODEV;
784 772
785 /* It's most likely that we're using V4, if the family is not 773 /* It's most likely that we're using V4, if the family is not
786 specified */ 774 specified */
787 regs = &v4_config_registers; 775 regs = &v4_config_registers;
788 family = of_get_property(op->dev.of_node, "xlnx,family", NULL); 776 family = pdev->dev.platform_data;
789 777
790 if (family) { 778 if (family) {
791 if (!strcmp(family, "virtex2p")) { 779 if (!strcmp(family, "virtex2p")) {
@@ -796,50 +784,38 @@ hwicap_of_probe(struct platform_device *op, const struct of_device_id *match)
796 regs = &v5_config_registers; 784 regs = &v5_config_registers;
797 } 785 }
798 } 786 }
799 return hwicap_setup(&op->dev, id ? *id : -1, &res, config, 787
800 regs); 788 return hwicap_setup(&pdev->dev, pdev->id, res,
789 &buffer_icap_config, regs);
801} 790}
802 791
803static int __devexit hwicap_of_remove(struct platform_device *op) 792static int __devexit hwicap_drv_remove(struct platform_device *pdev)
804{ 793{
805 return hwicap_remove(&op->dev); 794 return hwicap_remove(&pdev->dev);
806} 795}
807 796
808/* Match table for of_platform binding */ 797#ifdef CONFIG_OF
798/* Match table for device tree binding */
809static const struct of_device_id __devinitconst hwicap_of_match[] = { 799static const struct of_device_id __devinitconst hwicap_of_match[] = {
810 { .compatible = "xlnx,opb-hwicap-1.00.b", .data = &buffer_icap_config}, 800 { .compatible = "xlnx,opb-hwicap-1.00.b", .data = &buffer_icap_config},
811 { .compatible = "xlnx,xps-hwicap-1.00.a", .data = &fifo_icap_config}, 801 { .compatible = "xlnx,xps-hwicap-1.00.a", .data = &fifo_icap_config},
812 {}, 802 {},
813}; 803};
814MODULE_DEVICE_TABLE(of, hwicap_of_match); 804MODULE_DEVICE_TABLE(of, hwicap_of_match);
805#else
806#define hwicap_of_match NULL
807#endif
815 808
816static struct of_platform_driver hwicap_of_driver = { 809static struct platform_driver hwicap_platform_driver = {
817 .probe = hwicap_of_probe, 810 .probe = hwicap_drv_probe,
818 .remove = __devexit_p(hwicap_of_remove), 811 .remove = hwicap_drv_remove,
819 .driver = { 812 .driver = {
820 .name = DRIVER_NAME,
821 .owner = THIS_MODULE, 813 .owner = THIS_MODULE,
814 .name = DRIVER_NAME,
822 .of_match_table = hwicap_of_match, 815 .of_match_table = hwicap_of_match,
823 }, 816 },
824}; 817};
825 818
826/* Registration helpers to keep the number of #ifdefs to a minimum */
827static inline int __init hwicap_of_register(void)
828{
829 pr_debug("hwicap: calling of_register_platform_driver()\n");
830 return of_register_platform_driver(&hwicap_of_driver);
831}
832
833static inline void __exit hwicap_of_unregister(void)
834{
835 of_unregister_platform_driver(&hwicap_of_driver);
836}
837#else /* CONFIG_OF */
838/* CONFIG_OF not enabled; do nothing helpers */
839static inline int __init hwicap_of_register(void) { return 0; }
840static inline void __exit hwicap_of_unregister(void) { }
841#endif /* CONFIG_OF */
842
843static int __init hwicap_module_init(void) 819static int __init hwicap_module_init(void)
844{ 820{
845 dev_t devt; 821 dev_t devt;
@@ -856,21 +832,12 @@ static int __init hwicap_module_init(void)
856 return retval; 832 return retval;
857 833
858 retval = platform_driver_register(&hwicap_platform_driver); 834 retval = platform_driver_register(&hwicap_platform_driver);
859
860 if (retval)
861 goto failed1;
862
863 retval = hwicap_of_register();
864
865 if (retval) 835 if (retval)
866 goto failed2; 836 goto failed;
867 837
868 return retval; 838 return retval;
869 839
870 failed2: 840 failed:
871 platform_driver_unregister(&hwicap_platform_driver);
872
873 failed1:
874 unregister_chrdev_region(devt, HWICAP_DEVICES); 841 unregister_chrdev_region(devt, HWICAP_DEVICES);
875 842
876 return retval; 843 return retval;
@@ -884,8 +851,6 @@ static void __exit hwicap_module_cleanup(void)
884 851
885 platform_driver_unregister(&hwicap_platform_driver); 852 platform_driver_unregister(&hwicap_platform_driver);
886 853
887 hwicap_of_unregister();
888
889 unregister_chrdev_region(devt, HWICAP_DEVICES); 854 unregister_chrdev_region(devt, HWICAP_DEVICES);
890} 855}
891 856