[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101015232629.GA26031@xanatos>
Date: Fri, 15 Oct 2010 16:26:29 -0700
From: Sarah Sharp <sarah.a.sharp@...ux.intel.com>
To: Marcin Slusarz <marcin.slusarz@...il.com>
Cc: Greg KH <gregkh@...e.de>, Randy Dunlap <randy.dunlap@...cle.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
linux-next@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
lud <linux-usb@...r.kernel.org>, Andiry Xu <andiry.xu@....com>,
Dong Nguyen <dong.nguyen@....com>,
Libin Yang <libin.yang@....com>
Subject: Re: [PATCH] usb: Fix linker errors with CONFIG_PM=n
On Sat, Oct 16, 2010 at 12:23:01AM +0200, Marcin Slusarz wrote:
> On Fri, Oct 15, 2010 at 02:59:15PM -0700, Sarah Sharp wrote:
> > diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> > index c08928a..93d3bf4 100644
> > --- a/drivers/usb/host/xhci.h
> > +++ b/drivers/usb/host/xhci.h
> > @@ -1405,8 +1405,15 @@ int xhci_init(struct usb_hcd *hcd);
> > int xhci_run(struct usb_hcd *hcd);
> > void xhci_stop(struct usb_hcd *hcd);
> > void xhci_shutdown(struct usb_hcd *hcd);
> > +
> > +#ifdef CONFIG_PM
> > int xhci_suspend(struct xhci_hcd *xhci);
> > int xhci_resume(struct xhci_hcd *xhci, bool hibernated);
> > +#else
> > +#define xhci_suspend NULL
> > +#define xhci_resume NULL
> > +#endif
> > +
>
> "static inline int xhci_suspend(struct xhci_hcd *) {}"
> has the same effect but saves types
That doesn't have the same effect. Since those functions are only used
as function pointers, the original patch compiles to less code when
CONFIG_PM=n. Also, the original version will cause an oops if those
functions are ever called when CONFIG_PM=n, which would indicate a bug
in the callee (something we would rather catch anyway). This is the
style that other USB host controller drivers use, like EHCI.
I don't understand what you mean by "saves types". Is there something
I've missed?
Sarah Sharp
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists