diff options
Diffstat (limited to 'drivers')
47 files changed, 1058 insertions, 207 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index c40e487d9f5c..320ad7ba11d4 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -495,6 +495,21 @@ config LEGACY_PTY_COUNT | |||
495 | When not in use, each legacy PTY occupies 12 bytes on 32-bit | 495 | When not in use, each legacy PTY occupies 12 bytes on 32-bit |
496 | architectures and 24 bytes on 64-bit architectures. | 496 | architectures and 24 bytes on 64-bit architectures. |
497 | 497 | ||
498 | config BRIQ_PANEL | ||
499 | tristate 'Total Impact briQ front panel driver' | ||
500 | depends on PPC | ||
501 | ---help--- | ||
502 | The briQ is a small footprint CHRP computer with a frontpanel VFD, a | ||
503 | tristate led and two switches. It is the size of a CDROM drive. | ||
504 | |||
505 | If you have such one and want anything showing on the VFD then you | ||
506 | must answer Y here. | ||
507 | |||
508 | To compile this driver as a module, choose M here: the | ||
509 | module will be called briq_panel. | ||
510 | |||
511 | It's safe to say N here. | ||
512 | |||
498 | config PRINTER | 513 | config PRINTER |
499 | tristate "Parallel printer support" | 514 | tristate "Parallel printer support" |
500 | depends on PARPORT | 515 | depends on PARPORT |
@@ -596,6 +611,13 @@ config HVC_CONSOLE | |||
596 | console. This driver allows each pSeries partition to have a console | 611 | console. This driver allows each pSeries partition to have a console |
597 | which is accessed via the HMC. | 612 | which is accessed via the HMC. |
598 | 613 | ||
614 | config HVC_ISERIES | ||
615 | bool "iSeries Hypervisor Virtual Console support" | ||
616 | depends on PPC_ISERIES && !VIOCONS | ||
617 | select HVC_DRIVER | ||
618 | help | ||
619 | iSeries machines support a hypervisor virtual console. | ||
620 | |||
599 | config HVC_RTAS | 621 | config HVC_RTAS |
600 | bool "IBM RTAS Console support" | 622 | bool "IBM RTAS Console support" |
601 | depends on PPC_RTAS | 623 | depends on PPC_RTAS |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 6e0f4469d8bb..8c6dfc621520 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -42,6 +42,7 @@ obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o | |||
42 | obj-$(CONFIG_SX) += sx.o generic_serial.o | 42 | obj-$(CONFIG_SX) += sx.o generic_serial.o |
43 | obj-$(CONFIG_RIO) += rio/ generic_serial.o | 43 | obj-$(CONFIG_RIO) += rio/ generic_serial.o |
44 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o | 44 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o |
45 | obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o | ||
45 | obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o | 46 | obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o |
46 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o | 47 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o |
47 | obj-$(CONFIG_RAW_DRIVER) += raw.o | 48 | obj-$(CONFIG_RAW_DRIVER) += raw.o |
@@ -51,6 +52,7 @@ obj-$(CONFIG_VIOCONS) += viocons.o | |||
51 | obj-$(CONFIG_VIOTAPE) += viotape.o | 52 | obj-$(CONFIG_VIOTAPE) += viotape.o |
52 | obj-$(CONFIG_HVCS) += hvcs.o | 53 | obj-$(CONFIG_HVCS) += hvcs.o |
53 | obj-$(CONFIG_SGI_MBCS) += mbcs.o | 54 | obj-$(CONFIG_SGI_MBCS) += mbcs.o |
55 | obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o | ||
54 | 56 | ||
55 | obj-$(CONFIG_PRINTER) += lp.o | 57 | obj-$(CONFIG_PRINTER) += lp.o |
56 | obj-$(CONFIG_TIPAR) += tipar.o | 58 | obj-$(CONFIG_TIPAR) += tipar.o |
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c index 1de1b12043bf..91b71e750ee1 100644 --- a/drivers/char/agp/uninorth-agp.c +++ b/drivers/char/agp/uninorth-agp.c | |||
@@ -601,8 +601,8 @@ static int __devinit agp_uninorth_probe(struct pci_dev *pdev, | |||
601 | uninorth_node = of_find_node_by_name(NULL, "u3"); | 601 | uninorth_node = of_find_node_by_name(NULL, "u3"); |
602 | } | 602 | } |
603 | if (uninorth_node) { | 603 | if (uninorth_node) { |
604 | int *revprop = (int *) | 604 | const int *revprop = get_property(uninorth_node, |
605 | get_property(uninorth_node, "device-rev", NULL); | 605 | "device-rev", NULL); |
606 | if (revprop != NULL) | 606 | if (revprop != NULL) |
607 | uninorth_rev = *revprop & 0x3f; | 607 | uninorth_rev = *revprop & 0x3f; |
608 | of_node_put(uninorth_node); | 608 | of_node_put(uninorth_node); |
diff --git a/drivers/char/briq_panel.c b/drivers/char/briq_panel.c new file mode 100644 index 000000000000..a0e5eac5f33a --- /dev/null +++ b/drivers/char/briq_panel.c | |||
@@ -0,0 +1,268 @@ | |||
1 | /* | ||
2 | * Drivers for the Total Impact PPC based computer "BRIQ" | ||
3 | * by Dr. Karsten Jeppesen | ||
4 | * | ||
5 | */ | ||
6 | |||
7 | #include <linux/module.h> | ||
8 | |||
9 | #include <linux/types.h> | ||
10 | #include <linux/errno.h> | ||
11 | #include <linux/sched.h> | ||
12 | #include <linux/tty.h> | ||
13 | #include <linux/timer.h> | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/wait.h> | ||
17 | #include <linux/string.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/ioport.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/miscdevice.h> | ||
22 | #include <linux/fs.h> | ||
23 | #include <linux/mm.h> | ||
24 | #include <linux/init.h> | ||
25 | |||
26 | #include <asm/uaccess.h> | ||
27 | #include <asm/io.h> | ||
28 | #include <asm/prom.h> | ||
29 | |||
30 | #define BRIQ_PANEL_MINOR 156 | ||
31 | #define BRIQ_PANEL_VFD_IOPORT 0x0390 | ||
32 | #define BRIQ_PANEL_LED_IOPORT 0x0398 | ||
33 | #define BRIQ_PANEL_VER "1.1 (04/20/2002)" | ||
34 | #define BRIQ_PANEL_MSG0 "Loading Linux" | ||
35 | |||
36 | static int vfd_is_open; | ||
37 | static unsigned char vfd[40]; | ||
38 | static int vfd_cursor; | ||
39 | static unsigned char ledpb, led; | ||
40 | |||
41 | static void update_vfd(void) | ||
42 | { | ||
43 | int i; | ||
44 | |||
45 | /* cursor home */ | ||
46 | outb(0x02, BRIQ_PANEL_VFD_IOPORT); | ||
47 | for (i=0; i<20; i++) | ||
48 | outb(vfd[i], BRIQ_PANEL_VFD_IOPORT + 1); | ||
49 | |||
50 | /* cursor to next line */ | ||
51 | outb(0xc0, BRIQ_PANEL_VFD_IOPORT); | ||
52 | for (i=20; i<40; i++) | ||
53 | outb(vfd[i], BRIQ_PANEL_VFD_IOPORT + 1); | ||
54 | |||
55 | } | ||
56 | |||
57 | static void set_led(char state) | ||
58 | { | ||
59 | if (state == 'R') | ||
60 | led = 0x01; | ||
61 | else if (state == 'G') | ||
62 | led = 0x02; | ||
63 | else if (state == 'Y') | ||
64 | led = 0x03; | ||
65 | else if (state == 'X') | ||
66 | led = 0x00; | ||
67 | outb(led, BRIQ_PANEL_LED_IOPORT); | ||
68 | } | ||
69 | |||
70 | static int briq_panel_open(struct inode *ino, struct file *filep) | ||
71 | { | ||
72 | /* enforce single access */ | ||
73 | if (vfd_is_open) | ||
74 | return -EBUSY; | ||
75 | vfd_is_open = 1; | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static int briq_panel_release(struct inode *ino, struct file *filep) | ||
81 | { | ||
82 | if (!vfd_is_open) | ||
83 | return -ENODEV; | ||
84 | |||
85 | vfd_is_open = 0; | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static ssize_t briq_panel_read(struct file *file, char *buf, size_t count, | ||
91 | loff_t *ppos) | ||
92 | { | ||
93 | unsigned short c; | ||
94 | unsigned char cp; | ||
95 | |||
96 | #if 0 /* Can't seek (pread) on this device */ | ||
97 | if (ppos != &file->f_pos) | ||
98 | return -ESPIPE; | ||
99 | #endif | ||
100 | |||
101 | if (!vfd_is_open) | ||
102 | return -ENODEV; | ||
103 | |||
104 | c = (inb(BRIQ_PANEL_LED_IOPORT) & 0x000c) | (ledpb & 0x0003); | ||
105 | set_led(' '); | ||
106 | /* upper button released */ | ||
107 | if ((!(ledpb & 0x0004)) && (c & 0x0004)) { | ||
108 | cp = ' '; | ||
109 | ledpb = c; | ||
110 | if (copy_to_user(buf, &cp, 1)) | ||
111 | return -EFAULT; | ||
112 | return 1; | ||
113 | } | ||
114 | /* lower button released */ | ||
115 | else if ((!(ledpb & 0x0008)) && (c & 0x0008)) { | ||
116 | cp = '\r'; | ||
117 | ledpb = c; | ||
118 | if (copy_to_user(buf, &cp, 1)) | ||
119 | return -EFAULT; | ||
120 | return 1; | ||
121 | } else { | ||
122 | ledpb = c; | ||
123 | return 0; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | static void scroll_vfd( void ) | ||
128 | { | ||
129 | int i; | ||
130 | |||
131 | for (i=0; i<20; i++) { | ||
132 | vfd[i] = vfd[i+20]; | ||
133 | vfd[i+20] = ' '; | ||
134 | } | ||
135 | vfd_cursor = 20; | ||
136 | } | ||
137 | |||
138 | static ssize_t briq_panel_write(struct file *file, const char *buf, size_t len, | ||
139 | loff_t *ppos) | ||
140 | { | ||
141 | size_t indx = len; | ||
142 | int i, esc = 0; | ||
143 | |||
144 | #if 0 /* Can't seek (pwrite) on this device */ | ||
145 | if (ppos != &file->f_pos) | ||
146 | return -ESPIPE; | ||
147 | #endif | ||
148 | |||
149 | if (!vfd_is_open) | ||
150 | return -EBUSY; | ||
151 | |||
152 | for (;;) { | ||
153 | if (!indx) | ||
154 | break; | ||
155 | if (esc) { | ||
156 | set_led(*buf); | ||
157 | esc = 0; | ||
158 | } else if (*buf == 27) { | ||
159 | esc = 1; | ||
160 | } else if (*buf == 12) { | ||
161 | /* do a form feed */ | ||
162 | for (i=0; i<40; i++) | ||
163 | vfd[i] = ' '; | ||
164 | vfd_cursor = 0; | ||
165 | } else if (*buf == 10) { | ||
166 | if (vfd_cursor < 20) | ||
167 | vfd_cursor = 20; | ||
168 | else if (vfd_cursor < 40) | ||
169 | vfd_cursor = 40; | ||
170 | else if (vfd_cursor < 60) | ||
171 | vfd_cursor = 60; | ||
172 | if (vfd_cursor > 59) | ||
173 | scroll_vfd(); | ||
174 | } else { | ||
175 | /* just a character */ | ||
176 | if (vfd_cursor > 39) | ||
177 | scroll_vfd(); | ||
178 | vfd[vfd_cursor++] = *buf; | ||
179 | } | ||
180 | indx--; | ||
181 | buf++; | ||
182 | } | ||
183 | update_vfd(); | ||
184 | |||
185 | return len; | ||
186 | } | ||
187 | |||
188 | static struct file_operations briq_panel_fops = { | ||
189 | .owner = THIS_MODULE, | ||
190 | .read = briq_panel_read, | ||
191 | .write = briq_panel_write, | ||
192 | .open = briq_panel_open, | ||
193 | .release = briq_panel_release, | ||
194 | }; | ||
195 | |||
196 | static struct miscdevice briq_panel_miscdev = { | ||
197 | BRIQ_PANEL_MINOR, | ||
198 | "briq_panel", | ||
199 | &briq_panel_fops | ||
200 | }; | ||
201 | |||
202 | static int __init briq_panel_init(void) | ||
203 | { | ||
204 | struct device_node *root = find_path_device("/"); | ||
205 | char *machine; | ||
206 | int i; | ||
207 | |||
208 | machine = get_property(root, "model", NULL); | ||
209 | if (!machine || strncmp(machine, "TotalImpact,BRIQ-1", 18) != 0) | ||
210 | return -ENODEV; | ||
211 | |||
212 | printk(KERN_INFO | ||
213 | "briq_panel: v%s Dr. Karsten Jeppesen (kj@totalimpact.com)\n", | ||
214 | BRIQ_PANEL_VER); | ||
215 | |||
216 | if (!request_region(BRIQ_PANEL_VFD_IOPORT, 4, "BRIQ Front Panel")) | ||
217 | return -EBUSY; | ||
218 | |||
219 | if (!request_region(BRIQ_PANEL_LED_IOPORT, 2, "BRIQ Front Panel")) { | ||
220 | release_region(BRIQ_PANEL_VFD_IOPORT, 4); | ||
221 | return -EBUSY; | ||
222 | } | ||
223 | ledpb = inb(BRIQ_PANEL_LED_IOPORT) & 0x000c; | ||
224 | |||
225 | if (misc_register(&briq_panel_miscdev) < 0) { | ||
226 | release_region(BRIQ_PANEL_VFD_IOPORT, 4); | ||
227 | release_region(BRIQ_PANEL_LED_IOPORT, 2); | ||
228 | return -EBUSY; | ||
229 | } | ||
230 | |||
231 | outb(0x38, BRIQ_PANEL_VFD_IOPORT); /* Function set */ | ||
232 | outb(0x01, BRIQ_PANEL_VFD_IOPORT); /* Clear display */ | ||
233 | outb(0x0c, BRIQ_PANEL_VFD_IOPORT); /* Display on */ | ||
234 | outb(0x06, BRIQ_PANEL_VFD_IOPORT); /* Entry normal */ | ||
235 | for (i=0; i<40; i++) | ||
236 | vfd[i]=' '; | ||
237 | #ifndef MODULE | ||
238 | vfd[0] = 'L'; | ||
239 | vfd[1] = 'o'; | ||
240 | vfd[2] = 'a'; | ||
241 | vfd[3] = 'd'; | ||
242 | vfd[4] = 'i'; | ||
243 | vfd[5] = 'n'; | ||
244 | vfd[6] = 'g'; | ||
245 | vfd[7] = ' '; | ||
246 | vfd[8] = '.'; | ||
247 | vfd[9] = '.'; | ||
248 | vfd[10] = '.'; | ||
249 | #endif /* !MODULE */ | ||
250 | |||
251 | update_vfd(); | ||
252 | |||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | static void __exit briq_panel_exit(void) | ||
257 | { | ||
258 | misc_deregister(&briq_panel_miscdev); | ||
259 | release_region(BRIQ_PANEL_VFD_IOPORT, 4); | ||
260 | release_region(BRIQ_PANEL_LED_IOPORT, 2); | ||
261 | } | ||
262 | |||
263 | module_init(briq_panel_init); | ||
264 | module_exit(briq_panel_exit); | ||
265 | |||
266 | MODULE_LICENSE("GPL"); | ||
267 | MODULE_AUTHOR("Karsten Jeppesen <karsten@jeppesens.com>"); | ||
268 | MODULE_DESCRIPTION("Driver for the Total Impact briQ front panel"); | ||
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index ca2f538e549e..dbee8bed0530 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -80,7 +80,8 @@ struct hvc_struct { | |||
80 | struct tty_struct *tty; | 80 | struct tty_struct *tty; |
81 | unsigned int count; | 81 | unsigned int count; |
82 | int do_wakeup; | 82 | int do_wakeup; |
83 | char outbuf[N_OUTBUF] __ALIGNED__; | 83 | char *outbuf; |
84 | int outbuf_size; | ||
84 | int n_outbuf; | 85 | int n_outbuf; |
85 | uint32_t vtermno; | 86 | uint32_t vtermno; |
86 | struct hv_ops *ops; | 87 | struct hv_ops *ops; |
@@ -505,7 +506,7 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count | |||
505 | if (hp->n_outbuf > 0) | 506 | if (hp->n_outbuf > 0) |
506 | hvc_push(hp); | 507 | hvc_push(hp); |
507 | 508 | ||
508 | while (count > 0 && (rsize = N_OUTBUF - hp->n_outbuf) > 0) { | 509 | while (count > 0 && (rsize = hp->outbuf_size - hp->n_outbuf) > 0) { |
509 | if (rsize > count) | 510 | if (rsize > count) |
510 | rsize = count; | 511 | rsize = count; |
511 | memcpy(hp->outbuf + hp->n_outbuf, buf, rsize); | 512 | memcpy(hp->outbuf + hp->n_outbuf, buf, rsize); |
@@ -538,7 +539,7 @@ static int hvc_write_room(struct tty_struct *tty) | |||
538 | if (!hp) | 539 | if (!hp) |
539 | return -1; | 540 | return -1; |
540 | 541 | ||
541 | return N_OUTBUF - hp->n_outbuf; | 542 | return hp->outbuf_size - hp->n_outbuf; |
542 | } | 543 | } |
543 | 544 | ||
544 | static int hvc_chars_in_buffer(struct tty_struct *tty) | 545 | static int hvc_chars_in_buffer(struct tty_struct *tty) |
@@ -728,12 +729,13 @@ static struct kobj_type hvc_kobj_type = { | |||
728 | }; | 729 | }; |
729 | 730 | ||
730 | struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, | 731 | struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, |
731 | struct hv_ops *ops) | 732 | struct hv_ops *ops, int outbuf_size) |
732 | { | 733 | { |
733 | struct hvc_struct *hp; | 734 | struct hvc_struct *hp; |
734 | int i; | 735 | int i; |
735 | 736 | ||
736 | hp = kmalloc(sizeof(*hp), GFP_KERNEL); | 737 | hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, |
738 | GFP_KERNEL); | ||
737 | if (!hp) | 739 | if (!hp) |
738 | return ERR_PTR(-ENOMEM); | 740 | return ERR_PTR(-ENOMEM); |
739 | 741 | ||
@@ -742,6 +744,8 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, | |||
742 | hp->vtermno = vtermno; | 744 | hp->vtermno = vtermno; |
743 | hp->irq = irq; | 745 | hp->irq = irq; |
744 | hp->ops = ops; | 746 | hp->ops = ops; |
747 | hp->outbuf_size = outbuf_size; | ||
748 | hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))]; | ||
745 | 749 | ||
746 | kobject_init(&hp->kobj); | 750 | kobject_init(&hp->kobj); |
747 | hp->kobj.ktype = &hvc_kobj_type; | 751 | hp->kobj.ktype = &hvc_kobj_type; |
diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h index 96b7401319c1..8c59818050e6 100644 --- a/drivers/char/hvc_console.h +++ b/drivers/char/hvc_console.h | |||
@@ -56,7 +56,7 @@ extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops); | |||
56 | 56 | ||
57 | /* register a vterm for hvc tty operation (module_init or hotplug add) */ | 57 | /* register a vterm for hvc tty operation (module_init or hotplug add) */ |
58 | extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq, | 58 | extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq, |
59 | struct hv_ops *ops); | 59 | struct hv_ops *ops, int outbuf_size); |
60 | /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ | 60 | /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ |
61 | extern int __devexit hvc_remove(struct hvc_struct *hp); | 61 | extern int __devexit hvc_remove(struct hvc_struct *hp); |
62 | 62 | ||
diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c new file mode 100644 index 000000000000..4747729459c7 --- /dev/null +++ b/drivers/char/hvc_iseries.c | |||
@@ -0,0 +1,594 @@ | |||
1 | /* | ||
2 | * iSeries vio driver interface to hvc_console.c | ||
3 | * | ||
4 | * This code is based heavily on hvc_vio.c and viocons.c | ||
5 | * | ||
6 | * Copyright (C) 2006 Stephen Rothwell, IBM Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | #include <stdarg.h> | ||
23 | #include <linux/types.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/spinlock.h> | ||
27 | #include <linux/console.h> | ||
28 | |||
29 | #include <asm/hvconsole.h> | ||
30 | #include <asm/vio.h> | ||
31 | #include <asm/prom.h> | ||
32 | #include <asm/iseries/vio.h> | ||
33 | #include <asm/iseries/hv_call.h> | ||
34 | #include <asm/iseries/hv_lp_config.h> | ||
35 | #include <asm/iseries/hv_lp_event.h> | ||
36 | |||
37 | #include "hvc_console.h" | ||
38 | |||
39 | #define VTTY_PORTS 10 | ||
40 | |||
41 | static DEFINE_SPINLOCK(consolelock); | ||
42 | static DEFINE_SPINLOCK(consoleloglock); | ||
43 | |||
44 | static const char hvc_driver_name[] = "hvc_console"; | ||
45 | |||
46 | #define IN_BUF_SIZE 200 | ||
47 | |||
48 | /* | ||
49 | * Our port information. | ||
50 | */ | ||
51 | static struct port_info { | ||
52 | HvLpIndex lp; | ||
53 | u64 seq; /* sequence number of last HV send */ | ||
54 | u64 ack; /* last ack from HV */ | ||
55 | struct hvc_struct *hp; | ||
56 | int in_start; | ||
57 | int in_end; | ||
58 | unsigned char in_buf[IN_BUF_SIZE]; | ||
59 | } port_info[VTTY_PORTS] = { | ||
60 | [ 0 ... VTTY_PORTS - 1 ] = { | ||
61 | .lp = HvLpIndexInvalid | ||
62 | } | ||
63 | }; | ||
64 | |||
65 | #define viochar_is_console(pi) ((pi) == &port_info[0]) | ||
66 | |||
67 | static struct vio_device_id hvc_driver_table[] __devinitdata = { | ||
68 | {"serial", "IBM,iSeries-vty"}, | ||
69 | { "", "" } | ||
70 | }; | ||
71 | MODULE_DEVICE_TABLE(vio, hvc_driver_table); | ||
72 | |||
73 | static void hvlog(char *fmt, ...) | ||
74 | { | ||
75 | int i; | ||
76 | unsigned long flags; | ||
77 | va_list args; | ||
78 | static char buf[256]; | ||
79 | |||
80 | spin_lock_irqsave(&consoleloglock, flags); | ||
81 | va_start(args, fmt); | ||
82 | i = vscnprintf(buf, sizeof(buf) - 1, fmt, args); | ||
83 | va_end(args); | ||
84 | buf[i++] = '\r'; | ||
85 | HvCall_writeLogBuffer(buf, i); | ||
86 | spin_unlock_irqrestore(&consoleloglock, flags); | ||
87 | } | ||
88 | |||
89 | /* | ||
90 | * Initialize the common fields in a charLpEvent | ||
91 | */ | ||
92 | static void init_data_event(struct viocharlpevent *viochar, HvLpIndex lp) | ||
93 | { | ||
94 | struct HvLpEvent *hev = &viochar->event; | ||
95 | |||
96 | memset(viochar, 0, sizeof(struct viocharlpevent)); | ||
97 | |||
98 | hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DEFERRED_ACK | | ||
99 | HV_LP_EVENT_INT; | ||
100 | hev->xType = HvLpEvent_Type_VirtualIo; | ||
101 | hev->xSubtype = viomajorsubtype_chario | viochardata; | ||
102 | hev->xSourceLp = HvLpConfig_getLpIndex(); | ||
103 | hev->xTargetLp = lp; | ||
104 | hev->xSizeMinus1 = sizeof(struct viocharlpevent); | ||
105 | hev->xSourceInstanceId = viopath_sourceinst(lp); | ||
106 | hev->xTargetInstanceId = viopath_targetinst(lp); | ||
107 | } | ||
108 | |||
109 | static int get_chars(uint32_t vtermno, char *buf, int count) | ||
110 | { | ||
111 | struct port_info *pi; | ||
112 | int n = 0; | ||
113 | unsigned long flags; | ||
114 | |||
115 | if (vtermno >= VTTY_PORTS) | ||
116 | return -EINVAL; | ||
117 | if (count == 0) | ||
118 | return 0; | ||
119 | |||
120 | pi = &port_info[vtermno]; | ||
121 | spin_lock_irqsave(&consolelock, flags); | ||
122 | |||
123 | if (pi->in_end == 0) | ||
124 | goto done; | ||
125 | |||
126 | n = pi->in_end - pi->in_start; | ||
127 | if (n > count) | ||
128 | n = count; | ||
129 | memcpy(buf, &pi->in_buf[pi->in_start], n); | ||
130 | pi->in_start += n; | ||
131 | if (pi->in_start == pi->in_end) { | ||
132 | pi->in_start = 0; | ||
133 | pi->in_end = 0; | ||
134 | } | ||
135 | done: | ||
136 | spin_unlock_irqrestore(&consolelock, flags); | ||
137 | return n; | ||
138 | } | ||
139 | |||
140 | static int put_chars(uint32_t vtermno, const char *buf, int count) | ||
141 | { | ||
142 | struct viocharlpevent *viochar; | ||
143 | struct port_info *pi; | ||
144 | HvLpEvent_Rc hvrc; | ||
145 | unsigned long flags; | ||
146 | int sent = 0; | ||
147 | |||
148 | if (vtermno >= VTTY_PORTS) | ||
149 | return -EINVAL; | ||
150 | |||
151 | pi = &port_info[vtermno]; | ||
152 | |||
153 | spin_lock_irqsave(&consolelock, flags); | ||
154 | |||
155 | if (viochar_is_console(pi) && !viopath_isactive(pi->lp)) { | ||
156 | spin_lock_irqsave(&consoleloglock, flags); | ||
157 | HvCall_writeLogBuffer(buf, count); | ||
158 | spin_unlock_irqrestore(&consoleloglock, flags); | ||
159 | sent = count; | ||
160 | goto done; | ||
161 | } | ||
162 | |||
163 | viochar = vio_get_event_buffer(viomajorsubtype_chario); | ||
164 | if (viochar == NULL) { | ||
165 | hvlog("\n\rviocons: Can't get viochar buffer."); | ||
166 | goto done; | ||
167 | } | ||
168 | |||
169 | while ((count > 0) && ((pi->seq - pi->ack) < VIOCHAR_WINDOW)) { | ||
170 | int len; | ||
171 | |||
172 | len = (count > VIOCHAR_MAX_DATA) ? VIOCHAR_MAX_DATA : count; | ||
173 | |||
174 | if (viochar_is_console(pi)) { | ||
175 | spin_lock_irqsave(&consoleloglock, flags); | ||
176 | HvCall_writeLogBuffer(buf, len); | ||
177 | spin_unlock_irqrestore(&consoleloglock, flags); | ||
178 | } | ||
179 | |||
180 | init_data_event(viochar, pi->lp); | ||
181 | |||
182 | viochar->len = len; | ||
183 | viochar->event.xCorrelationToken = pi->seq++; | ||
184 | viochar->event.xSizeMinus1 = | ||
185 | offsetof(struct viocharlpevent, data) + len; | ||
186 | |||
187 | memcpy(viochar->data, buf, len); | ||
188 | |||
189 | hvrc = HvCallEvent_signalLpEvent(&viochar->event); | ||
190 | if (hvrc) | ||
191 | hvlog("\n\rerror sending event! return code %d\n\r", | ||
192 | (int)hvrc); | ||
193 | sent += len; | ||
194 | count -= len; | ||
195 | buf += len; | ||
196 | } | ||
197 | |||
198 | vio_free_event_buffer(viomajorsubtype_chario, viochar); | ||
199 | done: | ||
200 | spin_unlock_irqrestore(&consolelock, flags); | ||
201 | return sent; | ||
202 | } | ||
203 | |||
204 | static struct hv_ops hvc_get_put_ops = { | ||
205 | .get_chars = get_chars, | ||
206 | .put_chars = put_chars, | ||
207 | }; | ||
208 | |||
209 | static int __devinit hvc_vio_probe(struct vio_dev *vdev, | ||
210 | const struct vio_device_id *id) | ||
211 | { | ||
212 | struct hvc_struct *hp; | ||
213 | struct port_info *pi; | ||
214 | |||
215 | /* probed with invalid parameters. */ | ||
216 | if (!vdev || !id) | ||
217 | return -EPERM; | ||
218 | |||
219 | if (vdev->unit_address >= VTTY_PORTS) | ||
220 | return -ENODEV; | ||
221 | |||
222 | pi = &port_info[vdev->unit_address]; | ||
223 | |||
224 | hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops, | ||
225 | VIOCHAR_MAX_DATA); | ||
226 | if (IS_ERR(hp)) | ||
227 | return PTR_ERR(hp); | ||
228 | pi->hp = hp; | ||
229 | dev_set_drvdata(&vdev->dev, pi); | ||
230 | |||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static int __devexit hvc_vio_remove(struct vio_dev *vdev) | ||
235 | { | ||
236 | struct port_info *pi = dev_get_drvdata(&vdev->dev); | ||
237 | struct hvc_struct *hp = pi->hp; | ||
238 | |||
239 | return hvc_remove(hp); | ||
240 | } | ||
241 | |||
242 | static struct vio_driver hvc_vio_driver = { | ||
243 | .id_table = hvc_driver_table, | ||
244 | .probe = hvc_vio_probe, | ||
245 | .remove = hvc_vio_remove, | ||
246 | .driver = { | ||
247 | .name = hvc_driver_name, | ||
248 | .owner = THIS_MODULE, | ||
249 | } | ||
250 | }; | ||
251 | |||
252 | static void hvc_open_event(struct HvLpEvent *event) | ||
253 | { | ||
254 | unsigned long flags; | ||
255 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | ||
256 | u8 port = cevent->virtual_device; | ||
257 | struct port_info *pi; | ||
258 | int reject = 0; | ||
259 | |||
260 | if (hvlpevent_is_ack(event)) { | ||
261 | if (port >= VTTY_PORTS) | ||
262 | return; | ||
263 | |||
264 | spin_lock_irqsave(&consolelock, flags); | ||
265 | |||
266 | pi = &port_info[port]; | ||
267 | if (event->xRc == HvLpEvent_Rc_Good) { | ||
268 | pi->seq = pi->ack = 0; | ||
269 | /* | ||
270 | * This line allows connections from the primary | ||
271 | * partition but once one is connected from the | ||
272 | * primary partition nothing short of a reboot | ||
273 | * of linux will allow access from the hosting | ||
274 | * partition again without a required iSeries fix. | ||
275 | */ | ||
276 | pi->lp = event->xTargetLp; | ||
277 | } | ||
278 | |||
279 | spin_unlock_irqrestore(&consolelock, flags); | ||
280 | if (event->xRc != HvLpEvent_Rc_Good) | ||
281 | printk(KERN_WARNING | ||
282 | "hvc: handle_open_event: event->xRc == (%d).\n", | ||
283 | event->xRc); | ||
284 | |||
285 | if (event->xCorrelationToken != 0) { | ||
286 | atomic_t *aptr= (atomic_t *)event->xCorrelationToken; | ||
287 | atomic_set(aptr, 1); | ||
288 | } else | ||
289 | printk(KERN_WARNING | ||
290 | "hvc: weird...got open ack without atomic\n"); | ||
291 | return; | ||
292 | } | ||
293 | |||
294 | /* This had better require an ack, otherwise complain */ | ||
295 | if (!hvlpevent_need_ack(event)) { | ||
296 | printk(KERN_WARNING "hvc: viocharopen without ack bit!\n"); | ||
297 | return; | ||
298 | } | ||
299 | |||
300 | spin_lock_irqsave(&consolelock, flags); | ||
301 | |||
302 | /* Make sure this is a good virtual tty */ | ||
303 | if (port >= VTTY_PORTS) { | ||
304 | event->xRc = HvLpEvent_Rc_SubtypeError; | ||
305 | cevent->subtype_result_code = viorc_openRejected; | ||
306 | /* | ||
307 | * Flag state here since we can't printk while holding | ||
308 | * the consolelock spinlock. | ||
309 | */ | ||
310 | reject = 1; | ||
311 | } else { | ||
312 | pi = &port_info[port]; | ||
313 | if ((pi->lp != HvLpIndexInvalid) && | ||
314 | (pi->lp != event->xSourceLp)) { | ||
315 | /* | ||
316 | * If this is tty is already connected to a different | ||
317 | * partition, fail. | ||
318 | */ | ||
319 | event->xRc = HvLpEvent_Rc_SubtypeError; | ||
320 | cevent->subtype_result_code = viorc_openRejected; | ||
321 | reject = 2; | ||
322 | } else { | ||
323 | pi->lp = event->xSourceLp; | ||
324 | event->xRc = HvLpEvent_Rc_Good; | ||
325 | cevent->subtype_result_code = viorc_good; | ||
326 | pi->seq = pi->ack = 0; | ||
327 | } | ||
328 | } | ||
329 | |||
330 | spin_unlock_irqrestore(&consolelock, flags); | ||
331 | |||
332 | if (reject == 1) | ||
333 | printk(KERN_WARNING "hvc: open rejected: bad virtual tty.\n"); | ||
334 | else if (reject == 2) | ||
335 | printk(KERN_WARNING "hvc: open rejected: console in exclusive " | ||
336 | "use by another partition.\n"); | ||
337 | |||
338 | /* Return the acknowledgement */ | ||
339 | HvCallEvent_ackLpEvent(event); | ||
340 | } | ||
341 | |||
342 | /* | ||
343 | * Handle a close charLpEvent. This should ONLY be an Interrupt because the | ||
344 | * virtual console should never actually issue a close event to the hypervisor | ||
345 | * because the virtual console never goes away. A close event coming from the | ||
346 | * hypervisor simply means that there are no client consoles connected to the | ||
347 | * virtual console. | ||
348 | */ | ||
349 | static void hvc_close_event(struct HvLpEvent *event) | ||
350 | { | ||
351 | unsigned long flags; | ||
352 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | ||
353 | u8 port = cevent->virtual_device; | ||
354 | |||
355 | if (!hvlpevent_is_int(event)) { | ||
356 | printk(KERN_WARNING | ||
357 | "hvc: got unexpected close acknowlegement\n"); | ||
358 | return; | ||
359 | } | ||
360 | |||
361 | if (port >= VTTY_PORTS) { | ||
362 | printk(KERN_WARNING | ||
363 | "hvc: close message from invalid virtual device.\n"); | ||
364 | return; | ||
365 | } | ||
366 | |||
367 | /* For closes, just mark the console partition invalid */ | ||
368 | spin_lock_irqsave(&consolelock, flags); | ||
369 | |||
370 | if (port_info[port].lp == event->xSourceLp) | ||
371 | port_info[port].lp = HvLpIndexInvalid; | ||
372 | |||
373 | spin_unlock_irqrestore(&consolelock, flags); | ||
374 | } | ||
375 | |||
376 | static void hvc_data_event(struct HvLpEvent *event) | ||
377 | { | ||
378 | unsigned long flags; | ||
379 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | ||
380 | struct port_info *pi; | ||
381 | int n; | ||
382 | u8 port = cevent->virtual_device; | ||
383 | |||
384 | if (port >= VTTY_PORTS) { | ||
385 | printk(KERN_WARNING "hvc: data on invalid virtual device %d\n", | ||
386 | port); | ||
387 | return; | ||
388 | } | ||
389 | if (cevent->len == 0) | ||
390 | return; | ||
391 | |||
392 | /* | ||
393 | * Change 05/01/2003 - Ryan Arnold: If a partition other than | ||
394 | * the current exclusive partition tries to send us data | ||
395 | * events then just drop them on the floor because we don't | ||
396 | * want his stinking data. He isn't authorized to receive | ||
397 | * data because he wasn't the first one to get the console, | ||
398 | * therefore he shouldn't be allowed to send data either. | ||
399 | * This will work without an iSeries fix. | ||
400 | */ | ||
401 | pi = &port_info[port]; | ||
402 | if (pi->lp != event->xSourceLp) | ||
403 | return; | ||
404 | |||
405 | spin_lock_irqsave(&consolelock, flags); | ||
406 | |||
407 | n = IN_BUF_SIZE - pi->in_end; | ||
408 | if (n > cevent->len) | ||
409 | n = cevent->len; | ||
410 | if (n > 0) { | ||
411 | memcpy(&pi->in_buf[pi->in_end], cevent->data, n); | ||
412 | pi->in_end += n; | ||
413 | } | ||
414 | spin_unlock_irqrestore(&consolelock, flags); | ||
415 | if (n == 0) | ||
416 | printk(KERN_WARNING "hvc: input buffer overflow\n"); | ||
417 | } | ||
418 | |||
419 | static void hvc_ack_event(struct HvLpEvent *event) | ||
420 | { | ||
421 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | ||
422 | unsigned long flags; | ||
423 | u8 port = cevent->virtual_device; | ||
424 | |||
425 | if (port >= VTTY_PORTS) { | ||
426 | printk(KERN_WARNING "hvc: data on invalid virtual device\n"); | ||
427 | return; | ||
428 | } | ||
429 | |||
430 | spin_lock_irqsave(&consolelock, flags); | ||
431 | port_info[port].ack = event->xCorrelationToken; | ||
432 | spin_unlock_irqrestore(&consolelock, flags); | ||
433 | } | ||
434 | |||
435 | static void hvc_config_event(struct HvLpEvent *event) | ||
436 | { | ||
437 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | ||
438 | |||
439 | if (cevent->data[0] == 0x01) | ||
440 | printk(KERN_INFO "hvc: window resized to %d: %d: %d: %d\n", | ||
441 | cevent->data[1], cevent->data[2], | ||
442 | cevent->data[3], cevent->data[4]); | ||
443 | else | ||
444 | printk(KERN_WARNING "hvc: unknown config event\n"); | ||
445 | } | ||
446 | |||
447 | static void hvc_handle_event(struct HvLpEvent *event) | ||
448 | { | ||
449 | int charminor; | ||
450 | |||
451 | if (event == NULL) | ||
452 | return; | ||
453 | |||
454 | charminor = event->xSubtype & VIOMINOR_SUBTYPE_MASK; | ||
455 | switch (charminor) { | ||
456 | case viocharopen: | ||
457 | hvc_open_event(event); | ||
458 | break; | ||
459 | case viocharclose: | ||
460 | hvc_close_event(event); | ||
461 | break; | ||
462 | case viochardata: | ||
463 | hvc_data_event(event); | ||
464 | break; | ||
465 | case viocharack: | ||
466 | hvc_ack_event(event); | ||
467 | break; | ||
468 | case viocharconfig: | ||
469 | hvc_config_event(event); | ||
470 | break; | ||
471 | default: | ||
472 | if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) { | ||
473 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | ||
474 | HvCallEvent_ackLpEvent(event); | ||
475 | } | ||
476 | } | ||
477 | } | ||
478 | |||
479 | static int send_open(HvLpIndex remoteLp, void *sem) | ||
480 | { | ||
481 | return HvCallEvent_signalLpEventFast(remoteLp, | ||
482 | HvLpEvent_Type_VirtualIo, | ||
483 | viomajorsubtype_chario | viocharopen, | ||
484 | HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck, | ||
485 | viopath_sourceinst(remoteLp), | ||
486 | viopath_targetinst(remoteLp), | ||
487 | (u64)(unsigned long)sem, VIOVERSION << 16, | ||
488 | 0, 0, 0, 0); | ||
489 | } | ||
490 | |||
491 | static int hvc_vio_init(void) | ||
492 | { | ||
493 | atomic_t wait_flag; | ||
494 | int rc; | ||
495 | |||
496 | /* +2 for fudge */ | ||
497 | rc = viopath_open(HvLpConfig_getPrimaryLpIndex(), | ||
498 | viomajorsubtype_chario, VIOCHAR_WINDOW + 2); | ||
499 | if (rc) | ||
500 | printk(KERN_WARNING "hvc: error opening to primary %d\n", rc); | ||
501 | |||
502 | if (viopath_hostLp == HvLpIndexInvalid) | ||
503 | vio_set_hostlp(); | ||
504 | |||
505 | /* | ||
506 | * And if the primary is not the same as the hosting LP, open to the | ||
507 | * hosting lp | ||
508 | */ | ||
509 | if ((viopath_hostLp != HvLpIndexInvalid) && | ||
510 | (viopath_hostLp != HvLpConfig_getPrimaryLpIndex())) { | ||
511 | printk(KERN_INFO "hvc: open path to hosting (%d)\n", | ||
512 | viopath_hostLp); | ||
513 | rc = viopath_open(viopath_hostLp, viomajorsubtype_chario, | ||
514 | VIOCHAR_WINDOW + 2); /* +2 for fudge */ | ||
515 | if (rc) | ||
516 | printk(KERN_WARNING | ||
517 | "error opening to partition %d: %d\n", | ||
518 | viopath_hostLp, rc); | ||
519 | } | ||
520 | |||
521 | if (vio_setHandler(viomajorsubtype_chario, hvc_handle_event) < 0) | ||
522 | printk(KERN_WARNING | ||
523 | "hvc: error seting handler for console events!\n"); | ||
524 | |||
525 | /* | ||
526 | * First, try to open the console to the hosting lp. | ||
527 | * Wait on a semaphore for the response. | ||
528 | */ | ||
529 | atomic_set(&wait_flag, 0); | ||
530 | if ((viopath_isactive(viopath_hostLp)) && | ||
531 | (send_open(viopath_hostLp, &wait_flag) == 0)) { | ||
532 | printk(KERN_INFO "hvc: hosting partition %d\n", viopath_hostLp); | ||
533 | while (atomic_read(&wait_flag) == 0) | ||
534 | mb(); | ||
535 | atomic_set(&wait_flag, 0); | ||
536 | } | ||
537 | |||
538 | /* | ||
539 | * If we don't have an active console, try the primary | ||
540 | */ | ||
541 | if ((!viopath_isactive(port_info[0].lp)) && | ||
542 | (viopath_isactive(HvLpConfig_getPrimaryLpIndex())) && | ||
543 | (send_open(HvLpConfig_getPrimaryLpIndex(), &wait_flag) == 0)) { | ||
544 | printk(KERN_INFO "hvc: opening console to primary partition\n"); | ||
545 | while (atomic_read(&wait_flag) == 0) | ||
546 | mb(); | ||
547 | } | ||
548 | |||
549 | /* Register as a vio device to receive callbacks */ | ||
550 | rc = vio_register_driver(&hvc_vio_driver); | ||
551 | |||
552 | return rc; | ||
553 | } | ||
554 | module_init(hvc_vio_init); /* after drivers/char/hvc_console.c */ | ||
555 | |||
556 | static void hvc_vio_exit(void) | ||
557 | { | ||
558 | vio_unregister_driver(&hvc_vio_driver); | ||
559 | } | ||
560 | module_exit(hvc_vio_exit); | ||
561 | |||
562 | /* the device tree order defines our numbering */ | ||
563 | static int hvc_find_vtys(void) | ||
564 | { | ||
565 | struct device_node *vty; | ||
566 | int num_found = 0; | ||
567 | |||
568 | for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL; | ||
569 | vty = of_find_node_by_name(vty, "vty")) { | ||
570 | uint32_t *vtermno; | ||
571 | |||
572 | /* We have statically defined space for only a certain number | ||
573 | * of console adapters. | ||
574 | */ | ||
575 | if ((num_found >= MAX_NR_HVC_CONSOLES) || | ||
576 | (num_found >= VTTY_PORTS)) | ||
577 | break; | ||
578 | |||
579 | vtermno = (uint32_t *)get_property(vty, "reg", NULL); | ||
580 | if (!vtermno) | ||
581 | continue; | ||
582 | |||
583 | if (!device_is_compatible(vty, "IBM,iSeries-vty")) | ||
584 | continue; | ||
585 | |||
586 | if (num_found == 0) | ||
587 | add_preferred_console("hvc", 0, NULL); | ||
588 | hvc_instantiate(*vtermno, num_found, &hvc_get_put_ops); | ||
589 | ++num_found; | ||
590 | } | ||
591 | |||
592 | return num_found; | ||
593 | } | ||
594 | console_initcall(hvc_find_vtys); | ||
diff --git a/drivers/char/hvc_rtas.c b/drivers/char/hvc_rtas.c index 57106e02fd2e..4b97eaf18602 100644 --- a/drivers/char/hvc_rtas.c +++ b/drivers/char/hvc_rtas.c | |||
@@ -94,7 +94,7 @@ static int hvc_rtas_init(void) | |||
94 | 94 | ||
95 | /* Allocate an hvc_struct for the console device we instantiated | 95 | /* Allocate an hvc_struct for the console device we instantiated |
96 | * earlier. Save off hp so that we can return it on exit */ | 96 | * earlier. Save off hp so that we can return it on exit */ |
97 | hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops); | 97 | hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops, 16); |
98 | if (IS_ERR(hp)) | 98 | if (IS_ERR(hp)) |
99 | return PTR_ERR(hp); | 99 | return PTR_ERR(hp); |
100 | 100 | ||
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c index 9add81ceb440..cc95941148fb 100644 --- a/drivers/char/hvc_vio.c +++ b/drivers/char/hvc_vio.c | |||
@@ -90,7 +90,8 @@ static int __devinit hvc_vio_probe(struct vio_dev *vdev, | |||
90 | if (!vdev || !id) | 90 | if (!vdev || !id) |
91 | return -EPERM; | 91 | return -EPERM; |
92 | 92 | ||
93 | hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops); | 93 | hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops, |
94 | MAX_VIO_PUT_CHARS); | ||
94 | if (IS_ERR(hp)) | 95 | if (IS_ERR(hp)) |
95 | return PTR_ERR(hp); | 96 | return PTR_ERR(hp); |
96 | dev_set_drvdata(&vdev->dev, hp); | 97 | dev_set_drvdata(&vdev->dev, hp); |
@@ -140,7 +141,7 @@ static int hvc_find_vtys(void) | |||
140 | 141 | ||
141 | for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL; | 142 | for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL; |
142 | vty = of_find_node_by_name(vty, "vty")) { | 143 | vty = of_find_node_by_name(vty, "vty")) { |
143 | uint32_t *vtermno; | 144 | const uint32_t *vtermno; |
144 | 145 | ||
145 | /* We have statically defined space for only a certain number | 146 | /* We have statically defined space for only a certain number |
146 | * of console adapters. | 147 | * of console adapters. |
@@ -148,7 +149,7 @@ static int hvc_find_vtys(void) | |||
148 | if (num_found >= MAX_NR_HVC_CONSOLES) | 149 | if (num_found >= MAX_NR_HVC_CONSOLES) |
149 | break; | 150 | break; |
150 | 151 | ||
151 | vtermno = (uint32_t *)get_property(vty, "reg", NULL); | 152 | vtermno = get_property(vty, "reg", NULL); |
152 | if (!vtermno) | 153 | if (!vtermno) |
153 | continue; | 154 | continue; |
154 | 155 | ||
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index 41db8060e8f7..9101784ecf02 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c | |||
@@ -1276,11 +1276,10 @@ static int __init hvsi_console_init(void) | |||
1276 | vty != NULL; | 1276 | vty != NULL; |
1277 | vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) { | 1277 | vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) { |
1278 | struct hvsi_struct *hp; | 1278 | struct hvsi_struct *hp; |
1279 | uint32_t *vtermno; | 1279 | const uint32_t *vtermno, *irq; |
1280 | uint32_t *irq; | ||
1281 | 1280 | ||
1282 | vtermno = (uint32_t *)get_property(vty, "reg", NULL); | 1281 | vtermno = get_property(vty, "reg", NULL); |
1283 | irq = (uint32_t *)get_property(vty, "interrupts", NULL); | 1282 | irq = get_property(vty, "interrupts", NULL); |
1284 | if (!vtermno || !irq) | 1283 | if (!vtermno || !irq) |
1285 | continue; | 1284 | continue; |
1286 | 1285 | ||
diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h index 2e68eeb8a2cd..aefd683c60b7 100644 --- a/drivers/char/tpm/tpm_atmel.h +++ b/drivers/char/tpm/tpm_atmel.h | |||
@@ -37,7 +37,7 @@ static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size) | |||
37 | { | 37 | { |
38 | struct device_node *dn; | 38 | struct device_node *dn; |
39 | unsigned long address, size; | 39 | unsigned long address, size; |
40 | unsigned int *reg; | 40 | const unsigned int *reg; |
41 | int reglen; | 41 | int reglen; |
42 | int naddrc; | 42 | int naddrc; |
43 | int nsizec; | 43 | int nsizec; |
@@ -52,7 +52,7 @@ static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size) | |||
52 | return NULL; | 52 | return NULL; |
53 | } | 53 | } |
54 | 54 | ||
55 | reg = (unsigned int *) get_property(dn, "reg", ®len); | 55 | reg = get_property(dn, "reg", ®len); |
56 | naddrc = prom_n_addr_cells(dn); | 56 | naddrc = prom_n_addr_cells(dn); |
57 | nsizec = prom_n_size_cells(dn); | 57 | nsizec = prom_n_size_cells(dn); |
58 | 58 | ||
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index 766f7864c6c6..f3efeaf2826e 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/sysrq.h> | 43 | #include <linux/sysrq.h> |
44 | 44 | ||
45 | #include <asm/iseries/vio.h> | 45 | #include <asm/iseries/vio.h> |
46 | |||
47 | #include <asm/iseries/hv_lp_event.h> | 46 | #include <asm/iseries/hv_lp_event.h> |
48 | #include <asm/iseries/hv_call_event.h> | 47 | #include <asm/iseries/hv_call_event.h> |
49 | #include <asm/iseries/hv_lp_config.h> | 48 | #include <asm/iseries/hv_lp_config.h> |
@@ -67,35 +66,6 @@ static int vio_sysrq_pressed; | |||
67 | extern int sysrq_enabled; | 66 | extern int sysrq_enabled; |
68 | #endif | 67 | #endif |
69 | 68 | ||
70 | /* | ||
71 | * The structure of the events that flow between us and OS/400. You can't | ||
72 | * mess with this unless the OS/400 side changes too | ||
73 | */ | ||
74 | struct viocharlpevent { | ||
75 | struct HvLpEvent event; | ||
76 | u32 reserved; | ||
77 | u16 version; | ||
78 | u16 subtype_result_code; | ||
79 | u8 virtual_device; | ||
80 | u8 len; | ||
81 | u8 data[VIOCHAR_MAX_DATA]; | ||
82 | }; | ||
83 | |||
84 | #define VIOCHAR_WINDOW 10 | ||
85 | #define VIOCHAR_HIGHWATERMARK 3 | ||
86 | |||
87 | enum viocharsubtype { | ||
88 | viocharopen = 0x0001, | ||
89 | viocharclose = 0x0002, | ||
90 | viochardata = 0x0003, | ||
91 | viocharack = 0x0004, | ||
92 | viocharconfig = 0x0005 | ||
93 | }; | ||
94 | |||
95 | enum viochar_rc { | ||
96 | viochar_rc_ebusy = 1 | ||
97 | }; | ||
98 | |||
99 | #define VIOCHAR_NUM_BUF 16 | 69 | #define VIOCHAR_NUM_BUF 16 |
100 | 70 | ||
101 | /* | 71 | /* |
@@ -1183,6 +1153,7 @@ static int __init viocons_init(void) | |||
1183 | port_info[i].magic = VIOTTY_MAGIC; | 1153 | port_info[i].magic = VIOTTY_MAGIC; |
1184 | } | 1154 | } |
1185 | HvCall_setLogBufferFormatAndCodepage(HvCall_LogBuffer_ASCII, 437); | 1155 | HvCall_setLogBufferFormatAndCodepage(HvCall_LogBuffer_ASCII, 437); |
1156 | add_preferred_console("viocons", 0, NULL); | ||
1186 | register_console(&viocons_early); | 1157 | register_console(&viocons_early); |
1187 | return 0; | 1158 | return 0; |
1188 | } | 1159 | } |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index b72b2049aaae..73c78bf75d7f 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
@@ -940,7 +940,6 @@ static void vioHandleTapeEvent(struct HvLpEvent *event) | |||
940 | 940 | ||
941 | static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) | 941 | static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) |
942 | { | 942 | { |
943 | char tapename[32]; | ||
944 | int i = vdev->unit_address; | 943 | int i = vdev->unit_address; |
945 | int j; | 944 | int j; |
946 | 945 | ||
@@ -956,10 +955,9 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
956 | "iseries!vt%d", i); | 955 | "iseries!vt%d", i); |
957 | class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), | 956 | class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), |
958 | NULL, "iseries!nvt%d", i); | 957 | NULL, "iseries!nvt%d", i); |
959 | sprintf(tapename, "iseries/vt%d", i); | 958 | printk(VIOTAPE_KERN_INFO "tape iseries/vt%d is iSeries " |
960 | printk(VIOTAPE_KERN_INFO "tape %s is iSeries " | ||
961 | "resource %10.10s type %4.4s, model %3.3s\n", | 959 | "resource %10.10s type %4.4s, model %3.3s\n", |
962 | tapename, viotape_unitinfo[i].rsrcname, | 960 | i, viotape_unitinfo[i].rsrcname, |
963 | viotape_unitinfo[i].type, viotape_unitinfo[i].model); | 961 | viotape_unitinfo[i].type, viotape_unitinfo[i].model); |
964 | return 0; | 962 | return 0; |
965 | } | 963 | } |
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 53bb43593863..d658d9107955 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -207,7 +207,8 @@ static int i2c_powermac_probe(struct device *dev) | |||
207 | struct pmac_i2c_bus *bus = dev->platform_data; | 207 | struct pmac_i2c_bus *bus = dev->platform_data; |
208 | struct device_node *parent = NULL; | 208 | struct device_node *parent = NULL; |
209 | struct i2c_adapter *adapter; | 209 | struct i2c_adapter *adapter; |
210 | char name[32], *basename; | 210 | char name[32]; |
211 | const char *basename; | ||
211 | int rc; | 212 | int rc; |
212 | 213 | ||
213 | if (bus == NULL) | 214 | if (bus == NULL) |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index ebf961f1718d..fa46856e8068 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1154,7 +1154,7 @@ static int | |||
1154 | pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | 1154 | pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) |
1155 | { | 1155 | { |
1156 | struct device_node *np = pmif->node; | 1156 | struct device_node *np = pmif->node; |
1157 | int *bidp; | 1157 | const int *bidp; |
1158 | 1158 | ||
1159 | pmif->cable_80 = 0; | 1159 | pmif->cable_80 = 0; |
1160 | pmif->broken_dma = pmif->broken_dma_warn = 0; | 1160 | pmif->broken_dma = pmif->broken_dma_warn = 0; |
@@ -1176,14 +1176,14 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1176 | pmif->broken_dma = 1; | 1176 | pmif->broken_dma = 1; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | bidp = (int *)get_property(np, "AAPL,bus-id", NULL); | 1179 | bidp = get_property(np, "AAPL,bus-id", NULL); |
1180 | pmif->aapl_bus_id = bidp ? *bidp : 0; | 1180 | pmif->aapl_bus_id = bidp ? *bidp : 0; |
1181 | 1181 | ||
1182 | /* Get cable type from device-tree */ | 1182 | /* Get cable type from device-tree */ |
1183 | if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6 | 1183 | if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6 |
1184 | || pmif->kind == controller_k2_ata6 | 1184 | || pmif->kind == controller_k2_ata6 |
1185 | || pmif->kind == controller_sh_ata6) { | 1185 | || pmif->kind == controller_sh_ata6) { |
1186 | char* cable = get_property(np, "cable-type", NULL); | 1186 | const char* cable = get_property(np, "cable-type", NULL); |
1187 | if (cable && !strncmp(cable, "80-", 3)) | 1187 | if (cable && !strncmp(cable, "80-", 3)) |
1188 | pmif->cable_80 = 1; | 1188 | pmif->cable_80 = 1; |
1189 | } | 1189 | } |
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 82657bc86d19..d56216067549 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c | |||
@@ -139,7 +139,9 @@ static int macio_uevent(struct device *dev, char **envp, int num_envp, | |||
139 | { | 139 | { |
140 | struct macio_dev * macio_dev; | 140 | struct macio_dev * macio_dev; |
141 | struct of_device * of; | 141 | struct of_device * of; |
142 | char *scratch, *compat, *compat2; | 142 | char *scratch; |
143 | const char *compat, *compat2; | ||
144 | |||
143 | int i = 0; | 145 | int i = 0; |
144 | int length, cplen, cplen2, seen = 0; | 146 | int length, cplen, cplen2, seen = 0; |
145 | 147 | ||
@@ -173,7 +175,7 @@ static int macio_uevent(struct device *dev, char **envp, int num_envp, | |||
173 | * it's not really legal to split it out with commas. We split it | 175 | * it's not really legal to split it out with commas. We split it |
174 | * up using a number of environment variables instead. */ | 176 | * up using a number of environment variables instead. */ |
175 | 177 | ||
176 | compat = (char *) get_property(of->node, "compatible", &cplen); | 178 | compat = get_property(of->node, "compatible", &cplen); |
177 | compat2 = compat; | 179 | compat2 = compat; |
178 | cplen2= cplen; | 180 | cplen2= cplen; |
179 | while (compat && cplen > 0) { | 181 | while (compat && cplen > 0) { |
@@ -454,7 +456,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, | |||
454 | struct resource *parent_res) | 456 | struct resource *parent_res) |
455 | { | 457 | { |
456 | struct macio_dev *dev; | 458 | struct macio_dev *dev; |
457 | u32 *reg; | 459 | const u32 *reg; |
458 | 460 | ||
459 | if (np == NULL) | 461 | if (np == NULL) |
460 | return NULL; | 462 | return NULL; |
@@ -489,7 +491,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, | |||
489 | #endif | 491 | #endif |
490 | MAX_NODE_NAME_SIZE, np->name); | 492 | MAX_NODE_NAME_SIZE, np->name); |
491 | } else { | 493 | } else { |
492 | reg = (u32 *)get_property(np, "reg", NULL); | 494 | reg = get_property(np, "reg", NULL); |
493 | sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", | 495 | sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", |
494 | chip->lbus.index, | 496 | chip->lbus.index, |
495 | reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); | 497 | reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); |
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index cae24a13526a..8566bdfdd4b8 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c | |||
@@ -16,12 +16,12 @@ static ssize_t | |||
16 | compatible_show (struct device *dev, struct device_attribute *attr, char *buf) | 16 | compatible_show (struct device *dev, struct device_attribute *attr, char *buf) |
17 | { | 17 | { |
18 | struct of_device *of; | 18 | struct of_device *of; |
19 | char *compat; | 19 | const char *compat; |
20 | int cplen; | 20 | int cplen; |
21 | int length = 0; | 21 | int length = 0; |
22 | 22 | ||
23 | of = &to_macio_device (dev)->ofdev; | 23 | of = &to_macio_device (dev)->ofdev; |
24 | compat = (char *) get_property(of->node, "compatible", &cplen); | 24 | compat = get_property(of->node, "compatible", &cplen); |
25 | if (!compat) { | 25 | if (!compat) { |
26 | *buf = '\0'; | 26 | *buf = '\0'; |
27 | return 0; | 27 | return 0; |
@@ -42,12 +42,12 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, | |||
42 | char *buf) | 42 | char *buf) |
43 | { | 43 | { |
44 | struct of_device *of; | 44 | struct of_device *of; |
45 | char *compat; | 45 | const char *compat; |
46 | int cplen; | 46 | int cplen; |
47 | int length; | 47 | int length; |
48 | 48 | ||
49 | of = &to_macio_device (dev)->ofdev; | 49 | of = &to_macio_device (dev)->ofdev; |
50 | compat = (char *) get_property (of->node, "compatible", &cplen); | 50 | compat = get_property(of->node, "compatible", &cplen); |
51 | if (!compat) compat = "", cplen = 1; | 51 | if (!compat) compat = "", cplen = 1; |
52 | length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type); | 52 | length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type); |
53 | buf += length; | 53 | buf += length; |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index 00ef46898147..090e40fc5013 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
@@ -454,7 +454,7 @@ EXPORT_SYMBOL(smu_present); | |||
454 | int __init smu_init (void) | 454 | int __init smu_init (void) |
455 | { | 455 | { |
456 | struct device_node *np; | 456 | struct device_node *np; |
457 | u32 *data; | 457 | const u32 *data; |
458 | 458 | ||
459 | np = of_find_node_by_type(NULL, "smu"); | 459 | np = of_find_node_by_type(NULL, "smu"); |
460 | if (np == NULL) | 460 | if (np == NULL) |
@@ -490,7 +490,7 @@ int __init smu_init (void) | |||
490 | printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n"); | 490 | printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n"); |
491 | goto fail; | 491 | goto fail; |
492 | } | 492 | } |
493 | data = (u32 *)get_property(smu->db_node, "reg", NULL); | 493 | data = get_property(smu->db_node, "reg", NULL); |
494 | if (data == NULL) { | 494 | if (data == NULL) { |
495 | of_node_put(smu->db_node); | 495 | of_node_put(smu->db_node); |
496 | smu->db_node = NULL; | 496 | smu->db_node = NULL; |
@@ -511,7 +511,7 @@ int __init smu_init (void) | |||
511 | smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt"); | 511 | smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt"); |
512 | if (smu->msg_node == NULL) | 512 | if (smu->msg_node == NULL) |
513 | break; | 513 | break; |
514 | data = (u32 *)get_property(smu->msg_node, "reg", NULL); | 514 | data = get_property(smu->msg_node, "reg", NULL); |
515 | if (data == NULL) { | 515 | if (data == NULL) { |
516 | of_node_put(smu->msg_node); | 516 | of_node_put(smu->msg_node); |
517 | smu->msg_node = NULL; | 517 | smu->msg_node = NULL; |
@@ -982,11 +982,11 @@ static struct smu_sdbp_header *smu_create_sdb_partition(int id) | |||
982 | /* Note: Only allowed to return error code in pointers (using ERR_PTR) | 982 | /* Note: Only allowed to return error code in pointers (using ERR_PTR) |
983 | * when interruptible is 1 | 983 | * when interruptible is 1 |
984 | */ | 984 | */ |
985 | struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, | 985 | const struct smu_sdbp_header *__smu_get_sdb_partition(int id, |
986 | int interruptible) | 986 | unsigned int *size, int interruptible) |
987 | { | 987 | { |
988 | char pname[32]; | 988 | char pname[32]; |
989 | struct smu_sdbp_header *part; | 989 | const struct smu_sdbp_header *part; |
990 | 990 | ||
991 | if (!smu) | 991 | if (!smu) |
992 | return NULL; | 992 | return NULL; |
@@ -1003,8 +1003,7 @@ struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, | |||
1003 | } else | 1003 | } else |
1004 | mutex_lock(&smu_part_access); | 1004 | mutex_lock(&smu_part_access); |
1005 | 1005 | ||
1006 | part = (struct smu_sdbp_header *)get_property(smu->of_node, | 1006 | part = get_property(smu->of_node, pname, size); |
1007 | pname, size); | ||
1008 | if (part == NULL) { | 1007 | if (part == NULL) { |
1009 | DPRINTK("trying to extract from SMU ...\n"); | 1008 | DPRINTK("trying to extract from SMU ...\n"); |
1010 | part = smu_create_sdb_partition(id); | 1009 | part = smu_create_sdb_partition(id); |
@@ -1015,7 +1014,7 @@ struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, | |||
1015 | return part; | 1014 | return part; |
1016 | } | 1015 | } |
1017 | 1016 | ||
1018 | struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size) | 1017 | const struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size) |
1019 | { | 1018 | { |
1020 | return __smu_get_sdb_partition(id, size, 0); | 1019 | return __smu_get_sdb_partition(id, size, 0); |
1021 | } | 1020 | } |
@@ -1094,7 +1093,7 @@ static ssize_t smu_write(struct file *file, const char __user *buf, | |||
1094 | pp->mode = smu_file_events; | 1093 | pp->mode = smu_file_events; |
1095 | return 0; | 1094 | return 0; |
1096 | } else if (hdr.cmdtype == SMU_CMDTYPE_GET_PARTITION) { | 1095 | } else if (hdr.cmdtype == SMU_CMDTYPE_GET_PARTITION) { |
1097 | struct smu_sdbp_header *part; | 1096 | const struct smu_sdbp_header *part; |
1098 | part = __smu_get_sdb_partition(hdr.cmd, NULL, 1); | 1097 | part = __smu_get_sdb_partition(hdr.cmd, NULL, 1); |
1099 | if (part == NULL) | 1098 | if (part == NULL) |
1100 | return -EINVAL; | 1099 | return -EINVAL; |
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 7f86478bdd36..a0f30d0853ea 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
@@ -47,7 +47,7 @@ static u8 FAN_SPD_SET[2] = {0x30, 0x31}; | |||
47 | 47 | ||
48 | static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */ | 48 | static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */ |
49 | static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */ | 49 | static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */ |
50 | static char *sensor_location[3] = {NULL, NULL, NULL}; | 50 | static const char *sensor_location[3] = {NULL, NULL, NULL}; |
51 | 51 | ||
52 | static int limit_adjust = 0; | 52 | static int limit_adjust = 0; |
53 | static int fan_speed = -1; | 53 | static int fan_speed = -1; |
@@ -553,7 +553,7 @@ static int __init | |||
553 | thermostat_init(void) | 553 | thermostat_init(void) |
554 | { | 554 | { |
555 | struct device_node* np; | 555 | struct device_node* np; |
556 | u32 *prop; | 556 | const u32 *prop; |
557 | int i = 0, offset = 0; | 557 | int i = 0, offset = 0; |
558 | 558 | ||
559 | np = of_find_node_by_name(NULL, "fan"); | 559 | np = of_find_node_by_name(NULL, "fan"); |
@@ -566,13 +566,13 @@ thermostat_init(void) | |||
566 | else | 566 | else |
567 | return -ENODEV; | 567 | return -ENODEV; |
568 | 568 | ||
569 | prop = (u32 *)get_property(np, "hwsensor-params-version", NULL); | 569 | prop = get_property(np, "hwsensor-params-version", NULL); |
570 | printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop, | 570 | printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop, |
571 | (*prop == 1)?"":"un"); | 571 | (*prop == 1)?"":"un"); |
572 | if (*prop != 1) | 572 | if (*prop != 1) |
573 | return -ENODEV; | 573 | return -ENODEV; |
574 | 574 | ||
575 | prop = (u32 *)get_property(np, "reg", NULL); | 575 | prop = get_property(np, "reg", NULL); |
576 | if (!prop) | 576 | if (!prop) |
577 | return -ENODEV; | 577 | return -ENODEV; |
578 | 578 | ||
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 20bf67244e2c..d00c0c37a12e 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
@@ -660,7 +660,7 @@ static int read_eeprom(int cpu, struct mpu_data *out) | |||
660 | { | 660 | { |
661 | struct device_node *np; | 661 | struct device_node *np; |
662 | char nodename[64]; | 662 | char nodename[64]; |
663 | u8 *data; | 663 | const u8 *data; |
664 | int len; | 664 | int len; |
665 | 665 | ||
666 | /* prom.c routine for finding a node by path is a bit brain dead | 666 | /* prom.c routine for finding a node by path is a bit brain dead |
@@ -673,7 +673,7 @@ static int read_eeprom(int cpu, struct mpu_data *out) | |||
673 | printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid node from device-tree\n"); | 673 | printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid node from device-tree\n"); |
674 | return -ENODEV; | 674 | return -ENODEV; |
675 | } | 675 | } |
676 | data = (u8 *)get_property(np, "cpuid", &len); | 676 | data = get_property(np, "cpuid", &len); |
677 | if (data == NULL) { | 677 | if (data == NULL) { |
678 | printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid property from device-tree\n"); | 678 | printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid property from device-tree\n"); |
679 | of_node_put(np); | 679 | of_node_put(np); |
@@ -1336,7 +1336,7 @@ static int init_backside_state(struct backside_pid_state *state) | |||
1336 | */ | 1336 | */ |
1337 | u3 = of_find_node_by_path("/u3@0,f8000000"); | 1337 | u3 = of_find_node_by_path("/u3@0,f8000000"); |
1338 | if (u3 != NULL) { | 1338 | if (u3 != NULL) { |
1339 | u32 *vers = (u32 *)get_property(u3, "device-rev", NULL); | 1339 | const u32 *vers = get_property(u3, "device-rev", NULL); |
1340 | if (vers) | 1340 | if (vers) |
1341 | if (((*vers) & 0x3f) < 0x34) | 1341 | if (((*vers) & 0x3f) < 0x34) |
1342 | u3h = 0; | 1342 | u3h = 0; |
@@ -2111,8 +2111,8 @@ static void fcu_lookup_fans(struct device_node *fcu_node) | |||
2111 | 2111 | ||
2112 | while ((np = of_get_next_child(fcu_node, np)) != NULL) { | 2112 | while ((np = of_get_next_child(fcu_node, np)) != NULL) { |
2113 | int type = -1; | 2113 | int type = -1; |
2114 | char *loc; | 2114 | const char *loc; |
2115 | u32 *reg; | 2115 | const u32 *reg; |
2116 | 2116 | ||
2117 | DBG(" control: %s, type: %s\n", np->name, np->type); | 2117 | DBG(" control: %s, type: %s\n", np->name, np->type); |
2118 | 2118 | ||
@@ -2128,8 +2128,8 @@ static void fcu_lookup_fans(struct device_node *fcu_node) | |||
2128 | continue; | 2128 | continue; |
2129 | 2129 | ||
2130 | /* Lookup for a matching location */ | 2130 | /* Lookup for a matching location */ |
2131 | loc = (char *)get_property(np, "location", NULL); | 2131 | loc = get_property(np, "location", NULL); |
2132 | reg = (u32 *)get_property(np, "reg", NULL); | 2132 | reg = get_property(np, "reg", NULL); |
2133 | if (loc == NULL || reg == NULL) | 2133 | if (loc == NULL || reg == NULL) |
2134 | continue; | 2134 | continue; |
2135 | DBG(" matching location: %s, reg: 0x%08x\n", loc, *reg); | 2135 | DBG(" matching location: %s, reg: 0x%08x\n", loc, *reg); |
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index c7d1c290cb0c..738faab1b22c 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c | |||
@@ -484,14 +484,14 @@ struct apple_thermal_info { | |||
484 | static int __init | 484 | static int __init |
485 | g4fan_init( void ) | 485 | g4fan_init( void ) |
486 | { | 486 | { |
487 | struct apple_thermal_info *info; | 487 | const struct apple_thermal_info *info; |
488 | struct device_node *np; | 488 | struct device_node *np; |
489 | 489 | ||
490 | init_MUTEX( &x.lock ); | 490 | init_MUTEX( &x.lock ); |
491 | 491 | ||
492 | if( !(np=of_find_node_by_name(NULL, "power-mgt")) ) | 492 | if( !(np=of_find_node_by_name(NULL, "power-mgt")) ) |
493 | return -ENODEV; | 493 | return -ENODEV; |
494 | info = (struct apple_thermal_info*)get_property(np, "thermal-info", NULL); | 494 | info = get_property(np, "thermal-info", NULL); |
495 | of_node_put(np); | 495 | of_node_put(np); |
496 | 496 | ||
497 | if( !info || !machine_is_compatible("PowerMac3,6") ) | 497 | if( !info || !machine_is_compatible("PowerMac3,6") ) |
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c index 69d5452fd22f..7512d1c15207 100644 --- a/drivers/macintosh/via-cuda.c +++ b/drivers/macintosh/via-cuda.c | |||
@@ -123,7 +123,7 @@ int __init find_via_cuda(void) | |||
123 | { | 123 | { |
124 | struct adb_request req; | 124 | struct adb_request req; |
125 | phys_addr_t taddr; | 125 | phys_addr_t taddr; |
126 | u32 *reg; | 126 | const u32 *reg; |
127 | int err; | 127 | int err; |
128 | 128 | ||
129 | if (vias != 0) | 129 | if (vias != 0) |
@@ -132,7 +132,7 @@ int __init find_via_cuda(void) | |||
132 | if (vias == 0) | 132 | if (vias == 0) |
133 | return 0; | 133 | return 0; |
134 | 134 | ||
135 | reg = (u32 *)get_property(vias, "reg", NULL); | 135 | reg = get_property(vias, "reg", NULL); |
136 | if (reg == NULL) { | 136 | if (reg == NULL) { |
137 | printk(KERN_ERR "via-cuda: No \"reg\" property !\n"); | 137 | printk(KERN_ERR "via-cuda: No \"reg\" property !\n"); |
138 | goto fail; | 138 | goto fail; |
diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c index 5189d5454b1f..179af10105d9 100644 --- a/drivers/macintosh/via-pmu-led.c +++ b/drivers/macintosh/via-pmu-led.c | |||
@@ -120,7 +120,7 @@ static int __init via_pmu_led_init(void) | |||
120 | dt = of_find_node_by_path("/"); | 120 | dt = of_find_node_by_path("/"); |
121 | if (dt == NULL) | 121 | if (dt == NULL) |
122 | return -ENODEV; | 122 | return -ENODEV; |
123 | model = (const char *)get_property(dt, "model", NULL); | 123 | model = get_property(dt, "model", NULL); |
124 | if (model == NULL) | 124 | if (model == NULL) |
125 | return -ENODEV; | 125 | return -ENODEV; |
126 | if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 && | 126 | if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 && |
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index ea386801e215..0df500b9a66b 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -280,7 +280,7 @@ static char *pbook_type[] = { | |||
280 | int __init find_via_pmu(void) | 280 | int __init find_via_pmu(void) |
281 | { | 281 | { |
282 | u64 taddr; | 282 | u64 taddr; |
283 | u32 *reg; | 283 | const u32 *reg; |
284 | 284 | ||
285 | if (via != 0) | 285 | if (via != 0) |
286 | return 1; | 286 | return 1; |
@@ -288,7 +288,7 @@ int __init find_via_pmu(void) | |||
288 | if (vias == NULL) | 288 | if (vias == NULL) |
289 | return 0; | 289 | return 0; |
290 | 290 | ||
291 | reg = (u32 *)get_property(vias, "reg", NULL); | 291 | reg = get_property(vias, "reg", NULL); |
292 | if (reg == NULL) { | 292 | if (reg == NULL) { |
293 | printk(KERN_ERR "via-pmu: No \"reg\" property !\n"); | 293 | printk(KERN_ERR "via-pmu: No \"reg\" property !\n"); |
294 | goto fail; | 294 | goto fail; |
@@ -330,7 +330,7 @@ int __init find_via_pmu(void) | |||
330 | 330 | ||
331 | gpiop = of_find_node_by_name(NULL, "gpio"); | 331 | gpiop = of_find_node_by_name(NULL, "gpio"); |
332 | if (gpiop) { | 332 | if (gpiop) { |
333 | reg = (u32 *)get_property(gpiop, "reg", NULL); | 333 | reg = get_property(gpiop, "reg", NULL); |
334 | if (reg) | 334 | if (reg) |
335 | gaddr = of_translate_address(gpiop, reg); | 335 | gaddr = of_translate_address(gpiop, reg); |
336 | if (gaddr != OF_BAD_ADDR) | 336 | if (gaddr != OF_BAD_ADDR) |
@@ -479,9 +479,9 @@ static int __init via_pmu_dev_init(void) | |||
479 | pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART; | 479 | pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART; |
480 | } else { | 480 | } else { |
481 | struct device_node* prim = find_devices("power-mgt"); | 481 | struct device_node* prim = find_devices("power-mgt"); |
482 | u32 *prim_info = NULL; | 482 | const u32 *prim_info = NULL; |
483 | if (prim) | 483 | if (prim) |
484 | prim_info = (u32 *)get_property(prim, "prim-info", NULL); | 484 | prim_info = get_property(prim, "prim-info", NULL); |
485 | if (prim_info) { | 485 | if (prim_info) { |
486 | /* Other stuffs here yet unknown */ | 486 | /* Other stuffs here yet unknown */ |
487 | pmu_battery_count = (prim_info[6] >> 16) & 0xff; | 487 | pmu_battery_count = (prim_info[6] >> 16) & 0xff; |
diff --git a/drivers/macintosh/windfarm_pm81.c b/drivers/macintosh/windfarm_pm81.c index f1df6efcbe68..2ff546e4c92f 100644 --- a/drivers/macintosh/windfarm_pm81.c +++ b/drivers/macintosh/windfarm_pm81.c | |||
@@ -396,7 +396,7 @@ static void wf_smu_sys_fans_tick(struct wf_smu_sys_fans_state *st) | |||
396 | static void wf_smu_create_cpu_fans(void) | 396 | static void wf_smu_create_cpu_fans(void) |
397 | { | 397 | { |
398 | struct wf_cpu_pid_param pid_param; | 398 | struct wf_cpu_pid_param pid_param; |
399 | struct smu_sdbp_header *hdr; | 399 | const struct smu_sdbp_header *hdr; |
400 | struct smu_sdbp_cpupiddata *piddata; | 400 | struct smu_sdbp_cpupiddata *piddata; |
401 | struct smu_sdbp_fvt *fvt; | 401 | struct smu_sdbp_fvt *fvt; |
402 | s32 tmax, tdelta, maxpow, powadj; | 402 | s32 tmax, tdelta, maxpow, powadj; |
@@ -702,7 +702,7 @@ static struct notifier_block wf_smu_events = { | |||
702 | 702 | ||
703 | static int wf_init_pm(void) | 703 | static int wf_init_pm(void) |
704 | { | 704 | { |
705 | struct smu_sdbp_header *hdr; | 705 | const struct smu_sdbp_header *hdr; |
706 | 706 | ||
707 | hdr = smu_get_sdb_partition(SMU_SDB_SENSORTREE_ID, NULL); | 707 | hdr = smu_get_sdb_partition(SMU_SDB_SENSORTREE_ID, NULL); |
708 | if (hdr != 0) { | 708 | if (hdr != 0) { |
diff --git a/drivers/macintosh/windfarm_pm91.c b/drivers/macintosh/windfarm_pm91.c index 0d6372e96d32..59e9ffe37c39 100644 --- a/drivers/macintosh/windfarm_pm91.c +++ b/drivers/macintosh/windfarm_pm91.c | |||
@@ -144,7 +144,7 @@ static struct wf_smu_slots_fans_state *wf_smu_slots_fans; | |||
144 | static void wf_smu_create_cpu_fans(void) | 144 | static void wf_smu_create_cpu_fans(void) |
145 | { | 145 | { |
146 | struct wf_cpu_pid_param pid_param; | 146 | struct wf_cpu_pid_param pid_param; |
147 | struct smu_sdbp_header *hdr; | 147 | const struct smu_sdbp_header *hdr; |
148 | struct smu_sdbp_cpupiddata *piddata; | 148 | struct smu_sdbp_cpupiddata *piddata; |
149 | struct smu_sdbp_fvt *fvt; | 149 | struct smu_sdbp_fvt *fvt; |
150 | s32 tmax, tdelta, maxpow, powadj; | 150 | s32 tmax, tdelta, maxpow, powadj; |
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c index a9e88edc0c72..bff1f372f188 100644 --- a/drivers/macintosh/windfarm_smu_controls.c +++ b/drivers/macintosh/windfarm_smu_controls.c | |||
@@ -159,14 +159,15 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node, | |||
159 | int pwm_fan) | 159 | int pwm_fan) |
160 | { | 160 | { |
161 | struct smu_fan_control *fct; | 161 | struct smu_fan_control *fct; |
162 | s32 *v; u32 *reg; | 162 | const s32 *v; |
163 | char *l; | 163 | const u32 *reg; |
164 | const char *l; | ||
164 | 165 | ||
165 | fct = kmalloc(sizeof(struct smu_fan_control), GFP_KERNEL); | 166 | fct = kmalloc(sizeof(struct smu_fan_control), GFP_KERNEL); |
166 | if (fct == NULL) | 167 | if (fct == NULL) |
167 | return NULL; | 168 | return NULL; |
168 | fct->ctrl.ops = &smu_fan_ops; | 169 | fct->ctrl.ops = &smu_fan_ops; |
169 | l = (char *)get_property(node, "location", NULL); | 170 | l = get_property(node, "location", NULL); |
170 | if (l == NULL) | 171 | if (l == NULL) |
171 | goto fail; | 172 | goto fail; |
172 | 173 | ||
@@ -223,17 +224,17 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node, | |||
223 | goto fail; | 224 | goto fail; |
224 | 225 | ||
225 | /* Get min & max values*/ | 226 | /* Get min & max values*/ |
226 | v = (s32 *)get_property(node, "min-value", NULL); | 227 | v = get_property(node, "min-value", NULL); |
227 | if (v == NULL) | 228 | if (v == NULL) |
228 | goto fail; | 229 | goto fail; |
229 | fct->min = *v; | 230 | fct->min = *v; |
230 | v = (s32 *)get_property(node, "max-value", NULL); | 231 | v = get_property(node, "max-value", NULL); |
231 | if (v == NULL) | 232 | if (v == NULL) |
232 | goto fail; | 233 | goto fail; |
233 | fct->max = *v; | 234 | fct->max = *v; |
234 | 235 | ||
235 | /* Get "reg" value */ | 236 | /* Get "reg" value */ |
236 | reg = (u32 *)get_property(node, "reg", NULL); | 237 | reg = get_property(node, "reg", NULL); |
237 | if (reg == NULL) | 238 | if (reg == NULL) |
238 | goto fail; | 239 | goto fail; |
239 | fct->reg = *reg; | 240 | fct->reg = *reg; |
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c index e295a07a1ebc..aceb61d9fbc8 100644 --- a/drivers/macintosh/windfarm_smu_sat.c +++ b/drivers/macintosh/windfarm_smu_sat.c | |||
@@ -233,15 +233,15 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev) | |||
233 | { | 233 | { |
234 | struct wf_sat *sat; | 234 | struct wf_sat *sat; |
235 | struct wf_sat_sensor *sens; | 235 | struct wf_sat_sensor *sens; |
236 | u32 *reg; | 236 | const u32 *reg; |
237 | char *loc, *type; | 237 | const char *loc, *type; |
238 | u8 addr, chip, core; | 238 | u8 addr, chip, core; |
239 | struct device_node *child; | 239 | struct device_node *child; |
240 | int shift, cpu, index; | 240 | int shift, cpu, index; |
241 | char *name; | 241 | char *name; |
242 | int vsens[2], isens[2]; | 242 | int vsens[2], isens[2]; |
243 | 243 | ||
244 | reg = (u32 *) get_property(dev, "reg", NULL); | 244 | reg = get_property(dev, "reg", NULL); |
245 | if (reg == NULL) | 245 | if (reg == NULL) |
246 | return; | 246 | return; |
247 | addr = *reg; | 247 | addr = *reg; |
@@ -268,7 +268,7 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev) | |||
268 | isens[0] = isens[1] = -1; | 268 | isens[0] = isens[1] = -1; |
269 | child = NULL; | 269 | child = NULL; |
270 | while ((child = of_get_next_child(dev, child)) != NULL) { | 270 | while ((child = of_get_next_child(dev, child)) != NULL) { |
271 | reg = (u32 *) get_property(child, "reg", NULL); | 271 | reg = get_property(child, "reg", NULL); |
272 | type = get_property(child, "device_type", NULL); | 272 | type = get_property(child, "device_type", NULL); |
273 | loc = get_property(child, "location", NULL); | 273 | loc = get_property(child, "location", NULL); |
274 | if (reg == NULL || loc == NULL) | 274 | if (reg == NULL || loc == NULL) |
diff --git a/drivers/macintosh/windfarm_smu_sensors.c b/drivers/macintosh/windfarm_smu_sensors.c index bed25dcf8a1e..defe9922ebd1 100644 --- a/drivers/macintosh/windfarm_smu_sensors.c +++ b/drivers/macintosh/windfarm_smu_sensors.c | |||
@@ -198,14 +198,14 @@ static struct wf_sensor_ops smu_slotspow_ops = { | |||
198 | static struct smu_ad_sensor *smu_ads_create(struct device_node *node) | 198 | static struct smu_ad_sensor *smu_ads_create(struct device_node *node) |
199 | { | 199 | { |
200 | struct smu_ad_sensor *ads; | 200 | struct smu_ad_sensor *ads; |
201 | char *c, *l; | 201 | const char *c, *l; |
202 | u32 *v; | 202 | const u32 *v; |
203 | 203 | ||
204 | ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL); | 204 | ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL); |
205 | if (ads == NULL) | 205 | if (ads == NULL) |
206 | return NULL; | 206 | return NULL; |
207 | c = (char *)get_property(node, "device_type", NULL); | 207 | c = get_property(node, "device_type", NULL); |
208 | l = (char *)get_property(node, "location", NULL); | 208 | l = get_property(node, "location", NULL); |
209 | if (c == NULL || l == NULL) | 209 | if (c == NULL || l == NULL) |
210 | goto fail; | 210 | goto fail; |
211 | 211 | ||
@@ -255,7 +255,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node) | |||
255 | } else | 255 | } else |
256 | goto fail; | 256 | goto fail; |
257 | 257 | ||
258 | v = (u32 *)get_property(node, "reg", NULL); | 258 | v = get_property(node, "reg", NULL); |
259 | if (v == NULL) | 259 | if (v == NULL) |
260 | goto fail; | 260 | goto fail; |
261 | ads->reg = *v; | 261 | ads->reg = *v; |
@@ -382,7 +382,7 @@ smu_cpu_power_create(struct wf_sensor *volts, struct wf_sensor *amps) | |||
382 | 382 | ||
383 | static void smu_fetch_param_partitions(void) | 383 | static void smu_fetch_param_partitions(void) |
384 | { | 384 | { |
385 | struct smu_sdbp_header *hdr; | 385 | const struct smu_sdbp_header *hdr; |
386 | 386 | ||
387 | /* Get CPU voltage/current/power calibration data */ | 387 | /* Get CPU voltage/current/power calibration data */ |
388 | hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL); | 388 | hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL); |
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index 6fad83f24c4f..711609665632 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
@@ -1264,7 +1264,8 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i | |||
1264 | { | 1264 | { |
1265 | int j, rev, ret; | 1265 | int j, rev, ret; |
1266 | struct bmac_data *bp; | 1266 | struct bmac_data *bp; |
1267 | unsigned char *addr; | 1267 | const unsigned char *prop_addr; |
1268 | unsigned char addr[6]; | ||
1268 | struct net_device *dev; | 1269 | struct net_device *dev; |
1269 | int is_bmac_plus = ((int)match->data) != 0; | 1270 | int is_bmac_plus = ((int)match->data) != 0; |
1270 | 1271 | ||
@@ -1272,14 +1273,16 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i | |||
1272 | printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n"); | 1273 | printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n"); |
1273 | return -ENODEV; | 1274 | return -ENODEV; |
1274 | } | 1275 | } |
1275 | addr = get_property(macio_get_of_node(mdev), "mac-address", NULL); | 1276 | prop_addr = get_property(macio_get_of_node(mdev), "mac-address", NULL); |
1276 | if (addr == NULL) { | 1277 | if (prop_addr == NULL) { |
1277 | addr = get_property(macio_get_of_node(mdev), "local-mac-address", NULL); | 1278 | prop_addr = get_property(macio_get_of_node(mdev), |
1278 | if (addr == NULL) { | 1279 | "local-mac-address", NULL); |
1280 | if (prop_addr == NULL) { | ||
1279 | printk(KERN_ERR "BMAC: Can't get mac-address\n"); | 1281 | printk(KERN_ERR "BMAC: Can't get mac-address\n"); |
1280 | return -ENODEV; | 1282 | return -ENODEV; |
1281 | } | 1283 | } |
1282 | } | 1284 | } |
1285 | memcpy(addr, prop_addr, sizeof(addr)); | ||
1283 | 1286 | ||
1284 | dev = alloc_etherdev(PRIV_BYTES); | 1287 | dev = alloc_etherdev(PRIV_BYTES); |
1285 | if (!dev) { | 1288 | if (!dev) { |
diff --git a/drivers/net/ibmveth.h b/drivers/net/ibmveth.h index 8385bf836507..149191cef2f0 100644 --- a/drivers/net/ibmveth.h +++ b/drivers/net/ibmveth.h | |||
@@ -41,16 +41,6 @@ | |||
41 | #define IbmVethMcastRemoveFilter 0x2UL | 41 | #define IbmVethMcastRemoveFilter 0x2UL |
42 | #define IbmVethMcastClearFilterTable 0x3UL | 42 | #define IbmVethMcastClearFilterTable 0x3UL |
43 | 43 | ||
44 | /* hcall numbers */ | ||
45 | #define H_VIO_SIGNAL 0x104 | ||
46 | #define H_REGISTER_LOGICAL_LAN 0x114 | ||
47 | #define H_FREE_LOGICAL_LAN 0x118 | ||
48 | #define H_ADD_LOGICAL_LAN_BUFFER 0x11C | ||
49 | #define H_SEND_LOGICAL_LAN 0x120 | ||
50 | #define H_MULTICAST_CTRL 0x130 | ||
51 | #define H_CHANGE_LOGICAL_LAN_MAC 0x14C | ||
52 | #define H_FREE_LOGICAL_LAN_BUFFER 0x1D4 | ||
53 | |||
54 | /* hcall macros */ | 44 | /* hcall macros */ |
55 | #define h_register_logical_lan(ua, buflst, rxq, fltlst, mac) \ | 45 | #define h_register_logical_lan(ua, buflst, rxq, fltlst, mac) \ |
56 | plpar_hcall_norets(H_REGISTER_LOGICAL_LAN, ua, buflst, rxq, fltlst, mac) | 46 | plpar_hcall_norets(H_REGISTER_LOGICAL_LAN, ua, buflst, rxq, fltlst, mac) |
diff --git a/drivers/net/mace.c b/drivers/net/mace.c index 29e4b5aa6ead..5d80e0e6a8e9 100644 --- a/drivers/net/mace.c +++ b/drivers/net/mace.c | |||
@@ -113,7 +113,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i | |||
113 | struct device_node *mace = macio_get_of_node(mdev); | 113 | struct device_node *mace = macio_get_of_node(mdev); |
114 | struct net_device *dev; | 114 | struct net_device *dev; |
115 | struct mace_data *mp; | 115 | struct mace_data *mp; |
116 | unsigned char *addr; | 116 | const unsigned char *addr; |
117 | int j, rev, rc = -EBUSY; | 117 | int j, rev, rc = -EBUSY; |
118 | 118 | ||
119 | if (macio_resource_count(mdev) != 3 || macio_irq_count(mdev) != 3) { | 119 | if (macio_resource_count(mdev) != 3 || macio_irq_count(mdev) != 3) { |
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 647f62e9707d..ec1a8e2d458e 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -1698,10 +1698,10 @@ spider_net_setup_phy(struct spider_net_card *card) | |||
1698 | */ | 1698 | */ |
1699 | static int | 1699 | static int |
1700 | spider_net_download_firmware(struct spider_net_card *card, | 1700 | spider_net_download_firmware(struct spider_net_card *card, |
1701 | u8 *firmware_ptr) | 1701 | const void *firmware_ptr) |
1702 | { | 1702 | { |
1703 | int sequencer, i; | 1703 | int sequencer, i; |
1704 | u32 *fw_ptr = (u32 *)firmware_ptr; | 1704 | const u32 *fw_ptr = firmware_ptr; |
1705 | 1705 | ||
1706 | /* stop sequencers */ | 1706 | /* stop sequencers */ |
1707 | spider_net_write_reg(card, SPIDER_NET_GSINIT, | 1707 | spider_net_write_reg(card, SPIDER_NET_GSINIT, |
@@ -1758,7 +1758,7 @@ spider_net_init_firmware(struct spider_net_card *card) | |||
1758 | { | 1758 | { |
1759 | struct firmware *firmware = NULL; | 1759 | struct firmware *firmware = NULL; |
1760 | struct device_node *dn; | 1760 | struct device_node *dn; |
1761 | u8 *fw_prop = NULL; | 1761 | const u8 *fw_prop = NULL; |
1762 | int err = -ENOENT; | 1762 | int err = -ENOENT; |
1763 | int fw_size; | 1763 | int fw_size; |
1764 | 1764 | ||
@@ -1784,7 +1784,7 @@ try_host_fw: | |||
1784 | if (!dn) | 1784 | if (!dn) |
1785 | goto out_err; | 1785 | goto out_err; |
1786 | 1786 | ||
1787 | fw_prop = (u8 *)get_property(dn, "firmware", &fw_size); | 1787 | fw_prop = get_property(dn, "firmware", &fw_size); |
1788 | if (!fw_prop) | 1788 | if (!fw_prop) |
1789 | goto out_err; | 1789 | goto out_err; |
1790 | 1790 | ||
@@ -1987,7 +1987,7 @@ spider_net_setup_netdev(struct spider_net_card *card) | |||
1987 | struct net_device *netdev = card->netdev; | 1987 | struct net_device *netdev = card->netdev; |
1988 | struct device_node *dn; | 1988 | struct device_node *dn; |
1989 | struct sockaddr addr; | 1989 | struct sockaddr addr; |
1990 | u8 *mac; | 1990 | const u8 *mac; |
1991 | 1991 | ||
1992 | SET_MODULE_OWNER(netdev); | 1992 | SET_MODULE_OWNER(netdev); |
1993 | SET_NETDEV_DEV(netdev, &card->pdev->dev); | 1993 | SET_NETDEV_DEV(netdev, &card->pdev->dev); |
@@ -2017,7 +2017,7 @@ spider_net_setup_netdev(struct spider_net_card *card) | |||
2017 | if (!dn) | 2017 | if (!dn) |
2018 | return -EIO; | 2018 | return -EIO; |
2019 | 2019 | ||
2020 | mac = (u8 *)get_property(dn, "local-mac-address", NULL); | 2020 | mac = get_property(dn, "local-mac-address", NULL); |
2021 | if (!mac) | 2021 | if (!mac) |
2022 | return -EIO; | 2022 | return -EIO; |
2023 | memcpy(addr.sa_data, mac, ETH_ALEN); | 2023 | memcpy(addr.sa_data, mac, ETH_ALEN); |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index b70bbd748978..d7b1d1882cab 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -2896,7 +2896,7 @@ static int __devinit gem_get_device_address(struct gem *gp) | |||
2896 | if (use_idprom) | 2896 | if (use_idprom) |
2897 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); | 2897 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); |
2898 | #elif defined(CONFIG_PPC_PMAC) | 2898 | #elif defined(CONFIG_PPC_PMAC) |
2899 | unsigned char *addr; | 2899 | const unsigned char *addr; |
2900 | 2900 | ||
2901 | addr = get_property(gp->of_node, "local-mac-address", NULL); | 2901 | addr = get_property(gp->of_node, "local-mac-address", NULL); |
2902 | if (addr == NULL) { | 2902 | if (addr == NULL) { |
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 076bd6dcafae..7288a3eccfb3 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -176,16 +176,16 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe | |||
176 | return 0; | 176 | return 0; |
177 | } | 177 | } |
178 | 178 | ||
179 | static int get_children_props(struct device_node *dn, int **drc_indexes, | 179 | static int get_children_props(struct device_node *dn, const int **drc_indexes, |
180 | int **drc_names, int **drc_types, int **drc_power_domains) | 180 | const int **drc_names, const int **drc_types, |
181 | const int **drc_power_domains) | ||
181 | { | 182 | { |
182 | int *indexes, *names; | 183 | const int *indexes, *names, *types, *domains; |
183 | int *types, *domains; | ||
184 | 184 | ||
185 | indexes = (int *) get_property(dn, "ibm,drc-indexes", NULL); | 185 | indexes = get_property(dn, "ibm,drc-indexes", NULL); |
186 | names = (int *) get_property(dn, "ibm,drc-names", NULL); | 186 | names = get_property(dn, "ibm,drc-names", NULL); |
187 | types = (int *) get_property(dn, "ibm,drc-types", NULL); | 187 | types = get_property(dn, "ibm,drc-types", NULL); |
188 | domains = (int *) get_property(dn, "ibm,drc-power-domains", NULL); | 188 | domains = get_property(dn, "ibm,drc-power-domains", NULL); |
189 | 189 | ||
190 | if (!indexes || !names || !types || !domains) { | 190 | if (!indexes || !names || !types || !domains) { |
191 | /* Slot does not have dynamically-removable children */ | 191 | /* Slot does not have dynamically-removable children */ |
@@ -212,13 +212,13 @@ static int get_children_props(struct device_node *dn, int **drc_indexes, | |||
212 | int rpaphp_get_drc_props(struct device_node *dn, int *drc_index, | 212 | int rpaphp_get_drc_props(struct device_node *dn, int *drc_index, |
213 | char **drc_name, char **drc_type, int *drc_power_domain) | 213 | char **drc_name, char **drc_type, int *drc_power_domain) |
214 | { | 214 | { |
215 | int *indexes, *names; | 215 | const int *indexes, *names; |
216 | int *types, *domains; | 216 | const int *types, *domains; |
217 | unsigned int *my_index; | 217 | const unsigned int *my_index; |
218 | char *name_tmp, *type_tmp; | 218 | char *name_tmp, *type_tmp; |
219 | int i, rc; | 219 | int i, rc; |
220 | 220 | ||
221 | my_index = (int *) get_property(dn, "ibm,my-drc-index", NULL); | 221 | my_index = get_property(dn, "ibm,my-drc-index", NULL); |
222 | if (!my_index) { | 222 | if (!my_index) { |
223 | /* Node isn't DLPAR/hotplug capable */ | 223 | /* Node isn't DLPAR/hotplug capable */ |
224 | return -EINVAL; | 224 | return -EINVAL; |
@@ -265,10 +265,10 @@ static int is_php_type(char *drc_type) | |||
265 | return 1; | 265 | return 1; |
266 | } | 266 | } |
267 | 267 | ||
268 | static int is_php_dn(struct device_node *dn, int **indexes, int **names, | 268 | static int is_php_dn(struct device_node *dn, const int **indexes, |
269 | int **types, int **power_domains) | 269 | const int **names, const int **types, const int **power_domains) |
270 | { | 270 | { |
271 | int *drc_types; | 271 | const int *drc_types; |
272 | int rc; | 272 | int rc; |
273 | 273 | ||
274 | rc = get_children_props(dn, indexes, names, &drc_types, power_domains); | 274 | rc = get_children_props(dn, indexes, names, &drc_types, power_domains); |
@@ -296,7 +296,7 @@ int rpaphp_add_slot(struct device_node *dn) | |||
296 | struct slot *slot; | 296 | struct slot *slot; |
297 | int retval = 0; | 297 | int retval = 0; |
298 | int i; | 298 | int i; |
299 | int *indexes, *names, *types, *power_domains; | 299 | const int *indexes, *names, *types, *power_domains; |
300 | char *name, *type; | 300 | char *name, *type; |
301 | 301 | ||
302 | dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name); | 302 | dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name); |
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c index ed22b96580c6..01b8ac641eb8 100644 --- a/drivers/scsi/ibmvscsi/rpa_vscsi.c +++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c | |||
@@ -156,8 +156,8 @@ static void gather_partition_info(void) | |||
156 | { | 156 | { |
157 | struct device_node *rootdn; | 157 | struct device_node *rootdn; |
158 | 158 | ||
159 | char *ppartition_name; | 159 | const char *ppartition_name; |
160 | unsigned int *p_number_ptr; | 160 | const unsigned int *p_number_ptr; |
161 | 161 | ||
162 | /* Retrieve information about this partition */ | 162 | /* Retrieve information about this partition */ |
163 | rootdn = find_path_device("/"); | 163 | rootdn = find_path_device("/"); |
@@ -165,14 +165,11 @@ static void gather_partition_info(void) | |||
165 | return; | 165 | return; |
166 | } | 166 | } |
167 | 167 | ||
168 | ppartition_name = | 168 | ppartition_name = get_property(rootdn, "ibm,partition-name", NULL); |
169 | get_property(rootdn, "ibm,partition-name", NULL); | ||
170 | if (ppartition_name) | 169 | if (ppartition_name) |
171 | strncpy(partition_name, ppartition_name, | 170 | strncpy(partition_name, ppartition_name, |
172 | sizeof(partition_name)); | 171 | sizeof(partition_name)); |
173 | p_number_ptr = | 172 | p_number_ptr = get_property(rootdn, "ibm,partition-no", NULL); |
174 | (unsigned int *)get_property(rootdn, "ibm,partition-no", | ||
175 | NULL); | ||
176 | if (p_number_ptr) | 173 | if (p_number_ptr) |
177 | partition_number = *p_number_ptr; | 174 | partition_number = *p_number_ptr; |
178 | } | 175 | } |
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index 89ef34df5a1d..6422de72bf43 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c | |||
@@ -431,7 +431,7 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
431 | struct fsc_state *state; | 431 | struct fsc_state *state; |
432 | struct Scsi_Host *host; | 432 | struct Scsi_Host *host; |
433 | void *dma_cmd_space; | 433 | void *dma_cmd_space; |
434 | unsigned char *clkprop; | 434 | const unsigned char *clkprop; |
435 | int proplen, rc = -ENODEV; | 435 | int proplen, rc = -ENODEV; |
436 | 436 | ||
437 | if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) { | 437 | if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) { |
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index 5572981a9f92..592b52afe658 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c | |||
@@ -1850,7 +1850,8 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) | |||
1850 | { | 1850 | { |
1851 | struct device_node *mesh = macio_get_of_node(mdev); | 1851 | struct device_node *mesh = macio_get_of_node(mdev); |
1852 | struct pci_dev* pdev = macio_get_pci_dev(mdev); | 1852 | struct pci_dev* pdev = macio_get_pci_dev(mdev); |
1853 | int tgt, *cfp, minper; | 1853 | int tgt, minper; |
1854 | const int *cfp; | ||
1854 | struct mesh_state *ms; | 1855 | struct mesh_state *ms; |
1855 | struct Scsi_Host *mesh_host; | 1856 | struct Scsi_Host *mesh_host; |
1856 | void *dma_cmd_space; | 1857 | void *dma_cmd_space; |
@@ -1939,7 +1940,7 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) | |||
1939 | ms->tgts[tgt].current_req = NULL; | 1940 | ms->tgts[tgt].current_req = NULL; |
1940 | } | 1941 | } |
1941 | 1942 | ||
1942 | if ((cfp = (int *) get_property(mesh, "clock-frequency", NULL))) | 1943 | if ((cfp = get_property(mesh, "clock-frequency", NULL))) |
1943 | ms->clk_freq = *cfp; | 1944 | ms->clk_freq = *cfp; |
1944 | else { | 1945 | else { |
1945 | printk(KERN_INFO "mesh: assuming 50MHz clock frequency\n"); | 1946 | printk(KERN_INFO "mesh: assuming 50MHz clock frequency\n"); |
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index 7d0858095e1f..6b70c3c76dfd 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -268,7 +268,7 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start, | |||
268 | /* Match it to a port node */ | 268 | /* Match it to a port node */ |
269 | index = (ap == ap->host_set->ports[0]) ? 0 : 1; | 269 | index = (ap == ap->host_set->ports[0]) ? 0 : 1; |
270 | for (np = np->child; np != NULL; np = np->sibling) { | 270 | for (np = np->child; np != NULL; np = np->sibling) { |
271 | u32 *reg = (u32 *)get_property(np, "reg", NULL); | 271 | const u32 *reg = get_property(np, "reg", NULL); |
272 | if (!reg) | 272 | if (!reg) |
273 | continue; | 273 | continue; |
274 | if (index == *reg) | 274 | if (index == *reg) |
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index bfd2a22759eb..a3b99caf80e6 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c | |||
@@ -1400,8 +1400,8 @@ static struct uart_ops pmz_pops = { | |||
1400 | static int __init pmz_init_port(struct uart_pmac_port *uap) | 1400 | static int __init pmz_init_port(struct uart_pmac_port *uap) |
1401 | { | 1401 | { |
1402 | struct device_node *np = uap->node; | 1402 | struct device_node *np = uap->node; |
1403 | char *conn; | 1403 | const char *conn; |
1404 | struct slot_names_prop { | 1404 | const struct slot_names_prop { |
1405 | int count; | 1405 | int count; |
1406 | char name[1]; | 1406 | char name[1]; |
1407 | } *slots; | 1407 | } *slots; |
@@ -1458,7 +1458,7 @@ no_dma: | |||
1458 | uap->flags |= PMACZILOG_FLAG_IS_IRDA; | 1458 | uap->flags |= PMACZILOG_FLAG_IS_IRDA; |
1459 | uap->port_type = PMAC_SCC_ASYNC; | 1459 | uap->port_type = PMAC_SCC_ASYNC; |
1460 | /* 1999 Powerbook G3 has slot-names property instead */ | 1460 | /* 1999 Powerbook G3 has slot-names property instead */ |
1461 | slots = (struct slot_names_prop *)get_property(np, "slot-names", &len); | 1461 | slots = get_property(np, "slot-names", &len); |
1462 | if (slots && slots->count > 0) { | 1462 | if (slots && slots->count > 0) { |
1463 | if (strcmp(slots->name, "IrDA") == 0) | 1463 | if (strcmp(slots->name, "IrDA") == 0) |
1464 | uap->flags |= PMACZILOG_FLAG_IS_IRDA; | 1464 | uap->flags |= PMACZILOG_FLAG_IS_IRDA; |
@@ -1470,7 +1470,8 @@ no_dma: | |||
1470 | if (ZS_IS_INTMODEM(uap)) { | 1470 | if (ZS_IS_INTMODEM(uap)) { |
1471 | struct device_node* i2c_modem = find_devices("i2c-modem"); | 1471 | struct device_node* i2c_modem = find_devices("i2c-modem"); |
1472 | if (i2c_modem) { | 1472 | if (i2c_modem) { |
1473 | char* mid = get_property(i2c_modem, "modem-id", NULL); | 1473 | const char* mid = |
1474 | get_property(i2c_modem, "modem-id", NULL); | ||
1474 | if (mid) switch(*mid) { | 1475 | if (mid) switch(*mid) { |
1475 | case 0x04 : | 1476 | case 0x04 : |
1476 | case 0x05 : | 1477 | case 0x05 : |
diff --git a/drivers/video/S3triofb.c b/drivers/video/S3triofb.c index afd146f5f683..397005eb392d 100644 --- a/drivers/video/S3triofb.c +++ b/drivers/video/S3triofb.c | |||
@@ -349,30 +349,30 @@ static void __init s3triofb_of_init(struct device_node *dp) | |||
349 | s3trio_name[sizeof(s3trio_name)-1] = '\0'; | 349 | s3trio_name[sizeof(s3trio_name)-1] = '\0'; |
350 | strcpy(fb_fix.id, s3trio_name); | 350 | strcpy(fb_fix.id, s3trio_name); |
351 | 351 | ||
352 | if((pp = (int *)get_property(dp, "vendor-id", &len)) != NULL | 352 | if((pp = get_property(dp, "vendor-id", &len)) != NULL |
353 | && *pp!=PCI_VENDOR_ID_S3) { | 353 | && *pp!=PCI_VENDOR_ID_S3) { |
354 | printk("%s: can't find S3 Trio board\n", dp->full_name); | 354 | printk("%s: can't find S3 Trio board\n", dp->full_name); |
355 | return; | 355 | return; |
356 | } | 356 | } |
357 | 357 | ||
358 | if((pp = (int *)get_property(dp, "device-id", &len)) != NULL | 358 | if((pp = get_property(dp, "device-id", &len)) != NULL |
359 | && *pp!=PCI_DEVICE_ID_S3_TRIO) { | 359 | && *pp!=PCI_DEVICE_ID_S3_TRIO) { |
360 | printk("%s: can't find S3 Trio board\n", dp->full_name); | 360 | printk("%s: can't find S3 Trio board\n", dp->full_name); |
361 | return; | 361 | return; |
362 | } | 362 | } |
363 | 363 | ||
364 | if ((pp = (int *)get_property(dp, "depth", &len)) != NULL | 364 | if ((pp = get_property(dp, "depth", &len)) != NULL |
365 | && len == sizeof(int) && *pp != 8) { | 365 | && len == sizeof(int) && *pp != 8) { |
366 | printk("%s: can't use depth = %d\n", dp->full_name, *pp); | 366 | printk("%s: can't use depth = %d\n", dp->full_name, *pp); |
367 | return; | 367 | return; |
368 | } | 368 | } |
369 | if ((pp = (int *)get_property(dp, "width", &len)) != NULL | 369 | if ((pp = get_property(dp, "width", &len)) != NULL |
370 | && len == sizeof(int)) | 370 | && len == sizeof(int)) |
371 | fb_var.xres = fb_var.xres_virtual = *pp; | 371 | fb_var.xres = fb_var.xres_virtual = *pp; |
372 | if ((pp = (int *)get_property(dp, "height", &len)) != NULL | 372 | if ((pp = get_property(dp, "height", &len)) != NULL |
373 | && len == sizeof(int)) | 373 | && len == sizeof(int)) |
374 | fb_var.yres = fb_var.yres_virtual = *pp; | 374 | fb_var.yres = fb_var.yres_virtual = *pp; |
375 | if ((pp = (int *)get_property(dp, "linebytes", &len)) != NULL | 375 | if ((pp = get_property(dp, "linebytes", &len)) != NULL |
376 | && len == sizeof(int)) | 376 | && len == sizeof(int)) |
377 | fb_fix.line_length = *pp; | 377 | fb_fix.line_length = *pp; |
378 | else | 378 | else |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 8e3400d5dd21..0ed577e7cc21 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -413,11 +413,11 @@ static int __devinit radeon_find_mem_vbios(struct radeonfb_info *rinfo) | |||
413 | static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo) | 413 | static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo) |
414 | { | 414 | { |
415 | struct device_node *dp = rinfo->of_node; | 415 | struct device_node *dp = rinfo->of_node; |
416 | u32 *val; | 416 | const u32 *val; |
417 | 417 | ||
418 | if (dp == NULL) | 418 | if (dp == NULL) |
419 | return -ENODEV; | 419 | return -ENODEV; |
420 | val = (u32 *) get_property(dp, "ATY,RefCLK", NULL); | 420 | val = get_property(dp, "ATY,RefCLK", NULL); |
421 | if (!val || !*val) { | 421 | if (!val || !*val) { |
422 | printk(KERN_WARNING "radeonfb: No ATY,RefCLK property !\n"); | 422 | printk(KERN_WARNING "radeonfb: No ATY,RefCLK property !\n"); |
423 | return -EINVAL; | 423 | return -EINVAL; |
@@ -425,11 +425,11 @@ static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo) | |||
425 | 425 | ||
426 | rinfo->pll.ref_clk = (*val) / 10; | 426 | rinfo->pll.ref_clk = (*val) / 10; |
427 | 427 | ||
428 | val = (u32 *) get_property(dp, "ATY,SCLK", NULL); | 428 | val = get_property(dp, "ATY,SCLK", NULL); |
429 | if (val && *val) | 429 | if (val && *val) |
430 | rinfo->pll.sclk = (*val) / 10; | 430 | rinfo->pll.sclk = (*val) / 10; |
431 | 431 | ||
432 | val = (u32 *) get_property(dp, "ATY,MCLK", NULL); | 432 | val = get_property(dp, "ATY,MCLK", NULL); |
433 | if (val && *val) | 433 | if (val && *val) |
434 | rinfo->pll.mclk = (*val) / 10; | 434 | rinfo->pll.mclk = (*val) / 10; |
435 | 435 | ||
diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c index 98c05bc0de44..ea531a6f45d1 100644 --- a/drivers/video/aty/radeon_monitor.c +++ b/drivers/video/aty/radeon_monitor.c | |||
@@ -64,13 +64,13 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_ | |||
64 | { | 64 | { |
65 | static char *propnames[] = { "DFP,EDID", "LCD,EDID", "EDID", | 65 | static char *propnames[] = { "DFP,EDID", "LCD,EDID", "EDID", |
66 | "EDID1", "EDID2", NULL }; | 66 | "EDID1", "EDID2", NULL }; |
67 | u8 *pedid = NULL; | 67 | const u8 *pedid = NULL; |
68 | u8 *pmt = NULL; | 68 | const u8 *pmt = NULL; |
69 | u8 *tmp; | 69 | u8 *tmp; |
70 | int i, mt = MT_NONE; | 70 | int i, mt = MT_NONE; |
71 | 71 | ||
72 | RTRACE("analyzing OF properties...\n"); | 72 | RTRACE("analyzing OF properties...\n"); |
73 | pmt = (u8 *)get_property(dp, "display-type", NULL); | 73 | pmt = get_property(dp, "display-type", NULL); |
74 | if (!pmt) | 74 | if (!pmt) |
75 | return MT_NONE; | 75 | return MT_NONE; |
76 | RTRACE("display-type: %s\n", pmt); | 76 | RTRACE("display-type: %s\n", pmt); |
@@ -89,7 +89,7 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_ | |||
89 | } | 89 | } |
90 | 90 | ||
91 | for (i = 0; propnames[i] != NULL; ++i) { | 91 | for (i = 0; propnames[i] != NULL; ++i) { |
92 | pedid = (u8 *)get_property(dp, propnames[i], NULL); | 92 | pedid = get_property(dp, propnames[i], NULL); |
93 | if (pedid != NULL) | 93 | if (pedid != NULL) |
94 | break; | 94 | break; |
95 | } | 95 | } |
@@ -124,14 +124,14 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_ | |||
124 | return MT_NONE; | 124 | return MT_NONE; |
125 | 125 | ||
126 | if (rinfo->has_CRTC2) { | 126 | if (rinfo->has_CRTC2) { |
127 | char *pname; | 127 | const char *pname; |
128 | int len, second = 0; | 128 | int len, second = 0; |
129 | 129 | ||
130 | dp = dp->child; | 130 | dp = dp->child; |
131 | do { | 131 | do { |
132 | if (!dp) | 132 | if (!dp) |
133 | return MT_NONE; | 133 | return MT_NONE; |
134 | pname = (char *)get_property(dp, "name", NULL); | 134 | pname = get_property(dp, "name", NULL); |
135 | if (!pname) | 135 | if (!pname) |
136 | return MT_NONE; | 136 | return MT_NONE; |
137 | len = strlen(pname); | 137 | len = strlen(pname); |
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index f31e606a2ded..e308ed2d249a 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -1268,7 +1268,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo) | |||
1268 | 0x21320032, 0xa1320032, 0x21320032, 0xffffffff, | 1268 | 0x21320032, 0xa1320032, 0x21320032, 0xffffffff, |
1269 | 0x31320032 }; | 1269 | 0x31320032 }; |
1270 | 1270 | ||
1271 | u32 *mrtable = default_mrtable; | 1271 | const u32 *mrtable = default_mrtable; |
1272 | int i, mrtable_size = ARRAY_SIZE(default_mrtable); | 1272 | int i, mrtable_size = ARRAY_SIZE(default_mrtable); |
1273 | 1273 | ||
1274 | mdelay(30); | 1274 | mdelay(30); |
@@ -1287,7 +1287,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo) | |||
1287 | if (rinfo->of_node != NULL) { | 1287 | if (rinfo->of_node != NULL) { |
1288 | int size; | 1288 | int size; |
1289 | 1289 | ||
1290 | mrtable = (u32 *)get_property(rinfo->of_node, "ATY,MRT", &size); | 1290 | mrtable = get_property(rinfo->of_node, "ATY,MRT", &size); |
1291 | if (mrtable) | 1291 | if (mrtable) |
1292 | mrtable_size = size >> 2; | 1292 | mrtable_size = size >> 2; |
1293 | else | 1293 | else |
diff --git a/drivers/video/nvidia/nv_of.c b/drivers/video/nvidia/nv_of.c index 8209106e26ee..d9af88c2b580 100644 --- a/drivers/video/nvidia/nv_of.c +++ b/drivers/video/nvidia/nv_of.c | |||
@@ -32,7 +32,7 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) | |||
32 | { | 32 | { |
33 | struct nvidia_par *par = info->par; | 33 | struct nvidia_par *par = info->par; |
34 | struct device_node *parent, *dp; | 34 | struct device_node *parent, *dp; |
35 | unsigned char *pedid = NULL; | 35 | const unsigned char *pedid = NULL; |
36 | static char *propnames[] = { | 36 | static char *propnames[] = { |
37 | "DFP,EDID", "LCD,EDID", "EDID", "EDID1", | 37 | "DFP,EDID", "LCD,EDID", "EDID", "EDID1", |
38 | "EDID,B", "EDID,A", NULL }; | 38 | "EDID,B", "EDID,A", NULL }; |
@@ -42,20 +42,19 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) | |||
42 | if (parent == NULL) | 42 | if (parent == NULL) |
43 | return -1; | 43 | return -1; |
44 | if (par->twoHeads) { | 44 | if (par->twoHeads) { |
45 | char *pname; | 45 | const char *pname; |
46 | int len; | 46 | int len; |
47 | 47 | ||
48 | for (dp = NULL; | 48 | for (dp = NULL; |
49 | (dp = of_get_next_child(parent, dp)) != NULL;) { | 49 | (dp = of_get_next_child(parent, dp)) != NULL;) { |
50 | pname = (char *)get_property(dp, "name", NULL); | 50 | pname = get_property(dp, "name", NULL); |
51 | if (!pname) | 51 | if (!pname) |
52 | continue; | 52 | continue; |
53 | len = strlen(pname); | 53 | len = strlen(pname); |
54 | if ((pname[len-1] == 'A' && conn == 1) || | 54 | if ((pname[len-1] == 'A' && conn == 1) || |
55 | (pname[len-1] == 'B' && conn == 2)) { | 55 | (pname[len-1] == 'B' && conn == 2)) { |
56 | for (i = 0; propnames[i] != NULL; ++i) { | 56 | for (i = 0; propnames[i] != NULL; ++i) { |
57 | pedid = (unsigned char *) | 57 | pedid = get_property(dp, propnames[i], |
58 | get_property(dp, propnames[i], | ||
59 | NULL); | 58 | NULL); |
60 | if (pedid != NULL) | 59 | if (pedid != NULL) |
61 | break; | 60 | break; |
@@ -67,8 +66,7 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) | |||
67 | } | 66 | } |
68 | if (pedid == NULL) { | 67 | if (pedid == NULL) { |
69 | for (i = 0; propnames[i] != NULL; ++i) { | 68 | for (i = 0; propnames[i] != NULL; ++i) { |
70 | pedid = (unsigned char *) | 69 | pedid = get_property(parent, propnames[i], NULL); |
71 | get_property(parent, propnames[i], NULL); | ||
72 | if (pedid != NULL) | 70 | if (pedid != NULL) |
73 | break; | 71 | break; |
74 | } | 72 | } |
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 0013311e0564..bad0e98fb3b6 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
@@ -409,30 +409,30 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) | |||
409 | unsigned int flags, rsize, addr_prop = 0; | 409 | unsigned int flags, rsize, addr_prop = 0; |
410 | unsigned long max_size = 0; | 410 | unsigned long max_size = 0; |
411 | u64 rstart, address = OF_BAD_ADDR; | 411 | u64 rstart, address = OF_BAD_ADDR; |
412 | u32 *pp, *addrp, *up; | 412 | const u32 *pp, *addrp, *up; |
413 | u64 asize; | 413 | u64 asize; |
414 | 414 | ||
415 | pp = (u32 *)get_property(dp, "linux,bootx-depth", &len); | 415 | pp = get_property(dp, "linux,bootx-depth", &len); |
416 | if (pp == NULL) | 416 | if (pp == NULL) |
417 | pp = (u32 *)get_property(dp, "depth", &len); | 417 | pp = get_property(dp, "depth", &len); |
418 | if (pp && len == sizeof(u32)) | 418 | if (pp && len == sizeof(u32)) |
419 | depth = *pp; | 419 | depth = *pp; |
420 | 420 | ||
421 | pp = (u32 *)get_property(dp, "linux,bootx-width", &len); | 421 | pp = get_property(dp, "linux,bootx-width", &len); |
422 | if (pp == NULL) | 422 | if (pp == NULL) |
423 | pp = (u32 *)get_property(dp, "width", &len); | 423 | pp = get_property(dp, "width", &len); |
424 | if (pp && len == sizeof(u32)) | 424 | if (pp && len == sizeof(u32)) |
425 | width = *pp; | 425 | width = *pp; |
426 | 426 | ||
427 | pp = (u32 *)get_property(dp, "linux,bootx-height", &len); | 427 | pp = get_property(dp, "linux,bootx-height", &len); |
428 | if (pp == NULL) | 428 | if (pp == NULL) |
429 | pp = (u32 *)get_property(dp, "height", &len); | 429 | pp = get_property(dp, "height", &len); |
430 | if (pp && len == sizeof(u32)) | 430 | if (pp && len == sizeof(u32)) |
431 | height = *pp; | 431 | height = *pp; |
432 | 432 | ||
433 | pp = (u32 *)get_property(dp, "linux,bootx-linebytes", &len); | 433 | pp = get_property(dp, "linux,bootx-linebytes", &len); |
434 | if (pp == NULL) | 434 | if (pp == NULL) |
435 | pp = (u32 *)get_property(dp, "linebytes", &len); | 435 | pp = get_property(dp, "linebytes", &len); |
436 | if (pp && len == sizeof(u32)) | 436 | if (pp && len == sizeof(u32)) |
437 | pitch = *pp; | 437 | pitch = *pp; |
438 | else | 438 | else |
@@ -450,9 +450,9 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) | |||
450 | * ranges and pick one that is both big enough and if possible encloses | 450 | * ranges and pick one that is both big enough and if possible encloses |
451 | * the "address" property. If none match, we pick the biggest | 451 | * the "address" property. If none match, we pick the biggest |
452 | */ | 452 | */ |
453 | up = (u32 *)get_property(dp, "linux,bootx-addr", &len); | 453 | up = get_property(dp, "linux,bootx-addr", &len); |
454 | if (up == NULL) | 454 | if (up == NULL) |
455 | up = (u32 *)get_property(dp, "address", &len); | 455 | up = get_property(dp, "address", &len); |
456 | if (up && len == sizeof(u32)) | 456 | if (up && len == sizeof(u32)) |
457 | addr_prop = *up; | 457 | addr_prop = *up; |
458 | 458 | ||
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 76fc9d355eb7..9823ba939e11 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -1831,14 +1831,13 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) | |||
1831 | NVTRACE_ENTER(); | 1831 | NVTRACE_ENTER(); |
1832 | dp = pci_device_to_OF_node(pd); | 1832 | dp = pci_device_to_OF_node(pd); |
1833 | for (; dp != NULL; dp = dp->child) { | 1833 | for (; dp != NULL; dp = dp->child) { |
1834 | disptype = (unsigned char *)get_property(dp, "display-type", NULL); | 1834 | disptype = get_property(dp, "display-type", NULL); |
1835 | if (disptype == NULL) | 1835 | if (disptype == NULL) |
1836 | continue; | 1836 | continue; |
1837 | if (strncmp(disptype, "LCD", 3) != 0) | 1837 | if (strncmp(disptype, "LCD", 3) != 0) |
1838 | continue; | 1838 | continue; |
1839 | for (i = 0; propnames[i] != NULL; ++i) { | 1839 | for (i = 0; propnames[i] != NULL; ++i) { |
1840 | pedid = (unsigned char *) | 1840 | pedid = get_property(dp, propnames[i], NULL); |
1841 | get_property(dp, propnames[i], NULL); | ||
1842 | if (pedid != NULL) { | 1841 | if (pedid != NULL) { |
1843 | par->EDID = pedid; | 1842 | par->EDID = pedid; |
1844 | NVTRACE("LCD found.\n"); | 1843 | NVTRACE("LCD found.\n"); |