Skip to contentSkip to conversation

USB: Fix build breakage in musb

PATCH In review Alexander Graf 4 participants 6 messages May 7, 2011 – May 9, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: Fix build breakage in musb

Today's git failed building for me. It looks like a mismatching function prototype definition.

This patch fixes compilation of arm-softmmu for me.

---
 hw/usb-musb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/usb-musb.c +1 -1
index b30caeb..85a2b6f 100644
@@ -261,7 +261,7 @@
 
 static void musb_attach(USBPort *port);
 static void musb_detach(USBPort *port);
-static void musb_schedule_cb(USBDevice *dev, USBPacket *p);
+static inline void musb_schedule_cb(USBDevice *dev, USBPacket *p);
 
 static USBPortOps musb_port_ops = {
     .attach = musb_attach,
Signature · 1 line
1.6.0.2
Acked-by on v1 1/1
#1 lore raw

Am 08.05.2011 um 00:59 schrieb Alexander Graf:

Quoted 6 lines

Today's git failed building for me. It looks like a mismatching function prototype definition.

This patch fixes compilation of arm-softmmu for me.

Yup, prototype was incorrectly introduced in 13a9a0d3e253e272744b523e39642c9b6d564f4d (usb: move complete callback to port ops).

Fixes the warning for me.

Thanks,
Andreas

#2 lore raw
In reply to Alexander Graf

Am 08.05.2011 00:59, schrieb Alexander Graf:

Quoted 15 lines

Today's git failed building for me. It looks like a mismatching function prototype definition.

This patch fixes compilation of arm-softmmu for me.

---
hw/usb-musb.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
hw/usb-musb.c +0 -0
index b30caeb..85a2b6f 100644

hw/usb-musb.c line 267

Quoted 8 lines
hw/usb-musb.c +1 -1
@@ -261,7 +261,7 @@
 
 static void musb_attach(USBPort *port);
 static void musb_detach(USBPort *port);
-static void musb_schedule_cb(USBDevice *dev, USBPacket *p);
+static inline void musb_schedule_cb(USBDevice *dev, USBPacket *p);
 
 static USBPortOps musb_port_ops = {
 .attach = musb_attach,

The patch fixes the warning, because now forward declaration and function definition match, but it's not the correct approach.

Instead of adding 'inline' here, 'inline' should be removed from the definition. The function musb_schedule_cb is used via a function pointer, so it is never inline.

Regards,
Stefan W.

#3 lore raw

Am 08.05.2011 17:54, schrieb Stefan Weil:

Quoted 28 lines

Am 08.05.2011 00:59, schrieb Alexander Graf:

Quoted 15 lines

Today's git failed building for me. It looks like a mismatching function prototype definition.

This patch fixes compilation of arm-softmmu for me.

---
hw/usb-musb.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
hw/usb-musb.c +0 -0
index b30caeb..85a2b6f 100644

hw/usb-musb.c line 267

Quoted 8 lines
hw/usb-musb.c +1 -1
@@ -261,7 +261,7 @@
 
 static void musb_attach(USBPort *port);
 static void musb_detach(USBPort *port);
-static void musb_schedule_cb(USBDevice *dev, USBPacket *p);
+static inline void musb_schedule_cb(USBDevice *dev, USBPacket *p);
 
 static USBPortOps musb_port_ops = {
 .attach = musb_attach,

The patch fixes the warning, because now forward declaration and function definition match, but it's not the correct approach.

Quoted 5 lines

Instead of adding 'inline' here, 'inline' should be removed from the definition. The function musb_schedule_cb is used via a function pointer, so it is never inline.

Regards,
Stefan W.

Looking closer at file hw/usb-musb.c, I'd even recommend removing all 'inline' attributes there:

The functions musb_cb_tick0, musb_cb_tick1 are used via function pointer and a single direct call (which can be optimized by the compiler even without 'inline').

The function musb_packet is too large for a typical inline function.

Regards,
Stefan W.

#4 lore raw

Hi,

Quoted 2 lines

Looking closer at file hw/usb-musb.c, I'd even recommend removing all 'inline' attributes there:

I'll do that.

/me wonders why the local test build worked just fine. Seems recent gcc versions became pickier (running gcc 4.4).

cheers,
Gerd

#5 lore raw
Quoted 8 lines · Gerd Hoffmann

Hi,

Quoted 2 lines

Looking closer at file hw/usb-musb.c, I'd even recommend removing all 'inline' attributes there:

I'll do that.

/me wonders why the local test build worked just fine. Seems recent gcc versions became pickier (running gcc 4.4).

Hrm - maybe your gcc was just configured differently. It's certainly not the version :). I did my test builds on:

agraf@toonie:~> gcc --version
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]

Alex