From: "Rémi Denis-Courmont" <remi@remlab.net>
To: "linux-media" <linux-media@vger.kernel.org>
Subject: Re: [PATCH] Add fc0011 tuner driver
Date: Tue, 8 May 2012 00:13:58 +0300 [thread overview]
Message-ID: <201205080013.58509.remi@remlab.net> (raw)
In-Reply-To: <20120507230031.2b1e9e3c@milhouse>
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
prev parent reply other threads:[~2012-05-07 21:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-02 16:14 [PATCH] Add fc0011 tuner driver Michael Büsch
2012-04-02 16:56 ` Antti Palosaari
2012-04-02 17:20 ` Michael Büsch
2012-04-02 17:40 ` Antti Palosaari
2012-04-02 17:51 ` Michael Büsch
2012-04-02 21:52 ` Antti Palosaari
2012-04-03 6:36 ` Michael Büsch
2012-05-07 19:02 ` Antti Palosaari
2012-05-07 21:00 ` Michael Büsch
2012-05-07 21:13 ` Rémi Denis-Courmont [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201205080013.58509.remi@remlab.net \
--to=remi@remlab.net \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).