All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: "Eibach, Dirk" <Eibach@gdsys.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"khali@linux-fr.org" <khali@linux-fr.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>
Subject: Re: [PATCH] hwmon: Consider LM64 temperature offset
Date: Tue, 8 Feb 2011 08:07:36 -0800	[thread overview]
Message-ID: <20110208160736.GA13717@ericsson.com> (raw)
In-Reply-To: <48D3D52125C49B43AE880038E2E5314BB5BE41@SRV101.gdsys.de>

On Tue, Feb 08, 2011 at 10:54:52AM -0500, 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
> 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?
> 

static int lm63_probe(struct i2c_client *new_client,
                      const struct i2c_device_id *id)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
{
	struct lm63_data *data;
	^^^^^^^^^^^^^^^^^^^^^^
	...
	/* Set the device type */
        data->kind = id->driver_data;

with

struct lm63_data {
	...
	int kind;	// instead of is_lm64
	...
};

id is from 

static const struct i2c_device_id lm63_id[] = {
        { "lm63", lm63 },
        { "lm64", lm64 },
        { }
};

id->driver_data is thus either lm63 or lm64, depending on the chip type
detected in lm63_detect().

Thanks,
Guenter 


WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: "Eibach, Dirk" <Eibach@gdsys.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"khali@linux-fr.org" <khali@linux-fr.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>
Subject: Re: [lm-sensors] [PATCH] hwmon: Consider LM64 temperature offset
Date: Tue, 08 Feb 2011 16:07:36 +0000	[thread overview]
Message-ID: <20110208160736.GA13717@ericsson.com> (raw)
In-Reply-To: <48D3D52125C49B43AE880038E2E5314BB5BE41@SRV101.gdsys.de>

On Tue, Feb 08, 2011 at 10:54:52AM -0500, 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
> 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?
> 

static int lm63_probe(struct i2c_client *new_client,
                      const struct i2c_device_id *id)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
{
	struct lm63_data *data;
	^^^^^^^^^^^^^^^^^^^^^^
	...
	/* Set the device type */
        data->kind = id->driver_data;

with

struct lm63_data {
	...
	int kind;	// instead of is_lm64
	...
};

id is from 

static const struct i2c_device_id lm63_id[] = {
        { "lm63", lm63 },
        { "lm64", lm64 },
        { }
};

id->driver_data is thus either lm63 or lm64, depending on the chip type
detected in lm63_detect().

Thanks,
Guenter 


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  reply	other threads:[~2011-02-08 16:08 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 [this message]
2011-02-08 16:07       ` Guenter Roeck
2011-02-08 16:09     ` Jean Delvare
2011-02-08 16:09       ` [lm-sensors] " 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=20110208160736.GA13717@ericsson.com \
    --to=guenter.roeck@ericsson.com \
    --cc=Eibach@gdsys.de \
    --cc=khali@linux-fr.org \
    --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: link
Be 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.