On Sun, 5 Aug 2012 kuninori.morimoto.gx@xxxxxxxxxxx wrote: > This patch enables to call platform specific power callback function. > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> > --- > v2 -> v3 > > - add power multi functions > - call it by macro > > drivers/usb/host/ehci-platform.c | 40 ++++++++++++++++++++++++++++++++++--- > include/linux/usb/ehci_pdriver.h | 5 ++++ > 2 files changed, 41 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c > index db27dfe..bcdb9e4 100644 > --- a/drivers/usb/host/ehci-platform.c > +++ b/drivers/usb/host/ehci-platform.c > @@ -22,6 +22,8 @@ > #include <linux/usb/ehci_pdriver.h> > > #define ehci_pdata_get(pdata, x) ((pdata) ? (pdata)->x : 0) > +#define ehci_pdata_call(pdata, x, args...) \ > + ((!(pdata) || !((pdata)->x)) ? 0 : (pdata)->x(args)) I prefer not to have this. Just do the test before making each call. > static int ehci_platform_resume(struct device *dev) > { > struct usb_hcd *hcd = dev_get_drvdata(dev); > + struct usb_ehci_pdata *pdata = dev->platform_data; > + struct platform_device *pdev = > + container_of(dev, struct platform_device, dev); > + > + /* power resume if platform supported */ > + ehci_pdata_call(pdata, power_resume, pdev); You didn't check the return value. > > ehci_resume(hcd, false); > return 0; > --- a/include/linux/usb/ehci_pdriver.h > +++ b/include/linux/usb/ehci_pdriver.h > @@ -41,6 +41,11 @@ struct usb_ehci_pdata { > unsigned big_endian_mmio:1; > unsigned port_power_on:1; > unsigned port_power_off:1; > + > + int (*power_on)(struct platform_device *pdev); > + void (*power_off)(struct platform_device *pdev); > + void (*power_suspend)(struct platform_device *pdev); > + void (*power_resume)(struct platform_device *pdev); Shouldn't power_resume and power_on be the same function always? They do the same thing, even though the initial states of the power supplies might be different. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html