Hi, On Mon, Dec 13, 2010 at 01:01:57AM +0800, tom.leiming@xxxxxxxxx wrote:
From: Ming Lei <tom.leiming@xxxxxxxxx> This patch introduces musb_readb/musb_writeb function pointer, so that we can use same musb_readb/musb_writeb in one single binary image to help to support multiple machines. Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx> --- drivers/usb/musb/musb_core.c | 55 ++++++++++++++++++++++++++++++++++++++++++ drivers/usb/musb/musb_core.h | 3 ++ drivers/usb/musb/musb_io.h | 49 ------------------------------------- 3 files changed, 58 insertions(+), 49 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index dba20f8..ca3ae8b 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -135,6 +135,10 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:" MUSB_DRIVER_NAME); +u8 (*musb_readb)(const void __iomem *addr, unsigned offset); +EXPORT_SYMBOL(musb_readb); +void (*musb_writeb)(void __iomem *addr, unsigned offset, u8 data); +EXPORT_SYMBOL(musb_writeb);
my idea for this was to have struct musb_io_ops. something like: struct musb_io_ops { u8 (*readb)(const void __iomem *addr, unsigned offset); void (*writeb)(const void __iomem *addr, unsigned offset, u8 data); u16 (*readw)(....); void (*writew)(;...); u32 (*readl)(); void (writel)(); } then you have a pointer for that inside the struct musb_platform_ops, or maybe somewhere else. And you initialize the same way platform_ops, and if you don't have a field, you fallback to default implementation. -- balbi -- 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