[SPARC64] power: Convert to of_driver.

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

authored by David S. Miller and committed by David S. Miller abbce6e2 f2ad06a2

+18 -39
+18 -39
arch/sparc64/kernel/power.c
··· 17 17 #include <linux/pm.h> 18 18 19 19 #include <asm/system.h> 20 - #include <asm/ebus.h> 21 - #include <asm/isa.h> 22 20 #include <asm/auxio.h> 21 + #include <asm/prom.h> 22 + #include <asm/of_device.h> 23 + #include <asm/io.h> 23 24 24 25 #include <linux/unistd.h> 25 26 ··· 31 30 int scons_pwroff = 1; 32 31 33 32 #ifdef CONFIG_PCI 33 + #include <linux/pci.h> 34 34 static void __iomem *power_reg; 35 35 36 36 static DECLARE_WAIT_QUEUE_HEAD(powerd_wait); ··· 117 115 return 1; 118 116 } 119 117 120 - static void __devinit power_probe_common(struct of_device *dev, struct resource *res, unsigned int irq) 118 + static int __devinit power_probe(struct of_device *op, const struct of_device_id *match) 121 119 { 122 - power_reg = ioremap(res->start, 0x4); 120 + struct resource *res = &op->resource[0]; 121 + unsigned int irq= op->irqs[0]; 123 122 124 - printk("power: Control reg at %p ... ", power_reg); 123 + power_reg = of_ioremap(res, 0, 0x4, "power"); 124 + 125 + printk("%s: Control reg at %lx ... ", 126 + op->node->name, res->start); 125 127 126 128 poweroff_method = machine_halt; /* able to use the standard halt */ 127 129 128 - if (has_button_interrupt(irq, dev->node)) { 130 + if (has_button_interrupt(irq, op->node)) { 129 131 if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { 130 132 printk("Failed to start power daemon.\n"); 131 - return; 133 + return 0; 132 134 } 133 135 printk("powerd running.\n"); 134 136 ··· 142 136 } else { 143 137 printk("not using powerd.\n"); 144 138 } 139 + 140 + return 0; 145 141 } 146 142 147 143 static struct of_device_id power_match[] = { ··· 153 145 {}, 154 146 }; 155 147 156 - static int __devinit ebus_power_probe(struct of_device *dev, const struct of_device_id *match) 157 - { 158 - struct linux_ebus_device *edev = to_ebus_device(&dev->dev); 159 - struct resource *res = &edev->resource[0]; 160 - unsigned int irq = edev->irqs[0]; 161 - 162 - power_probe_common(dev, res,irq); 163 - 164 - return 0; 165 - } 166 - 167 - static struct of_platform_driver ebus_power_driver = { 148 + static struct of_platform_driver power_driver = { 168 149 .name = "power", 169 150 .match_table = power_match, 170 - .probe = ebus_power_probe, 171 - }; 172 - 173 - static int __devinit isa_power_probe(struct of_device *dev, const struct of_device_id *match) 174 - { 175 - struct sparc_isa_device *idev = to_isa_device(&dev->dev); 176 - struct resource *res = &idev->resource; 177 - unsigned int irq = idev->irq; 178 - 179 - power_probe_common(dev, res,irq); 180 - 181 - return 0; 182 - } 183 - 184 - static struct of_platform_driver isa_power_driver = { 185 - .name = "power", 186 - .match_table = power_match, 187 - .probe = isa_power_probe, 151 + .probe = power_probe, 188 152 }; 189 153 190 154 void __init power_init(void) 191 155 { 192 - of_register_driver(&ebus_power_driver, &ebus_bus_type); 193 - of_register_driver(&isa_power_driver, &isa_bus_type); 156 + of_register_driver(&power_driver, &of_bus_type); 194 157 return; 195 158 } 196 159 #endif /* CONFIG_PCI */