Re: [PATCH v2] usb: host: ehci: allow ehci_* symbols to be unused

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Feb 15, 2012 at 09:27:35PM +0530, Govindraj wrote:
> On Wed, Feb 15, 2012 at 1:04 PM, Felipe Balbi <balbi@xxxxxx> wrote:
> > not all platforms will use all of those ehci_*
> > symbols on their hc_driver structure. Sometimes
> > we might need to provide a modified version of
> > a certain method or not provide it at all, as is
> > the case with OMAPs which don't support port handoff
> > feature.
> >
> > Whenever we compile a kernel for an OMAP board with
> > EHCI enabled, we get compile warnings:
> >
> > drivers/usb/host/ehci-hub.c:1079: warning: 'ehci_relinquish_port' \
> >        defined but not used
> > drivers/usb/host/ehci-hub.c:1088: warning: 'ehci_port_handed_over' \
> >        defined but not used
> >
> > In order to cleanup those warnings, we're adding
> > __maybe_unused annotation to those functions.
> >
> > Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> > ---
> >
> > Changes from v1:
> >        - only add __maybe_used to relinquish_port, port_handed_over
> >                and port_change
> >
> >  drivers/usb/host/ehci-hub.c |    8 +++++---
> >  1 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
> > index 77bbb23..01011dd 100644
> > --- a/drivers/usb/host/ehci-hub.c
> > +++ b/drivers/usb/host/ehci-hub.c
> > @@ -107,7 +107,7 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci)
> >        ehci->owned_ports = 0;
> >  }
> >
> > -static int ehci_port_change(struct ehci_hcd *ehci)
> > +static int __maybe_unused ehci_port_change(struct ehci_hcd *ehci)
> 
> should be __maybe_used ? and in rest of the patch

why ? That isn't even defined anywhere. Take a look at
<linux/compiler-gcc.h>

| /*
|  * From the GCC manual:
|  *
|  * Many functions have no effects except the return value and their
|  * return value depends only on the parameters and/or global
|  * variables.  Such a function can be subject to common subexpression
|  * elimination and loop optimization just as an arithmetic operator
|  * would be.
|  * [...]
|  */
| #define __pure				__attribute__((pure))
| #define __aligned(x)			__attribute__((aligned(x)))
| #define __printf(a,b)			__attribute__((format(printf,a,b)))
| #define  noinline			__attribute__((noinline))
| #define __attribute_const__		__attribute__((__const__))
| #define __maybe_unused			__attribute__((unused))
| #define __always_unused			__attribute__((unused))

did you try to search for a definition of __maybe_used ? It doesn't
exist, try:

$ git grep -e __maybe_used include/

on a git kernel tree. Besides, if we had a __maybe_used flag, it
wouldn't survive very long as semantically they would be essentially the
same.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux