diff mbox

USB: Fix build breakage in musb

Message ID 1304809179-7359-1-git-send-email-agraf@suse.de
State New
Headers show

Commit Message

Alexander Graf May 7, 2011, 10:59 p.m. UTC
Today's git failed building for me. It looks like a mismatching function
prototype definition.

This patch fixes compilation of arm-softmmu for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/usb-musb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Andreas Färber May 8, 2011, 3:40 p.m. UTC | #1
Am 08.05.2011 um 00:59 schrieb Alexander Graf:

> Today's git failed building for me. It looks like a mismatching  
> function
> prototype definition.
>
> This patch fixes compilation of arm-softmmu for me.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>

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

Acked-by: Andreas Färber <andreas.faerber@web.de>

Fixes the warning for me.

Thanks,
Andreas
Stefan Weil May 8, 2011, 3:54 p.m. UTC | #2
Am 08.05.2011 00:59, schrieb Alexander Graf:
> Today's git failed building for me. It looks like a mismatching function
> prototype definition.
>
> This patch fixes compilation of arm-softmmu for me.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
> hw/usb-musb.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/usb-musb.c b/hw/usb-musb.c
> index b30caeb..85a2b6f 100644
> --- a/hw/usb-musb.c
> +++ b/hw/usb-musb.c
> @@ -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.
Stefan Weil May 8, 2011, 4:08 p.m. UTC | #3
Am 08.05.2011 17:54, schrieb Stefan Weil:
> Am 08.05.2011 00:59, schrieb Alexander Graf:
>> Today's git failed building for me. It looks like a mismatching function
>> prototype definition.
>>
>> This patch fixes compilation of arm-softmmu for me.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> hw/usb-musb.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/hw/usb-musb.c b/hw/usb-musb.c
>> index b30caeb..85a2b6f 100644
>> --- a/hw/usb-musb.c
>> +++ b/hw/usb-musb.c
>> @@ -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.

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.
Gerd Hoffmann May 9, 2011, 7:43 a.m. UTC | #4
Hi,

> 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
Alexander Graf May 9, 2011, 9:05 a.m. UTC | #5
On 09.05.2011, at 09:43, Gerd Hoffmann wrote:

>  Hi,
> 
>> 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
diff mbox

Patch

diff --git a/hw/usb-musb.c b/hw/usb-musb.c
index b30caeb..85a2b6f 100644
--- a/hw/usb-musb.c
+++ b/hw/usb-musb.c
@@ -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,