diff options
Diffstat (limited to 'arch/sparc64/kernel/prom.c')
-rw-r--r-- | arch/sparc64/kernel/prom.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c index 0917c24c4f08..5e1fcd05160d 100644 --- a/arch/sparc64/kernel/prom.c +++ b/arch/sparc64/kernel/prom.c | |||
@@ -36,12 +36,13 @@ static struct device_node *allnodes; | |||
36 | */ | 36 | */ |
37 | static DEFINE_RWLOCK(devtree_lock); | 37 | static DEFINE_RWLOCK(devtree_lock); |
38 | 38 | ||
39 | int of_device_is_compatible(struct device_node *device, const char *compat) | 39 | int of_device_is_compatible(const struct device_node *device, |
40 | const char *compat) | ||
40 | { | 41 | { |
41 | const char* cp; | 42 | const char* cp; |
42 | int cplen, l; | 43 | int cplen, l; |
43 | 44 | ||
44 | cp = (char *) of_get_property(device, "compatible", &cplen); | 45 | cp = of_get_property(device, "compatible", &cplen); |
45 | if (cp == NULL) | 46 | if (cp == NULL) |
46 | return 0; | 47 | return 0; |
47 | while (cplen > 0) { | 48 | while (cplen > 0) { |
@@ -154,13 +155,14 @@ struct device_node *of_find_compatible_node(struct device_node *from, | |||
154 | } | 155 | } |
155 | EXPORT_SYMBOL(of_find_compatible_node); | 156 | EXPORT_SYMBOL(of_find_compatible_node); |
156 | 157 | ||
157 | struct property *of_find_property(struct device_node *np, const char *name, | 158 | struct property *of_find_property(const struct device_node *np, |
159 | const char *name, | ||
158 | int *lenp) | 160 | int *lenp) |
159 | { | 161 | { |
160 | struct property *pp; | 162 | struct property *pp; |
161 | 163 | ||
162 | for (pp = np->properties; pp != 0; pp = pp->next) { | 164 | for (pp = np->properties; pp != 0; pp = pp->next) { |
163 | if (strcmp(pp->name, name) == 0) { | 165 | if (strcasecmp(pp->name, name) == 0) { |
164 | if (lenp != 0) | 166 | if (lenp != 0) |
165 | *lenp = pp->length; | 167 | *lenp = pp->length; |
166 | break; | 168 | break; |
@@ -174,7 +176,8 @@ EXPORT_SYMBOL(of_find_property); | |||
174 | * Find a property with a given name for a given node | 176 | * Find a property with a given name for a given node |
175 | * and return the value. | 177 | * and return the value. |
176 | */ | 178 | */ |
177 | void *of_get_property(struct device_node *np, const char *name, int *lenp) | 179 | const void *of_get_property(const struct device_node *np, const char *name, |
180 | int *lenp) | ||
178 | { | 181 | { |
179 | struct property *pp = of_find_property(np,name,lenp); | 182 | struct property *pp = of_find_property(np,name,lenp); |
180 | return pp ? pp->value : NULL; | 183 | return pp ? pp->value : NULL; |
@@ -196,7 +199,7 @@ EXPORT_SYMBOL(of_getintprop_default); | |||
196 | 199 | ||
197 | int of_n_addr_cells(struct device_node *np) | 200 | int of_n_addr_cells(struct device_node *np) |
198 | { | 201 | { |
199 | int* ip; | 202 | const int* ip; |
200 | do { | 203 | do { |
201 | if (np->parent) | 204 | if (np->parent) |
202 | np = np->parent; | 205 | np = np->parent; |
@@ -211,7 +214,7 @@ EXPORT_SYMBOL(of_n_addr_cells); | |||
211 | 214 | ||
212 | int of_n_size_cells(struct device_node *np) | 215 | int of_n_size_cells(struct device_node *np) |
213 | { | 216 | { |
214 | int* ip; | 217 | const int* ip; |
215 | do { | 218 | do { |
216 | if (np->parent) | 219 | if (np->parent) |
217 | np = np->parent; | 220 | np = np->parent; |
@@ -243,7 +246,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len | |||
243 | while (*prevp) { | 246 | while (*prevp) { |
244 | struct property *prop = *prevp; | 247 | struct property *prop = *prevp; |
245 | 248 | ||
246 | if (!strcmp(prop->name, name)) { | 249 | if (!strcasecmp(prop->name, name)) { |
247 | void *old_val = prop->value; | 250 | void *old_val = prop->value; |
248 | int ret; | 251 | int ret; |
249 | 252 | ||
@@ -397,7 +400,7 @@ static unsigned int psycho_irq_build(struct device_node *dp, | |||
397 | 400 | ||
398 | static void psycho_irq_trans_init(struct device_node *dp) | 401 | static void psycho_irq_trans_init(struct device_node *dp) |
399 | { | 402 | { |
400 | struct linux_prom64_registers *regs; | 403 | const struct linux_prom64_registers *regs; |
401 | 404 | ||
402 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); | 405 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); |
403 | dp->irq_trans->irq_build = psycho_irq_build; | 406 | dp->irq_trans->irq_build = psycho_irq_build; |
@@ -547,7 +550,7 @@ static unsigned long __sabre_onboard_imap_off[] = { | |||
547 | static int sabre_device_needs_wsync(struct device_node *dp) | 550 | static int sabre_device_needs_wsync(struct device_node *dp) |
548 | { | 551 | { |
549 | struct device_node *parent = dp->parent; | 552 | struct device_node *parent = dp->parent; |
550 | char *parent_model, *parent_compat; | 553 | const char *parent_model, *parent_compat; |
551 | 554 | ||
552 | /* This traversal up towards the root is meant to | 555 | /* This traversal up towards the root is meant to |
553 | * handle two cases: | 556 | * handle two cases: |
@@ -589,7 +592,7 @@ static unsigned int sabre_irq_build(struct device_node *dp, | |||
589 | { | 592 | { |
590 | struct sabre_irq_data *irq_data = _data; | 593 | struct sabre_irq_data *irq_data = _data; |
591 | unsigned long controller_regs = irq_data->controller_regs; | 594 | unsigned long controller_regs = irq_data->controller_regs; |
592 | struct linux_prom_pci_registers *regs; | 595 | const struct linux_prom_pci_registers *regs; |
593 | unsigned long imap, iclr; | 596 | unsigned long imap, iclr; |
594 | unsigned long imap_off, iclr_off; | 597 | unsigned long imap_off, iclr_off; |
595 | int inofixup = 0; | 598 | int inofixup = 0; |
@@ -639,9 +642,9 @@ static unsigned int sabre_irq_build(struct device_node *dp, | |||
639 | 642 | ||
640 | static void sabre_irq_trans_init(struct device_node *dp) | 643 | static void sabre_irq_trans_init(struct device_node *dp) |
641 | { | 644 | { |
642 | struct linux_prom64_registers *regs; | 645 | const struct linux_prom64_registers *regs; |
643 | struct sabre_irq_data *irq_data; | 646 | struct sabre_irq_data *irq_data; |
644 | u32 *busrange; | 647 | const u32 *busrange; |
645 | 648 | ||
646 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); | 649 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); |
647 | dp->irq_trans->irq_build = sabre_irq_build; | 650 | dp->irq_trans->irq_build = sabre_irq_build; |
@@ -795,7 +798,7 @@ static unsigned int schizo_irq_build(struct device_node *dp, | |||
795 | 798 | ||
796 | static void __schizo_irq_trans_init(struct device_node *dp, int is_tomatillo) | 799 | static void __schizo_irq_trans_init(struct device_node *dp, int is_tomatillo) |
797 | { | 800 | { |
798 | struct linux_prom64_registers *regs; | 801 | const struct linux_prom64_registers *regs; |
799 | struct schizo_irq_data *irq_data; | 802 | struct schizo_irq_data *irq_data; |
800 | 803 | ||
801 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); | 804 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); |
@@ -836,7 +839,7 @@ static unsigned int pci_sun4v_irq_build(struct device_node *dp, | |||
836 | 839 | ||
837 | static void pci_sun4v_irq_trans_init(struct device_node *dp) | 840 | static void pci_sun4v_irq_trans_init(struct device_node *dp) |
838 | { | 841 | { |
839 | struct linux_prom64_registers *regs; | 842 | const struct linux_prom64_registers *regs; |
840 | 843 | ||
841 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); | 844 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); |
842 | dp->irq_trans->irq_build = pci_sun4v_irq_build; | 845 | dp->irq_trans->irq_build = pci_sun4v_irq_build; |
@@ -940,7 +943,7 @@ static unsigned int sbus_of_build_irq(struct device_node *dp, | |||
940 | void *_data) | 943 | void *_data) |
941 | { | 944 | { |
942 | unsigned long reg_base = (unsigned long) _data; | 945 | unsigned long reg_base = (unsigned long) _data; |
943 | struct linux_prom_registers *regs; | 946 | const struct linux_prom_registers *regs; |
944 | unsigned long imap, iclr; | 947 | unsigned long imap, iclr; |
945 | int sbus_slot = 0; | 948 | int sbus_slot = 0; |
946 | int sbus_level = 0; | 949 | int sbus_level = 0; |
@@ -994,7 +997,7 @@ static unsigned int sbus_of_build_irq(struct device_node *dp, | |||
994 | 997 | ||
995 | static void sbus_irq_trans_init(struct device_node *dp) | 998 | static void sbus_irq_trans_init(struct device_node *dp) |
996 | { | 999 | { |
997 | struct linux_prom64_registers *regs; | 1000 | const struct linux_prom64_registers *regs; |
998 | 1001 | ||
999 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); | 1002 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); |
1000 | dp->irq_trans->irq_build = sbus_of_build_irq; | 1003 | dp->irq_trans->irq_build = sbus_of_build_irq; |
@@ -1080,7 +1083,7 @@ static unsigned int sun4v_vdev_irq_build(struct device_node *dp, | |||
1080 | 1083 | ||
1081 | static void sun4v_vdev_irq_trans_init(struct device_node *dp) | 1084 | static void sun4v_vdev_irq_trans_init(struct device_node *dp) |
1082 | { | 1085 | { |
1083 | struct linux_prom64_registers *regs; | 1086 | const struct linux_prom64_registers *regs; |
1084 | 1087 | ||
1085 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); | 1088 | dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); |
1086 | dp->irq_trans->irq_build = sun4v_vdev_irq_build; | 1089 | dp->irq_trans->irq_build = sun4v_vdev_irq_build; |