lkml.org 
[lkml]   [2012]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/13] drivers/media/tuners/qt1010.c: use macros for i2c_msg initialization
On Tue, 9 Oct 2012, Jean Delvare wrote:

> Hi Julia,
>
> On Mon, 8 Oct 2012 07:24:11 +0200 (CEST), Julia Lawall wrote:
> > > Sorry, I mean either:
> > >
> > > I2C_MSG_WRITE(priv->cfg->i2c_address, &reg, sizeof(reg)),
> > > I2C_MSG_READ(priv->cfg->i2c_address, val, sizeof(*val)),
> >
> > Of course. Sorry for not having seen that. I can do that.
>
> Eek, no, you can't, not in the general case at least. sizeof(*val) will
> return the size of the _first_ element of the destination buffer, which
> has nothing to do with the length of that buffer (which in turn might
> be rightfully longer than the read length for this specific message.)

I was actually only going to do it when the size was 1 and the type was
u8 *. But your other email suggests that converting to sizeof is just not
a good idea at all. So I will drop that part of the rule.

julia


\
 
 \ /
  Last update: 2012-10-09 15:41    [W:0.075 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site