[i2c] [RFC/PATCH] i2c: Constify client address data

Mark M. Hoffman mhoffman at lightlink.com
Sun Nov 18 19:56:04 CET 2007


Hi Jean:

* Jean Delvare <khali at linux-fr.org> [2007-11-16 23:30:26 +0100]:
> Hi Mark,
> 
> On Thu, 15 Nov 2007 08:47:57 -0500, Mark M. Hoffman wrote:
> > Hi Jean:
> > 
> > Here's a patch for your consideration.  It applies cleanly to the top of
> > your stack [1].  I've compile-tested this against allmodconfig.  The
> > patch makes I2C client "force" data const, and it also allows (but does
> 
> Only the array that points to the "force" data, not the "force" data
> itself, if I read the patch correctly.

Correct.  The force data itself cannot be constant - it's part of the
module parameters.

> 
> > not force) the other client address data to become const.  If this patch
> > is OK, then I will prepare a dependent patch for drivers/hwmon/* which
> > makes all client address data const.
> > 
> > BTW: I touched more lines at the bottom of i2c.h than I strictly had to.
> > I can split that cleanup out if you prefer.
> 
> I'm fine with these changes, no problem.
> 
> > 
> > commit 35a234621b7f76688fdc41605e0c6955fd2f1d91
> > Author: Mark M. Hoffman <mhoffman at lightlink.com>
> > Date:   Thu Nov 15 08:04:46 2007 -0500
> > 
> >     i2c: Constify client address data
> >     
> >     This patch allows much of the I2C client address data to move from initdata
> >     into text.
> 
> What good will it do in practice?
> 

Not much: it's a micro-optimization.

> By "much of the I2C client address data", you mean only normal_i2c
> arrays, right? Not sure if it really qualifies as "much". normal_i2c
> arrays are only a small amount of the overall address data.

Small amount of the *overall* data in a driver, yes.  It is "much" of
the *address* data.

> 
> Other than that, I'm fine with your patch, I'll apply it. Thanks.

Thanks,

-- 
Mark M. Hoffman
mhoffman at lightlink.com




More information about the i2c mailing list