linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 15/20] [powerpc,netdevices] Constify & voidify get_property()
@ 2006-07-04  6:47 Jeremy Kerr
  0 siblings, 0 replies; 4+ messages in thread
From: Jeremy Kerr @ 2006-07-04  6:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: netdev, cbe-oss-dev

Now that get_property() returns a void *, there's no need to cast its
return value. Also, treat the return value as const, so we can
constify get_property later.

powerpc-specific network device driver changes.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---

 bmac.c       |   13 ++++++++-----
 mace.c       |    2 +-
 spider_net.c |   12 ++++++------
 sungem.c     |    2 +-
 4 files changed, 16 insertions(+), 13 deletions(-)

Index: linux-2.6/drivers/net/bmac.c
===================================================================
--- linux-2.6.orig/drivers/net/bmac.c
+++ linux-2.6/drivers/net/bmac.c
@@ -1264,7 +1264,8 @@ static int __devinit bmac_probe(struct m
 {
	int j, rev, ret;
	struct bmac_data *bp;
-	unsigned char *addr;
+	const unsigned char *prop_addr;
+	unsigned char addr[6];
	struct net_device *dev;
	int is_bmac_plus = ((int)match->data) != 0;
 
@@ -1272,14 +1273,16 @@ static int __devinit bmac_probe(struct m
		printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n");
		return -ENODEV;
	}
-	addr = get_property(macio_get_of_node(mdev), "mac-address", NULL);
-	if (addr == NULL) {
-		addr = get_property(macio_get_of_node(mdev), "local-mac-address", NULL);
-		if (addr == NULL) {
+	prop_addr = get_property(macio_get_of_node(mdev), "mac-address", NULL);
+	if (prop_addr == NULL) {
+		prop_addr = 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");
			return -ENODEV;
		}
	}
+	memcpy(addr, prop_addr, sizeof(addr));
 
	dev = alloc_etherdev(PRIV_BYTES);
	if (!dev) {
Index: linux-2.6/drivers/net/mace.c
===================================================================
--- linux-2.6.orig/drivers/net/mace.c
+++ linux-2.6/drivers/net/mace.c
@@ -113,7 +113,7 @@ static int __devinit mace_probe(struct m
	struct device_node *mace = macio_get_of_node(mdev);
	struct net_device *dev;
	struct mace_data *mp;
-	unsigned char *addr;
+	const unsigned char *addr;
	int j, rev, rc = -EBUSY;
 
	if (macio_resource_count(mdev) != 3 || macio_irq_count(mdev) != 3) {
Index: linux-2.6/drivers/net/sungem.c
===================================================================
--- linux-2.6.orig/drivers/net/sungem.c
+++ linux-2.6/drivers/net/sungem.c
@@ -2896,7 +2896,7 @@ static int __devinit gem_get_device_addr
	if (use_idprom)
		memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
 #elif defined(CONFIG_PPC_PMAC)
-	unsigned char *addr;
+	const unsigned char *addr;
 
	addr = get_property(gp->of_node, "local-mac-address", NULL);
	if (addr == NULL) {
Index: linux-2.6/drivers/net/spider_net.c
===================================================================
--- linux-2.6.orig/drivers/net/spider_net.c
+++ linux-2.6/drivers/net/spider_net.c
@@ -1812,10 +1812,10 @@ spider_net_setup_phy(struct spider_net_c
  */
 static int
 spider_net_download_firmware(struct spider_net_card *card,
-			     u8 *firmware_ptr)
+			     const void *firmware_ptr)
 {
 	int sequencer, i;
-	u32 *fw_ptr = (u32 *)firmware_ptr;
+	const u32 *fw_ptr = firmware_ptr;
 
 	/* stop sequencers */
 	spider_net_write_reg(card, SPIDER_NET_GSINIT,
@@ -1872,7 +1872,7 @@ spider_net_init_firmware(struct spider_n
 {
 	struct firmware *firmware = NULL;
 	struct device_node *dn;
-	u8 *fw_prop = NULL;
+	const u8 *fw_prop = NULL;
 	int err = -ENOENT;
 	int fw_size;
 
@@ -1898,7 +1898,7 @@ try_host_fw:
 	if (!dn)
 		goto out_err;
 
-	fw_prop = (u8 *)get_property(dn, "firmware", &fw_size);
+	fw_prop = get_property(dn, "firmware", &fw_size);
 	if (!fw_prop)
 		goto out_err;
 
@@ -2058,7 +2058,7 @@ spider_net_setup_netdev(struct spider_ne
 	struct net_device *netdev = card->netdev;
 	struct device_node *dn;
 	struct sockaddr addr;
-	u8 *mac;
+	const u8 *mac;
 
 	SET_MODULE_OWNER(netdev);
 	SET_NETDEV_DEV(netdev, &card->pdev->dev);
@@ -2089,7 +2089,7 @@ spider_net_setup_netdev(struct spider_ne
 	if (!dn)
 		return -EIO;
 
-	mac = (u8 *)get_property(dn, "local-mac-address", NULL);
+	mac = get_property(dn, "local-mac-address", NULL);
 	if (!mac)
 		return -EIO;
 	memcpy(addr.sa_data, mac, ETH_ALEN);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 15/20] [powerpc, netdevices] Constify & voidify get_property()
       [not found] <98457831@toto.iv>
@ 2006-07-07 10:35 ` Paul Mackerras
  2006-07-10  3:40   ` Jeremy Kerr
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Mackerras @ 2006-07-07 10:35 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: linuxppc-dev, cbe-oss-dev, netdev

Jeremy Kerr writes:

> powerpc-specific network device driver changes.

For some reason, the whitespace got munged on this one.  There were
some rejects on some of the other patches due to some of Ben H's
patches.  Please fix them and move the include/linux/platform_device.h
change into the same patch as the drivers/base/platform.c change.

I have applied patches 1-3.  Please resubmit the rest.

Regards,
Paul.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 15/20] [powerpc, netdevices] Constify & voidify get_property()
  2006-07-07 10:35 ` [PATCH 15/20] [powerpc, netdevices] Constify & voidify get_property() Paul Mackerras
@ 2006-07-10  3:40   ` Jeremy Kerr
  2006-07-10 12:43     ` Paul Mackerras
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Kerr @ 2006-07-10  3:40 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, cbe-oss-dev

Paul,

> For some reason, the whitespace got munged on this one.

Hm, that's odd - you mean the patch doesn't apply, or that it introduces 
incorrect whitepace? I can apply this patch (from patchwork or the list 
archives) without problems.

> There were some rejects on some of the other patches due to some of
> Ben H's patches. Please fix them and move the
> include/linux/platform_device.h change into the same patch as the
> drivers/base/platform.c change.

Sure thing. patches coming.


Jeremy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 15/20] [powerpc, netdevices] Constify & voidify get_property()
  2006-07-10  3:40   ` Jeremy Kerr
@ 2006-07-10 12:43     ` Paul Mackerras
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Mackerras @ 2006-07-10 12:43 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: linuxppc-dev, cbe-oss-dev

Jeremy Kerr writes:

> Hm, that's odd - you mean the patch doesn't apply, or that it introduces 
> incorrect whitepace? I can apply this patch (from patchwork or the list 
> archives) without problems.

The git-applymbox script says the patch is corrupt, because several of
the context lines that should start with <space><tab> had the space
removed.

Paul.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-07-10 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <98457831@toto.iv>
2006-07-07 10:35 ` [PATCH 15/20] [powerpc, netdevices] Constify & voidify get_property() Paul Mackerras
2006-07-10  3:40   ` Jeremy Kerr
2006-07-10 12:43     ` Paul Mackerras
2006-07-04  6:47 [PATCH 15/20] [powerpc,netdevices] " Jeremy Kerr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).