From: Andrew Morton <akpm@linux-foundation.org>
To: Jean Delvare <khali@linux-fr.org>
Cc: djwong@us.ibm.com, linux-kernel@vger.kernel.org,
lm-sensors@lm-sensors.org
Subject: Re: [lm-sensors] [PATCH] lm90: Support the MAX6648/6692 chips
Date: Tue, 03 Mar 2009 08:04:12 +0000 [thread overview]
Message-ID: <20090303000412.3c38c266.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090303084746.14462e04@hyperion.delvare>
On Tue, 3 Mar 2009 08:47:46 +0100 Jean Delvare <khali@linux-fr.org> wrote:
> Hi Andrew,
>
> On Mon, 2 Mar 2009 15:04:26 -0800, Andrew Morton wrote:
> > On Mon, 2 Mar 2009 13:01:06 -0800
> > "Darrick J. Wong" <djwong@us.ibm.com> wrote:
> >
> > > @@ -776,7 +776,12 @@ static int lm90_detect(struct i2c_client *new_client, int kind,
> > > && (reg_config1 & 0x3f) = 0x00
> > > && reg_convrate <= 0x07) {
> > > kind = max6646;
> > > - }
> > > + } else
> > > + /* The MAX6648/6692 chips have a working man/chip id
> > > + * and the same register set as the 6657.
> > > + */
> > > + if (chip_id = 0x59 && address = 0x4C)
> > > + kind = max6657;
> > > }
> >
> > gack, the indenting and layout there is totally busted.
>
> This specific layout is consistently used through the whole function,
> and checkpatch.pl doesn't complain about it. While unconventional, it
> has its advantages, in particular it avoids extra indentation that
> would make some lines too long. At any rate it doesn't make sense to
> change this last chunk without changing all the rest if this layout is
> deemed unacceptable.
lol, be serious.
> > --- a/drivers/hwmon/lm90.c~lm90-support-the-max6648-6692-chips-fix
> > +++ a/drivers/hwmon/lm90.c
> > @@ -776,12 +776,14 @@ static int lm90_detect(struct i2c_client
> > && (reg_config1 & 0x3f) = 0x00
> > && reg_convrate <= 0x07) {
> > kind = max6646;
> > - } else
> > - /* The MAX6648/6692 chips have a working man/chip id
> > - * and the same register set as the 6657.
> > - */
> > - if (chip_id = 0x59 && address = 0x4C)
> > + } else if (chip_id = 0x59 && address = 0x4C) {
> > + /*
> > + * The MAX6648/6692 chips have a working
> > + * man/chip id and the same register set as the
> > + * 6657.
> > + */
> > kind = max6657;
> > + }
> > }
> >
> > if (kind <= 0) { /* identification failed */
>
> I thus nack this change of yours.
Something like this...
diff -puN drivers/hwmon/lm90.c~drivers-hwmon-lm90c-fix-coding-style drivers/hwmon/lm90.c
--- a/drivers/hwmon/lm90.c~drivers-hwmon-lm90c-fix-coding-style
+++ a/drivers/hwmon/lm90.c
@@ -694,22 +694,22 @@ static int lm90_detect(struct i2c_client
LM90_REG_R_CONVRATE)) < 0)
return -ENODEV;
- if ((address = 0x4C || address = 0x4D)
- && man_id = 0x01) { /* National Semiconductor */
+ if ((address = 0x4C || address = 0x4D) && man_id = 0x01) {
+ /* National Semiconductor */
int reg_config2;
if ((reg_config2 = i2c_smbus_read_byte_data(new_client,
LM90_REG_R_CONFIG2)) < 0)
return -ENODEV;
- if ((reg_config1 & 0x2A) = 0x00
- && (reg_config2 & 0xF8) = 0x00
- && reg_convrate <= 0x09) {
- if (address = 0x4C
- && (chip_id & 0xF0) = 0x20) { /* LM90 */
+ if ((reg_config1 & 0x2A) = 0x00 &&
+ (reg_config2 & 0xF8) = 0x00 &&
+ reg_convrate <= 0x09) {
+ if (address = 0x4C &&
+ (chip_id & 0xF0) = 0x20) { /* LM90 */
kind = lm90;
- } else
- if ((chip_id & 0xF0) = 0x30) { /* LM89/LM99 */
+ } else if ((chip_id & 0xF0) = 0x30) {
+ /* LM89/LM99 */
kind = lm99;
dev_info(&adapter->dev,
"Assuming LM99 chip at "
@@ -720,27 +720,24 @@ static int lm90_detect(struct i2c_client
"loading the lm90 driver\n",
i2c_adapter_id(adapter),
address);
- } else
- if (address = 0x4C
- && (chip_id & 0xF0) = 0x10) { /* LM86 */
+ } else if (address = 0x4C &&
+ (chip_id & 0xF0) = 0x10) { /* LM86 */
kind = lm86;
}
}
- } else
- if ((address = 0x4C || address = 0x4D)
- && man_id = 0x41) { /* Analog Devices */
- if ((chip_id & 0xF0) = 0x40 /* ADM1032 */
- && (reg_config1 & 0x3F) = 0x00
- && reg_convrate <= 0x0A) {
+ } else if ((address = 0x4C || address = 0x4D) &&
+ man_id = 0x41) {
+ /* Analog Devices */
+ if ((chip_id & 0xF0) = 0x40 && /* ADM1032 */
+ (reg_config1 & 0x3F) = 0x00 &&
+ reg_convrate <= 0x0A) {
kind = adm1032;
- } else
- if (chip_id = 0x51 /* ADT7461 */
- && (reg_config1 & 0x1B) = 0x00
- && reg_convrate <= 0x0A) {
+ } else if (chip_id = 0x51 && /* ADT7461 */
+ (reg_config1 & 0x1B) = 0x00 &&
+ reg_convrate <= 0x0A) {
kind = adt7461;
}
- } else
- if (man_id = 0x4D) { /* Maxim */
+ } else if (man_id = 0x4D) { /* Maxim */
/*
* The MAX6657, MAX6658 and MAX6659 do NOT have a
* chip_id register. Reading from that address will
@@ -750,31 +747,32 @@ static int lm90_detect(struct i2c_client
* will be those of the previous read, so in our case
* those of the man_id register.
*/
- if (chip_id = man_id
- && (address = 0x4C || address = 0x4D)
- && (reg_config1 & 0x1F) = (man_id & 0x0F)
- && reg_convrate <= 0x09) {
+ if (chip_id = man_id &&
+ (address = 0x4C || address = 0x4D) &&
+ (reg_config1 & 0x1F) = (man_id & 0x0F) &&
+ reg_convrate <= 0x09) {
kind = max6657;
- } else
- /* The chip_id register of the MAX6680 and MAX6681
- * holds the revision of the chip.
- * the lowest bit of the config1 register is unused
- * and should return zero when read, so should the
- * second to last bit of config1 (software reset)
- */
- if (chip_id = 0x01
- && (reg_config1 & 0x03) = 0x00
- && reg_convrate <= 0x07) {
+ } else if (chip_id = 0x01 &&
+ (reg_config1 & 0x03) = 0x00 &&
+ reg_convrate <= 0x07) {
+ /*
+ * The chip_id register of the MAX6680 and
+ * MAX6681 holds the revision of the chip.
+ * the lowest bit of the config1 register is
+ * unused and should return zero when read, so
+ * should the second to last bit of config1
+ * (software reset)
+ */
kind = max6680;
- } else
- /* The chip_id register of the MAX6646/6647/6649
- * holds the revision of the chip.
- * The lowest 6 bits of the config1 register are
- * unused and should return zero when read.
- */
- if (chip_id = 0x59
- && (reg_config1 & 0x3f) = 0x00
- && reg_convrate <= 0x07) {
+ } else if (chip_id = 0x59 &&
+ (reg_config1 & 0x3f) = 0x00 &&
+ reg_convrate <= 0x07) {
+ /*
+ * The chip_id register of the MAX6646/6647/6649
+ * holds the revision of the chip.
+ * The lowest 6 bits of the config1 register are
+ * unused and should return zero when read.
+ */
kind = max6646;
} else if (chip_id = 0x59 && address = 0x4C) {
/*
_
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Jean Delvare <khali@linux-fr.org>
Cc: djwong@us.ibm.com, linux-kernel@vger.kernel.org,
lm-sensors@lm-sensors.org
Subject: Re: [PATCH] lm90: Support the MAX6648/6692 chips
Date: Tue, 3 Mar 2009 00:04:12 -0800 [thread overview]
Message-ID: <20090303000412.3c38c266.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090303084746.14462e04@hyperion.delvare>
On Tue, 3 Mar 2009 08:47:46 +0100 Jean Delvare <khali@linux-fr.org> wrote:
> Hi Andrew,
>
> On Mon, 2 Mar 2009 15:04:26 -0800, Andrew Morton wrote:
> > On Mon, 2 Mar 2009 13:01:06 -0800
> > "Darrick J. Wong" <djwong@us.ibm.com> wrote:
> >
> > > @@ -776,7 +776,12 @@ static int lm90_detect(struct i2c_client *new_client, int kind,
> > > && (reg_config1 & 0x3f) == 0x00
> > > && reg_convrate <= 0x07) {
> > > kind = max6646;
> > > - }
> > > + } else
> > > + /* The MAX6648/6692 chips have a working man/chip id
> > > + * and the same register set as the 6657.
> > > + */
> > > + if (chip_id == 0x59 && address == 0x4C)
> > > + kind = max6657;
> > > }
> >
> > gack, the indenting and layout there is totally busted.
>
> This specific layout is consistently used through the whole function,
> and checkpatch.pl doesn't complain about it. While unconventional, it
> has its advantages, in particular it avoids extra indentation that
> would make some lines too long. At any rate it doesn't make sense to
> change this last chunk without changing all the rest if this layout is
> deemed unacceptable.
lol, be serious.
> > --- a/drivers/hwmon/lm90.c~lm90-support-the-max6648-6692-chips-fix
> > +++ a/drivers/hwmon/lm90.c
> > @@ -776,12 +776,14 @@ static int lm90_detect(struct i2c_client
> > && (reg_config1 & 0x3f) == 0x00
> > && reg_convrate <= 0x07) {
> > kind = max6646;
> > - } else
> > - /* The MAX6648/6692 chips have a working man/chip id
> > - * and the same register set as the 6657.
> > - */
> > - if (chip_id == 0x59 && address == 0x4C)
> > + } else if (chip_id == 0x59 && address == 0x4C) {
> > + /*
> > + * The MAX6648/6692 chips have a working
> > + * man/chip id and the same register set as the
> > + * 6657.
> > + */
> > kind = max6657;
> > + }
> > }
> >
> > if (kind <= 0) { /* identification failed */
>
> I thus nack this change of yours.
Something like this...
diff -puN drivers/hwmon/lm90.c~drivers-hwmon-lm90c-fix-coding-style drivers/hwmon/lm90.c
--- a/drivers/hwmon/lm90.c~drivers-hwmon-lm90c-fix-coding-style
+++ a/drivers/hwmon/lm90.c
@@ -694,22 +694,22 @@ static int lm90_detect(struct i2c_client
LM90_REG_R_CONVRATE)) < 0)
return -ENODEV;
- if ((address == 0x4C || address == 0x4D)
- && man_id == 0x01) { /* National Semiconductor */
+ if ((address == 0x4C || address == 0x4D) && man_id == 0x01) {
+ /* National Semiconductor */
int reg_config2;
if ((reg_config2 = i2c_smbus_read_byte_data(new_client,
LM90_REG_R_CONFIG2)) < 0)
return -ENODEV;
- if ((reg_config1 & 0x2A) == 0x00
- && (reg_config2 & 0xF8) == 0x00
- && reg_convrate <= 0x09) {
- if (address == 0x4C
- && (chip_id & 0xF0) == 0x20) { /* LM90 */
+ if ((reg_config1 & 0x2A) == 0x00 &&
+ (reg_config2 & 0xF8) == 0x00 &&
+ reg_convrate <= 0x09) {
+ if (address == 0x4C &&
+ (chip_id & 0xF0) == 0x20) { /* LM90 */
kind = lm90;
- } else
- if ((chip_id & 0xF0) == 0x30) { /* LM89/LM99 */
+ } else if ((chip_id & 0xF0) == 0x30) {
+ /* LM89/LM99 */
kind = lm99;
dev_info(&adapter->dev,
"Assuming LM99 chip at "
@@ -720,27 +720,24 @@ static int lm90_detect(struct i2c_client
"loading the lm90 driver\n",
i2c_adapter_id(adapter),
address);
- } else
- if (address == 0x4C
- && (chip_id & 0xF0) == 0x10) { /* LM86 */
+ } else if (address == 0x4C &&
+ (chip_id & 0xF0) == 0x10) { /* LM86 */
kind = lm86;
}
}
- } else
- if ((address == 0x4C || address == 0x4D)
- && man_id == 0x41) { /* Analog Devices */
- if ((chip_id & 0xF0) == 0x40 /* ADM1032 */
- && (reg_config1 & 0x3F) == 0x00
- && reg_convrate <= 0x0A) {
+ } else if ((address == 0x4C || address == 0x4D) &&
+ man_id == 0x41) {
+ /* Analog Devices */
+ if ((chip_id & 0xF0) == 0x40 && /* ADM1032 */
+ (reg_config1 & 0x3F) == 0x00 &&
+ reg_convrate <= 0x0A) {
kind = adm1032;
- } else
- if (chip_id == 0x51 /* ADT7461 */
- && (reg_config1 & 0x1B) == 0x00
- && reg_convrate <= 0x0A) {
+ } else if (chip_id == 0x51 && /* ADT7461 */
+ (reg_config1 & 0x1B) == 0x00 &&
+ reg_convrate <= 0x0A) {
kind = adt7461;
}
- } else
- if (man_id == 0x4D) { /* Maxim */
+ } else if (man_id == 0x4D) { /* Maxim */
/*
* The MAX6657, MAX6658 and MAX6659 do NOT have a
* chip_id register. Reading from that address will
@@ -750,31 +747,32 @@ static int lm90_detect(struct i2c_client
* will be those of the previous read, so in our case
* those of the man_id register.
*/
- if (chip_id == man_id
- && (address == 0x4C || address == 0x4D)
- && (reg_config1 & 0x1F) == (man_id & 0x0F)
- && reg_convrate <= 0x09) {
+ if (chip_id == man_id &&
+ (address == 0x4C || address == 0x4D) &&
+ (reg_config1 & 0x1F) == (man_id & 0x0F) &&
+ reg_convrate <= 0x09) {
kind = max6657;
- } else
- /* The chip_id register of the MAX6680 and MAX6681
- * holds the revision of the chip.
- * the lowest bit of the config1 register is unused
- * and should return zero when read, so should the
- * second to last bit of config1 (software reset)
- */
- if (chip_id == 0x01
- && (reg_config1 & 0x03) == 0x00
- && reg_convrate <= 0x07) {
+ } else if (chip_id == 0x01 &&
+ (reg_config1 & 0x03) == 0x00 &&
+ reg_convrate <= 0x07) {
+ /*
+ * The chip_id register of the MAX6680 and
+ * MAX6681 holds the revision of the chip.
+ * the lowest bit of the config1 register is
+ * unused and should return zero when read, so
+ * should the second to last bit of config1
+ * (software reset)
+ */
kind = max6680;
- } else
- /* The chip_id register of the MAX6646/6647/6649
- * holds the revision of the chip.
- * The lowest 6 bits of the config1 register are
- * unused and should return zero when read.
- */
- if (chip_id == 0x59
- && (reg_config1 & 0x3f) == 0x00
- && reg_convrate <= 0x07) {
+ } else if (chip_id == 0x59 &&
+ (reg_config1 & 0x3f) == 0x00 &&
+ reg_convrate <= 0x07) {
+ /*
+ * The chip_id register of the MAX6646/6647/6649
+ * holds the revision of the chip.
+ * The lowest 6 bits of the config1 register are
+ * unused and should return zero when read.
+ */
kind = max6646;
} else if (chip_id == 0x59 && address == 0x4C) {
/*
_
next prev parent reply other threads:[~2009-03-03 8:04 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-02 21:01 [lm-sensors] [PATCH] lm90: Support the MAX6648/6692 chips Darrick J. Wong
2009-03-02 21:01 ` Darrick J. Wong
2009-03-02 23:04 ` [lm-sensors] " Andrew Morton
2009-03-02 23:04 ` Andrew Morton
2009-03-03 7:47 ` [lm-sensors] " Jean Delvare
2009-03-03 7:47 ` Jean Delvare
2009-03-03 8:04 ` Andrew Morton [this message]
2009-03-03 8:04 ` Andrew Morton
2009-03-04 15:27 ` [lm-sensors] " Jean Delvare
2009-03-04 15:27 ` Jean Delvare
2009-03-02 23:07 ` [lm-sensors] " Andrew Morton
2009-03-02 23:07 ` Andrew Morton
2009-03-04 15:28 ` [lm-sensors] " Jean Delvare
2009-03-04 15:28 ` Jean Delvare
2009-03-05 14:25 ` [lm-sensors] " Jean Delvare
2009-03-05 14:25 ` Jean Delvare
2009-03-05 15:47 ` [lm-sensors] " Darrick J. Wong
2009-03-05 15:47 ` Darrick J. Wong
2009-03-05 16:44 ` [lm-sensors] " Jean Delvare
2009-03-05 16:44 ` Jean Delvare
2009-03-05 17:37 ` [lm-sensors] [PATCH] lm90: Document support for the MAX6648/6692 Darrick J. Wong
2009-03-05 17:37 ` [PATCH] lm90: Document support for the MAX6648/6692 chips Darrick J. Wong
2009-03-05 18:01 ` [lm-sensors] [PATCH] lm90: Document support for the Jean Delvare
2009-03-05 18:01 ` [PATCH] lm90: Document support for the MAX6648/6692 chips Jean Delvare
2009-03-05 17:58 ` [lm-sensors] [PATCH] lm90: Update Documentation/hwmon/lm90 to Darrick J. Wong
2009-03-05 17:58 ` [PATCH] lm90: Update Documentation/hwmon/lm90 to reflect max6648/92 support Darrick J. Wong
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=20090303000412.3c38c266.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=djwong@us.ibm.com \
--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.