From: Guenter Roeck <linux@roeck-us.net> To: Lars-Peter Clausen <lars@metafoo.de> Cc: Jean Delvare <khali@linux-fr.org>, Hartmut Knaack <knaack.h@gmx.de>, Jonathan Cameron <jic23@cam.ac.uk>, lm-sensors@lm-sensors.org, linux-iio@vger.kernel.org Subject: Re: [PATCH v2 1/4] hwmon: (adt7410) Don't re-read non-volatile registers Date: Mon, 18 Feb 2013 17:32:04 -0800 [thread overview] Message-ID: <20130219013204.GC25124@roeck-us.net> (raw) In-Reply-To: <1361194739-16525-1-git-send-email-lars@metafoo.de> On Mon, Feb 18, 2013 at 02:38:56PM +0100, Lars-Peter Clausen wrote: > Currently each time the temperature register is read the driver also reads the > threshold and hysteresis registers. This increases the amount of I2C traffic and > time needed to read the temperature by a factor of ~5. Neither the threshold nor > the hysteresis change on their own, so once we've read them, we should be able > to just use the cached value of the registers. This patch modifies the code > accordingly and only reads the threshold and hysteresis registers once during > probe. > > Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> > Just one comment (thanks to Hartmut), otherwise looks good. > --- > Changes since v1: > * Fix error checking for i2c reads > --- [ ... ] > +static int adt7410_fill_cache(struct i2c_client *client) > +{ > + struct adt7410_data *data = i2c_get_clientdata(client); > + int ret; > + int i; > + > + for (i = 1; i < ARRAY_SIZE(ADT7410_REG_TEMP); i++) { > + ret = i2c_smbus_read_word_swapped(client, ADT7410_REG_TEMP[i]); > + if (ret < 0) { > + dev_dbg(&client->dev, > + "Failed to read value: reg %d, error %d\n", > + ADT7410_REG_TEMP[0], ret); ADT7410_REG_TEMP[i] Thanks, Guenter
WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux@roeck-us.net> To: Lars-Peter Clausen <lars@metafoo.de> Cc: Jean Delvare <khali@linux-fr.org>, Hartmut Knaack <knaack.h@gmx.de>, Jonathan Cameron <jic23@cam.ac.uk>, lm-sensors@lm-sensors.org, linux-iio@vger.kernel.org Subject: Re: [lm-sensors] [PATCH v2 1/4] hwmon: (adt7410) Don't re-read non-volatile registers Date: Tue, 19 Feb 2013 01:32:04 +0000 [thread overview] Message-ID: <20130219013204.GC25124@roeck-us.net> (raw) In-Reply-To: <1361194739-16525-1-git-send-email-lars@metafoo.de> On Mon, Feb 18, 2013 at 02:38:56PM +0100, Lars-Peter Clausen wrote: > Currently each time the temperature register is read the driver also reads the > threshold and hysteresis registers. This increases the amount of I2C traffic and > time needed to read the temperature by a factor of ~5. Neither the threshold nor > the hysteresis change on their own, so once we've read them, we should be able > to just use the cached value of the registers. This patch modifies the code > accordingly and only reads the threshold and hysteresis registers once during > probe. > > Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> > Just one comment (thanks to Hartmut), otherwise looks good. > --- > Changes since v1: > * Fix error checking for i2c reads > --- [ ... ] > +static int adt7410_fill_cache(struct i2c_client *client) > +{ > + struct adt7410_data *data = i2c_get_clientdata(client); > + int ret; > + int i; > + > + for (i = 1; i < ARRAY_SIZE(ADT7410_REG_TEMP); i++) { > + ret = i2c_smbus_read_word_swapped(client, ADT7410_REG_TEMP[i]); > + if (ret < 0) { > + dev_dbg(&client->dev, > + "Failed to read value: reg %d, error %d\n", > + ADT7410_REG_TEMP[0], ret); ADT7410_REG_TEMP[i] Thanks, Guenter _______________________________________________ lm-sensors mailing list lm-sensors@lm-sensors.org http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2013-02-19 1:31 UTC|newest] Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-02-18 13:38 [PATCH v2 1/4] hwmon: (adt7410) Don't re-read non-volatile registers Lars-Peter Clausen 2013-02-18 13:38 ` [lm-sensors] " Lars-Peter Clausen 2013-02-18 13:38 ` [PATCH v2 2/4] hwmon: (adt7410) Add support for the adt7310/adt7320 Lars-Peter Clausen 2013-02-18 13:38 ` [lm-sensors] [PATCH v2 2/4] hwmon: (adt7410) =?utf-8?q?Add_support_for_the_ad Lars-Peter Clausen 2013-02-19 1:30 ` [PATCH v2 2/4] hwmon: (adt7410) Add support for the adt7310/adt7320 Guenter Roeck 2013-02-19 1:30 ` [lm-sensors] " Guenter Roeck 2013-02-19 11:57 ` Lars-Peter Clausen 2013-02-19 11:57 ` [lm-sensors] " Lars-Peter Clausen 2013-02-19 16:52 ` Guenter Roeck 2013-02-19 16:52 ` [lm-sensors] " Guenter Roeck 2013-02-18 13:38 ` [PATCH v2 3/4] hwmon: (adt7x10) Add alarm interrupt support Lars-Peter Clausen 2013-02-18 13:38 ` [lm-sensors] " Lars-Peter Clausen 2013-02-19 1:39 ` Guenter Roeck 2013-02-19 1:39 ` [lm-sensors] " Guenter Roeck 2013-02-19 12:05 ` Lars-Peter Clausen 2013-02-19 12:05 ` [lm-sensors] " Lars-Peter Clausen 2013-02-19 17:10 ` Guenter Roeck 2013-02-19 17:10 ` [lm-sensors] " Guenter Roeck 2013-02-18 13:38 ` [PATCH v2 4/4] staging:iio: Remove adt7410 driver Lars-Peter Clausen 2013-02-18 13:38 ` [lm-sensors] " Lars-Peter Clausen 2013-03-02 16:45 ` Jonathan Cameron 2013-03-02 16:45 ` [lm-sensors] " Jonathan Cameron 2013-03-02 17:10 ` Guenter Roeck 2013-03-02 17:10 ` [lm-sensors] " Guenter Roeck 2013-02-18 20:22 ` [PATCH v2 1/4] hwmon: (adt7410) Don't re-read non-volatile registers Hartmut Knaack 2013-02-18 20:22 ` [lm-sensors] " Hartmut Knaack 2013-02-19 1:02 ` Guenter Roeck 2013-02-19 1:02 ` [lm-sensors] " Guenter Roeck 2013-02-19 19:39 ` Hartmut Knaack 2013-02-19 19:39 ` [lm-sensors] " Hartmut Knaack 2013-02-20 1:22 ` Guenter Roeck 2013-02-20 1:22 ` [lm-sensors] " Guenter Roeck 2013-02-19 1:32 ` Guenter Roeck [this message] 2013-02-19 1:32 ` Guenter Roeck 2013-02-23 0:45 ` Hartmut Knaack 2013-02-23 20:18 ` Guenter Roeck 2013-02-23 20:18 ` [lm-sensors] " Guenter Roeck 2013-02-25 22:03 ` Hartmut Knaack 2013-02-25 22:03 ` [lm-sensors] " Hartmut Knaack 2013-02-26 1:40 ` Guenter Roeck 2013-02-26 1:40 ` [lm-sensors] " Guenter Roeck 2013-02-25 9:54 ` Lars-Peter Clausen 2013-02-25 9:54 ` [lm-sensors] " Lars-Peter Clausen 2013-02-25 21:30 ` Hartmut Knaack 2013-02-25 21:30 ` [lm-sensors] " Hartmut Knaack 2013-02-26 1:39 ` Guenter Roeck 2013-02-26 1:39 ` [lm-sensors] " Guenter Roeck
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=20130219013204.GC25124@roeck-us.net \ --to=linux@roeck-us.net \ --cc=jic23@cam.ac.uk \ --cc=khali@linux-fr.org \ --cc=knaack.h@gmx.de \ --cc=lars@metafoo.de \ --cc=linux-iio@vger.kernel.org \ --cc=lm-sensors@lm-sensors.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.