Re: [PATCH 4/5] i2c: designware: Add debug print for SDA hold time value

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

 



On Wed, 2018-05-30 at 09:19 +0300, Jarkko Nikula wrote:
> On 05/29/2018 04:52 PM, Andy Shevchenko wrote:
> > On Tue, 2018-05-29 at 14:27 +0300, Jarkko Nikula wrote:

> > > +		dev_dbg(dev->dev, "SDA Hold Time TX:RX =
> > > %d:%d\n",
> > > +			dev->sda_hold_time &
> > > ~(u32)DW_IC_SDA_HOLD_RX_MASK,
> > 
> > I'm not sure I understand why you need casting here.

> Me neither but gcc thinks otherwise in 64-bit build. It appears to 
> convert that "(u32) & ~FOO" as u64 and complains "format ‘%d’ expects 
> argument of type ‘int’, but argument 4 has type ‘long unsigned int’".

Okay, we have, I think, the following options
 - (u32) explicit casting
 - lower_32_bits() macro call
 - defining mask with U type (not sure if ~ doesn't promote to UL)
 - defining negative mask explicitly as a number

All of them seems to me a compromise in one way or another (U suffix,
for example, will probably require to change all such definitions for
sake of consistency).

-- 
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux