diff mbox

[U-Boot] net: sh_eth: Fix build warnings and whitespace for sh_eth

Message ID 1328254249-2121-2-git-send-email-nobuhiro.iwamatsu.yj@renesas.com
State Rejected
Delegated to: Joe Hershberger
Headers show

Commit Message

Nobuhiro Iwamatsu Feb. 3, 2012, 7:30 a.m. UTC
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
 drivers/net/sh_eth.c |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

Comments

Mike Frysinger Feb. 3, 2012, 11:21 a.m. UTC | #1
On Friday 03 February 2012 02:30:48 Nobuhiro Iwamatsu wrote:
> @@ -564,8 +569,10 @@ static int sh_eth_bb_init(struct bb_miiphy_bus *bus)
> 
>  static int sh_eth_bb_mdio_active(struct bb_miiphy_bus *bus)
>  {
> +	int port;
>  	struct sh_eth_dev *eth = bus->priv;
> -	int port = eth->port;
> +
> +	port = eth->port;
> 
>  	outl(inl(PIR(port)) | PIR_MMD, PIR(port));
> 
> @@ -574,8 +581,10 @@ static int sh_eth_bb_mdio_active(struct bb_miiphy_bus
> *bus)
> 
>  static int sh_eth_bb_mdio_tristate(struct bb_miiphy_bus *bus)
>  {
> +	int port;
>  	struct sh_eth_dev *eth = bus->priv;
> -	int port = eth->port;
> +
> +	port = eth->port;
> 
>  	outl(inl(PIR(port)) & ~PIR_MMD, PIR(port));
> 
> @@ -584,8 +593,10 @@ static int sh_eth_bb_mdio_tristate(struct
> bb_miiphy_bus *bus)
> 
>  static int sh_eth_bb_set_mdio(struct bb_miiphy_bus *bus, int v)
>  {
> +	int port;
>  	struct sh_eth_dev *eth = bus->priv;
> -	int port = eth->port;
> +
> +	port = eth->port;
> 
>  	if (v)
>  		outl(inl(PIR(port)) | PIR_MDO, PIR(port));
> @@ -597,8 +608,10 @@ static int sh_eth_bb_set_mdio(struct bb_miiphy_bus
> *bus, int v)
> 
>  static int sh_eth_bb_get_mdio(struct bb_miiphy_bus *bus, int *v)
>  {
> +	int port;
>  	struct sh_eth_dev *eth = bus->priv;
> -	int port = eth->port;
> +
> +	port = eth->port;
> 
>  	*v = (inl(PIR(port)) & PIR_MDI) >> 3;
> 
> @@ -607,8 +620,10 @@ static int sh_eth_bb_get_mdio(struct bb_miiphy_bus
> *bus, int *v)
> 
>  static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v)
>  {
> +	int port;
>  	struct sh_eth_dev *eth = bus->priv;
> -	int port = eth->port;
> +
> +	port = eth->port;
> 
>  	if (v)
>  		outl(inl(PIR(port)) | PIR_MDC, PIR(port));

i don't see why any of these changes are necessary ... the old code looks fine 
to me (from a warning and style pov)
-mike
Nobuhiro Iwamatsu Feb. 15, 2012, 7:51 a.m. UTC | #2
Hi,

2012/2/3 Mike Frysinger <vapier@gentoo.org>:
> On Friday 03 February 2012 02:30:48 Nobuhiro Iwamatsu wrote:
>> @@ -564,8 +569,10 @@ static int sh_eth_bb_init(struct bb_miiphy_bus *bus)
>>
>>  static int sh_eth_bb_mdio_active(struct bb_miiphy_bus *bus)
>>  {
>> +     int port;
>>       struct sh_eth_dev *eth = bus->priv;
>> -     int port = eth->port;
>> +
>> +     port = eth->port;
>>
>>       outl(inl(PIR(port)) | PIR_MMD, PIR(port));
>>
>> @@ -574,8 +581,10 @@ static int sh_eth_bb_mdio_active(struct bb_miiphy_bus
>> *bus)
>>
>>  static int sh_eth_bb_mdio_tristate(struct bb_miiphy_bus *bus)
>>  {
>> +     int port;
>>       struct sh_eth_dev *eth = bus->priv;
>> -     int port = eth->port;
>> +
>> +     port = eth->port;
>>
>>       outl(inl(PIR(port)) & ~PIR_MMD, PIR(port));
>>
>> @@ -584,8 +593,10 @@ static int sh_eth_bb_mdio_tristate(struct
>> bb_miiphy_bus *bus)
>>
>>  static int sh_eth_bb_set_mdio(struct bb_miiphy_bus *bus, int v)
>>  {
>> +     int port;
>>       struct sh_eth_dev *eth = bus->priv;
>> -     int port = eth->port;
>> +
>> +     port = eth->port;
>>
>>       if (v)
>>               outl(inl(PIR(port)) | PIR_MDO, PIR(port));
>> @@ -597,8 +608,10 @@ static int sh_eth_bb_set_mdio(struct bb_miiphy_bus
>> *bus, int v)
>>
>>  static int sh_eth_bb_get_mdio(struct bb_miiphy_bus *bus, int *v)
>>  {
>> +     int port;
>>       struct sh_eth_dev *eth = bus->priv;
>> -     int port = eth->port;
>> +
>> +     port = eth->port;
>>
>>       *v = (inl(PIR(port)) & PIR_MDI) >> 3;
>>
>> @@ -607,8 +620,10 @@ static int sh_eth_bb_get_mdio(struct bb_miiphy_bus
>> *bus, int *v)
>>
>>  static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v)
>>  {
>> +     int port;
>>       struct sh_eth_dev *eth = bus->priv;
>> -     int port = eth->port;
>> +
>> +     port = eth->port;
>>
>>       if (v)
>>               outl(inl(PIR(port)) | PIR_MDC, PIR(port));
>
> i don't see why any of these changes are necessary ... the old code looks fine
> to me (from a warning and style pov)
> -mike

I do not seem to have any problem with the former cord, too either.
But when I dont apply this patch, I get the following warning.
-----
sh4-linux-gnu-gcc  -g  -Os   -ffixed-r13 -D__KERNEL__
-DCONFIG_SYS_TEXT_BASE=0x8FFC0000
-I/home/iwamatsu/work/u-boot/u-boot-sh/include -fno-builtin
-ffreestanding -nostdinc -isystem
/usr/lib/gcc/sh4-linux-gnu/4.4.6/include -pipe  -DCONFIG_SH -D__SH__
-m4-nofpu -Wall -Wstrict-prototypes -fno-stack-protector
-Wno-format-nonliteral -Wno-format-security     -o sh_eth.o sh_eth.c
-c
sh_eth.c: In function ‘sh_eth_reset’:
sh_eth.c:140: warning: unused variable ‘port’
sh_eth.c: In function ‘sh_eth_bb_mdio_active’:
sh_eth.c:568: warning: unused variable ‘port’
sh_eth.c: In function ‘sh_eth_bb_mdio_tristate’:
sh_eth.c:578: warning: unused variable ‘port’
sh_eth.c: In function ‘sh_eth_bb_set_mdio’:
sh_eth.c:588: warning: unused variable ‘port’
sh_eth.c: In function ‘sh_eth_bb_get_mdio’:
sh_eth.c:601: warning: unused variable ‘port’
sh_eth.c: In function ‘sh_eth_bb_set_mdc’:
sh_eth.c:611: warning: unused variable ‘port’
sh4-linux-gnu-ld  -e 0x8FFC0000 --defsym reloc_dst=0x8FFC0000 -r -o
libnet.o  sh_eth.o
-----

Best regards,
  Nobuhiro
Mike Frysinger Feb. 15, 2012, 3:25 p.m. UTC | #3
On Wednesday 15 February 2012 02:51:40 Nobuhiro Iwamatsu wrote:
> 2012/2/3 Mike Frysinger:
> > On Friday 03 February 2012 02:30:48 Nobuhiro Iwamatsu wrote:
> >>  static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v)
> >>  {
> >> +     int port;
> >>       struct sh_eth_dev *eth = bus->priv;
> >> -     int port = eth->port;
> >> +
> >> +     port = eth->port;
> >> 
> >>       if (v)
> >>               outl(inl(PIR(port)) | PIR_MDC, PIR(port));
> > 
> > i don't see why any of these changes are necessary ... the old code looks
> > fine to me (from a warning and style pov)
> 
> I do not seem to have any problem with the former cord, too either.
> But when I dont apply this patch, I get the following warning.
>
> sh_eth.c: In function ‘sh_eth_bb_set_mdc’:
> sh_eth.c:611: warning: unused variable ‘port’

you've got a different problem then and modifying the sh_eth driver ignores it

what board are you building for exactly ?
-mike
Nobuhiro Iwamatsu Feb. 22, 2012, 1:20 a.m. UTC | #4
Hi,

I built with ecovec board.

you can check command following :
make CROSS_COMPILE=sh-linux-gnu- ecovec_config
make CROSS_COMPILE=sh-linux-gnu-

Best regards,
  Nobuhiro

2012/2/16 Mike Frysinger <vapier@gentoo.org>:
> On Wednesday 15 February 2012 02:51:40 Nobuhiro Iwamatsu wrote:
>> 2012/2/3 Mike Frysinger:
>> > On Friday 03 February 2012 02:30:48 Nobuhiro Iwamatsu wrote:
>> >>  static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v)
>> >>  {
>> >> +     int port;
>> >>       struct sh_eth_dev *eth = bus->priv;
>> >> -     int port = eth->port;
>> >> +
>> >> +     port = eth->port;
>> >>
>> >>       if (v)
>> >>               outl(inl(PIR(port)) | PIR_MDC, PIR(port));
>> >
>> > i don't see why any of these changes are necessary ... the old code looks
>> > fine to me (from a warning and style pov)
>>
>> I do not seem to have any problem with the former cord, too either.
>> But when I dont apply this patch, I get the following warning.
>>
>> sh_eth.c: In function ‘sh_eth_bb_set_mdc’:
>> sh_eth.c:611: warning: unused variable ‘port’
>
> you've got a different problem then and modifying the sh_eth driver ignores it
>
> what board are you building for exactly ?
> -mike
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
Mike Frysinger Feb. 22, 2012, 5:30 a.m. UTC | #5
On Tuesday 21 February 2012 20:20:39 Nobuhiro Iwamatsu wrote:
> I built with ecovec board.
> 
> you can check command following :
> make CROSS_COMPILE=sh-linux-gnu- ecovec_config
> make CROSS_COMPILE=sh-linux-gnu-

that board doesn't build for me:
$ make CROSS_COMPILE=sh4-gentoo-linux-gnu- ecovec -s -j4
Configuring for ecovec board...
Generating include/generated/asm-offsets.h
time.c: In function 'get_ticks':
time.c:111:16: warning: variable 'ticks' set but not used [-Wunused-but-set-
variable]
sh_i2c.c:55:13: warning: 'irq_wait' defined but not used [-Wunused-function]
sh_eth.c: In function 'sh_eth_send':
sh_eth.c:79:2: warning: implicit declaration of function 'EDTRR' [-Wimplicit-
function-declaration]
sh_eth.c: In function 'sh_eth_recv':
sh_eth.c:133:2: warning: implicit declaration of function 'EDRRR' [-Wimplicit-
function-declaration]
....

and indeed, when i look at sh_eth.h in mainline, there is logic for 
CONFIG_CPU_SH7763 and CONFIG_CPU_SH7757, but not for CONFIG_CPU_SH7724.  i 
guess you're using changes that aren't in mainline yet to make this board 
build.
-mike
diff mbox

Patch

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index c1abe7c..e29061c 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -60,7 +60,8 @@  int sh_eth_send(struct eth_device *dev, volatile void *packet, int len)
 
 	/* packet must be a 4 byte boundary */
 	if ((int)packet & 3) {
-		printf(SHETHER_NAME ": %s: packet not 4 byte alligned\n", __func__);
+		printf(SHETHER_NAME
+			": %s: packet not 4 byte alligned\n" , __func__);
 		ret = -EFAULT;
 		goto err;
 	}
@@ -141,6 +142,8 @@  static int sh_eth_reset(struct sh_eth_dev *eth)
 #if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734)
 	int ret = 0, i;
 
+	port = eth->port;
+
 	/* Start e-dmac transmitter and receiver */
 	outl(EDSR_ENALL, EDSR(port));
 
@@ -159,6 +162,8 @@  static int sh_eth_reset(struct sh_eth_dev *eth)
 
 	return ret;
 #else
+	port = eth->port;
+
 	outl(inl(EDMR(port)) | EDMR_SRST, EDMR(port));
 	udelay(3000);
 	outl(inl(EDMR(port)) & ~EDMR_SRST, EDMR(port));
@@ -564,8 +569,10 @@  static int sh_eth_bb_init(struct bb_miiphy_bus *bus)
 
 static int sh_eth_bb_mdio_active(struct bb_miiphy_bus *bus)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	outl(inl(PIR(port)) | PIR_MMD, PIR(port));
 
@@ -574,8 +581,10 @@  static int sh_eth_bb_mdio_active(struct bb_miiphy_bus *bus)
 
 static int sh_eth_bb_mdio_tristate(struct bb_miiphy_bus *bus)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	outl(inl(PIR(port)) & ~PIR_MMD, PIR(port));
 
@@ -584,8 +593,10 @@  static int sh_eth_bb_mdio_tristate(struct bb_miiphy_bus *bus)
 
 static int sh_eth_bb_set_mdio(struct bb_miiphy_bus *bus, int v)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	if (v)
 		outl(inl(PIR(port)) | PIR_MDO, PIR(port));
@@ -597,8 +608,10 @@  static int sh_eth_bb_set_mdio(struct bb_miiphy_bus *bus, int v)
 
 static int sh_eth_bb_get_mdio(struct bb_miiphy_bus *bus, int *v)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	*v = (inl(PIR(port)) & PIR_MDI) >> 3;
 
@@ -607,8 +620,10 @@  static int sh_eth_bb_get_mdio(struct bb_miiphy_bus *bus, int *v)
 
 static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	if (v)
 		outl(inl(PIR(port)) | PIR_MDC, PIR(port));