diff options
Diffstat (limited to 'arch/powerpc/kernel/legacy_serial.c')
-rw-r--r-- | arch/powerpc/kernel/legacy_serial.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index 40a39291861f..5e6ddfa474c0 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c | |||
@@ -39,16 +39,17 @@ static int __init add_legacy_port(struct device_node *np, int want_index, | |||
39 | phys_addr_t taddr, unsigned long irq, | 39 | phys_addr_t taddr, unsigned long irq, |
40 | upf_t flags, int irq_check_parent) | 40 | upf_t flags, int irq_check_parent) |
41 | { | 41 | { |
42 | u32 *clk, *spd, clock = BASE_BAUD * 16; | 42 | const u32 *clk, *spd; |
43 | u32 clock = BASE_BAUD * 16; | ||
43 | int index; | 44 | int index; |
44 | 45 | ||
45 | /* get clock freq. if present */ | 46 | /* get clock freq. if present */ |
46 | clk = (u32 *)get_property(np, "clock-frequency", NULL); | 47 | clk = get_property(np, "clock-frequency", NULL); |
47 | if (clk && *clk) | 48 | if (clk && *clk) |
48 | clock = *clk; | 49 | clock = *clk; |
49 | 50 | ||
50 | /* get default speed if present */ | 51 | /* get default speed if present */ |
51 | spd = (u32 *)get_property(np, "current-speed", NULL); | 52 | spd = get_property(np, "current-speed", NULL); |
52 | 53 | ||
53 | /* If we have a location index, then try to use it */ | 54 | /* If we have a location index, then try to use it */ |
54 | if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) | 55 | if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) |
@@ -113,7 +114,7 @@ static int __init add_legacy_soc_port(struct device_node *np, | |||
113 | struct device_node *soc_dev) | 114 | struct device_node *soc_dev) |
114 | { | 115 | { |
115 | u64 addr; | 116 | u64 addr; |
116 | u32 *addrp; | 117 | const u32 *addrp; |
117 | upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; | 118 | upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; |
118 | struct device_node *tsi = of_get_parent(np); | 119 | struct device_node *tsi = of_get_parent(np); |
119 | 120 | ||
@@ -144,15 +145,15 @@ static int __init add_legacy_soc_port(struct device_node *np, | |||
144 | static int __init add_legacy_isa_port(struct device_node *np, | 145 | static int __init add_legacy_isa_port(struct device_node *np, |
145 | struct device_node *isa_brg) | 146 | struct device_node *isa_brg) |
146 | { | 147 | { |
147 | u32 *reg; | 148 | const u32 *reg; |
148 | char *typep; | 149 | const char *typep; |
149 | int index = -1; | 150 | int index = -1; |
150 | u64 taddr; | 151 | u64 taddr; |
151 | 152 | ||
152 | DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); | 153 | DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); |
153 | 154 | ||
154 | /* Get the ISA port number */ | 155 | /* Get the ISA port number */ |
155 | reg = (u32 *)get_property(np, "reg", NULL); | 156 | reg = get_property(np, "reg", NULL); |
156 | if (reg == NULL) | 157 | if (reg == NULL) |
157 | return -1; | 158 | return -1; |
158 | 159 | ||
@@ -163,7 +164,7 @@ static int __init add_legacy_isa_port(struct device_node *np, | |||
163 | /* Now look for an "ibm,aix-loc" property that gives us ordering | 164 | /* Now look for an "ibm,aix-loc" property that gives us ordering |
164 | * if any... | 165 | * if any... |
165 | */ | 166 | */ |
166 | typep = (char *)get_property(np, "ibm,aix-loc", NULL); | 167 | typep = get_property(np, "ibm,aix-loc", NULL); |
167 | 168 | ||
168 | /* If we have a location index, then use it */ | 169 | /* If we have a location index, then use it */ |
169 | if (typep && *typep == 'S') | 170 | if (typep && *typep == 'S') |
@@ -188,7 +189,7 @@ static int __init add_legacy_pci_port(struct device_node *np, | |||
188 | struct device_node *pci_dev) | 189 | struct device_node *pci_dev) |
189 | { | 190 | { |
190 | u64 addr, base; | 191 | u64 addr, base; |
191 | u32 *addrp; | 192 | const u32 *addrp; |
192 | unsigned int flags; | 193 | unsigned int flags; |
193 | int iotype, index = -1, lindex = 0; | 194 | int iotype, index = -1, lindex = 0; |
194 | 195 | ||
@@ -227,7 +228,7 @@ static int __init add_legacy_pci_port(struct device_node *np, | |||
227 | * we get to their "reg" property | 228 | * we get to their "reg" property |
228 | */ | 229 | */ |
229 | if (np != pci_dev) { | 230 | if (np != pci_dev) { |
230 | u32 *reg = (u32 *)get_property(np, "reg", NULL); | 231 | const u32 *reg = get_property(np, "reg", NULL); |
231 | if (reg && (*reg < 4)) | 232 | if (reg && (*reg < 4)) |
232 | index = lindex = *reg; | 233 | index = lindex = *reg; |
233 | } | 234 | } |
@@ -285,13 +286,13 @@ static void __init setup_legacy_serial_console(int console) | |||
285 | void __init find_legacy_serial_ports(void) | 286 | void __init find_legacy_serial_ports(void) |
286 | { | 287 | { |
287 | struct device_node *np, *stdout = NULL; | 288 | struct device_node *np, *stdout = NULL; |
288 | char *path; | 289 | const char *path; |
289 | int index; | 290 | int index; |
290 | 291 | ||
291 | DBG(" -> find_legacy_serial_port()\n"); | 292 | DBG(" -> find_legacy_serial_port()\n"); |
292 | 293 | ||
293 | /* Now find out if one of these is out firmware console */ | 294 | /* Now find out if one of these is out firmware console */ |
294 | path = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 295 | path = get_property(of_chosen, "linux,stdout-path", NULL); |
295 | if (path != NULL) { | 296 | if (path != NULL) { |
296 | stdout = of_find_node_by_path(path); | 297 | stdout = of_find_node_by_path(path); |
297 | if (stdout) | 298 | if (stdout) |
@@ -491,8 +492,8 @@ static int __init check_legacy_serial_console(void) | |||
491 | { | 492 | { |
492 | struct device_node *prom_stdout = NULL; | 493 | struct device_node *prom_stdout = NULL; |
493 | int speed = 0, offset = 0; | 494 | int speed = 0, offset = 0; |
494 | char *name; | 495 | const char *name; |
495 | u32 *spd; | 496 | const u32 *spd; |
496 | 497 | ||
497 | DBG(" -> check_legacy_serial_console()\n"); | 498 | DBG(" -> check_legacy_serial_console()\n"); |
498 | 499 | ||
@@ -513,7 +514,7 @@ static int __init check_legacy_serial_console(void) | |||
513 | } | 514 | } |
514 | /* We are getting a weird phandle from OF ... */ | 515 | /* We are getting a weird phandle from OF ... */ |
515 | /* ... So use the full path instead */ | 516 | /* ... So use the full path instead */ |
516 | name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 517 | name = get_property(of_chosen, "linux,stdout-path", NULL); |
517 | if (name == NULL) { | 518 | if (name == NULL) { |
518 | DBG(" no linux,stdout-path !\n"); | 519 | DBG(" no linux,stdout-path !\n"); |
519 | return -ENODEV; | 520 | return -ENODEV; |
@@ -525,12 +526,12 @@ static int __init check_legacy_serial_console(void) | |||
525 | } | 526 | } |
526 | DBG("stdout is %s\n", prom_stdout->full_name); | 527 | DBG("stdout is %s\n", prom_stdout->full_name); |
527 | 528 | ||
528 | name = (char *)get_property(prom_stdout, "name", NULL); | 529 | name = get_property(prom_stdout, "name", NULL); |
529 | if (!name) { | 530 | if (!name) { |
530 | DBG(" stdout package has no name !\n"); | 531 | DBG(" stdout package has no name !\n"); |
531 | goto not_found; | 532 | goto not_found; |
532 | } | 533 | } |
533 | spd = (u32 *)get_property(prom_stdout, "current-speed", NULL); | 534 | spd = get_property(prom_stdout, "current-speed", NULL); |
534 | if (spd) | 535 | if (spd) |
535 | speed = *spd; | 536 | speed = *spd; |
536 | 537 | ||