Message ID | 508BBC59.60504@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sat, 27 Oct 2012, Santosh Shilimkar wrote: > Another alternative, which I will recommend to just make use of the > read*/wrire* instead __raw versions. The barriers are taken care > already and driver point of view, it is transparent. Those barriers will disappear if CONFIG_ARM_DMA_MEM_BUFFERABLE is set to N, so that's probably not the right thing to do in this case. The barrier here isn't DMA-related, it's needed due to the design of the driver. In fact the wmb() is probably overkill, since only a compiler reordering barrier is needed. It can probably just be barrier(). - Paul
On Saturday 27 October 2012 09:29 PM, Paul Walmsley wrote: > On Sat, 27 Oct 2012, Santosh Shilimkar wrote: > >> Another alternative, which I will recommend to just make use of the >> read*/wrire* instead __raw versions. The barriers are taken care >> already and driver point of view, it is transparent. > > Those barriers will disappear if CONFIG_ARM_DMA_MEM_BUFFERABLE is set to > N, so that's probably not the right thing to do in this case. The barrier > here isn't DMA-related, it's needed due to the design of the driver. > Good point. > In fact the wmb() is probably overkill, since only a compiler reordering > barrier is needed. It can probably just be barrier(). > I agree. Just barrier() is enough to avoid compiler re-ordering. Regards Santosh
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index db31eae..0cd6365 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -265,13 +265,13 @@ static const u8 reg_map_ip_v2[] = { static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev, int reg, u16 val) { - __raw_writew(val, i2c_dev->base + + writew(val, i2c_dev->base + (i2c_dev->regs[reg] << i2c_dev->reg_shift)); } static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg) { - return __raw_readw(i2c_dev->base + + return readw(i2c_dev->base + (i2c_dev->regs[reg] << i2c_dev->reg_shift)); }