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