diff options
Diffstat (limited to 'drivers/sbus/char/flash.c')
-rw-r--r-- | drivers/sbus/char/flash.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c index 2beb3dded087..5ae684c011f8 100644 --- a/drivers/sbus/char/flash.c +++ b/drivers/sbus/char/flash.c | |||
@@ -192,9 +192,11 @@ static int __init flash_init(void) | |||
192 | } | 192 | } |
193 | if (!sdev) { | 193 | if (!sdev) { |
194 | #ifdef CONFIG_PCI | 194 | #ifdef CONFIG_PCI |
195 | struct linux_prom_registers *ebus_regs; | ||
196 | |||
195 | for_each_ebus(ebus) { | 197 | for_each_ebus(ebus) { |
196 | for_each_ebusdev(edev, ebus) { | 198 | for_each_ebusdev(edev, ebus) { |
197 | if (!strcmp(edev->prom_name, "flashprom")) | 199 | if (!strcmp(edev->prom_node->name, "flashprom")) |
198 | goto ebus_done; | 200 | goto ebus_done; |
199 | } | 201 | } |
200 | } | 202 | } |
@@ -202,23 +204,23 @@ static int __init flash_init(void) | |||
202 | if (!edev) | 204 | if (!edev) |
203 | return -ENODEV; | 205 | return -ENODEV; |
204 | 206 | ||
205 | len = prom_getproperty(edev->prom_node, "reg", (void *)regs, sizeof(regs)); | 207 | ebus_regs = of_get_property(edev->prom_node, "reg", &len); |
206 | if ((len % sizeof(regs[0])) != 0) { | 208 | if (!ebus_regs || (len % sizeof(regs[0])) != 0) { |
207 | printk("flash: Strange reg property size %d\n", len); | 209 | printk("flash: Strange reg property size %d\n", len); |
208 | return -ENODEV; | 210 | return -ENODEV; |
209 | } | 211 | } |
210 | 212 | ||
211 | nregs = len / sizeof(regs[0]); | 213 | nregs = len / sizeof(ebus_regs[0]); |
212 | 214 | ||
213 | flash.read_base = edev->resource[0].start; | 215 | flash.read_base = edev->resource[0].start; |
214 | flash.read_size = regs[0].reg_size; | 216 | flash.read_size = ebus_regs[0].reg_size; |
215 | 217 | ||
216 | if (nregs == 1) { | 218 | if (nregs == 1) { |
217 | flash.write_base = edev->resource[0].start; | 219 | flash.write_base = edev->resource[0].start; |
218 | flash.write_size = regs[0].reg_size; | 220 | flash.write_size = ebus_regs[0].reg_size; |
219 | } else if (nregs == 2) { | 221 | } else if (nregs == 2) { |
220 | flash.write_base = edev->resource[1].start; | 222 | flash.write_base = edev->resource[1].start; |
221 | flash.write_size = regs[1].reg_size; | 223 | flash.write_size = ebus_regs[1].reg_size; |
222 | } else { | 224 | } else { |
223 | printk("flash: Strange number of regs %d\n", nregs); | 225 | printk("flash: Strange number of regs %d\n", nregs); |
224 | return -ENODEV; | 226 | return -ENODEV; |