diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-31 15:50:35 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-31 15:50:35 -0700 |
commit | 88c8199b9d2f5ec0a8468a0495ba4c9656846500 (patch) | |
tree | 666dc82c5a1ec041a7312f4ef3306bb1806620eb /drivers | |
parent | 0439208a8a399f0c4307c561d97e3f5523f5d085 (diff) | |
parent | 50aa485e1abb7566ce68418c7bbc6a6b454f9039 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[BBC_I2C]: kmalloc + memset conversion to kzalloc
[BBC_ENVCTRL]: kmalloc + memset conversion to kzalloc
[SPARC]: Fix exec failures on sun4c.
[SPARC] Videopix Frame Grabber: Fix unreleased lock in vfc_debug()
[SPARC64]: Add missing dma_get_cache_alignment().
[SUNLANCE]: Fix sparc32 crashes by using of_*() interfaces.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/sunlance.c | 48 | ||||
-rw-r--r-- | drivers/sbus/char/bbc_envctrl.c | 10 | ||||
-rw-r--r-- | drivers/sbus/char/bbc_i2c.c | 4 |
3 files changed, 28 insertions, 34 deletions
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c index 053b7cb0d944..68e4f660367d 100644 --- a/drivers/net/sunlance.c +++ b/drivers/net/sunlance.c @@ -99,8 +99,7 @@ static char lancestr[] = "LANCE"; #include <asm/byteorder.h> /* Used by the checksum routines */ #include <asm/idprom.h> #include <asm/sbus.h> -#include <asm/openprom.h> -#include <asm/oplib.h> +#include <asm/prom.h> #include <asm/auxio.h> /* For tpe-link-test? setting */ #include <asm/irq.h> @@ -1326,6 +1325,7 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev, struct sbus_dev *lebuffer) { static unsigned version_printed; + struct device_node *dp = sdev->ofdev.node; struct net_device *dev; struct lance_private *lp; int i; @@ -1389,54 +1389,46 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev, lp->rx = lance_rx_dvma; lp->tx = lance_tx_dvma; } - lp->busmaster_regval = prom_getintdefault(sdev->prom_node, - "busmaster-regval", - (LE_C3_BSWP | LE_C3_ACON | - LE_C3_BCON)); + lp->busmaster_regval = of_getintprop_default(dp, "busmaster-regval", + (LE_C3_BSWP | + LE_C3_ACON | + LE_C3_BCON)); lp->name = lancestr; lp->ledma = ledma; lp->burst_sizes = 0; if (lp->ledma) { - char prop[6]; + struct device_node *ledma_dp = ledma->sdev->ofdev.node; + const char *prop; unsigned int sbmask; u32 csr; /* Find burst-size property for ledma */ - lp->burst_sizes = prom_getintdefault(ledma->sdev->prom_node, - "burst-sizes", 0); + lp->burst_sizes = of_getintprop_default(ledma_dp, + "burst-sizes", 0); /* ledma may be capable of fast bursts, but sbus may not. */ - sbmask = prom_getintdefault(ledma->sdev->bus->prom_node, - "burst-sizes", DMA_BURSTBITS); + sbmask = of_getintprop_default(ledma_dp, "burst-sizes", + DMA_BURSTBITS); lp->burst_sizes &= sbmask; /* Get the cable-selection property */ - memset(prop, 0, sizeof(prop)); - prom_getstring(ledma->sdev->prom_node, "cable-selection", - prop, sizeof(prop)); - if (prop[0] == 0) { - int topnd, nd; + prop = of_get_property(ledma_dp, "cable-selection", NULL); + if (!prop || prop[0] == '\0') { + struct device_node *nd; - printk(KERN_INFO "SunLance: using auto-carrier-detection.\n"); + printk(KERN_INFO "SunLance: using " + "auto-carrier-detection.\n"); - /* Is this found at /options .attributes in all - * Prom versions? XXX - */ - topnd = prom_getchild(prom_root_node); - - nd = prom_searchsiblings(topnd, "options"); + nd = of_find_node_by_path("/options"); if (!nd) goto no_link_test; - if (!prom_node_has_property(nd, "tpe-link-test?")) + prop = of_get_property(nd, "tpe-link-test?", NULL); + if (!prop) goto no_link_test; - memset(prop, 0, sizeof(prop)); - prom_getstring(nd, "tpe-link-test?", prop, - sizeof(prop)); - if (strcmp(prop, "true")) { printk(KERN_NOTICE "SunLance: warning: overriding option " "'tpe-link-test?'\n"); diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c index e821a155b658..0bde26989a23 100644 --- a/drivers/sbus/char/bbc_envctrl.c +++ b/drivers/sbus/char/bbc_envctrl.c @@ -479,11 +479,12 @@ static int kenvctrld(void *__unused) static void attach_one_temp(struct linux_ebus_child *echild, int temp_idx) { - struct bbc_cpu_temperature *tp = kmalloc(sizeof(*tp), GFP_KERNEL); + struct bbc_cpu_temperature *tp; + tp = kzalloc(sizeof(*tp), GFP_KERNEL); if (!tp) return; - memset(tp, 0, sizeof(*tp)); + tp->client = bbc_i2c_attach(echild); if (!tp->client) { kfree(tp); @@ -525,11 +526,12 @@ static void attach_one_temp(struct linux_ebus_child *echild, int temp_idx) static void attach_one_fan(struct linux_ebus_child *echild, int fan_idx) { - struct bbc_fan_control *fp = kmalloc(sizeof(*fp), GFP_KERNEL); + struct bbc_fan_control *fp; + fp = kzalloc(sizeof(*fp), GFP_KERNEL); if (!fp) return; - memset(fp, 0, sizeof(*fp)); + fp->client = bbc_i2c_attach(echild); if (!fp->client) { kfree(fp); diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c index fbadd4d761f3..ac8ef2ce07fb 100644 --- a/drivers/sbus/char/bbc_i2c.c +++ b/drivers/sbus/char/bbc_i2c.c @@ -357,13 +357,13 @@ static void __init reset_one_i2c(struct bbc_i2c_bus *bp) static int __init attach_one_i2c(struct linux_ebus_device *edev, int index) { - struct bbc_i2c_bus *bp = kmalloc(sizeof(*bp), GFP_KERNEL); + struct bbc_i2c_bus *bp; struct linux_ebus_child *echild; int entry; + bp = kzalloc(sizeof(*bp), GFP_KERNEL); if (!bp) return -ENOMEM; - memset(bp, 0, sizeof(*bp)); bp->i2c_control_regs = ioremap(edev->resource[0].start, 0x2); if (!bp->i2c_control_regs) |