Re: [PATCH] Add fc0011 tuner driver

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

 



Le mardi 8 mai 2012 00:00:31 Michael Büsch, vous avez écrit :
> > > +	dev_dbg(&priv->i2c->dev, "Tuned to "
> > > +		"fa=%02X fp=%02X xin=%02X%02X vco=%02X vcosel=%02X "
> > > +		"vcocal=%02X(%u) bw=%u\n",
> > > +		(unsigned int)regs[FC11_REG_FA],
> > > +		(unsigned int)regs[FC11_REG_FP],
> > > +		(unsigned int)regs[FC11_REG_XINHI],
> > > +		(unsigned int)regs[FC11_REG_XINLO],
> > > +		(unsigned int)regs[FC11_REG_VCO],
> > > +		(unsigned int)regs[FC11_REG_VCOSEL],
> > > +		(unsigned int)vco_cal, vco_retries,
> > > +		(unsigned int)bandwidth);
> > 
> > Just for the interest, is there any reason you use so much casting or is
> > that only your style?
> 
> Well it makes sure the types are what the format string and thus vararg
> code expects. it is true that most (probably all) of those explicit casts
> could be removed and instead rely on implicit casts and promotions. But I
> personally prefer explicit casts in this case (and only this case).

Not sure Linux printk supports it, but C specifies the "hh" prefix for 'char', 
and the "h" prefix for 'short' for instance "%02hhX", and this would also work 
for u8 and u16.

The pedantic in me needs to add that the official prefixes for uint8_t and 
uint16_t are the PRIX8 and PRIX16 macros from <inttypes.h>, e.g.:
	printf("%02"PRIX8"\n", regs[0]);
...but that's definitely not valid in kernel.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux