From: Jean Delvare <khali@linux-fr.org> To: "Eibach, Dirk" <Eibach@gdsys.de> Cc: "Guenter Roeck" <guenter.roeck@ericsson.com>, <linux-kernel@vger.kernel.org>, <lm-sensors@lm-sensors.org> Subject: Re: [PATCH] hwmon: Consider LM64 temperature offset Date: Tue, 8 Feb 2011 17:09:51 +0100 [thread overview] Message-ID: <20110208170951.2cc64a62@endymion.delvare> (raw) In-Reply-To: <48D3D52125C49B43AE880038E2E5314BB5BE41@SRV101.gdsys.de> Hi Dirk, On Tue, 8 Feb 2011 16:54:52 +0100, Eibach, Dirk wrote: > > Dear Guenter, > > > Chip id is already detected in lm63_detect. You don't need to > > detect it again. > > The more common approach would be something along the line of > > data->kind = id->driver_data; > > You would then use > > if (data->kind == lm64) > > throughout the code. In addition to that, you could define > > data->kind = id->driver_data; > > if (data->kind == lm64) > > data->offset = 16000; > > which would save you the repeated recalculation of offset > > as mentioned before. > > I don't understand, what structures "data" and "id" you are referring to data is struct lm63_data and id is const struct i2c_device_id which is passed as a second parameter to the probe function. > here and where the fields driver_data and kind come from. I remember to > have seen such in older kernels, but wasn't that replaced sometime ago? There were indeed some changes in this area in the past few years, but what Guenter says still applies to current kernels. Look at lm90_probe() in drivers/hwmon/lm90.c for an example (amongst may others.) -- Jean Delvare
WARNING: multiple messages have this Message-ID (diff)
From: Jean Delvare <khali@linux-fr.org> To: "Eibach, Dirk" <Eibach@gdsys.de> Cc: Guenter Roeck <guenter.roeck@ericsson.com>, linux-kernel@vger.kernel.org, lm-sensors@lm-sensors.org Subject: Re: [lm-sensors] [PATCH] hwmon: Consider LM64 temperature offset Date: Tue, 08 Feb 2011 16:09:51 +0000 [thread overview] Message-ID: <20110208170951.2cc64a62@endymion.delvare> (raw) In-Reply-To: <48D3D52125C49B43AE880038E2E5314BB5BE41@SRV101.gdsys.de> Hi Dirk, On Tue, 8 Feb 2011 16:54:52 +0100, Eibach, Dirk wrote: > > Dear Guenter, > > > Chip id is already detected in lm63_detect. You don't need to > > detect it again. > > The more common approach would be something along the line of > > data->kind = id->driver_data; > > You would then use > > if (data->kind = lm64) > > throughout the code. In addition to that, you could define > > data->kind = id->driver_data; > > if (data->kind = lm64) > > data->offset = 16000; > > which would save you the repeated recalculation of offset > > as mentioned before. > > I don't understand, what structures "data" and "id" you are referring to data is struct lm63_data and id is const struct i2c_device_id which is passed as a second parameter to the probe function. > here and where the fields driver_data and kind come from. I remember to > have seen such in older kernels, but wasn't that replaced sometime ago? There were indeed some changes in this area in the past few years, but what Guenter says still applies to current kernels. Look at lm90_probe() in drivers/hwmon/lm90.c for an example (amongst may others.) -- Jean Delvare _______________________________________________ lm-sensors mailing list lm-sensors@lm-sensors.org http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2011-02-08 16:10 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-02-08 13:16 [PATCH] hwmon: Consider LM64 temperature offset Dirk Eibach 2011-02-08 13:16 ` [lm-sensors] " Dirk Eibach 2011-02-08 15:28 ` Guenter Roeck 2011-02-08 15:28 ` [lm-sensors] " Guenter Roeck 2011-02-08 15:54 ` Eibach, Dirk 2011-02-08 15:54 ` [lm-sensors] " Eibach, Dirk 2011-02-08 16:07 ` Guenter Roeck 2011-02-08 16:07 ` [lm-sensors] " Guenter Roeck 2011-02-08 16:09 ` Jean Delvare [this message] 2011-02-08 16:09 ` Jean Delvare 2011-02-09 9:51 ` [PATCH v2] " Dirk Eibach 2011-02-09 9:51 ` [lm-sensors] " Dirk Eibach 2011-02-09 18:17 ` Guenter Roeck 2011-02-09 18:17 ` [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=20110208170951.2cc64a62@endymion.delvare \ --to=khali@linux-fr.org \ --cc=Eibach@gdsys.de \ --cc=guenter.roeck@ericsson.com \ --cc=linux-kernel@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.