Commit d05c7a80 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Paul Mackerras

[POWERPC] Rename get_property to of_get_property: drivers

Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent c4f55b39
......@@ -297,7 +297,7 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
/* Match it to a port node */
index = (ap == ap->host->ports[0]) ? 0 : 1;
for (np = np->child; np != NULL; np = np->sibling) {
const u32 *reg = get_property(np, "reg", NULL);
const u32 *reg = of_get_property(np, "reg", NULL);
if (!reg)
continue;
if (index == *reg)
......
......@@ -613,7 +613,7 @@ static int __devinit agp_uninorth_probe(struct pci_dev *pdev,
uninorth_node = of_find_node_by_name(NULL, "u3");
}
if (uninorth_node) {
const int *revprop = get_property(uninorth_node,
const int *revprop = of_get_property(uninorth_node,
"device-rev", NULL);
if (revprop != NULL)
uninorth_rev = *revprop & 0x3f;
......
......@@ -206,7 +206,7 @@ static int __init briq_panel_init(void)
const char *machine;
int i;
machine = get_property(root, "model", NULL);
machine = of_get_property(root, "model", NULL);
if (!machine || strncmp(machine, "TotalImpact,BRIQ-1", 18) != 0)
return -ENODEV;
......
......@@ -575,7 +575,7 @@ static int hvc_find_vtys(void)
(num_found >= VTTY_PORTS))
break;
vtermno = get_property(vty, "reg", NULL);
vtermno = of_get_property(vty, "reg", NULL);
if (!vtermno)
continue;
......
......@@ -153,7 +153,7 @@ static int hvc_find_vtys(void)
if (num_found >= MAX_NR_HVC_CONSOLES)
break;
vtermno = get_property(vty, "reg", NULL);
vtermno = of_get_property(vty, "reg", NULL);
if (!vtermno)
continue;
......
......@@ -1279,8 +1279,8 @@ static int __init hvsi_console_init(void)
struct hvsi_struct *hp;
const uint32_t *vtermno, *irq;
vtermno = get_property(vty, "reg", NULL);
irq = get_property(vty, "interrupts", NULL);
vtermno = of_get_property(vty, "reg", NULL);
irq = of_get_property(vty, "interrupts", NULL);
if (!vtermno || !irq)
continue;
......
......@@ -52,7 +52,7 @@ static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size)
return NULL;
}
reg = get_property(dn, "reg", &reglen);
reg = of_get_property(dn, "reg", &reglen);
naddrc = of_n_addr_cells(dn);
nsizec = of_n_size_cells(dn);
......
......@@ -144,7 +144,7 @@ int ams_sensor_attach(void)
const u32 *prop;
/* Get orientation */
prop = get_property(ams_info.of_node, "orientation", NULL);
prop = of_get_property(ams_info.of_node, "orientation", NULL);
if (!prop)
return -ENODEV;
ams_info.orient1 = *prop;
......
......@@ -276,7 +276,7 @@ int __init ams_i2c_init(struct device_node *np)
ams_info.bustype = BUS_I2C;
/* look for bus either using "reg" or by path */
prop = get_property(ams_info.of_node, "reg", NULL);
prop = of_get_property(ams_info.of_node, "reg", NULL);
if (!prop) {
result = -ENODEV;
......
......@@ -160,7 +160,7 @@ int __init ams_pmu_init(struct device_node *np)
ams_info.bustype = BUS_HOST;
/* Get PMU command, should be 0x4e, but we can never know */
prop = get_property(ams_info.of_node, "reg", NULL);
prop = of_get_property(ams_info.of_node, "reg", NULL);
if (!prop) {
result = -ENODEV;
goto exit;
......
......@@ -1175,14 +1175,14 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
pmif->broken_dma = 1;
}
bidp = get_property(np, "AAPL,bus-id", NULL);
bidp = of_get_property(np, "AAPL,bus-id", NULL);
pmif->aapl_bus_id = bidp ? *bidp : 0;
/* Get cable type from device-tree */
if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6
|| pmif->kind == controller_k2_ata6
|| pmif->kind == controller_sh_ata6) {
const char* cable = get_property(np, "cable-type", NULL);
const char* cable = of_get_property(np, "cable-type", NULL);
if (cable && !strncmp(cable, "80-", 3))
pmif->cable_80 = 1;
}
......
......@@ -569,7 +569,7 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
struct ib_pd *ibpd;
int ret;
handle = get_property(dev->ofdev.node, "ibm,hca-handle", NULL);
handle = of_get_property(dev->ofdev.node, "ibm,hca-handle", NULL);
if (!handle) {
ehca_gen_err("Cannot get eHCA handle for adapter: %s.",
dev->ofdev.node->full_name);
......
......@@ -395,7 +395,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
#endif
MAX_NODE_NAME_SIZE, np->name);
} else {
reg = get_property(np, "reg", NULL);
reg = of_get_property(np, "reg", NULL);
sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s",
chip->lbus.index,
reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name);
......
......@@ -21,7 +21,7 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
int length = 0;
of = &to_macio_device (dev)->ofdev;
compat = get_property(of->node, "compatible", &cplen);
compat = of_get_property(of->node, "compatible", &cplen);
if (!compat) {
*buf = '\0';
return 0;
......@@ -47,7 +47,7 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
int length;
of = &to_macio_device (dev)->ofdev;
compat = get_property(of->node, "compatible", &cplen);
compat = of_get_property(of->node, "compatible", &cplen);
if (!compat) compat = "", cplen = 1;
length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type);
buf += length;
......
......@@ -387,7 +387,7 @@ static int __devinit rackmeter_probe(struct macio_dev* mdev,
if (strcmp(np->name, "lightshow") == 0)
break;
if ((strcmp(np->name, "sound") == 0) &&
get_property(np, "virtual", NULL) != NULL)
of_get_property(np, "virtual", NULL) != NULL)
break;
}
if (np == NULL) {
......
......@@ -491,7 +491,7 @@ int __init smu_init (void)
printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n");
goto fail;
}
data = get_property(smu->db_node, "reg", NULL);
data = of_get_property(smu->db_node, "reg", NULL);
if (data == NULL) {
of_node_put(smu->db_node);
smu->db_node = NULL;
......@@ -512,7 +512,7 @@ int __init smu_init (void)
smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt");
if (smu->msg_node == NULL)
break;
data = get_property(smu->msg_node, "reg", NULL);
data = of_get_property(smu->msg_node, "reg", NULL);
if (data == NULL) {
of_node_put(smu->msg_node);
smu->msg_node = NULL;
......@@ -1004,7 +1004,7 @@ const struct smu_sdbp_header *__smu_get_sdb_partition(int id,
} else
mutex_lock(&smu_part_access);
part = get_property(smu->of_node, pname, size);
part = of_get_property(smu->of_node, pname, size);
if (part == NULL) {
DPRINTK("trying to extract from SMU ...\n");
part = smu_create_sdb_partition(id);
......
......@@ -567,13 +567,13 @@ thermostat_init(void)
else
return -ENODEV;
prop = get_property(np, "hwsensor-params-version", NULL);
prop = of_get_property(np, "hwsensor-params-version", NULL);
printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop,
(*prop == 1)?"":"un");
if (*prop != 1)
return -ENODEV;
prop = get_property(np, "reg", NULL);
prop = of_get_property(np, "reg", NULL);
if (!prop)
return -ENODEV;
......@@ -591,9 +591,9 @@ thermostat_init(void)
"limit_adjust: %d, fan_speed: %d\n",
therm_bus, therm_address, limit_adjust, fan_speed);
if (get_property(np, "hwsensor-location", NULL)) {
if (of_get_property(np, "hwsensor-location", NULL)) {
for (i = 0; i < 3; i++) {
sensor_location[i] = get_property(np,
sensor_location[i] = of_get_property(np,
"hwsensor-location", NULL) + offset;
if (sensor_location[i] == NULL)
......
......@@ -674,7 +674,7 @@ static int read_eeprom(int cpu, struct mpu_data *out)
printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid node from device-tree\n");
return -ENODEV;
}
data = get_property(np, "cpuid", &len);
data = of_get_property(np, "cpuid", &len);
if (data == NULL) {
printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid property from device-tree\n");
of_node_put(np);
......@@ -1337,7 +1337,7 @@ static int init_backside_state(struct backside_pid_state *state)
*/
u3 = of_find_node_by_path("/u3@0,f8000000");
if (u3 != NULL) {
const u32 *vers = get_property(u3, "device-rev", NULL);
const u32 *vers = of_get_property(u3, "device-rev", NULL);
if (vers)
if (((*vers) & 0x3f) < 0x34)
u3h = 0;
......@@ -2129,8 +2129,8 @@ static void fcu_lookup_fans(struct device_node *fcu_node)
continue;
/* Lookup for a matching location */
loc = get_property(np, "location", NULL);
reg = get_property(np, "reg", NULL);
loc = of_get_property(np, "location", NULL);
reg = of_get_property(np, "reg", NULL);
if (loc == NULL || reg == NULL)
continue;
DBG(" matching location: %s, reg: 0x%08x\n", loc, *reg);
......
......@@ -492,7 +492,7 @@ g4fan_init( void )
if( !(np=of_find_node_by_name(NULL, "power-mgt")) )
return -ENODEV;
info = get_property(np, "thermal-info", NULL);
info = of_get_property(np, "thermal-info", NULL);
of_node_put(np);
if( !info || !machine_is_compatible("PowerMac3,6") )
......
......@@ -131,7 +131,7 @@ int __init find_via_cuda(void)
if (vias == 0)
return 0;
reg = get_property(vias, "reg", NULL);
reg = of_get_property(vias, "reg", NULL);
if (reg == NULL) {
printk(KERN_ERR "via-cuda: No \"reg\" property !\n");
goto fail;
......
......@@ -118,7 +118,7 @@ static int __init via_pmu_led_init(void)
dt = of_find_node_by_path("/");
if (dt == NULL)
return -ENODEV;
model = get_property(dt, "model", NULL);
model = of_get_property(dt, "model", NULL);
if (model == NULL)
return -ENODEV;
if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 &&
......
......@@ -289,7 +289,7 @@ int __init find_via_pmu(void)
if (vias == NULL)
return 0;
reg = get_property(vias, "reg", NULL);
reg = of_get_property(vias, "reg", NULL);
if (reg == NULL) {
printk(KERN_ERR "via-pmu: No \"reg\" property !\n");
goto fail;
......@@ -331,7 +331,7 @@ int __init find_via_pmu(void)
gpiop = of_find_node_by_name(NULL, "gpio");
if (gpiop) {
reg = get_property(gpiop, "reg", NULL);
reg = of_get_property(gpiop, "reg", NULL);
if (reg)
gaddr = of_translate_address(gpiop, reg);
if (gaddr != OF_BAD_ADDR)
......@@ -487,7 +487,7 @@ static int __init via_pmu_dev_init(void)
struct device_node* prim = find_devices("power-mgt");
const u32 *prim_info = NULL;
if (prim)
prim_info = get_property(prim, "prim-info", NULL);
prim_info = of_get_property(prim, "prim-info", NULL);
if (prim_info) {
/* Other stuffs here yet unknown */
pmu_battery_count = (prim_info[6] >> 16) & 0xff;
......
......@@ -176,7 +176,7 @@ static int wf_lm75_attach(struct i2c_adapter *adapter)
for (dev = NULL;
(dev = of_get_next_child(busnode, dev)) != NULL;) {
const char *loc =
get_property(dev, "hwsensor-location", NULL);
of_get_property(dev, "hwsensor-location", NULL);
u8 addr;
/* We must re-match the adapter in order to properly check
......
......@@ -134,7 +134,7 @@ static int wf_max6690_attach(struct i2c_adapter *adapter)
if (!device_is_compatible(dev, "max6690"))
continue;
addr = pmac_i2c_get_dev_addr(dev);
loc = get_property(dev, "hwsensor-location", NULL);
loc = of_get_property(dev, "hwsensor-location", NULL);
if (loc == NULL || addr == 0)
continue;
printk("found max6690, loc=%s addr=0x%02x\n", loc, addr);
......
......@@ -167,7 +167,7 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
if (fct == NULL)
return NULL;
fct->ctrl.ops = &smu_fan_ops;
l = get_property(node, "location", NULL);
l = of_get_property(node, "location", NULL);
if (l == NULL)
goto fail;
......@@ -224,17 +224,17 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
goto fail;
/* Get min & max values*/
v = get_property(node, "min-value", NULL);
v = of_get_property(node, "min-value", NULL);
if (v == NULL)
goto fail;
fct->min = *v;
v = get_property(node, "max-value", NULL);
v = of_get_property(node, "max-value", NULL);
if (v == NULL)
goto fail;
fct->max = *v;
/* Get "reg" value */
reg = get_property(node, "reg", NULL);
reg = of_get_property(node, "reg", NULL);
if (reg == NULL)
goto fail;
fct->reg = *reg;
......
......@@ -241,7 +241,7 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
char *name;
int vsens[2], isens[2];
reg = get_property(dev, "reg", NULL);
reg = of_get_property(dev, "reg", NULL);
if (reg == NULL)
return;
addr = *reg;
......@@ -268,9 +268,9 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
isens[0] = isens[1] = -1;
child = NULL;
while ((child = of_get_next_child(dev, child)) != NULL) {
reg = get_property(child, "reg", NULL);
type = get_property(child, "device_type", NULL);
loc = get_property(child, "location", NULL);
reg = of_get_property(child, "reg", NULL);
type = of_get_property(child, "device_type", NULL);
loc = of_get_property(child, "location", NULL);
if (reg == NULL || loc == NULL)
continue;
......
......@@ -204,8 +204,8 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL);
if (ads == NULL)
return NULL;
c = get_property(node, "device_type", NULL);
l = get_property(node, "location", NULL);
c = of_get_property(node, "device_type", NULL);
l = of_get_property(node, "location", NULL);
if (c == NULL || l == NULL)
goto fail;
......@@ -255,7 +255,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
} else
goto fail;
v = get_property(node, "reg", NULL);
v = of_get_property(node, "reg", NULL);
if (v == NULL)
goto fail;
ads->reg = *v;
......
......@@ -48,7 +48,7 @@ static int parse_flash_partitions(struct device_node *node,
const u32 *part;
const char *name;
part = get_property(node, "partitions", &plen);
part = of_get_property(node, "partitions", &plen);
if (part == NULL)
goto err;
......@@ -59,7 +59,7 @@ static int parse_flash_partitions(struct device_node *node,
goto err;
}
name = get_property(node, "partition-names", &plen);
name = of_get_property(node, "partition-names", &plen);
for (i = 0; i < retval; i++) {
(*parts)[i].offset = *part++;
......@@ -153,7 +153,7 @@ static int __devinit of_physmap_probe(struct of_device *dev, const struct of_dev
goto err_out;
}
width = get_property(dp, "bank-width", NULL);
width = of_get_property(dp, "bank-width", NULL);
if (width == NULL) {
dev_err(&dev->dev, "Can't get the flash bank width!\n");
err = -EINVAL;
......@@ -174,7 +174,7 @@ static int __devinit of_physmap_probe(struct of_device *dev, const struct of_dev
simple_map_init(&info->map);
of_probe = get_property(dp, "probe-type", NULL);
of_probe = of_get_property(dp, "probe-type", NULL);
if (of_probe == NULL) {
probe_type = rom_probe_types;
for (; info->mtd == NULL && *probe_type != NULL; probe_type++)
......
......@@ -1261,9 +1261,10 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i
printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n");
return -ENODEV;
}
prop_addr = get_property(macio_get_of_node(mdev), "mac-address", NULL);
prop_addr = of_get_property(macio_get_of_node(mdev),
"mac-address", NULL);
if (prop_addr == NULL) {
prop_addr = get_property(macio_get_of_node(mdev),
prop_addr = of_get_property(macio_get_of_node(mdev),
"local-mac-address", NULL);
if (prop_addr == NULL) {
printk(KERN_ERR "BMAC: Can't get mac-address\n");
......
......@@ -2336,7 +2336,7 @@ static int ehea_setup_single_port(struct ehea_port *port,
port->of_dev_node = dn;
/* Determine logical port id */
dn_log_port_id = get_property(dn, "ibm,hea-port-no", NULL);
dn_log_port_id = of_get_property(dn, "ibm,hea-port-no", NULL);
if (!dn_log_port_id) {
ehea_error("bad device node: dn_log_port_id=%p",
......@@ -2502,7 +2502,7 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev,
goto out;
}
adapter_handle = get_property(dev->ofdev.node, "ibm,hea-handle",
adapter_handle = of_get_property(dev->ofdev.node, "ibm,hea-handle",
NULL);
if (adapter_handle)
adapter->handle = *adapter_handle;
......
......@@ -110,9 +110,9 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
return -ENODEV;
}
addr = get_property(mace, "mac-address", NULL);
addr = of_get_property(mace, "mac-address", NULL);
if (addr == NULL) {
addr = get_property(mace, "local-mac-address", NULL);
addr = of_get_property(mace, "local-mac-address", NULL);
if (addr == NULL) {
printk(KERN_ERR "Can't get mac-address for MACE %s\n",
mace->full_name);
......
......@@ -80,7 +80,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
return -ENOENT;
}
maddr = get_property(dn, "mac-address", NULL);
maddr = of_get_property(dn, "mac-address", NULL);
if (maddr == NULL) {
dev_warn(&pdev->dev,
"no mac address in device tree, not configuring\n");
......
......@@ -1831,7 +1831,7 @@ try_host_fw:
if (!dn)
goto out_err;
fw_prop = get_property(dn, "firmware", &fw_size);
fw_prop = of_get_property(dn, "firmware", &fw_size);
if (!fw_prop)
goto out_err;
......@@ -2237,7 +2237,7 @@ spider_net_setup_netdev(struct spider_net_card *card)
if (!dn)
return -EIO;
mac = get_property(dn, "local-mac-address", NULL);
mac = of_get_property(dn, "local-mac-address", NULL);
if (!mac)
return -EIO;
memcpy(addr.sa_data, mac, ETH_ALEN);
......
......@@ -2929,7 +2929,7 @@ static int __devinit gem_get_device_address(struct gem *gp)
#elif defined(CONFIG_PPC_PMAC)
const unsigned char *addr;
addr = get_property(gp->of_node, "local-mac-address", NULL);
addr = of_get_property(gp->of_node, "local-mac-address", NULL);
if (addr == NULL) {
printk("\n");
printk(KERN_ERR "%s: can't get mac-address\n", dev->name);
......
......@@ -451,7 +451,7 @@ static int bcm5421_init(struct mii_phy* phy)
if (phy->platform_data) {
struct device_node *np = of_get_parent(phy->platform_data);
int can_low_power = 1;
if (np == NULL || get_property(np, "no-autolowpower", NULL))
if (np == NULL || of_get_property(np, "no-autolowpower", NULL))
can_low_power = 0;
if (can_low_power) {
/* Enable automatic low-power */
......
......@@ -4080,16 +4080,16 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ugeth_vdbg("%s: IN", __FUNCTION__);
prop = get_property(np, "device-id", NULL);
prop = of_get_property(np, "device-id", NULL);
ucc_num = *prop - 1;
if ((ucc_num < 0) || (ucc_num > 7))
return -ENODEV;
ug_info = &ugeth_info[ucc_num];
ug_info->uf_info.ucc_num = ucc_num;
prop = get_property(np, "rx-clock", NULL);
prop = of_get_property(np, "rx-clock", NULL);
ug_info->uf_info.rx_clock = *prop;
prop = get_property(np, "tx-clock", NULL);
prop = of_get_property(np, "tx-clock", NULL);
ug_info->uf_info.tx_clock = *prop;
err = of_address_to_resource(np, 0, &res);
if (err)
......@@ -4098,15 +4098,15 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ug_info->uf_info.regs = res.start;
ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
ph = get_property(np, "phy-handle", NULL);
ph = of_get_property(np, "phy-handle", NULL);
phy = of_find_node_by_phandle(*ph);
if (phy == NULL)
return -ENODEV;
prop = get_property(phy, "reg", NULL);
prop = of_get_property(phy, "reg", NULL);
ug_info->phy_address = *prop;
prop = get_property(phy, "interface", NULL);
prop = of_get_property(phy, "interface", NULL);
ug_info->enet_interface = *prop;
ug_info->phy_interrupt = irq_of_parse_and_map(phy, 0);
ug_info->board_flags = (ug_info->phy_interrupt == NO_IRQ)?
......@@ -4127,7 +4127,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
/* timing. */
/* The following compensates by writing to the reserved */
/* QE Port Output Hold Registers (CPOH1?). */
prop = get_property(phy, "interface", NULL);
prop = of_get_property(phy, "interface", NULL);
phy_interface = *prop;
if ((phy_interface == ENET_1000_RGMII) ||
(phy_interface == ENET_100_RGMII) ||
......@@ -4140,7 +4140,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
soc = of_find_node_by_type(NULL, "soc");
if (soc) {
unsigned int size;
const void *prop = get_property(soc, "reg", &size);
const void *prop = of_get_property(soc, "reg", &size);
immrbase = of_translate_address(soc, prop);