public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] MPC5xxx: fix some compiler warnings in USB code
@ 2007-08-21 10:40 Martin Krause
  2007-08-23 16:25 ` Markus Klotzbücher
  2007-08-29  0:11 ` Wolfgang Denk
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Krause @ 2007-08-21 10:40 UTC (permalink / raw)
  To: u-boot

Fix the following warnings:
- usb.c:xx: warning: function declaration isn't a prototype
- usb_ohci.c:xxx: warning: passing argument 1 of '__fswab32' makes integer
  from pointer wihtout a cast 

Signed-off-by: Martin Krause <martin.krase@tqs.de>
---
Some remarks:

The patch fixes the compiler warnings, but I'm not sure, if the
original code is correct. It seems, that in function periodic_unlink()
the pointer ed_p is little/big endian swapped and not the content, the
pointer is pointing to. Not sure if this was intended. Maybe some USB 
expert (Markus?) could take a look at this?


 cpu/mpc5xxx/usb.c  |    6 +++---
 drivers/usb_ohci.c |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cpu/mpc5xxx/usb.c b/cpu/mpc5xxx/usb.c
index ce709fc..ed467ab 100644
--- a/cpu/mpc5xxx/usb.c
+++ b/cpu/mpc5xxx/usb.c
@@ -27,7 +27,7 @@
 
 #include <mpc5xxx.h>
 
-int usb_cpu_init()
+int usb_cpu_init(void)
 {
 	/* Set the USB Clock						     */
 	*(vu_long *)MPC5XXX_CDM_48_FDC = CONFIG_USB_CLOCK;
@@ -41,12 +41,12 @@ int usb_cpu_init()
 	return 0;
 }
 
-int usb_cpu_stop()
+int usb_cpu_stop(void)
 {
 	return 0;
 }
 
-int usb_cpu_init_fail()
+int usb_cpu_init_fail(void)
 {
 	return 0;
 }
diff --git a/drivers/usb_ohci.c b/drivers/usb_ohci.c
index f0a37b2..14984a5 100644
--- a/drivers/usb_ohci.c
+++ b/drivers/usb_ohci.c
@@ -669,7 +669,7 @@ static int ep_link (ohci_t *ohci, ed_t *edi)
 				ed_p = &(((ed_t *)ed_p)->hwNextED))
 					inter = ep_rev (6, ((ed_t *)ed_p)->int_interval);
 			ed->hwNextED = *ed_p;
-			*ed_p = m32_swap(ed);
+			*ed_p = m32_swap((unsigned long)ed);
 		}
 		break;
 	}
@@ -687,11 +687,11 @@ static void periodic_unlink ( struct ohci *ohci, volatile struct ed *ed,
 
 		/* ED might have been unlinked through another path */
 		while (*ed_p != 0) {
-			if (((struct ed *)m32_swap (ed_p)) == ed) {
+			if (((struct ed *)m32_swap ((unsigned long)ed_p)) == ed) {
 				*ed_p = ed->hwNextED;
 				break;
 			}
-			ed_p = & (((struct ed *)m32_swap (ed_p))->hwNextED);
+			ed_p = & (((struct ed *)m32_swap ((unsigned long)ed_p))->hwNextED);
 		}
 	}
 }

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

* [U-Boot-Users] [PATCH] MPC5xxx: fix some compiler warnings in USB code
  2007-08-21 10:40 [U-Boot-Users] [PATCH] MPC5xxx: fix some compiler warnings in USB code Martin Krause
@ 2007-08-23 16:25 ` Markus Klotzbücher
  2007-08-24  7:27   ` Martin Krause
  2007-08-29  0:11 ` Wolfgang Denk
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Klotzbücher @ 2007-08-23 16:25 UTC (permalink / raw)
  To: u-boot

Hi Martin,

Martin Krause <martin.krause@tqs.de> writes:

> Fix the following warnings:
> - usb.c:xx: warning: function declaration isn't a prototype
> - usb_ohci.c:xxx: warning: passing argument 1 of '__fswab32' makes integer
>   from pointer wihtout a cast 
>
> Signed-off-by: Martin Krause <martin.krase@tqs.de>

Thanks, will be added to Custodian repo.

> Some remarks:
>
> The patch fixes the compiler warnings, but I'm not sure, if the
> original code is correct. It seems, that in function periodic_unlink()
> the pointer ed_p is little/big endian swapped and not the content, the
> pointer is pointing to. Not sure if this was intended. Maybe some USB 
> expert (Markus?) could take a look at this?

Hmm, not sure. I'll try to take a look, but it'll take a while. Are you
experiencing a problem you suspect is caused by this?

Best regards

Markus Klotzbuecher

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de

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

* [U-Boot-Users] [PATCH] MPC5xxx: fix some compiler warnings in USB code
  2007-08-23 16:25 ` Markus Klotzbücher
@ 2007-08-24  7:27   ` Martin Krause
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Krause @ 2007-08-24  7:27 UTC (permalink / raw)
  To: u-boot

Hi Markus,

Markus Klotzb?cher wrote on Thursday, August 23, 2007 6:26 PM:
> > The patch fixes the compiler warnings, but I'm not sure, if the
> > original code is correct. It seems, that in function
> > periodic_unlink() the pointer ed_p is little/big endian swapped and
> > not the content, the pointer is pointing to. Not sure if this was
> > intended. Maybe some USB expert (Markus?) could take a look at this?
> 
> Hmm, not sure. I'll try to take a look, but it'll take a while. Are
> you experiencing a problem you suspect is caused by this?

No, no problems. I only found it strange to byte-swap a pointer and
then compare it to another (unswapped) pointer. But maybe this is all 
OK for pointes included in USB data structures (because of little/big
endian conversion).

Best Regards,
Martin Krause

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

* [U-Boot-Users] [PATCH] MPC5xxx: fix some compiler warnings in USB code
  2007-08-21 10:40 [U-Boot-Users] [PATCH] MPC5xxx: fix some compiler warnings in USB code Martin Krause
  2007-08-23 16:25 ` Markus Klotzbücher
@ 2007-08-29  0:11 ` Wolfgang Denk
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2007-08-29  0:11 UTC (permalink / raw)
  To: u-boot

In message <20070821102751.5636.68943.stgit@tq-sewsrv-4.tq-net.de> you wrote:
> Fix the following warnings:
> - usb.c:xx: warning: function declaration isn't a prototype
> - usb_ohci.c:xxx: warning: passing argument 1 of '__fswab32' makes integer
>   from pointer wihtout a cast 
> 
> Signed-off-by: Martin Krause <martin.krase@tqs.de>

Applied, thanks.

> Some remarks:
> 
> The patch fixes the compiler warnings, but I'm not sure, if the
> original code is correct. It seems, that in function periodic_unlink()
> the pointer ed_p is little/big endian swapped and not the content, the
> pointer is pointing to. Not sure if this was intended. Maybe some USB 
> expert (Markus?) could take a look at this?

Markus, I accepted this patch to get rid  of  the  warnings  for  the
2.3.0-rc1  version. Could you please check the code again it if needs
to be changed as Martin suggests?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Gods don't like people not doing much work. People  who  aren't  busy
all the time might start to _think_.  - Terry Pratchett, _Small Gods_

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

end of thread, other threads:[~2007-08-29  0:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-21 10:40 [U-Boot-Users] [PATCH] MPC5xxx: fix some compiler warnings in USB code Martin Krause
2007-08-23 16:25 ` Markus Klotzbücher
2007-08-24  7:27   ` Martin Krause
2007-08-29  0:11 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox