[SPARC64] auxio: Convert to pure of_device driver.

Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

David S. Miller and committed by
David S. Miller
36a59bd8 50312ce9

+24 -49
+24 -49
arch/sparc64/kernel/auxio.c
··· 111 } 112 } 113 114 - static void __devinit auxio_report_dev(struct device_node *dp) 115 - { 116 - printk(KERN_INFO "AUXIO: Found device at %s\n", 117 - dp->full_name); 118 - } 119 - 120 static struct of_device_id auxio_match[] = { 121 { 122 .name = "auxio", ··· 120 121 MODULE_DEVICE_TABLE(of, auxio_match); 122 123 - #ifdef CONFIG_SBUS 124 - static int __devinit auxio_sbus_probe(struct of_device *dev, const struct of_device_id *match) 125 { 126 - struct sbus_dev *sdev = to_sbus_device(&dev->dev); 127 128 - auxio_devtype = AUXIO_TYPE_SBUS; 129 - auxio_register = sbus_ioremap(&sdev->resource[0], 0, 130 - sdev->reg_addrs[0].reg_size, 131 - "auxiliaryIO"); 132 if (!auxio_register) 133 return -ENODEV; 134 135 - auxio_report_dev(dev->node); 136 - return 0; 137 - } 138 139 - static struct of_platform_driver auxio_sbus_driver = { 140 - .name = "auxio", 141 - .match_table = auxio_match, 142 - .probe = auxio_sbus_probe, 143 - }; 144 - #endif 145 - 146 - #ifdef CONFIG_PCI 147 - static int __devinit auxio_ebus_probe(struct of_device *dev, const struct of_device_id *match) 148 - { 149 - struct linux_ebus_device *edev = to_ebus_device(&dev->dev); 150 - 151 - auxio_devtype = AUXIO_TYPE_EBUS; 152 - auxio_register = ioremap(edev->resource[0].start, sizeof(u32)); 153 - if (!auxio_register) 154 - return -ENODEV; 155 - 156 - auxio_report_dev(dev->node); 157 - 158 - auxio_set_led(AUXIO_LED_ON); 159 160 return 0; 161 } 162 163 - static struct of_platform_driver auxio_ebus_driver = { 164 .name = "auxio", 165 .match_table = auxio_match, 166 - .probe = auxio_ebus_probe, 167 }; 168 - #endif 169 170 - static int __init auxio_probe(void) 171 { 172 - #ifdef CONFIG_SBUS 173 - of_register_driver(&auxio_sbus_driver, &sbus_bus_type); 174 - #endif 175 - #ifdef CONFIG_PCI 176 - of_register_driver(&auxio_ebus_driver, &ebus_bus_type); 177 - #endif 178 - 179 - return 0; 180 } 181 182 /* Must be after subsys_initcall() so that busses are probed. Must 183 * be before device_initcall() because things like the floppy driver 184 * need to use the AUXIO register. 185 */ 186 - fs_initcall(auxio_probe);
··· 111 } 112 } 113 114 static struct of_device_id auxio_match[] = { 115 { 116 .name = "auxio", ··· 126 127 MODULE_DEVICE_TABLE(of, auxio_match); 128 129 + static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match) 130 { 131 + struct device_node *dp = dev->node; 132 + unsigned long size; 133 134 + if (!strcmp(dp->parent->name, "ebus")) { 135 + auxio_devtype = AUXIO_TYPE_EBUS; 136 + size = sizeof(u32); 137 + } else if (!strcmp(dp->parent->name, "sbus")) { 138 + auxio_devtype = AUXIO_TYPE_SBUS; 139 + size = 1; 140 + } else { 141 + printk("auxio: Unknown parent bus type [%s]\n", 142 + dp->parent->name); 143 + return -ENODEV; 144 + } 145 + auxio_register = of_ioremap(&dev->resource[0], 0, size, "auxio"); 146 if (!auxio_register) 147 return -ENODEV; 148 149 + printk(KERN_INFO "AUXIO: Found device at %s\n", 150 + dp->full_name); 151 152 + if (auxio_devtype == AUXIO_TYPE_EBUS) 153 + auxio_set_led(AUXIO_LED_ON); 154 155 return 0; 156 } 157 158 + static struct of_platform_driver auxio_driver = { 159 .name = "auxio", 160 .match_table = auxio_match, 161 + .probe = auxio_probe, 162 }; 163 164 + static int __init auxio_init(void) 165 { 166 + return of_register_driver(&auxio_driver, &of_bus_type); 167 } 168 169 /* Must be after subsys_initcall() so that busses are probed. Must 170 * be before device_initcall() because things like the floppy driver 171 * need to use the AUXIO register. 172 */ 173 + fs_initcall(auxio_init);