2009-06-10 17:43:41

by Subrata Modak

[permalink] [raw]
Subject: [PATCH] Re:[BUILD FAILURE 04/04] Next June 04:PPC64 randconfig [drivers/net/ucc_geth.o]

Hi Ling,

>On Thu, 2009-06-04 at 19:02 +0530, Subrata Modak wrote:
>CC [M] drivers/net/ucc_geth.o
> drivers/net/ucc_geth.c: In function bucc_geth_probeb:
> drivers/net/ucc_geth.c:3822: error: 'ph' undeclared (first use in this function)
> drivers/net/ucc_geth.c:3822: error: (Each undeclared identifier is reported only once
> drivers/net/ucc_geth.c:3822: error: for each function it appears in.)
> drivers/net/ucc_geth.c:3832: error: 'mdio' undeclared (first use in this function)
> make[2]: *** [drivers/net/ucc_geth.o] Error 1

With the above build error reported on 4th June linux next tree, i am proposing
the following patch. Can you please let me know if you would like to merge it.

Reference: http://lkml.org/lkml/2009/6/4/241,
Fix the following build error:

drivers/net/ucc_geth.c: In function bucc_geth_probeb:
drivers/net/ucc_geth.c:3822: error: 'ph' undeclared (first use in this function)
drivers/net/ucc_geth.c:3822: error: (Each undeclared identifier is reported only once
drivers/net/ucc_geth.c:3822: error: for each function it appears in.)
drivers/net/ucc_geth.c:3832: error: 'mdio' undeclared (first use in this function)
make[2]: *** [drivers/net/ucc_geth.o] Error 1

Signed-off-by: Subrata Modak <[email protected]>
---

--- linux-2.6.30-rc8/drivers/net/ucc_geth.c.orig 2009-06-10 11:58:39.000000000 -0500
+++ linux-2.6.30-rc8/drivers/net/ucc_geth.c 2009-06-10 12:37:15.000000000 -0500
@@ -3595,6 +3595,8 @@ static const struct net_device_ops ucc_g

static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *match)
{
+ struct device_node *mdio;
+ phandle *ph;
struct device *device = &ofdev->dev;
struct device_node *np = ofdev->node;
struct net_device *dev = NULL;
@@ -3819,7 +3821,7 @@ static int ucc_geth_probe(struct of_devi
ugeth->node = np;

/* Find the TBI PHY. If it's not there, we don't support SGMII */
- ph = of_get_property(np, "tbi-handle", NULL);
+ ph = (phandle *)of_get_property(np, "tbi-handle", NULL);
if (ph) {
struct device_node *tbi = of_find_node_by_phandle(*ph);
struct of_device *ofdev;

---
Regards--
Subrata


2009-06-11 01:05:39

by Stephen Rothwell

[permalink] [raw]
Subject: Re: [PATCH] Re:[BUILD FAILURE 04/04] Next June 04:PPC64 randconfig [drivers/net/ucc_geth.o]

Hi Subrata,

On Wed, 10 Jun 2009 23:13:23 +0530 Subrata Modak <[email protected]> wrote:
>
> /* Find the TBI PHY. If it's not there, we don't support SGMII */
> - ph = of_get_property(np, "tbi-handle", NULL);
> + ph = (phandle *)of_get_property(np, "tbi-handle", NULL);

You don't need this cast because of_get_property() returns "void *".

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (456.00 B)
(No filename) (197.00 B)
Download all attachments

2009-06-11 01:56:21

by Subrata Modak

[permalink] [raw]
Subject: Re: [PATCH] Re:[BUILD FAILURE 04/04] Next June 04:PPC64 randconfig [drivers/net/ucc_geth.o]

On Thu, 2009-06-11 at 11:05 +1000, Stephen Rothwell wrote:
> Hi Subrata,
>
> On Wed, 10 Jun 2009 23:13:23 +0530 Subrata Modak <[email protected]> wrote:
> >
> > /* Find the TBI PHY. If it's not there, we don't support SGMII */
> > - ph = of_get_property(np, "tbi-handle", NULL);
> > + ph = (phandle *)of_get_property(np, "tbi-handle", NULL);
>
> You don't need this cast because of_get_property() returns "void *".

Stephen,

True. But without this gcc complains:

CC [M] drivers/net/ucc_geth.o
drivers/net/ucc_geth.c: In function ‘ucc_geth_probe’:
drivers/net/ucc_geth.c:3824: warning: assignment discards qualifiers
from pointer target type

Else gcc just builds fine:

CC [M] drivers/net/ucc_geth.o

This is an just an extra caution to fix both the build and warning
regression(s).

Regards--
Subrata

>

2009-06-11 02:03:22

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH] Re:[BUILD FAILURE 04/04] Next June 04:PPC64 randconfig [drivers/net/ucc_geth.o]

On Thu, 2009-06-11 at 07:26 +0530, Subrata Modak wrote:
> On Thu, 2009-06-11 at 11:05 +1000, Stephen Rothwell wrote:
> > Hi Subrata,
> >
> > On Wed, 10 Jun 2009 23:13:23 +0530 Subrata Modak <[email protected]> wrote:
> > >
> > > /* Find the TBI PHY. If it's not there, we don't support SGMII */
> > > - ph = of_get_property(np, "tbi-handle", NULL);
> > > + ph = (phandle *)of_get_property(np, "tbi-handle", NULL);
> >
> > You don't need this cast because of_get_property() returns "void *".
>
> Stephen,
>
> True. But without this gcc complains:
>
> CC [M] drivers/net/ucc_geth.o
> drivers/net/ucc_geth.c: In function ‘ucc_geth_probe’:
> drivers/net/ucc_geth.c:3824: warning: assignment discards qualifiers from pointer target type
^^^^^^^^^^^

And what does that warning actually mean?

Your cast actually introduces a bug.

cheers


Attachments:
signature.asc (197.00 B)
This is a digitally signed message part

2009-06-11 02:22:21

by Tony Breeds

[permalink] [raw]
Subject: Re: [PATCH] Re:[BUILD FAILURE 04/04] Next June 04:PPC64 randconfig [drivers/net/ucc_geth.o]

On Thu, Jun 11, 2009 at 07:26:04AM +0530, Subrata Modak wrote:
> On Thu, 2009-06-11 at 11:05 +1000, Stephen Rothwell wrote:
> > Hi Subrata,
> >
> > On Wed, 10 Jun 2009 23:13:23 +0530 Subrata Modak <[email protected]> wrote:
> > >
> > > /* Find the TBI PHY. If it's not there, we don't support SGMII */
> > > - ph = of_get_property(np, "tbi-handle", NULL);
> > > + ph = (phandle *)of_get_property(np, "tbi-handle", NULL);
> >
> > You don't need this cast because of_get_property() returns "void *".
>
> Stephen,
>
> True. But without this gcc complains:
>
> CC [M] drivers/net/ucc_geth.o
> drivers/net/ucc_geth.c: In function ‘ucc_geth_probe’:
> drivers/net/ucc_geth.c:3824: warning: assignment discards qualifiers
> from pointer target type
>
> Else gcc just builds fine:
>
> CC [M] drivers/net/ucc_geth.o
>
> This is an just an extra caution to fix both the build and warning
> regression(s).

ph needs to be const.

I think the following untested (and hence un-signed-off-by) patch is closer,
however I also think that the whole SGMII setup code could use the various OF
helper functions better :)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index e2f2e91..796253d 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3603,6 +3603,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
struct resource res;
struct device_node *phy;
int err, ucc_num, max_speed = 0;
+ const phandle *ph;
const u32 *fixed_link;
const unsigned int *prop;
const char *sprop;
@@ -3821,7 +3822,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
/* Find the TBI PHY. If it's not there, we don't support SGMII */
ph = of_get_property(np, "tbi-handle", NULL);
if (ph) {
- struct device_node *tbi = of_find_node_by_phandle(*ph);
+ struct device_node *tbi = of_find_node_by_phandle(*ph), *mdio;
struct of_device *ofdev;
struct mii_bus *bus;
const unsigned int *id;

Yours Tony

2009-06-11 02:28:54

by Nathan Lynch

[permalink] [raw]
Subject: Re: [PATCH] Re:[BUILD FAILURE 04/04] Next June 04:PPC64 randconfig [drivers/net/ucc_geth.o]

Subrata Modak <[email protected]> writes:

> On Thu, 2009-06-11 at 11:05 +1000, Stephen Rothwell wrote:
>> Hi Subrata,
>>
>> On Wed, 10 Jun 2009 23:13:23 +0530 Subrata Modak <[email protected]> wrote:
>> >
>> > /* Find the TBI PHY. If it's not there, we don't support SGMII */
>> > - ph = of_get_property(np, "tbi-handle", NULL);
>> > + ph = (phandle *)of_get_property(np, "tbi-handle", NULL);
>>
>> You don't need this cast because of_get_property() returns "void *".
>
> Stephen,
>
> True. But without this gcc complains:
>
> CC [M] drivers/net/ucc_geth.o
> drivers/net/ucc_geth.c: In function ‘ucc_geth_probe’:
> drivers/net/ucc_geth.c:3824: warning: assignment discards qualifiers
> from pointer target type

ph should be declared const phandle *. Look at other uses of
of_get_property.