Re: [PATCH 2/7] usb: chipidea: add freescale imx28 special write register method

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

 



On Fri, Jan 10, 2014 at 10:25:54AM +0000, David Laight wrote:
> From: Peter Chen
> ...
> > +#ifdef 
> > +static inline void imx28_ci_writel(u32 val, volatile void __iomem *addr)
> > +{
> > +	__asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr));
> > +}
> > +#else
> > +static inline void imx28_ci_writel(u32 val, volatile void __iomem *addr)
> > +{
> > +}
> > +#endif
> > +
> > +static inline void __hw_write(struct ci_hdrc *ci, u32 val,
> > +		void __iomem *addr)
> > +{
> > +	if (ci->imx28_write_fix)
> > +		imx28_ci_writel(val, addr);
> > +	else
> > +		iowrite32(val, addr);
> > +}
> > +
> 
> This code ought to be defensive against 'imx28_write_fix' being
> set when the kernel isn't compiled with CONFIG_SOC_IMX28.
> This can easily be done by changing the #else block to do an iowrite().

You missed the long email thread we just had about this earlier in the
week...

> It is worth looking to see if the compiler manages to optimise away
> the 'if' test in this case. It might do better if a #define is used
> instead of the inline function.

It shouldn't make a difference, gcc should optimize it away.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]