aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:50:19 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:50:19 -0400
commitdf6d3916f3b7b7e2067567a256dd4f0c1ea854a2 (patch)
tree0fdeab1ab5d566605fc99aeb5ea3f621f11e7608 /drivers
parent74add80cbd7fe246c893b93ee75ac59acdd01dd4 (diff)
parent197686dfe0038fd190326d118b743ff65ad20c0e (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (77 commits) [POWERPC] Abolish powerpc_flash_init() [POWERPC] Early serial debug support for PPC44x [POWERPC] Support for the Ebony 440GP reference board in arch/powerpc [POWERPC] Add device tree for Ebony [POWERPC] Add powerpc/platforms/44x, disable platforms/4xx for now [POWERPC] MPIC U3/U4 MSI backend [POWERPC] MPIC MSI allocator [POWERPC] Enable MSI mappings for MPIC [POWERPC] Tell Phyp we support MSI [POWERPC] RTAS MSI implementation [POWERPC] PowerPC MSI infrastructure [POWERPC] Rip out the existing powerpc msi stubs [POWERPC] Remove use of 4level-fixup.h for ppc32 [POWERPC] Add powerpc PCI-E reset API implementation [POWERPC] Holly bootwrapper [POWERPC] Holly DTS [POWERPC] Holly defconfig [POWERPC] Add support for 750CL Holly board [POWERPC] Generalize tsi108 PCI setup [POWERPC] Generalize tsi108 PHY types ... Fixed conflict in include/asm-powerpc/kdebug.h manually Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/sata_svw.c2
-rw-r--r--drivers/char/agp/uninorth-agp.c2
-rw-r--r--drivers/char/briq_panel.c2
-rw-r--r--drivers/char/hvc_iseries.c2
-rw-r--r--drivers/char/hvc_vio.c2
-rw-r--r--drivers/char/tpm/tpm_atmel.h4
-rw-r--r--drivers/hwmon/ams/ams-core.c6
-rw-r--r--drivers/hwmon/ams/ams-i2c.c2
-rw-r--r--drivers/hwmon/ams/ams-pmu.c2
-rw-r--r--drivers/ide/pci/pdc202xx_new.c2
-rw-r--r--drivers/ide/ppc/pmac.c18
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c2
-rw-r--r--drivers/macintosh/Kconfig12
-rw-r--r--drivers/macintosh/apm_emu.c521
-rw-r--r--drivers/macintosh/mac_hid.c8
-rw-r--r--drivers/macintosh/macio_sysfs.c27
-rw-r--r--drivers/macintosh/smu.c2
-rw-r--r--drivers/macintosh/therm_adt746x.c4
-rw-r--r--drivers/macintosh/via-pmu-led.c35
-rw-r--r--drivers/macintosh/via-pmu.c12
-rw-r--r--drivers/macintosh/windfarm_lm75_sensor.c4
-rw-r--r--drivers/macintosh/windfarm_max6690_sensor.c2
-rw-r--r--drivers/macintosh/windfarm_smu_controls.c2
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c2
-rw-r--r--drivers/mtd/maps/physmap_of.c8
-rw-r--r--drivers/net/bmac.c5
-rw-r--r--drivers/net/ehea/ehea_main.c13
-rw-r--r--drivers/net/mace.c4
-rw-r--r--drivers/net/pasemi_mac.c2
-rw-r--r--drivers/net/spider_net.c4
-rw-r--r--drivers/net/sungem.c2
-rw-r--r--drivers/net/sungem_phy.c2
-rw-r--r--drivers/net/tsi108_eth.c12
-rw-r--r--drivers/net/tsi108_eth.h9
-rw-r--r--drivers/net/ucc_geth.c18
-rw-r--r--drivers/net/ucc_geth_mii.c4
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c10
-rw-r--r--drivers/ps3/vuart.c8
-rw-r--r--drivers/scsi/ibmvscsi/ibmvstgt.c8
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c4
-rw-r--r--drivers/scsi/mac53c94.c2
-rw-r--r--drivers/scsi/mesh.c2
-rw-r--r--drivers/serial/mpc52xx_uart.c7
-rw-r--r--drivers/serial/of_serial.c4
-rw-r--r--drivers/serial/pmac_zilog.c8
-rw-r--r--drivers/usb/host/ehci-ps3.c4
-rw-r--r--drivers/usb/host/ohci-ppc-of.c4
-rw-r--r--drivers/usb/host/ohci-ps3.c4
-rw-r--r--drivers/video/aty/radeon_base.c6
-rw-r--r--drivers/video/aty/radeon_monitor.c11
-rw-r--r--drivers/video/aty/radeon_pm.c2
-rw-r--r--drivers/video/nvidia/nv_of.c8
-rw-r--r--drivers/video/offb.c32
-rw-r--r--drivers/video/ps3fb.c12
-rw-r--r--drivers/video/riva/fbdev.c4
55 files changed, 213 insertions, 687 deletions
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index cc07aac10e8c..17246734fe76 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -288,7 +288,7 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
288 /* Match it to a port node */ 288 /* Match it to a port node */
289 index = (ap == ap->host->ports[0]) ? 0 : 1; 289 index = (ap == ap->host->ports[0]) ? 0 : 1;
290 for (np = np->child; np != NULL; np = np->sibling) { 290 for (np = np->child; np != NULL; np = np->sibling) {
291 const u32 *reg = get_property(np, "reg", NULL); 291 const u32 *reg = of_get_property(np, "reg", NULL);
292 if (!reg) 292 if (!reg)
293 continue; 293 continue;
294 if (index == *reg) 294 if (index == *reg)
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 91b062126a68..42c0a600b1ac 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -613,7 +613,7 @@ static int __devinit agp_uninorth_probe(struct pci_dev *pdev,
613 uninorth_node = of_find_node_by_name(NULL, "u3"); 613 uninorth_node = of_find_node_by_name(NULL, "u3");
614 } 614 }
615 if (uninorth_node) { 615 if (uninorth_node) {
616 const int *revprop = get_property(uninorth_node, 616 const int *revprop = of_get_property(uninorth_node,
617 "device-rev", NULL); 617 "device-rev", NULL);
618 if (revprop != NULL) 618 if (revprop != NULL)
619 uninorth_rev = *revprop & 0x3f; 619 uninorth_rev = *revprop & 0x3f;
diff --git a/drivers/char/briq_panel.c b/drivers/char/briq_panel.c
index c70d52ace8b2..ed53f541d9e8 100644
--- a/drivers/char/briq_panel.c
+++ b/drivers/char/briq_panel.c
@@ -206,7 +206,7 @@ static int __init briq_panel_init(void)
206 const char *machine; 206 const char *machine;
207 int i; 207 int i;
208 208
209 machine = get_property(root, "model", NULL); 209 machine = of_get_property(root, "model", NULL);
210 if (!machine || strncmp(machine, "TotalImpact,BRIQ-1", 18) != 0) { 210 if (!machine || strncmp(machine, "TotalImpact,BRIQ-1", 18) != 0) {
211 of_node_put(root); 211 of_node_put(root);
212 return -ENODEV; 212 return -ENODEV;
diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c
index ec420fe8a908..b37f1d5a5be6 100644
--- a/drivers/char/hvc_iseries.c
+++ b/drivers/char/hvc_iseries.c
@@ -579,7 +579,7 @@ static int hvc_find_vtys(void)
579 if (!vtermno) 579 if (!vtermno)
580 continue; 580 continue;
581 581
582 if (!device_is_compatible(vty, "IBM,iSeries-vty")) 582 if (!of_device_is_compatible(vty, "IBM,iSeries-vty"))
583 continue; 583 continue;
584 584
585 if (num_found == 0) 585 if (num_found == 0)
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c
index 94a542e20efb..79711aa4b41d 100644
--- a/drivers/char/hvc_vio.c
+++ b/drivers/char/hvc_vio.c
@@ -157,7 +157,7 @@ static int hvc_find_vtys(void)
157 if (!vtermno) 157 if (!vtermno)
158 continue; 158 continue;
159 159
160 if (device_is_compatible(vty, "hvterm1")) { 160 if (of_device_is_compatible(vty, "hvterm1")) {
161 hvc_instantiate(*vtermno, num_found, &hvc_get_put_ops); 161 hvc_instantiate(*vtermno, num_found, &hvc_get_put_ops);
162 ++num_found; 162 ++num_found;
163 } 163 }
diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h
index 3c852009196e..c912d8691cbd 100644
--- a/drivers/char/tpm/tpm_atmel.h
+++ b/drivers/char/tpm/tpm_atmel.h
@@ -47,12 +47,12 @@ static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size)
47 if (!dn) 47 if (!dn)
48 return NULL; 48 return NULL;
49 49
50 if (!device_is_compatible(dn, "AT97SC3201")) { 50 if (!of_device_is_compatible(dn, "AT97SC3201")) {
51 of_node_put(dn); 51 of_node_put(dn);
52 return NULL; 52 return NULL;
53 } 53 }
54 54
55 reg = get_property(dn, "reg", &reglen); 55 reg = of_get_property(dn, "reg", &reglen);
56 naddrc = of_n_addr_cells(dn); 56 naddrc = of_n_addr_cells(dn);
57 nsizec = of_n_size_cells(dn); 57 nsizec = of_n_size_cells(dn);
58 58
diff --git a/drivers/hwmon/ams/ams-core.c b/drivers/hwmon/ams/ams-core.c
index f5ebad561412..dbe6a32c064e 100644
--- a/drivers/hwmon/ams/ams-core.c
+++ b/drivers/hwmon/ams/ams-core.c
@@ -144,7 +144,7 @@ int ams_sensor_attach(void)
144 const u32 *prop; 144 const u32 *prop;
145 145
146 /* Get orientation */ 146 /* Get orientation */
147 prop = get_property(ams_info.of_node, "orientation", NULL); 147 prop = of_get_property(ams_info.of_node, "orientation", NULL);
148 if (!prop) 148 if (!prop)
149 return -ENODEV; 149 return -ENODEV;
150 ams_info.orient1 = *prop; 150 ams_info.orient1 = *prop;
@@ -208,14 +208,14 @@ int __init ams_init(void)
208 208
209#ifdef CONFIG_SENSORS_AMS_I2C 209#ifdef CONFIG_SENSORS_AMS_I2C
210 np = of_find_node_by_name(NULL, "accelerometer"); 210 np = of_find_node_by_name(NULL, "accelerometer");
211 if (np && device_is_compatible(np, "AAPL,accelerometer_1")) 211 if (np && of_device_is_compatible(np, "AAPL,accelerometer_1"))
212 /* Found I2C motion sensor */ 212 /* Found I2C motion sensor */
213 return ams_i2c_init(np); 213 return ams_i2c_init(np);
214#endif 214#endif
215 215
216#ifdef CONFIG_SENSORS_AMS_PMU 216#ifdef CONFIG_SENSORS_AMS_PMU
217 np = of_find_node_by_name(NULL, "sms"); 217 np = of_find_node_by_name(NULL, "sms");
218 if (np && device_is_compatible(np, "sms")) 218 if (np && of_device_is_compatible(np, "sms"))
219 /* Found PMU motion sensor */ 219 /* Found PMU motion sensor */
220 return ams_pmu_init(np); 220 return ams_pmu_init(np);
221#endif 221#endif
diff --git a/drivers/hwmon/ams/ams-i2c.c b/drivers/hwmon/ams/ams-i2c.c
index 485d333bcb3e..ccd5cefae90e 100644
--- a/drivers/hwmon/ams/ams-i2c.c
+++ b/drivers/hwmon/ams/ams-i2c.c
@@ -276,7 +276,7 @@ int __init ams_i2c_init(struct device_node *np)
276 ams_info.bustype = BUS_I2C; 276 ams_info.bustype = BUS_I2C;
277 277
278 /* look for bus either using "reg" or by path */ 278 /* look for bus either using "reg" or by path */
279 prop = get_property(ams_info.of_node, "reg", NULL); 279 prop = of_get_property(ams_info.of_node, "reg", NULL);
280 if (!prop) { 280 if (!prop) {
281 result = -ENODEV; 281 result = -ENODEV;
282 282
diff --git a/drivers/hwmon/ams/ams-pmu.c b/drivers/hwmon/ams/ams-pmu.c
index 1b01c215bfe7..9463e9768f6f 100644
--- a/drivers/hwmon/ams/ams-pmu.c
+++ b/drivers/hwmon/ams/ams-pmu.c
@@ -160,7 +160,7 @@ int __init ams_pmu_init(struct device_node *np)
160 ams_info.bustype = BUS_HOST; 160 ams_info.bustype = BUS_HOST;
161 161
162 /* Get PMU command, should be 0x4e, but we can never know */ 162 /* Get PMU command, should be 0x4e, but we can never know */
163 prop = get_property(ams_info.of_node, "reg", NULL); 163 prop = of_get_property(ams_info.of_node, "reg", NULL);
164 if (!prop) { 164 if (!prop) {
165 result = -ENODEV; 165 result = -ENODEV;
166 goto exit; 166 goto exit;
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 2da5cbb53566..2cdd629c653d 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -395,7 +395,7 @@ static void __devinit apple_kiwi_init(struct pci_dev *pdev)
395 unsigned int class_rev = 0; 395 unsigned int class_rev = 0;
396 u8 conf; 396 u8 conf;
397 397
398 if (np == NULL || !device_is_compatible(np, "kiwi-root")) 398 if (np == NULL || !of_device_is_compatible(np, "kiwi-root"))
399 return; 399 return;
400 400
401 pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev); 401 pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev);
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 071a030ec26e..a49ebe44babd 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1157,32 +1157,32 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1157 1157
1158 pmif->cable_80 = 0; 1158 pmif->cable_80 = 0;
1159 pmif->broken_dma = pmif->broken_dma_warn = 0; 1159 pmif->broken_dma = pmif->broken_dma_warn = 0;
1160 if (device_is_compatible(np, "shasta-ata")) 1160 if (of_device_is_compatible(np, "shasta-ata"))
1161 pmif->kind = controller_sh_ata6; 1161 pmif->kind = controller_sh_ata6;
1162 else if (device_is_compatible(np, "kauai-ata")) 1162 else if (of_device_is_compatible(np, "kauai-ata"))
1163 pmif->kind = controller_un_ata6; 1163 pmif->kind = controller_un_ata6;
1164 else if (device_is_compatible(np, "K2-UATA")) 1164 else if (of_device_is_compatible(np, "K2-UATA"))
1165 pmif->kind = controller_k2_ata6; 1165 pmif->kind = controller_k2_ata6;
1166 else if (device_is_compatible(np, "keylargo-ata")) { 1166 else if (of_device_is_compatible(np, "keylargo-ata")) {
1167 if (strcmp(np->name, "ata-4") == 0) 1167 if (strcmp(np->name, "ata-4") == 0)
1168 pmif->kind = controller_kl_ata4; 1168 pmif->kind = controller_kl_ata4;
1169 else 1169 else
1170 pmif->kind = controller_kl_ata3; 1170 pmif->kind = controller_kl_ata3;
1171 } else if (device_is_compatible(np, "heathrow-ata")) 1171 } else if (of_device_is_compatible(np, "heathrow-ata"))
1172 pmif->kind = controller_heathrow; 1172 pmif->kind = controller_heathrow;
1173 else { 1173 else {
1174 pmif->kind = controller_ohare; 1174 pmif->kind = controller_ohare;
1175 pmif->broken_dma = 1; 1175 pmif->broken_dma = 1;
1176 } 1176 }
1177 1177
1178 bidp = get_property(np, "AAPL,bus-id", NULL); 1178 bidp = of_get_property(np, "AAPL,bus-id", NULL);
1179 pmif->aapl_bus_id = bidp ? *bidp : 0; 1179 pmif->aapl_bus_id = bidp ? *bidp : 0;
1180 1180
1181 /* Get cable type from device-tree */ 1181 /* Get cable type from device-tree */
1182 if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6 1182 if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6
1183 || pmif->kind == controller_k2_ata6 1183 || pmif->kind == controller_k2_ata6
1184 || pmif->kind == controller_sh_ata6) { 1184 || pmif->kind == controller_sh_ata6) {
1185 const char* cable = get_property(np, "cable-type", NULL); 1185 const char* cable = of_get_property(np, "cable-type", NULL);
1186 if (cable && !strncmp(cable, "80-", 3)) 1186 if (cable && !strncmp(cable, "80-", 3))
1187 pmif->cable_80 = 1; 1187 pmif->cable_80 = 1;
1188 } 1188 }
@@ -1190,8 +1190,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1190 * they have a 80 conductor cable, this seem to be always the case unless 1190 * they have a 80 conductor cable, this seem to be always the case unless
1191 * the user mucked around 1191 * the user mucked around
1192 */ 1192 */
1193 if (device_is_compatible(np, "K2-UATA") || 1193 if (of_device_is_compatible(np, "K2-UATA") ||
1194 device_is_compatible(np, "shasta-ata")) 1194 of_device_is_compatible(np, "shasta-ata"))
1195 pmif->cable_80 = 1; 1195 pmif->cable_80 = 1;
1196 1196
1197 /* On Kauai-type controllers, we make sure the FCR is correct */ 1197 /* On Kauai-type controllers, we make sure the FCR is correct */
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 2d370543e96d..fe90e7454560 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -570,7 +570,7 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
570 struct ib_pd *ibpd; 570 struct ib_pd *ibpd;
571 int ret; 571 int ret;
572 572
573 handle = get_property(dev->ofdev.node, "ibm,hca-handle", NULL); 573 handle = of_get_property(dev->ofdev.node, "ibm,hca-handle", NULL);
574 if (!handle) { 574 if (!handle) {
575 ehca_gen_err("Cannot get eHCA handle for adapter: %s.", 575 ehca_gen_err("Cannot get eHCA handle for adapter: %s.",
576 dev->ofdev.node->full_name); 576 dev->ofdev.node->full_name);
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index 1a86387e23be..a32c91e27b3c 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -1,6 +1,10 @@
1 1
2menu "Macintosh device drivers" 2menuconfig MACINTOSH_DRIVERS
3 bool "Macintosh device drivers"
3 depends on PPC || MAC || X86 4 depends on PPC || MAC || X86
5 default y
6
7if MACINTOSH_DRIVERS
4 8
5config ADB 9config ADB
6 bool "Apple Desktop Bus (ADB) support" 10 bool "Apple Desktop Bus (ADB) support"
@@ -109,7 +113,9 @@ config PMAC_SMU
109 113
110config PMAC_APM_EMU 114config PMAC_APM_EMU
111 tristate "APM emulation" 115 tristate "APM emulation"
112 depends on PPC_PMAC && PPC32 && PM && ADB_PMU 116 select SYS_SUPPORTS_APM_EMULATION
117 select APM_EMULATION
118 depends on ADB_PMU && PM
113 119
114config PMAC_MEDIABAY 120config PMAC_MEDIABAY
115 bool "Support PowerBook hotswap media bay" 121 bool "Support PowerBook hotswap media bay"
@@ -234,4 +240,4 @@ config PMAC_RACKMETER
234 This driver procides some support to control the front panel 240 This driver procides some support to control the front panel
235 blue LEDs "vu-meter" of the XServer macs. 241 blue LEDs "vu-meter" of the XServer macs.
236 242
237endmenu 243endif # MACINTOSH_DRIVERS
diff --git a/drivers/macintosh/apm_emu.c b/drivers/macintosh/apm_emu.c
index cdb0bead9917..9821e6361e60 100644
--- a/drivers/macintosh/apm_emu.c
+++ b/drivers/macintosh/apm_emu.c
@@ -1,9 +1,7 @@
1/* APM emulation layer for PowerMac 1/*
2 * 2 * APM emulation for PMU-based machines
3 * Copyright 2001 Benjamin Herrenschmidt (benh@kernel.crashing.org)
4 * 3 *
5 * Lots of code inherited from apm.c, see appropriate notice in 4 * Copyright 2001 Benjamin Herrenschmidt (benh@kernel.crashing.org)
6 * arch/i386/kernel/apm.c
7 * 5 *
8 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -18,429 +16,39 @@
18 * 16 *
19 */ 17 */
20 18
21#include <linux/module.h>
22
23#include <linux/poll.h>
24#include <linux/types.h>
25#include <linux/stddef.h>
26#include <linux/timer.h>
27#include <linux/fcntl.h>
28#include <linux/slab.h>
29#include <linux/stat.h>
30#include <linux/proc_fs.h>
31#include <linux/miscdevice.h>
32#include <linux/apm_bios.h>
33#include <linux/init.h>
34#include <linux/sched.h>
35#include <linux/pm.h>
36#include <linux/kernel.h> 19#include <linux/kernel.h>
37#include <linux/smp_lock.h> 20#include <linux/module.h>
38 21#include <linux/apm-emulation.h>
39#include <linux/adb.h> 22#include <linux/adb.h>
40#include <linux/pmu.h> 23#include <linux/pmu.h>
41 24
42#include <asm/system.h>
43#include <asm/uaccess.h>
44#include <asm/machdep.h>
45
46#undef DEBUG
47
48#ifdef DEBUG
49#define DBG(args...) printk(KERN_DEBUG args)
50//#define DBG(args...) xmon_printf(args)
51#else
52#define DBG(args...) do { } while (0)
53#endif
54
55/*
56 * The apm_bios device is one of the misc char devices.
57 * This is its minor number.
58 */
59#define APM_MINOR_DEV 134
60
61/*
62 * Maximum number of events stored
63 */
64#define APM_MAX_EVENTS 20
65
66#define FAKE_APM_BIOS_VERSION 0x0101
67
68#define APM_USER_NOTIFY_TIMEOUT (5*HZ)
69
70/*
71 * The per-file APM data
72 */
73struct apm_user {
74 int magic;
75 struct apm_user * next;
76 int suser: 1;
77 int suspend_waiting: 1;
78 int suspends_pending;
79 int suspends_read;
80 int event_head;
81 int event_tail;
82 apm_event_t events[APM_MAX_EVENTS];
83};
84
85/*
86 * The magic number in apm_user
87 */
88#define APM_BIOS_MAGIC 0x4101
89
90/*
91 * Local variables
92 */
93static int suspends_pending;
94
95static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
96static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
97static struct apm_user * user_list;
98
99static void apm_notify_sleep(struct pmu_sleep_notifier *self, int when);
100static struct pmu_sleep_notifier apm_sleep_notifier = {
101 apm_notify_sleep,
102 SLEEP_LEVEL_USERLAND,
103};
104
105static const char driver_version[] = "0.5"; /* no spaces */
106
107#ifdef DEBUG
108static char * apm_event_name[] = {
109 "system standby",
110 "system suspend",
111 "normal resume",
112 "critical resume",
113 "low battery",
114 "power status change",
115 "update time",
116 "critical suspend",
117 "user standby",
118 "user suspend",
119 "system standby resume",
120 "capabilities change"
121};
122#define NR_APM_EVENT_NAME \
123 (sizeof(apm_event_name) / sizeof(apm_event_name[0]))
124
125#endif
126
127static int queue_empty(struct apm_user *as)
128{
129 return as->event_head == as->event_tail;
130}
131
132static apm_event_t get_queued_event(struct apm_user *as)
133{
134 as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS;
135 return as->events[as->event_tail];
136}
137
138static void queue_event(apm_event_t event, struct apm_user *sender)
139{
140 struct apm_user * as;
141
142 DBG("apm_emu: queue_event(%s)\n", apm_event_name[event-1]);
143 if (user_list == NULL)
144 return;
145 for (as = user_list; as != NULL; as = as->next) {
146 if (as == sender)
147 continue;
148 as->event_head = (as->event_head + 1) % APM_MAX_EVENTS;
149 if (as->event_head == as->event_tail) {
150 static int notified;
151
152 if (notified++ == 0)
153 printk(KERN_ERR "apm_emu: an event queue overflowed\n");
154 as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS;
155 }
156 as->events[as->event_head] = event;
157 if (!as->suser)
158 continue;
159 switch (event) {
160 case APM_SYS_SUSPEND:
161 case APM_USER_SUSPEND:
162 as->suspends_pending++;
163 suspends_pending++;
164 break;
165 case APM_NORMAL_RESUME:
166 as->suspend_waiting = 0;
167 break;
168 }
169 }
170 wake_up_interruptible(&apm_waitqueue);
171}
172
173static int check_apm_user(struct apm_user *as, const char *func)
174{
175 if ((as == NULL) || (as->magic != APM_BIOS_MAGIC)) {
176 printk(KERN_ERR "apm_emu: %s passed bad filp\n", func);
177 return 1;
178 }
179 return 0;
180}
181
182static ssize_t do_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos)
183{
184 struct apm_user * as;
185 size_t i;
186 apm_event_t event;
187 DECLARE_WAITQUEUE(wait, current);
188
189 as = fp->private_data;
190 if (check_apm_user(as, "read"))
191 return -EIO;
192 if (count < sizeof(apm_event_t))
193 return -EINVAL;
194 if (queue_empty(as)) {
195 if (fp->f_flags & O_NONBLOCK)
196 return -EAGAIN;
197 add_wait_queue(&apm_waitqueue, &wait);
198repeat:
199 set_current_state(TASK_INTERRUPTIBLE);
200 if (queue_empty(as) && !signal_pending(current)) {
201 schedule();
202 goto repeat;
203 }
204 set_current_state(TASK_RUNNING);
205 remove_wait_queue(&apm_waitqueue, &wait);
206 }
207 i = count;
208 while ((i >= sizeof(event)) && !queue_empty(as)) {
209 event = get_queued_event(as);
210 DBG("apm_emu: do_read, returning: %s\n", apm_event_name[event-1]);
211 if (copy_to_user(buf, &event, sizeof(event))) {
212 if (i < count)
213 break;
214 return -EFAULT;
215 }
216 switch (event) {
217 case APM_SYS_SUSPEND:
218 case APM_USER_SUSPEND:
219 as->suspends_read++;
220 break;
221 }
222 buf += sizeof(event);
223 i -= sizeof(event);
224 }
225 if (i < count)
226 return count - i;
227 if (signal_pending(current))
228 return -ERESTARTSYS;
229 return 0;
230}
231
232static unsigned int do_poll(struct file *fp, poll_table * wait)
233{
234 struct apm_user * as;
235
236 as = fp->private_data;
237 if (check_apm_user(as, "poll"))
238 return 0;
239 poll_wait(fp, &apm_waitqueue, wait);
240 if (!queue_empty(as))
241 return POLLIN | POLLRDNORM;
242 return 0;
243}
244
245static int do_ioctl(struct inode * inode, struct file *filp,
246 u_int cmd, u_long arg)
247{
248 struct apm_user * as;
249 DECLARE_WAITQUEUE(wait, current);
250
251 as = filp->private_data;
252 if (check_apm_user(as, "ioctl"))
253 return -EIO;
254 if (!as->suser)
255 return -EPERM;
256 switch (cmd) {
257 case APM_IOC_SUSPEND:
258 /* If a suspend message was sent to userland, we
259 * consider this as a confirmation message
260 */
261 if (as->suspends_read > 0) {
262 as->suspends_read--;
263 as->suspends_pending--;
264 suspends_pending--;
265 } else {
266 // Route to PMU suspend ?
267 break;
268 }
269 as->suspend_waiting = 1;
270 add_wait_queue(&apm_waitqueue, &wait);
271 DBG("apm_emu: ioctl waking up sleep waiter !\n");
272 wake_up(&apm_suspend_waitqueue);
273 mb();
274 while(as->suspend_waiting && !signal_pending(current)) {
275 set_current_state(TASK_INTERRUPTIBLE);
276 schedule();
277 }
278 set_current_state(TASK_RUNNING);
279 remove_wait_queue(&apm_waitqueue, &wait);
280 break;
281 default:
282 return -EINVAL;
283 }
284 return 0;
285}
286
287static int do_release(struct inode * inode, struct file * filp)
288{
289 struct apm_user * as;
290
291 as = filp->private_data;
292 if (check_apm_user(as, "release"))
293 return 0;
294 filp->private_data = NULL;
295 lock_kernel();
296 if (as->suspends_pending > 0) {
297 suspends_pending -= as->suspends_pending;
298 if (suspends_pending <= 0)
299 wake_up(&apm_suspend_waitqueue);
300 }
301 if (user_list == as)
302 user_list = as->next;
303 else {
304 struct apm_user * as1;
305
306 for (as1 = user_list;
307 (as1 != NULL) && (as1->next != as);
308 as1 = as1->next)
309 ;
310 if (as1 == NULL)
311 printk(KERN_ERR "apm: filp not in user list\n");
312 else
313 as1->next = as->next;
314 }
315 unlock_kernel();
316 kfree(as);
317 return 0;
318}
319
320static int do_open(struct inode * inode, struct file * filp)
321{
322 struct apm_user * as;
323
324 as = kmalloc(sizeof(*as), GFP_KERNEL);
325 if (as == NULL) {
326 printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n",
327 sizeof(*as));
328 return -ENOMEM;
329 }
330 as->magic = APM_BIOS_MAGIC;
331 as->event_tail = as->event_head = 0;
332 as->suspends_pending = 0;
333 as->suspends_read = 0;
334 /*
335 * XXX - this is a tiny bit broken, when we consider BSD
336 * process accounting. If the device is opened by root, we
337 * instantly flag that we used superuser privs. Who knows,
338 * we might close the device immediately without doing a
339 * privileged operation -- cevans
340 */
341 as->suser = capable(CAP_SYS_ADMIN);
342 as->next = user_list;
343 user_list = as;
344 filp->private_data = as;
345
346 DBG("apm_emu: opened by %s, suser: %d\n", current->comm, (int)as->suser);
347
348 return 0;
349}
350
351/* Wait for all clients to ack the suspend request. APM API
352 * doesn't provide a way to NAK, but this could be added
353 * here.
354 */
355static void wait_all_suspend(void)
356{
357 DECLARE_WAITQUEUE(wait, current);
358
359 add_wait_queue(&apm_suspend_waitqueue, &wait);
360 DBG("apm_emu: wait_all_suspend(), suspends_pending: %d\n", suspends_pending);
361 while(suspends_pending > 0) {
362 set_current_state(TASK_UNINTERRUPTIBLE);
363 schedule();
364 }
365 set_current_state(TASK_RUNNING);
366 remove_wait_queue(&apm_suspend_waitqueue, &wait);
367
368 DBG("apm_emu: wait_all_suspend() - complete !\n");
369}
370
371static void apm_notify_sleep(struct pmu_sleep_notifier *self, int when)
372{
373 switch(when) {
374 case PBOOK_SLEEP_REQUEST:
375 queue_event(APM_SYS_SUSPEND, NULL);
376 wait_all_suspend();
377 break;
378 case PBOOK_WAKE:
379 queue_event(APM_NORMAL_RESUME, NULL);
380 break;
381 }
382}
383
384#define APM_CRITICAL 10 25#define APM_CRITICAL 10
385#define APM_LOW 30 26#define APM_LOW 30
386 27
387static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length) 28static void pmu_apm_get_power_status(struct apm_power_info *info)
388{ 29{
389 /* Arguments, with symbols from linux/apm_bios.h. Information is 30 int percentage = -1;
390 from the Get Power Status (0x0a) call unless otherwise noted. 31 int batteries = 0;
32 int time_units = -1;
33 int real_count = 0;
34 int i;
35 char charging = 0;
36 long charge = -1;
37 long amperage = 0;
38 unsigned long btype = 0;
39
40 info->battery_status = APM_BATTERY_STATUS_UNKNOWN;
41 info->battery_flag = APM_BATTERY_FLAG_UNKNOWN;
42 info->units = APM_UNITS_MINS;
43
44 if (pmu_power_flags & PMU_PWR_AC_PRESENT)
45 info->ac_line_status = APM_AC_ONLINE;
46 else
47 info->ac_line_status = APM_AC_OFFLINE;
391 48
392 0) Linux driver version (this will change if format changes)
393 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2.
394 2) APM flags from APM Installation Check (0x00):
395 bit 0: APM_16_BIT_SUPPORT
396 bit 1: APM_32_BIT_SUPPORT
397 bit 2: APM_IDLE_SLOWS_CLOCK
398 bit 3: APM_BIOS_DISABLED
399 bit 4: APM_BIOS_DISENGAGED
400 3) AC line status
401 0x00: Off-line
402 0x01: On-line
403 0x02: On backup power (BIOS >= 1.1 only)
404 0xff: Unknown
405 4) Battery status
406 0x00: High
407 0x01: Low
408 0x02: Critical
409 0x03: Charging
410 0x04: Selected battery not present (BIOS >= 1.2 only)
411 0xff: Unknown
412 5) Battery flag
413 bit 0: High
414 bit 1: Low
415 bit 2: Critical
416 bit 3: Charging
417 bit 7: No system battery
418 0xff: Unknown
419 6) Remaining battery life (percentage of charge):
420 0-100: valid
421 -1: Unknown
422 7) Remaining battery life (time units):
423 Number of remaining minutes or seconds
424 -1: Unknown
425 8) min = minutes; sec = seconds */
426
427 unsigned short ac_line_status;
428 unsigned short battery_status = 0;
429 unsigned short battery_flag = 0xff;
430 int percentage = -1;
431 int time_units = -1;
432 int real_count = 0;
433 int i;
434 char * p = buf;
435 char charging = 0;
436 long charge = -1;
437 long amperage = 0;
438 unsigned long btype = 0;
439
440 ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0);
441 for (i=0; i<pmu_battery_count; i++) { 49 for (i=0; i<pmu_battery_count; i++) {
442 if (pmu_batteries[i].flags & PMU_BATT_PRESENT) { 50 if (pmu_batteries[i].flags & PMU_BATT_PRESENT) {
443 battery_status++; 51 batteries++;
444 if (percentage < 0) 52 if (percentage < 0)
445 percentage = 0; 53 percentage = 0;
446 if (charge < 0) 54 if (charge < 0)
@@ -456,9 +64,9 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length)
456 charging++; 64 charging++;
457 } 65 }
458 } 66 }
459 if (0 == battery_status) 67 if (batteries == 0)
460 ac_line_status = 1; 68 info->ac_line_status = APM_AC_ONLINE;
461 battery_status = 0xff; 69
462 if (real_count) { 70 if (real_count) {
463 if (amperage < 0) { 71 if (amperage < 0) {
464 if (btype == PMU_BATT_TYPE_SMART) 72 if (btype == PMU_BATT_TYPE_SMART)
@@ -468,85 +76,44 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length)
468 } 76 }
469 percentage /= real_count; 77 percentage /= real_count;
470 if (charging > 0) { 78 if (charging > 0) {
471 battery_status = 0x03; 79 info->battery_status = APM_BATTERY_STATUS_CHARGING;
472 battery_flag = 0x08; 80 info->battery_flag = APM_BATTERY_FLAG_CHARGING;
473 } else if (percentage <= APM_CRITICAL) { 81 } else if (percentage <= APM_CRITICAL) {
474 battery_status = 0x02; 82 info->battery_status = APM_BATTERY_STATUS_CRITICAL;
475 battery_flag = 0x04; 83 info->battery_flag = APM_BATTERY_FLAG_CRITICAL;
476 } else if (percentage <= APM_LOW) { 84 } else if (percentage <= APM_LOW) {
477 battery_status = 0x01; 85 info->battery_status = APM_BATTERY_STATUS_LOW;
478 battery_flag = 0x02; 86 info->battery_flag = APM_BATTERY_FLAG_LOW;
479 } else { 87 } else {
480 battery_status = 0x00; 88 info->battery_status = APM_BATTERY_STATUS_HIGH;
481 battery_flag = 0x01; 89 info->battery_flag = APM_BATTERY_FLAG_HIGH;
482 } 90 }
483 } 91 }
484 p += sprintf(p, "%s %d.%d 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n",
485 driver_version,
486 (FAKE_APM_BIOS_VERSION >> 8) & 0xff,
487 FAKE_APM_BIOS_VERSION & 0xff,
488 0,
489 ac_line_status,
490 battery_status,
491 battery_flag,
492 percentage,
493 time_units,
494 "min");
495 92
496 return p - buf; 93 info->battery_life = percentage;
94 info->time = time_units;
497} 95}
498 96
499static const struct file_operations apm_bios_fops = {
500 .owner = THIS_MODULE,
501 .read = do_read,
502 .poll = do_poll,
503 .ioctl = do_ioctl,
504 .open = do_open,
505 .release = do_release,
506};
507
508static struct miscdevice apm_device = {
509 APM_MINOR_DEV,
510 "apm_bios",
511 &apm_bios_fops
512};
513
514static int __init apm_emu_init(void) 97static int __init apm_emu_init(void)
515{ 98{
516 struct proc_dir_entry *apm_proc; 99 apm_get_power_status = pmu_apm_get_power_status;
517
518 if (sys_ctrler != SYS_CTRLER_PMU) {
519 printk(KERN_INFO "apm_emu: Requires a machine with a PMU.\n");
520 return -ENODEV;
521 }
522
523 apm_proc = create_proc_info_entry("apm", 0, NULL, apm_emu_get_info);
524 if (apm_proc)
525 apm_proc->owner = THIS_MODULE;
526 100
527 if (misc_register(&apm_device) != 0) 101 printk(KERN_INFO "apm_emu: PMU APM Emulation initialized.\n");
528 printk(KERN_INFO "Could not create misc. device for apm\n");
529
530 pmu_register_sleep_notifier(&apm_sleep_notifier);
531
532 printk(KERN_INFO "apm_emu: APM Emulation %s initialized.\n", driver_version);
533 102
534 return 0; 103 return 0;
535} 104}
536 105
537static void __exit apm_emu_exit(void) 106static void __exit apm_emu_exit(void)
538{ 107{
539 pmu_unregister_sleep_notifier(&apm_sleep_notifier); 108 if (apm_get_power_status == pmu_apm_get_power_status)
540 misc_deregister(&apm_device); 109 apm_get_power_status = NULL;
541 remove_proc_entry("apm", NULL);
542 110
543 printk(KERN_INFO "apm_emu: APM Emulation removed.\n"); 111 printk(KERN_INFO "apm_emu: PMU APM Emulation removed.\n");
544} 112}
545 113
546module_init(apm_emu_init); 114module_init(apm_emu_init);
547module_exit(apm_emu_exit); 115module_exit(apm_emu_exit);
548 116
549MODULE_AUTHOR("Benjamin Herrenschmidt"); 117MODULE_AUTHOR("Benjamin Herrenschmidt");
550MODULE_DESCRIPTION("APM emulation layer for PowerMac"); 118MODULE_DESCRIPTION("APM emulation for PowerMac");
551MODULE_LICENSE("GPL"); 119MODULE_LICENSE("GPL");
552
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index 1599dc34f15f..76c1e8e4a487 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -24,7 +24,7 @@ static int mouse_last_keycode;
24 24
25#if defined(CONFIG_SYSCTL) 25#if defined(CONFIG_SYSCTL)
26/* file(s) in /proc/sys/dev/mac_hid */ 26/* file(s) in /proc/sys/dev/mac_hid */
27ctl_table mac_hid_files[] = { 27static ctl_table mac_hid_files[] = {
28 { 28 {
29 .ctl_name = DEV_MAC_HID_MOUSE_BUTTON_EMULATION, 29 .ctl_name = DEV_MAC_HID_MOUSE_BUTTON_EMULATION,
30 .procname = "mouse_button_emulation", 30 .procname = "mouse_button_emulation",
@@ -53,7 +53,7 @@ ctl_table mac_hid_files[] = {
53}; 53};
54 54
55/* dir in /proc/sys/dev */ 55/* dir in /proc/sys/dev */
56ctl_table mac_hid_dir[] = { 56static ctl_table mac_hid_dir[] = {
57 { 57 {
58 .ctl_name = DEV_MAC_HID, 58 .ctl_name = DEV_MAC_HID,
59 .procname = "mac_hid", 59 .procname = "mac_hid",
@@ -65,7 +65,7 @@ ctl_table mac_hid_dir[] = {
65}; 65};
66 66
67/* /proc/sys/dev itself, in case that is not there yet */ 67/* /proc/sys/dev itself, in case that is not there yet */
68ctl_table mac_hid_root_dir[] = { 68static ctl_table mac_hid_root_dir[] = {
69 { 69 {
70 .ctl_name = CTL_DEV, 70 .ctl_name = CTL_DEV,
71 .procname = "dev", 71 .procname = "dev",
@@ -127,7 +127,7 @@ static int emumousebtn_input_register(void)
127 return ret; 127 return ret;
128} 128}
129 129
130int __init mac_hid_init(void) 130static int __init mac_hid_init(void)
131{ 131{
132 int err; 132 int err;
133 133
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
index cc8267912656..112e5ef728f1 100644
--- a/drivers/macintosh/macio_sysfs.c
+++ b/drivers/macintosh/macio_sysfs.c
@@ -41,28 +41,15 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
41static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, 41static 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 *ofdev = to_of_device(dev);
45 const char *compat; 45 int len;
46 int cplen;
47 int length;
48 46
49 of = &to_macio_device (dev)->ofdev; 47 len = of_device_get_modalias(ofdev, buf, PAGE_SIZE);
50 compat = of_get_property(of->node, "compatible", &cplen);
51 if (!compat) compat = "", cplen = 1;
52 length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type);
53 buf += length;
54 while (cplen > 0) {
55 int l;
56 l = sprintf (buf, "C%s", compat);
57 length += l;
58 buf += l;
59 l = strlen (compat) + 1;
60 compat += l;
61 cplen -= l;
62 }
63 length += sprintf(buf, "\n");
64 48
65 return length; 49 buf[len] = '\n';
50 buf[len+1] = 0;
51
52 return len+1;
66} 53}
67 54
68macio_config_of_attr (name, "%s\n"); 55macio_config_of_attr (name, "%s\n");
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index a98a328b1cfc..f8e1a135bf9d 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -606,7 +606,7 @@ static void smu_expose_childs(struct work_struct *unused)
606 struct device_node *np; 606 struct device_node *np;
607 607
608 for (np = NULL; (np = of_get_next_child(smu->of_node, np)) != NULL;) 608 for (np = NULL; (np = of_get_next_child(smu->of_node, np)) != NULL;)
609 if (device_is_compatible(np, "smu-sensors")) 609 if (of_device_is_compatible(np, "smu-sensors"))
610 of_platform_device_create(np, "smu-sensors", 610 of_platform_device_create(np, "smu-sensors",
611 &smu->of_dev->dev); 611 &smu->of_dev->dev);
612} 612}
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index 6c3734325f8e..bd55e6ab99fc 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -559,9 +559,9 @@ thermostat_init(void)
559 np = of_find_node_by_name(NULL, "fan"); 559 np = of_find_node_by_name(NULL, "fan");
560 if (!np) 560 if (!np)
561 return -ENODEV; 561 return -ENODEV;
562 if (device_is_compatible(np, "adt7460")) 562 if (of_device_is_compatible(np, "adt7460"))
563 therm_type = ADT7460; 563 therm_type = ADT7460;
564 else if (device_is_compatible(np, "adt7467")) 564 else if (of_device_is_compatible(np, "adt7467"))
565 therm_type = ADT7467; 565 therm_type = ADT7467;
566 else 566 else
567 return -ENODEV; 567 return -ENODEV;
diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c
index fc89a7047cd0..55ad95671387 100644
--- a/drivers/macintosh/via-pmu-led.c
+++ b/drivers/macintosh/via-pmu-led.c
@@ -31,7 +31,6 @@ static spinlock_t pmu_blink_lock;
31static struct adb_request pmu_blink_req; 31static struct adb_request pmu_blink_req;
32/* -1: no change, 0: request off, 1: request on */ 32/* -1: no change, 0: request off, 1: request on */
33static int requested_change; 33static int requested_change;
34static int sleeping;
35 34
36static void pmu_req_done(struct adb_request * req) 35static void pmu_req_done(struct adb_request * req)
37{ 36{
@@ -41,7 +40,7 @@ static void pmu_req_done(struct adb_request * req)
41 /* if someone requested a change in the meantime 40 /* if someone requested a change in the meantime
42 * (we only see the last one which is fine) 41 * (we only see the last one which is fine)
43 * then apply it now */ 42 * then apply it now */
44 if (requested_change != -1 && !sleeping) 43 if (requested_change != -1 && !pmu_sys_suspended)
45 pmu_request(&pmu_blink_req, NULL, 4, 0xee, 4, 0, requested_change); 44 pmu_request(&pmu_blink_req, NULL, 4, 0xee, 4, 0, requested_change);
46 /* reset requested change */ 45 /* reset requested change */
47 requested_change = -1; 46 requested_change = -1;
@@ -66,7 +65,7 @@ static void pmu_led_set(struct led_classdev *led_cdev,
66 break; 65 break;
67 } 66 }
68 /* if request isn't done, then don't do anything */ 67 /* if request isn't done, then don't do anything */
69 if (pmu_blink_req.complete && !sleeping) 68 if (pmu_blink_req.complete && !pmu_sys_suspended)
70 pmu_request(&pmu_blink_req, NULL, 4, 0xee, 4, 0, requested_change); 69 pmu_request(&pmu_blink_req, NULL, 4, 0xee, 4, 0, requested_change);
71 out: 70 out:
72 spin_unlock_irqrestore(&pmu_blink_lock, flags); 71 spin_unlock_irqrestore(&pmu_blink_lock, flags);
@@ -80,32 +79,6 @@ static struct led_classdev pmu_led = {
80 .brightness_set = pmu_led_set, 79 .brightness_set = pmu_led_set,
81}; 80};
82 81
83#ifdef CONFIG_PM
84static void pmu_led_sleep_call(struct pmu_sleep_notifier *self, int when)
85{
86 unsigned long flags;
87
88 spin_lock_irqsave(&pmu_blink_lock, flags);
89
90 switch (when) {
91 case PBOOK_SLEEP_REQUEST:
92 sleeping = 1;
93 break;
94 case PBOOK_WAKE:
95 sleeping = 0;
96 break;
97 default:
98 /* do nothing */
99 break;
100 }
101 spin_unlock_irqrestore(&pmu_blink_lock, flags);
102}
103
104static struct pmu_sleep_notifier via_pmu_led_sleep_notif = {
105 .notifier_call = pmu_led_sleep_call,
106};
107#endif
108
109static int __init via_pmu_led_init(void) 82static int __init via_pmu_led_init(void)
110{ 83{
111 struct device_node *dt; 84 struct device_node *dt;
@@ -135,9 +108,7 @@ static int __init via_pmu_led_init(void)
135 /* no outstanding req */ 108 /* no outstanding req */
136 pmu_blink_req.complete = 1; 109 pmu_blink_req.complete = 1;
137 pmu_blink_req.done = pmu_req_done; 110 pmu_blink_req.done = pmu_req_done;
138#ifdef CONFIG_PM 111
139 pmu_register_sleep_notifier(&via_pmu_led_sleep_notif);
140#endif
141 return led_classdev_register(NULL, &pmu_led); 112 return led_classdev_register(NULL, &pmu_led);
142} 113}
143 114
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 1729d3fd7a11..157080b3b468 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -310,14 +310,14 @@ int __init find_via_pmu(void)
310 PMU_INT_TICK; 310 PMU_INT_TICK;
311 311
312 if (vias->parent->name && ((strcmp(vias->parent->name, "ohare") == 0) 312 if (vias->parent->name && ((strcmp(vias->parent->name, "ohare") == 0)
313 || device_is_compatible(vias->parent, "ohare"))) 313 || of_device_is_compatible(vias->parent, "ohare")))
314 pmu_kind = PMU_OHARE_BASED; 314 pmu_kind = PMU_OHARE_BASED;
315 else if (device_is_compatible(vias->parent, "paddington")) 315 else if (of_device_is_compatible(vias->parent, "paddington"))
316 pmu_kind = PMU_PADDINGTON_BASED; 316 pmu_kind = PMU_PADDINGTON_BASED;
317 else if (device_is_compatible(vias->parent, "heathrow")) 317 else if (of_device_is_compatible(vias->parent, "heathrow"))
318 pmu_kind = PMU_HEATHROW_BASED; 318 pmu_kind = PMU_HEATHROW_BASED;
319 else if (device_is_compatible(vias->parent, "Keylargo") 319 else if (of_device_is_compatible(vias->parent, "Keylargo")
320 || device_is_compatible(vias->parent, "K2-Keylargo")) { 320 || of_device_is_compatible(vias->parent, "K2-Keylargo")) {
321 struct device_node *gpiop; 321 struct device_node *gpiop;
322 struct device_node *adbp; 322 struct device_node *adbp;
323 u64 gaddr = OF_BAD_ADDR; 323 u64 gaddr = OF_BAD_ADDR;
@@ -2759,7 +2759,7 @@ pmu_polled_request(struct adb_request *req)
2759 2759
2760#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 2760#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
2761 2761
2762static int pmu_sys_suspended; 2762int pmu_sys_suspended;
2763 2763
2764static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state) 2764static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state)
2765{ 2765{
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c
index ab4d1b63f63e..a0fabf3c2008 100644
--- a/drivers/macintosh/windfarm_lm75_sensor.c
+++ b/drivers/macintosh/windfarm_lm75_sensor.c
@@ -188,10 +188,10 @@ static int wf_lm75_attach(struct i2c_adapter *adapter)
188 if (loc == NULL || addr == 0) 188 if (loc == NULL || addr == 0)
189 continue; 189 continue;
190 /* real lm75 */ 190 /* real lm75 */
191 if (device_is_compatible(dev, "lm75")) 191 if (of_device_is_compatible(dev, "lm75"))
192 wf_lm75_create(adapter, addr, 0, loc); 192 wf_lm75_create(adapter, addr, 0, loc);
193 /* ds1775 (compatible, better resolution */ 193 /* ds1775 (compatible, better resolution */
194 else if (device_is_compatible(dev, "ds1775")) 194 else if (of_device_is_compatible(dev, "ds1775"))
195 wf_lm75_create(adapter, addr, 1, loc); 195 wf_lm75_create(adapter, addr, 1, loc);
196 } 196 }
197 return 0; 197 return 0;
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c
index eaa74afa175b..5f03aab9fb5d 100644
--- a/drivers/macintosh/windfarm_max6690_sensor.c
+++ b/drivers/macintosh/windfarm_max6690_sensor.c
@@ -131,7 +131,7 @@ static int wf_max6690_attach(struct i2c_adapter *adapter)
131 */ 131 */
132 if (!pmac_i2c_match_adapter(dev, adapter)) 132 if (!pmac_i2c_match_adapter(dev, adapter))
133 continue; 133 continue;
134 if (!device_is_compatible(dev, "max6690")) 134 if (!of_device_is_compatible(dev, "max6690"))
135 continue; 135 continue;
136 addr = pmac_i2c_get_dev_addr(dev); 136 addr = pmac_i2c_get_dev_addr(dev);
137 loc = of_get_property(dev, "hwsensor-location", NULL); 137 loc = of_get_property(dev, "hwsensor-location", NULL);
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
index ff398adc0283..58c2590f05ec 100644
--- a/drivers/macintosh/windfarm_smu_controls.c
+++ b/drivers/macintosh/windfarm_smu_controls.c
@@ -263,7 +263,7 @@ static int __init smu_controls_init(void)
263 /* Look for RPM fans */ 263 /* Look for RPM fans */
264 for (fans = NULL; (fans = of_get_next_child(smu, fans)) != NULL;) 264 for (fans = NULL; (fans = of_get_next_child(smu, fans)) != NULL;)
265 if (!strcmp(fans->name, "rpm-fans") || 265 if (!strcmp(fans->name, "rpm-fans") ||
266 device_is_compatible(fans, "smu-rpm-fans")) 266 of_device_is_compatible(fans, "smu-rpm-fans"))
267 break; 267 break;
268 for (fan = NULL; 268 for (fan = NULL;
269 fans && (fan = of_get_next_child(fans, fan)) != NULL;) { 269 fans && (fan = of_get_next_child(fans, fan)) != NULL;) {
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index 9a6c2cf8fd0e..1043b39aa123 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -380,7 +380,7 @@ static int wf_sat_attach(struct i2c_adapter *adapter)
380 busnode = pmac_i2c_get_bus_node(bus); 380 busnode = pmac_i2c_get_bus_node(bus);
381 381
382 while ((dev = of_get_next_child(busnode, dev)) != NULL) 382 while ((dev = of_get_next_child(busnode, dev)) != NULL)
383 if (device_is_compatible(dev, "smu-sat")) 383 if (of_device_is_compatible(dev, "smu-sat"))
384 wf_sat_create(adapter, dev); 384 wf_sat_create(adapter, dev);
385 return 0; 385 return 0;
386} 386}
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 7efe744ad31e..72107dc06d67 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -48,7 +48,7 @@ static int parse_flash_partitions(struct device_node *node,
48 const u32 *part; 48 const u32 *part;
49 const char *name; 49 const char *name;
50 50
51 part = get_property(node, "partitions", &plen); 51 part = of_get_property(node, "partitions", &plen);
52 if (part == NULL) 52 if (part == NULL)
53 goto err; 53 goto err;
54 54
@@ -59,7 +59,7 @@ static int parse_flash_partitions(struct device_node *node,
59 goto err; 59 goto err;
60 } 60 }
61 61
62 name = get_property(node, "partition-names", &plen); 62 name = of_get_property(node, "partition-names", &plen);
63 63
64 for (i = 0; i < retval; i++) { 64 for (i = 0; i < retval; i++) {
65 (*parts)[i].offset = *part++; 65 (*parts)[i].offset = *part++;
@@ -153,7 +153,7 @@ static int __devinit of_physmap_probe(struct of_device *dev, const struct of_dev
153 goto err_out; 153 goto err_out;
154 } 154 }
155 155
156 width = get_property(dp, "bank-width", NULL); 156 width = of_get_property(dp, "bank-width", NULL);
157 if (width == NULL) { 157 if (width == NULL) {
158 dev_err(&dev->dev, "Can't get the flash bank width!\n"); 158 dev_err(&dev->dev, "Can't get the flash bank width!\n");
159 err = -EINVAL; 159 err = -EINVAL;
@@ -174,7 +174,7 @@ static int __devinit of_physmap_probe(struct of_device *dev, const struct of_dev
174 174
175 simple_map_init(&info->map); 175 simple_map_init(&info->map);
176 176
177 of_probe = get_property(dp, "probe-type", NULL); 177 of_probe = of_get_property(dp, "probe-type", NULL);
178 if (of_probe == NULL) { 178 if (of_probe == NULL) {
179 probe_type = rom_probe_types; 179 probe_type = rom_probe_types;
180 for (; info->mtd == NULL && *probe_type != NULL; probe_type++) 180 for (; info->mtd == NULL && *probe_type != NULL; probe_type++)
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 4612725965df..9b8d7d9dbe86 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -1260,9 +1260,10 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i
1260 printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n"); 1260 printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n");
1261 return -ENODEV; 1261 return -ENODEV;
1262 } 1262 }
1263 prop_addr = get_property(macio_get_of_node(mdev), "mac-address", NULL); 1263 prop_addr = of_get_property(macio_get_of_node(mdev),
1264 "mac-address", NULL);
1264 if (prop_addr == NULL) { 1265 if (prop_addr == NULL) {
1265 prop_addr = get_property(macio_get_of_node(mdev), 1266 prop_addr = of_get_property(macio_get_of_node(mdev),
1266 "local-mac-address", NULL); 1267 "local-mac-address", NULL);
1267 if (prop_addr == NULL) { 1268 if (prop_addr == NULL) {
1268 printk(KERN_ERR "BMAC: Can't get mac-address\n"); 1269 printk(KERN_ERR "BMAC: Can't get mac-address\n");
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index c7a5614e66c0..a1bd2d861d92 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2603,14 +2603,13 @@ static int ehea_setup_ports(struct ehea_adapter *adapter)
2603{ 2603{
2604 struct device_node *lhea_dn; 2604 struct device_node *lhea_dn;
2605 struct device_node *eth_dn = NULL; 2605 struct device_node *eth_dn = NULL;
2606 2606 const u32 *dn_log_port_id;
2607 u32 *dn_log_port_id;
2608 int i = 0; 2607 int i = 0;
2609 2608
2610 lhea_dn = adapter->ebus_dev->ofdev.node; 2609 lhea_dn = adapter->ebus_dev->ofdev.node;
2611 while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { 2610 while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
2612 2611
2613 dn_log_port_id = (u32*)get_property(eth_dn, "ibm,hea-port-no", 2612 dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
2614 NULL); 2613 NULL);
2615 if (!dn_log_port_id) { 2614 if (!dn_log_port_id) {
2616 ehea_error("bad device node: eth_dn name=%s", 2615 ehea_error("bad device node: eth_dn name=%s",
@@ -2645,12 +2644,12 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter,
2645{ 2644{
2646 struct device_node *lhea_dn; 2645 struct device_node *lhea_dn;
2647 struct device_node *eth_dn = NULL; 2646 struct device_node *eth_dn = NULL;
2648 u32 *dn_log_port_id; 2647 const u32 *dn_log_port_id;
2649 2648
2650 lhea_dn = adapter->ebus_dev->ofdev.node; 2649 lhea_dn = adapter->ebus_dev->ofdev.node;
2651 while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { 2650 while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
2652 2651
2653 dn_log_port_id = (u32*)get_property(eth_dn, "ibm,hea-port-no", 2652 dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
2654 NULL); 2653 NULL);
2655 if (dn_log_port_id) 2654 if (dn_log_port_id)
2656 if (*dn_log_port_id == logical_port_id) 2655 if (*dn_log_port_id == logical_port_id)
@@ -2774,7 +2773,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
2774 const struct of_device_id *id) 2773 const struct of_device_id *id)
2775{ 2774{
2776 struct ehea_adapter *adapter; 2775 struct ehea_adapter *adapter;
2777 u64 *adapter_handle; 2776 const u64 *adapter_handle;
2778 int ret; 2777 int ret;
2779 2778
2780 if (!dev || !dev->ofdev.node) { 2779 if (!dev || !dev->ofdev.node) {
@@ -2791,7 +2790,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
2791 2790
2792 adapter->ebus_dev = dev; 2791 adapter->ebus_dev = dev;
2793 2792
2794 adapter_handle = (u64*)get_property(dev->ofdev.node, "ibm,hea-handle", 2793 adapter_handle = of_get_property(dev->ofdev.node, "ibm,hea-handle",
2795 NULL); 2794 NULL);
2796 if (adapter_handle) 2795 if (adapter_handle)
2797 adapter->handle = *adapter_handle; 2796 adapter->handle = *adapter_handle;
diff --git a/drivers/net/mace.c b/drivers/net/mace.c
index b3bd62394958..52b9332810c5 100644
--- a/drivers/net/mace.c
+++ b/drivers/net/mace.c
@@ -110,9 +110,9 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
110 return -ENODEV; 110 return -ENODEV;
111 } 111 }
112 112
113 addr = get_property(mace, "mac-address", NULL); 113 addr = of_get_property(mace, "mac-address", NULL);
114 if (addr == NULL) { 114 if (addr == NULL) {
115 addr = get_property(mace, "local-mac-address", NULL); 115 addr = of_get_property(mace, "local-mac-address", NULL);
116 if (addr == NULL) { 116 if (addr == NULL) {
117 printk(KERN_ERR "Can't get mac-address for MACE %s\n", 117 printk(KERN_ERR "Can't get mac-address for MACE %s\n",
118 mace->full_name); 118 mace->full_name);
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 76fe9dd8e841..07eb9b24a97f 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -80,7 +80,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
80 return -ENOENT; 80 return -ENOENT;
81 } 81 }
82 82
83 maddr = get_property(dn, "mac-address", NULL); 83 maddr = of_get_property(dn, "mac-address", NULL);
84 if (maddr == NULL) { 84 if (maddr == NULL) {
85 dev_warn(&pdev->dev, 85 dev_warn(&pdev->dev,
86 "no mac address in device tree, not configuring\n"); 86 "no mac address in device tree, not configuring\n");
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 230da14b1b68..c15e97253ede 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1830,7 +1830,7 @@ try_host_fw:
1830 if (!dn) 1830 if (!dn)
1831 goto out_err; 1831 goto out_err;
1832 1832
1833 fw_prop = get_property(dn, "firmware", &fw_size); 1833 fw_prop = of_get_property(dn, "firmware", &fw_size);
1834 if (!fw_prop) 1834 if (!fw_prop)
1835 goto out_err; 1835 goto out_err;
1836 1836
@@ -2236,7 +2236,7 @@ spider_net_setup_netdev(struct spider_net_card *card)
2236 if (!dn) 2236 if (!dn)
2237 return -EIO; 2237 return -EIO;
2238 2238
2239 mac = get_property(dn, "local-mac-address", NULL); 2239 mac = of_get_property(dn, "local-mac-address", NULL);
2240 if (!mac) 2240 if (!mac)
2241 return -EIO; 2241 return -EIO;
2242 memcpy(addr.sa_data, mac, ETH_ALEN); 2242 memcpy(addr.sa_data, mac, ETH_ALEN);
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 5da73212ac91..432803855034 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2903,7 +2903,7 @@ static int __devinit gem_get_device_address(struct gem *gp)
2903 struct net_device *dev = gp->dev; 2903 struct net_device *dev = gp->dev;
2904 const unsigned char *addr; 2904 const unsigned char *addr;
2905 2905
2906 addr = get_property(gp->of_node, "local-mac-address", NULL); 2906 addr = of_get_property(gp->of_node, "local-mac-address", NULL);
2907 if (addr == NULL) { 2907 if (addr == NULL) {
2908#ifdef CONFIG_SPARC 2908#ifdef CONFIG_SPARC
2909 addr = idprom->id_ethaddr; 2909 addr = idprom->id_ethaddr;
diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
index 56a110ca5e6f..61843fd57525 100644
--- a/drivers/net/sungem_phy.c
+++ b/drivers/net/sungem_phy.c
@@ -451,7 +451,7 @@ static int bcm5421_init(struct mii_phy* phy)
451 if (phy->platform_data) { 451 if (phy->platform_data) {
452 struct device_node *np = of_get_parent(phy->platform_data); 452 struct device_node *np = of_get_parent(phy->platform_data);
453 int can_low_power = 1; 453 int can_low_power = 1;
454 if (np == NULL || get_property(np, "no-autolowpower", NULL)) 454 if (np == NULL || of_get_property(np, "no-autolowpower", NULL))
455 can_low_power = 0; 455 can_low_power = 0;
456 if (can_low_power) { 456 if (can_low_power) {
457 /* Enable automatic low-power */ 457 /* Enable automatic low-power */
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 0bfc2c9c1c08..1aabc91f6458 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -82,6 +82,7 @@ struct tsi108_prv_data {
82 unsigned int phy; /* Index of PHY for this interface */ 82 unsigned int phy; /* Index of PHY for this interface */
83 unsigned int irq_num; 83 unsigned int irq_num;
84 unsigned int id; 84 unsigned int id;
85 unsigned int phy_type;
85 86
86 struct timer_list timer;/* Timer that triggers the check phy function */ 87 struct timer_list timer;/* Timer that triggers the check phy function */
87 unsigned int rxtail; /* Next entry in rxring to read */ 88 unsigned int rxtail; /* Next entry in rxring to read */
@@ -1256,11 +1257,11 @@ static void tsi108_init_phy(struct net_device *dev)
1256 if (i == 0) 1257 if (i == 0)
1257 printk(KERN_ERR "%s function time out \n", __FUNCTION__); 1258 printk(KERN_ERR "%s function time out \n", __FUNCTION__);
1258 1259
1259#if (TSI108_PHY_TYPE == PHY_BCM54XX) /* Broadcom BCM54xx PHY */ 1260 if (data->phy_type == TSI108_PHY_BCM54XX) {
1260 tsi108_write_mii(data, 0x09, 0x0300); 1261 tsi108_write_mii(data, 0x09, 0x0300);
1261 tsi108_write_mii(data, 0x10, 0x1020); 1262 tsi108_write_mii(data, 0x10, 0x1020);
1262 tsi108_write_mii(data, 0x1c, 0x8c00); 1263 tsi108_write_mii(data, 0x1c, 0x8c00);
1263#endif 1264 }
1264 1265
1265 tsi108_write_mii(data, 1266 tsi108_write_mii(data,
1266 MII_BMCR, 1267 MII_BMCR,
@@ -1587,6 +1588,7 @@ tsi108_init_one(struct platform_device *pdev)
1587 data->mii_if.supports_gmii = mii_check_gmii_support(&data->mii_if); 1588 data->mii_if.supports_gmii = mii_check_gmii_support(&data->mii_if);
1588 1589
1589 data->phy = einfo->phy; 1590 data->phy = einfo->phy;
1591 data->phy_type = einfo->phy_type;
1590 data->irq_num = einfo->irq_num; 1592 data->irq_num = einfo->irq_num;
1591 data->id = pdev->id; 1593 data->id = pdev->id;
1592 dev->open = tsi108_open; 1594 dev->open = tsi108_open;
diff --git a/drivers/net/tsi108_eth.h b/drivers/net/tsi108_eth.h
index 77a769df228a..5a77ae6c5f36 100644
--- a/drivers/net/tsi108_eth.h
+++ b/drivers/net/tsi108_eth.h
@@ -43,15 +43,6 @@
43 in_be32((data->phyregs + (offset))) 43 in_be32((data->phyregs + (offset)))
44 44
45/* 45/*
46 * PHY Configuration Options
47 *
48 * NOTE: Enable set of definitions corresponding to your board type
49 */
50#define PHY_MV88E 1 /* Marvel 88Exxxx PHY */
51#define PHY_BCM54XX 2 /* Broardcom BCM54xx PHY */
52#define TSI108_PHY_TYPE PHY_MV88E
53
54/*
55 * TSI108 GIGE port registers 46 * TSI108 GIGE port registers
56 */ 47 */
57 48
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 16b9acdabbe8..d7aff8189377 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3787,7 +3787,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3787 3787
3788 ugeth_vdbg("%s: IN", __FUNCTION__); 3788 ugeth_vdbg("%s: IN", __FUNCTION__);
3789 3789
3790 prop = get_property(np, "device-id", NULL); 3790 prop = of_get_property(np, "device-id", NULL);
3791 ucc_num = *prop - 1; 3791 ucc_num = *prop - 1;
3792 if ((ucc_num < 0) || (ucc_num > 7)) 3792 if ((ucc_num < 0) || (ucc_num > 7))
3793 return -ENODEV; 3793 return -ENODEV;
@@ -3795,9 +3795,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3795 ug_info = &ugeth_info[ucc_num]; 3795 ug_info = &ugeth_info[ucc_num];
3796 ug_info->uf_info.ucc_num = ucc_num; 3796 ug_info->uf_info.ucc_num = ucc_num;
3797 3797
3798 prop = get_property(np, "rx-clock", NULL); 3798 prop = of_get_property(np, "rx-clock", NULL);
3799 ug_info->uf_info.rx_clock = *prop; 3799 ug_info->uf_info.rx_clock = *prop;
3800 prop = get_property(np, "tx-clock", NULL); 3800 prop = of_get_property(np, "tx-clock", NULL);
3801 ug_info->uf_info.tx_clock = *prop; 3801 ug_info->uf_info.tx_clock = *prop;
3802 err = of_address_to_resource(np, 0, &res); 3802 err = of_address_to_resource(np, 0, &res);
3803 if (err) 3803 if (err)
@@ -3806,23 +3806,23 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3806 ug_info->uf_info.regs = res.start; 3806 ug_info->uf_info.regs = res.start;
3807 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0); 3807 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
3808 3808
3809 ph = get_property(np, "phy-handle", NULL); 3809 ph = of_get_property(np, "phy-handle", NULL);
3810 phy = of_find_node_by_phandle(*ph); 3810 phy = of_find_node_by_phandle(*ph);
3811 3811
3812 if (phy == NULL) 3812 if (phy == NULL)
3813 return -ENODEV; 3813 return -ENODEV;
3814 3814
3815 /* set the PHY address */ 3815 /* set the PHY address */
3816 prop = get_property(phy, "reg", NULL); 3816 prop = of_get_property(phy, "reg", NULL);
3817 if (prop == NULL) 3817 if (prop == NULL)
3818 return -1; 3818 return -1;
3819 ug_info->phy_address = *prop; 3819 ug_info->phy_address = *prop;
3820 3820
3821 /* get the phy interface type, or default to MII */ 3821 /* get the phy interface type, or default to MII */
3822 prop = get_property(np, "interface-type", NULL); 3822 prop = of_get_property(np, "interface-type", NULL);
3823 if (!prop) { 3823 if (!prop) {
3824 /* handle interface property present in old trees */ 3824 /* handle interface property present in old trees */
3825 prop = get_property(phy, "interface", NULL); 3825 prop = of_get_property(phy, "interface", NULL);
3826 if (prop != NULL) 3826 if (prop != NULL)
3827 phy_interface = enet_to_phy_interface[*prop]; 3827 phy_interface = enet_to_phy_interface[*prop];
3828 else 3828 else
@@ -3832,10 +3832,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3832 } 3832 }
3833 3833
3834 /* get speed, or derive from interface */ 3834 /* get speed, or derive from interface */
3835 prop = get_property(np, "max-speed", NULL); 3835 prop = of_get_property(np, "max-speed", NULL);
3836 if (!prop) { 3836 if (!prop) {
3837 /* handle interface property present in old trees */ 3837 /* handle interface property present in old trees */
3838 prop = get_property(phy, "interface", NULL); 3838 prop = of_get_property(phy, "interface", NULL);
3839 if (prop != NULL) 3839 if (prop != NULL)
3840 max_speed = enet_to_speed[*prop]; 3840 max_speed = enet_to_speed[*prop];
3841 } else { 3841 } else {
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 73b5a538e8f4..27a1ef3b7b06 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -172,7 +172,7 @@ static int uec_mdio_probe(struct of_device *ofdev, const struct of_device_id *ma
172 while ((child = of_get_next_child(np, child)) != NULL) { 172 while ((child = of_get_next_child(np, child)) != NULL) {
173 int irq = irq_of_parse_and_map(child, 0); 173 int irq = irq_of_parse_and_map(child, 0);
174 if (irq != NO_IRQ) { 174 if (irq != NO_IRQ) {
175 const u32 *id = get_property(child, "reg", NULL); 175 const u32 *id = of_get_property(child, "reg", NULL);
176 new_bus->irq[*id] = irq; 176 new_bus->irq[*id] = irq;
177 } 177 }
178 } 178 }
@@ -203,7 +203,7 @@ static int uec_mdio_probe(struct of_device *ofdev, const struct of_device_id *ma
203 if ((res.start >= tempres.start) && 203 if ((res.start >= tempres.start) &&
204 (res.end <= tempres.end)) { 204 (res.end <= tempres.end)) {
205 /* set this UCC to be the MII master */ 205 /* set this UCC to be the MII master */
206 const u32 *id = get_property(tempnp, "device-id", NULL); 206 const u32 *id = of_get_property(tempnp, "device-id", NULL);
207 if (id == NULL) 207 if (id == NULL)
208 goto bus_register_fail; 208 goto bus_register_fail;
209 209
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 6e3118733508..458c08ef2654 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -169,10 +169,10 @@ static int get_children_props(struct device_node *dn, const int **drc_indexes,
169{ 169{
170 const int *indexes, *names, *types, *domains; 170 const int *indexes, *names, *types, *domains;
171 171
172 indexes = get_property(dn, "ibm,drc-indexes", NULL); 172 indexes = of_get_property(dn, "ibm,drc-indexes", NULL);
173 names = get_property(dn, "ibm,drc-names", NULL); 173 names = of_get_property(dn, "ibm,drc-names", NULL);
174 types = get_property(dn, "ibm,drc-types", NULL); 174 types = of_get_property(dn, "ibm,drc-types", NULL);
175 domains = get_property(dn, "ibm,drc-power-domains", NULL); 175 domains = of_get_property(dn, "ibm,drc-power-domains", NULL);
176 176
177 if (!indexes || !names || !types || !domains) { 177 if (!indexes || !names || !types || !domains) {
178 /* Slot does not have dynamically-removable children */ 178 /* Slot does not have dynamically-removable children */
@@ -205,7 +205,7 @@ int rpaphp_get_drc_props(struct device_node *dn, int *drc_index,
205 char *name_tmp, *type_tmp; 205 char *name_tmp, *type_tmp;
206 int i, rc; 206 int i, rc;
207 207
208 my_index = get_property(dn, "ibm,my-drc-index", NULL); 208 my_index = of_get_property(dn, "ibm,my-drc-index", NULL);
209 if (!my_index) { 209 if (!my_index) {
210 /* Node isn't DLPAR/hotplug capable */ 210 /* Node isn't DLPAR/hotplug capable */
211 return -EINVAL; 211 return -EINVAL;
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/vuart.c
index 7d7cab1d91b4..ec2d36a1bc67 100644
--- a/drivers/ps3/vuart.c
+++ b/drivers/ps3/vuart.c
@@ -886,12 +886,12 @@ static int ps3_vuart_probe(struct device *_dev)
886 886
887 if (++vuart_bus_priv.use_count == 1) { 887 if (++vuart_bus_priv.use_count == 1) {
888 888
889 result = ps3_alloc_vuart_irq(PS3_BINDING_CPU_ANY, 889 result = ps3_vuart_irq_setup(PS3_BINDING_CPU_ANY,
890 (void*)&vuart_bus_priv.bmp.status, &vuart_bus_priv.virq); 890 (void*)&vuart_bus_priv.bmp.status, &vuart_bus_priv.virq);
891 891
892 if (result) { 892 if (result) {
893 dev_dbg(&dev->core, 893 dev_dbg(&dev->core,
894 "%s:%d: ps3_alloc_vuart_irq failed (%d)\n", 894 "%s:%d: ps3_vuart_irq_setup failed (%d)\n",
895 __func__, __LINE__, result); 895 __func__, __LINE__, result);
896 result = -EPERM; 896 result = -EPERM;
897 goto fail_alloc_irq; 897 goto fail_alloc_irq;
@@ -937,7 +937,7 @@ static int ps3_vuart_probe(struct device *_dev)
937fail_probe: 937fail_probe:
938 ps3_vuart_set_interrupt_mask(dev, 0); 938 ps3_vuart_set_interrupt_mask(dev, 0);
939fail_request_irq: 939fail_request_irq:
940 ps3_free_vuart_irq(vuart_bus_priv.virq); 940 ps3_vuart_irq_destroy(vuart_bus_priv.virq);
941 vuart_bus_priv.virq = NO_IRQ; 941 vuart_bus_priv.virq = NO_IRQ;
942fail_alloc_irq: 942fail_alloc_irq:
943 --vuart_bus_priv.use_count; 943 --vuart_bus_priv.use_count;
@@ -975,7 +975,7 @@ static int ps3_vuart_remove(struct device *_dev)
975 if (--vuart_bus_priv.use_count == 0) { 975 if (--vuart_bus_priv.use_count == 0) {
976 BUG(); 976 BUG();
977 free_irq(vuart_bus_priv.virq, &vuart_bus_priv); 977 free_irq(vuart_bus_priv.virq, &vuart_bus_priv);
978 ps3_free_vuart_irq(vuart_bus_priv.virq); 978 ps3_vuart_irq_destroy(vuart_bus_priv.virq);
979 vuart_bus_priv.virq = NO_IRQ; 979 vuart_bus_priv.virq = NO_IRQ;
980 } 980 }
981 981
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index 6d223dd76440..8ba7dd09d01d 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -892,16 +892,16 @@ static int get_system_info(void)
892 if (!rootdn) 892 if (!rootdn)
893 return -ENOENT; 893 return -ENOENT;
894 894
895 model = get_property(rootdn, "model", NULL); 895 model = of_get_property(rootdn, "model", NULL);
896 id = get_property(rootdn, "system-id", NULL); 896 id = of_get_property(rootdn, "system-id", NULL);
897 if (model && id) 897 if (model && id)
898 snprintf(system_id, sizeof(system_id), "%s-%s", model, id); 898 snprintf(system_id, sizeof(system_id), "%s-%s", model, id);
899 899
900 name = get_property(rootdn, "ibm,partition-name", NULL); 900 name = of_get_property(rootdn, "ibm,partition-name", NULL);
901 if (name) 901 if (name)
902 strncpy(partition_name, name, sizeof(partition_name)); 902 strncpy(partition_name, name, sizeof(partition_name));
903 903
904 num = get_property(rootdn, "ibm,partition-no", NULL); 904 num = of_get_property(rootdn, "ibm,partition-no", NULL);
905 if (num) 905 if (num)
906 partition_number = *num; 906 partition_number = *num;
907 907
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index 0a533f398f52..d8700aaa6114 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -162,11 +162,11 @@ static void gather_partition_info(void)
162 return; 162 return;
163 } 163 }
164 164
165 ppartition_name = get_property(rootdn, "ibm,partition-name", NULL); 165 ppartition_name = of_get_property(rootdn, "ibm,partition-name", NULL);
166 if (ppartition_name) 166 if (ppartition_name)
167 strncpy(partition_name, ppartition_name, 167 strncpy(partition_name, ppartition_name,
168 sizeof(partition_name)); 168 sizeof(partition_name));
169 p_number_ptr = get_property(rootdn, "ibm,partition-no", NULL); 169 p_number_ptr = of_get_property(rootdn, "ibm,partition-no", NULL);
170 if (p_number_ptr) 170 if (p_number_ptr)
171 partition_number = *p_number_ptr; 171 partition_number = *p_number_ptr;
172 of_node_put(rootdn); 172 of_node_put(rootdn);
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index 753d88306cd1..5806ede120a4 100644
--- a/drivers/scsi/mac53c94.c
+++ b/drivers/scsi/mac53c94.c
@@ -471,7 +471,7 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat
471 goto out_free; 471 goto out_free;
472 } 472 }
473 473
474 clkprop = get_property(node, "clock-frequency", &proplen); 474 clkprop = of_get_property(node, "clock-frequency", &proplen);
475 if (clkprop == NULL || proplen != sizeof(int)) { 475 if (clkprop == NULL || proplen != sizeof(int)) {
476 printk(KERN_ERR "%s: can't get clock frequency, " 476 printk(KERN_ERR "%s: can't get clock frequency, "
477 "assuming 25MHz\n", node->full_name); 477 "assuming 25MHz\n", node->full_name);
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index 1fd3c7590d31..cf3666d7d97a 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -1947,7 +1947,7 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match)
1947 ms->tgts[tgt].current_req = NULL; 1947 ms->tgts[tgt].current_req = NULL;
1948 } 1948 }
1949 1949
1950 if ((cfp = get_property(mesh, "clock-frequency", NULL))) 1950 if ((cfp = of_get_property(mesh, "clock-frequency", NULL)))
1951 ms->clk_freq = *cfp; 1951 ms->clk_freq = *cfp;
1952 else { 1952 else {
1953 printk(KERN_INFO "mesh: assuming 50MHz clock frequency\n"); 1953 printk(KERN_INFO "mesh: assuming 50MHz clock frequency\n");
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 8d24cd521056..35f8b86cc78f 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -257,9 +257,10 @@ mpc52xx_uart_shutdown(struct uart_port *port)
257{ 257{
258 struct mpc52xx_psc __iomem *psc = PSC(port); 258 struct mpc52xx_psc __iomem *psc = PSC(port);
259 259
260 /* Shut down the port, interrupt and all */ 260 /* Shut down the port. Leave TX active if on a console port */
261 out_8(&psc->command,MPC52xx_PSC_RST_RX); 261 out_8(&psc->command,MPC52xx_PSC_RST_RX);
262 out_8(&psc->command,MPC52xx_PSC_RST_TX); 262 if (!uart_console(port))
263 out_8(&psc->command,MPC52xx_PSC_RST_TX);
263 264
264 port->read_status_mask = 0; 265 port->read_status_mask = 0;
265 out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask); 266 out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask);
@@ -1069,7 +1070,7 @@ mpc52xx_uart_of_enumerate(void)
1069 continue; 1070 continue;
1070 1071
1071 /* Is a particular device number requested? */ 1072 /* Is a particular device number requested? */
1072 devno = get_property(np, "port-number", NULL); 1073 devno = of_get_property(np, "port-number", NULL);
1073 mpc52xx_uart_of_assign(of_node_get(np), devno ? *devno : -1); 1074 mpc52xx_uart_of_assign(of_node_get(np), devno ? *devno : -1);
1074 } 1075 }
1075 1076
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index 336d0f4580d9..7ffdaeaf0545 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -29,8 +29,8 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
29 int ret; 29 int ret;
30 30
31 memset(port, 0, sizeof *port); 31 memset(port, 0, sizeof *port);
32 spd = get_property(np, "current-speed", NULL); 32 spd = of_get_property(np, "current-speed", NULL);
33 clk = get_property(np, "clock-frequency", NULL); 33 clk = of_get_property(np, "clock-frequency", NULL);
34 if (!clk) { 34 if (!clk) {
35 dev_warn(&ofdev->dev, "no clock-frequency property set\n"); 35 dev_warn(&ofdev->dev, "no clock-frequency property set\n");
36 return -ENODEV; 36 return -ENODEV;
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index be8d75721a85..0fa9f6761763 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -1450,14 +1450,14 @@ no_dma:
1450 /* 1450 /*
1451 * Detect port type 1451 * Detect port type
1452 */ 1452 */
1453 if (device_is_compatible(np, "cobalt")) 1453 if (of_device_is_compatible(np, "cobalt"))
1454 uap->flags |= PMACZILOG_FLAG_IS_INTMODEM; 1454 uap->flags |= PMACZILOG_FLAG_IS_INTMODEM;
1455 conn = get_property(np, "AAPL,connector", &len); 1455 conn = of_get_property(np, "AAPL,connector", &len);
1456 if (conn && (strcmp(conn, "infrared") == 0)) 1456 if (conn && (strcmp(conn, "infrared") == 0))
1457 uap->flags |= PMACZILOG_FLAG_IS_IRDA; 1457 uap->flags |= PMACZILOG_FLAG_IS_IRDA;
1458 uap->port_type = PMAC_SCC_ASYNC; 1458 uap->port_type = PMAC_SCC_ASYNC;
1459 /* 1999 Powerbook G3 has slot-names property instead */ 1459 /* 1999 Powerbook G3 has slot-names property instead */
1460 slots = get_property(np, "slot-names", &len); 1460 slots = of_get_property(np, "slot-names", &len);
1461 if (slots && slots->count > 0) { 1461 if (slots && slots->count > 0) {
1462 if (strcmp(slots->name, "IrDA") == 0) 1462 if (strcmp(slots->name, "IrDA") == 0)
1463 uap->flags |= PMACZILOG_FLAG_IS_IRDA; 1463 uap->flags |= PMACZILOG_FLAG_IS_IRDA;
@@ -1471,7 +1471,7 @@ no_dma:
1471 of_find_node_by_name(NULL, "i2c-modem"); 1471 of_find_node_by_name(NULL, "i2c-modem");
1472 if (i2c_modem) { 1472 if (i2c_modem) {
1473 const char* mid = 1473 const char* mid =
1474 get_property(i2c_modem, "modem-id", NULL); 1474 of_get_property(i2c_modem, "modem-id", NULL);
1475 if (mid) switch(*mid) { 1475 if (mid) switch(*mid) {
1476 case 0x04 : 1476 case 0x04 :
1477 case 0x05 : 1477 case 0x05 :
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
index 93107453f124..37b83ba09969 100644
--- a/drivers/usb/host/ehci-ps3.c
+++ b/drivers/usb/host/ehci-ps3.c
@@ -97,7 +97,7 @@ static int ps3_ehci_sb_probe(struct ps3_system_bus_device *dev)
97 dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__, 97 dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__,
98 __LINE__, dev->m_region->lpar_addr); 98 __LINE__, dev->m_region->lpar_addr);
99 99
100 result = ps3_alloc_io_irq(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq); 100 result = ps3_io_irq_setup(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq);
101 101
102 if (result) { 102 if (result) {
103 dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n", 103 dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n",
@@ -155,7 +155,7 @@ fail_add_hcd:
155fail_ioremap: 155fail_ioremap:
156 usb_put_hcd(hcd); 156 usb_put_hcd(hcd);
157fail_create_hcd: 157fail_create_hcd:
158 ps3_free_io_irq(virq); 158 ps3_io_irq_destroy(virq);
159fail_irq: 159fail_irq:
160 ps3_free_mmio_region(dev->m_region); 160 ps3_free_mmio_region(dev->m_region);
161fail_mmio: 161fail_mmio:
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 08e237c7bc43..c43b66acd4d5 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -97,8 +97,8 @@ ohci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match)
97 return -ENODEV; 97 return -ENODEV;
98 98
99 is_bigendian = 99 is_bigendian =
100 device_is_compatible(dn, "ohci-bigendian") || 100 of_device_is_compatible(dn, "ohci-bigendian") ||
101 device_is_compatible(dn, "ohci-be"); 101 of_device_is_compatible(dn, "ohci-be");
102 102
103 dev_dbg(&op->dev, "initializing PPC-OF USB Controller\n"); 103 dev_dbg(&op->dev, "initializing PPC-OF USB Controller\n");
104 104
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
index c849f72b508a..d7cf07288b0b 100644
--- a/drivers/usb/host/ohci-ps3.c
+++ b/drivers/usb/host/ohci-ps3.c
@@ -99,7 +99,7 @@ static int ps3_ohci_sb_probe(struct ps3_system_bus_device *dev)
99 dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__, 99 dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__,
100 __LINE__, dev->m_region->lpar_addr); 100 __LINE__, dev->m_region->lpar_addr);
101 101
102 result = ps3_alloc_io_irq(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq); 102 result = ps3_io_irq_setup(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq);
103 103
104 if (result) { 104 if (result) {
105 dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n", 105 dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n",
@@ -157,7 +157,7 @@ fail_add_hcd:
157fail_ioremap: 157fail_ioremap:
158 usb_put_hcd(hcd); 158 usb_put_hcd(hcd);
159fail_create_hcd: 159fail_create_hcd:
160 ps3_free_io_irq(virq); 160 ps3_io_irq_destroy(virq);
161fail_irq: 161fail_irq:
162 ps3_free_mmio_region(dev->m_region); 162 ps3_free_mmio_region(dev->m_region);
163fail_mmio: 163fail_mmio:
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 0ec36cd5de28..2ce050193018 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -424,7 +424,7 @@ static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo)
424 424
425 if (dp == NULL) 425 if (dp == NULL)
426 return -ENODEV; 426 return -ENODEV;
427 val = get_property(dp, "ATY,RefCLK", NULL); 427 val = of_get_property(dp, "ATY,RefCLK", NULL);
428 if (!val || !*val) { 428 if (!val || !*val) {
429 printk(KERN_WARNING "radeonfb: No ATY,RefCLK property !\n"); 429 printk(KERN_WARNING "radeonfb: No ATY,RefCLK property !\n");
430 return -EINVAL; 430 return -EINVAL;
@@ -432,11 +432,11 @@ static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo)
432 432
433 rinfo->pll.ref_clk = (*val) / 10; 433 rinfo->pll.ref_clk = (*val) / 10;
434 434
435 val = get_property(dp, "ATY,SCLK", NULL); 435 val = of_get_property(dp, "ATY,SCLK", NULL);
436 if (val && *val) 436 if (val && *val)
437 rinfo->pll.sclk = (*val) / 10; 437 rinfo->pll.sclk = (*val) / 10;
438 438
439 val = get_property(dp, "ATY,MCLK", NULL); 439 val = of_get_property(dp, "ATY,MCLK", NULL);
440 if (val && *val) 440 if (val && *val)
441 rinfo->pll.mclk = (*val) / 10; 441 rinfo->pll.mclk = (*val) / 10;
442 442
diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c
index 737b5c09dbdb..2030ed813429 100644
--- a/drivers/video/aty/radeon_monitor.c
+++ b/drivers/video/aty/radeon_monitor.c
@@ -70,7 +70,7 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_
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 = get_property(dp, "display-type", NULL); 73 pmt = of_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 = get_property(dp, propnames[i], NULL); 92 pedid = of_get_property(dp, propnames[i], NULL);
93 if (pedid != NULL) 93 if (pedid != NULL)
94 break; 94 break;
95 } 95 }
@@ -98,9 +98,10 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_
98 * single-head cards have hdno == -1 and skip this step 98 * single-head cards have hdno == -1 and skip this step
99 */ 99 */
100 if (pedid == NULL && dp->parent && (hdno != -1)) 100 if (pedid == NULL && dp->parent && (hdno != -1))
101 pedid = get_property(dp->parent, (hdno == 0) ? "EDID1" : "EDID2", NULL); 101 pedid = of_get_property(dp->parent,
102 (hdno == 0) ? "EDID1" : "EDID2", NULL);
102 if (pedid == NULL && dp->parent && (hdno == 0)) 103 if (pedid == NULL && dp->parent && (hdno == 0))
103 pedid = get_property(dp->parent, "EDID", NULL); 104 pedid = of_get_property(dp->parent, "EDID", NULL);
104 if (pedid == NULL) 105 if (pedid == NULL)
105 return mt; 106 return mt;
106 107
@@ -130,7 +131,7 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_
130 do { 131 do {
131 if (!dp) 132 if (!dp)
132 return MT_NONE; 133 return MT_NONE;
133 pname = get_property(dp, "name", NULL); 134 pname = of_get_property(dp, "name", NULL);
134 if (!pname) 135 if (!pname)
135 return MT_NONE; 136 return MT_NONE;
136 len = strlen(pname); 137 len = strlen(pname);
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index 4425f7e90309..be1d57bf9dc8 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -1290,7 +1290,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo)
1290 if (rinfo->of_node != NULL) { 1290 if (rinfo->of_node != NULL) {
1291 int size; 1291 int size;
1292 1292
1293 mrtable = get_property(rinfo->of_node, "ATY,MRT", &size); 1293 mrtable = of_get_property(rinfo->of_node, "ATY,MRT", &size);
1294 if (mrtable) 1294 if (mrtable)
1295 mrtable_size = size >> 2; 1295 mrtable_size = size >> 2;
1296 else 1296 else
diff --git a/drivers/video/nvidia/nv_of.c b/drivers/video/nvidia/nv_of.c
index 163a774a1b30..73afd7eb9977 100644
--- a/drivers/video/nvidia/nv_of.c
+++ b/drivers/video/nvidia/nv_of.c
@@ -46,15 +46,15 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid)
46 46
47 for (dp = NULL; 47 for (dp = NULL;
48 (dp = of_get_next_child(parent, dp)) != NULL;) { 48 (dp = of_get_next_child(parent, dp)) != NULL;) {
49 pname = get_property(dp, "name", NULL); 49 pname = of_get_property(dp, "name", NULL);
50 if (!pname) 50 if (!pname)
51 continue; 51 continue;
52 len = strlen(pname); 52 len = strlen(pname);
53 if ((pname[len-1] == 'A' && conn == 1) || 53 if ((pname[len-1] == 'A' && conn == 1) ||
54 (pname[len-1] == 'B' && conn == 2)) { 54 (pname[len-1] == 'B' && conn == 2)) {
55 for (i = 0; propnames[i] != NULL; ++i) { 55 for (i = 0; propnames[i] != NULL; ++i) {
56 pedid = get_property(dp, propnames[i], 56 pedid = of_get_property(dp,
57 NULL); 57 propnames[i], NULL);
58 if (pedid != NULL) 58 if (pedid != NULL)
59 break; 59 break;
60 } 60 }
@@ -65,7 +65,7 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid)
65 } 65 }
66 if (pedid == NULL) { 66 if (pedid == NULL) {
67 for (i = 0; propnames[i] != NULL; ++i) { 67 for (i = 0; propnames[i] != NULL; ++i) {
68 pedid = get_property(parent, propnames[i], NULL); 68 pedid = of_get_property(parent, propnames[i], NULL);
69 if (pedid != NULL) 69 if (pedid != NULL)
70 break; 70 break;
71 } 71 }
diff --git a/drivers/video/offb.c b/drivers/video/offb.c
index 9576a55eaf16..885b42836cbb 100644
--- a/drivers/video/offb.c
+++ b/drivers/video/offb.c
@@ -322,8 +322,8 @@ static void __init offb_init_fb(const char *name, const char *full_name,
322 ioremap(base + 0x7ff000, 0x1000) + 0xcc0; 322 ioremap(base + 0x7ff000, 0x1000) + 0xcc0;
323 par->cmap_data = par->cmap_adr + 1; 323 par->cmap_data = par->cmap_adr + 1;
324 par->cmap_type = cmap_m64; 324 par->cmap_type = cmap_m64;
325 } else if (dp && (device_is_compatible(dp, "pci1014,b7") || 325 } else if (dp && (of_device_is_compatible(dp, "pci1014,b7") ||
326 device_is_compatible(dp, "pci1014,21c"))) { 326 of_device_is_compatible(dp, "pci1014,21c"))) {
327 par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000); 327 par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000);
328 if (par->cmap_adr) 328 if (par->cmap_adr)
329 par->cmap_type = cmap_gxt2000; 329 par->cmap_type = cmap_gxt2000;
@@ -425,27 +425,27 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node)
425 const u32 *pp, *addrp, *up; 425 const u32 *pp, *addrp, *up;
426 u64 asize; 426 u64 asize;
427 427
428 pp = get_property(dp, "linux,bootx-depth", &len); 428 pp = of_get_property(dp, "linux,bootx-depth", &len);
429 if (pp == NULL) 429 if (pp == NULL)
430 pp = get_property(dp, "depth", &len); 430 pp = of_get_property(dp, "depth", &len);
431 if (pp && len == sizeof(u32)) 431 if (pp && len == sizeof(u32))
432 depth = *pp; 432 depth = *pp;
433 433
434 pp = get_property(dp, "linux,bootx-width", &len); 434 pp = of_get_property(dp, "linux,bootx-width", &len);
435 if (pp == NULL) 435 if (pp == NULL)
436 pp = get_property(dp, "width", &len); 436 pp = of_get_property(dp, "width", &len);
437 if (pp && len == sizeof(u32)) 437 if (pp && len == sizeof(u32))
438 width = *pp; 438 width = *pp;
439 439
440 pp = get_property(dp, "linux,bootx-height", &len); 440 pp = of_get_property(dp, "linux,bootx-height", &len);
441 if (pp == NULL) 441 if (pp == NULL)
442 pp = get_property(dp, "height", &len); 442 pp = of_get_property(dp, "height", &len);
443 if (pp && len == sizeof(u32)) 443 if (pp && len == sizeof(u32))
444 height = *pp; 444 height = *pp;
445 445
446 pp = get_property(dp, "linux,bootx-linebytes", &len); 446 pp = of_get_property(dp, "linux,bootx-linebytes", &len);
447 if (pp == NULL) 447 if (pp == NULL)
448 pp = get_property(dp, "linebytes", &len); 448 pp = of_get_property(dp, "linebytes", &len);
449 if (pp && len == sizeof(u32) && (*pp != 0xffffffffu)) 449 if (pp && len == sizeof(u32) && (*pp != 0xffffffffu))
450 pitch = *pp; 450 pitch = *pp;
451 else 451 else
@@ -463,9 +463,9 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node)
463 * ranges and pick one that is both big enough and if possible encloses 463 * ranges and pick one that is both big enough and if possible encloses
464 * the "address" property. If none match, we pick the biggest 464 * the "address" property. If none match, we pick the biggest
465 */ 465 */
466 up = get_property(dp, "linux,bootx-addr", &len); 466 up = of_get_property(dp, "linux,bootx-addr", &len);
467 if (up == NULL) 467 if (up == NULL)
468 up = get_property(dp, "address", &len); 468 up = of_get_property(dp, "address", &len);
469 if (up && len == sizeof(u32)) 469 if (up && len == sizeof(u32))
470 addr_prop = *up; 470 addr_prop = *up;
471 471
@@ -521,7 +521,7 @@ static int __init offb_init(void)
521 return -ENODEV; 521 return -ENODEV;
522 522
523 /* Check if we have a MacOS display without a node spec */ 523 /* Check if we have a MacOS display without a node spec */
524 if (get_property(of_chosen, "linux,bootx-noscreen", NULL) != NULL) { 524 if (of_get_property(of_chosen, "linux,bootx-noscreen", NULL) != NULL) {
525 /* The old code tried to work out which node was the MacOS 525 /* The old code tried to work out which node was the MacOS
526 * display based on the address. I'm dropping that since the 526 * display based on the address. I'm dropping that since the
527 * lack of a node spec only happens with old BootX versions 527 * lack of a node spec only happens with old BootX versions
@@ -532,14 +532,14 @@ static int __init offb_init(void)
532 } 532 }
533 533
534 for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { 534 for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) {
535 if (get_property(dp, "linux,opened", NULL) && 535 if (of_get_property(dp, "linux,opened", NULL) &&
536 get_property(dp, "linux,boot-display", NULL)) { 536 of_get_property(dp, "linux,boot-display", NULL)) {
537 boot_disp = dp; 537 boot_disp = dp;
538 offb_init_nodriver(dp, 0); 538 offb_init_nodriver(dp, 0);
539 } 539 }
540 } 540 }
541 for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { 541 for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) {
542 if (get_property(dp, "linux,opened", NULL) && 542 if (of_get_property(dp, "linux,opened", NULL) &&
543 dp != boot_disp) 543 dp != boot_disp)
544 offb_init_nodriver(dp, 0); 544 offb_init_nodriver(dp, 0);
545 } 545 }
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 07d1979bc23e..9756a728b74f 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -898,8 +898,8 @@ static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, void *dev)
898 } 898 }
899 899
900 ps3fb.dev = dev; 900 ps3fb.dev = dev;
901 error = ps3_alloc_irq(PS3_BINDING_CPU_ANY, dinfo->irq.irq_outlet, 901 error = ps3_irq_plug_setup(PS3_BINDING_CPU_ANY, dinfo->irq.irq_outlet,
902 &ps3fb.irq_no); 902 &ps3fb.irq_no);
903 if (error) { 903 if (error) {
904 printk(KERN_ERR "%s: ps3_alloc_irq failed %d\n", __func__, 904 printk(KERN_ERR "%s: ps3_alloc_irq failed %d\n", __func__,
905 error); 905 error);
@@ -911,7 +911,7 @@ static int ps3fb_vsync_settings(struct gpu_driver_info *dinfo, void *dev)
911 if (error) { 911 if (error) {
912 printk(KERN_ERR "%s: request_irq failed %d\n", __func__, 912 printk(KERN_ERR "%s: request_irq failed %d\n", __func__,
913 error); 913 error);
914 ps3_free_irq(ps3fb.irq_no); 914 ps3_irq_plug_destroy(ps3fb.irq_no);
915 return error; 915 return error;
916 } 916 }
917 917
@@ -1083,7 +1083,7 @@ err_framebuffer_release:
1083 framebuffer_release(info); 1083 framebuffer_release(info);
1084err_free_irq: 1084err_free_irq:
1085 free_irq(ps3fb.irq_no, ps3fb.dev); 1085 free_irq(ps3fb.irq_no, ps3fb.dev);
1086 ps3_free_irq(ps3fb.irq_no); 1086 ps3_irq_plug_destroy(ps3fb.irq_no);
1087err_iounmap_dinfo: 1087err_iounmap_dinfo:
1088 iounmap((u8 __iomem *)ps3fb.dinfo); 1088 iounmap((u8 __iomem *)ps3fb.dinfo);
1089err_gpu_context_free: 1089err_gpu_context_free:
@@ -1099,7 +1099,7 @@ static void ps3fb_shutdown(struct platform_device *dev)
1099 ps3fb_flip_ctl(0); /* flip off */ 1099 ps3fb_flip_ctl(0); /* flip off */
1100 ps3fb.dinfo->irq.mask = 0; 1100 ps3fb.dinfo->irq.mask = 0;
1101 free_irq(ps3fb.irq_no, ps3fb.dev); 1101 free_irq(ps3fb.irq_no, ps3fb.dev);
1102 ps3_free_irq(ps3fb.irq_no); 1102 ps3_irq_plug_destroy(ps3fb.irq_no);
1103 iounmap((u8 __iomem *)ps3fb.dinfo); 1103 iounmap((u8 __iomem *)ps3fb.dinfo);
1104} 1104}
1105 1105
@@ -1114,7 +1114,7 @@ void ps3fb_cleanup(void)
1114 } 1114 }
1115 if (ps3fb.irq_no) { 1115 if (ps3fb.irq_no) {
1116 free_irq(ps3fb.irq_no, ps3fb.dev); 1116 free_irq(ps3fb.irq_no, ps3fb.dev);
1117 ps3_free_irq(ps3fb.irq_no); 1117 ps3_irq_plug_destroy(ps3fb.irq_no);
1118 } 1118 }
1119 iounmap((u8 __iomem *)ps3fb.dinfo); 1119 iounmap((u8 __iomem *)ps3fb.dinfo);
1120 1120
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 19dff8dbe8af..0fe547842c64 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -1760,13 +1760,13 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
1760 NVTRACE_ENTER(); 1760 NVTRACE_ENTER();
1761 dp = pci_device_to_OF_node(pd); 1761 dp = pci_device_to_OF_node(pd);
1762 for (; dp != NULL; dp = dp->child) { 1762 for (; dp != NULL; dp = dp->child) {
1763 disptype = get_property(dp, "display-type", NULL); 1763 disptype = of_get_property(dp, "display-type", NULL);
1764 if (disptype == NULL) 1764 if (disptype == NULL)
1765 continue; 1765 continue;
1766 if (strncmp(disptype, "LCD", 3) != 0) 1766 if (strncmp(disptype, "LCD", 3) != 0)
1767 continue; 1767 continue;
1768 for (i = 0; propnames[i] != NULL; ++i) { 1768 for (i = 0; propnames[i] != NULL; ++i) {
1769 pedid = get_property(dp, propnames[i], NULL); 1769 pedid = of_get_property(dp, propnames[i], NULL);
1770 if (pedid != NULL) { 1770 if (pedid != NULL) {
1771 par->EDID = (unsigned char *)pedid; 1771 par->EDID = (unsigned char *)pedid;
1772 NVTRACE("LCD found.\n"); 1772 NVTRACE("LCD found.\n");