[UBOOT,RFC,11/13] commom: usb: implement "__weak" functions to make compiler happy

Message ID 1408372115-4570-12-git-send-email-kishon@ti.com
State New
Headers show

Commit Message

Kishon Vijay Abraham I Aug. 18, 2014, 2:28 p.m.
Implemented __weak functions for board_usb_cleanup,
board_usb_gadget_handle_interrupts and usb_gadget_handle_interrupts
to get of compiler errors in platforms that haven't implemented
these functions.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 common/usb.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Lukasz Majewski Aug. 19, 2014, 8:28 a.m. | #1
Hi Kishon,

> Implemented __weak functions for board_usb_cleanup,
> board_usb_gadget_handle_interrupts and usb_gadget_handle_interrupts
> to get of compiler errors in platforms that haven't implemented
> these functions.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  common/usb.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/common/usb.c b/common/usb.c
> index 60daa10..892bf7c 100644
> --- a/common/usb.c
> +++ b/common/usb.c
> @@ -1072,4 +1072,22 @@ int board_usb_init(int index, enum
> usb_init_type init) {
>  	return 0;
>  }
> +
> +__weak
> +int board_usb_cleanup(int index, enum usb_init_type init)
> +{
> +	return 0;
> +}

This needed before [PATCH 7/13]. Without it your code will cause u-boot
repository to not be bisectable.

> +
> +__weak
> +int board_usb_gadget_handle_interrupts(int index)
> +{
> +	return 0;
> +}
> +
> +__weak
> +int usb_gadget_handle_interrupts(void)
> +{
> +	return 0;
> +}
>  /* EOF */
Kishon Vijay Abraham I Aug. 19, 2014, 4:14 p.m. | #2
On Tuesday 19 August 2014 01:58 PM, Lukasz Majewski wrote:
> Hi Kishon,
> 
>> Implemented __weak functions for board_usb_cleanup,
>> board_usb_gadget_handle_interrupts and usb_gadget_handle_interrupts
>> to get of compiler errors in platforms that haven't implemented
>> these functions.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  common/usb.c | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>>
>> diff --git a/common/usb.c b/common/usb.c
>> index 60daa10..892bf7c 100644
>> --- a/common/usb.c
>> +++ b/common/usb.c
>> @@ -1072,4 +1072,22 @@ int board_usb_init(int index, enum
>> usb_init_type init) {
>>  	return 0;
>>  }
>> +
>> +__weak
>> +int board_usb_cleanup(int index, enum usb_init_type init)
>> +{
>> +	return 0;
>> +}
> 
> This needed before [PATCH 7/13]. Without it your code will cause u-boot
> repository to not be bisectable.

hmm. ok

-Kishon
> 
>> +
>> +__weak
>> +int board_usb_gadget_handle_interrupts(int index)
>> +{
>> +	return 0;
>> +}
>> +
>> +__weak
>> +int usb_gadget_handle_interrupts(void)
>> +{
>> +	return 0;
>> +}
>>  /* EOF */
> 
> 
>
Tom Rini Aug. 21, 2014, 5:32 p.m. | #3
On Tue, Aug 19, 2014 at 09:44:20PM +0530, Kishon Vijay Abraham I wrote:
> 
> 
> On Tuesday 19 August 2014 01:58 PM, Lukasz Majewski wrote:
> > Hi Kishon,
> > 
> >> Implemented __weak functions for board_usb_cleanup,
> >> board_usb_gadget_handle_interrupts and usb_gadget_handle_interrupts
> >> to get of compiler errors in platforms that haven't implemented
> >> these functions.
> >>
> >> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> >> ---
> >>  common/usb.c | 18 ++++++++++++++++++
> >>  1 file changed, 18 insertions(+)
> >>
> >> diff --git a/common/usb.c b/common/usb.c
> >> index 60daa10..892bf7c 100644
> >> --- a/common/usb.c
> >> +++ b/common/usb.c
> >> @@ -1072,4 +1072,22 @@ int board_usb_init(int index, enum
> >> usb_init_type init) {
> >>  	return 0;
> >>  }
> >> +
> >> +__weak
> >> +int board_usb_cleanup(int index, enum usb_init_type init)
> >> +{
> >> +	return 0;
> >> +}
> > 
> > This needed before [PATCH 7/13]. Without it your code will cause u-boot
> > repository to not be bisectable.
> 
> hmm. ok

And note that you can use buildman to make sure that your branch is
bisectable, in addition to the normal git rebase 'exec' keyword.

Patch

diff --git a/common/usb.c b/common/usb.c
index 60daa10..892bf7c 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1072,4 +1072,22 @@  int board_usb_init(int index, enum usb_init_type init)
 {
 	return 0;
 }
+
+__weak
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	return 0;
+}
+
+__weak
+int board_usb_gadget_handle_interrupts(int index)
+{
+	return 0;
+}
+
+__weak
+int usb_gadget_handle_interrupts(void)
+{
+	return 0;
+}
 /* EOF */