linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Stijn Devriendt (sdevrien)" <sdevrien@cisco.com>
To: "anish singh" <anish198519851985@gmail.com>
Cc: <khali@linux-fr.org>, <lm-sensors@lm-sensors.org>,
	<linux-kernel@vger.kernel.org>, <guenter.roeck@ericsson.com>
Subject: RE: [PATCH] Add support for the Philips SA56004 temperature sensor.
Date: Sat, 4 Jun 2011 18:32:01 +0200	[thread overview]
Message-ID: <6E4D2678AC543844917CA081C9D6B33F049B1DE3@XMB-AMS-103.cisco.com> (raw)
In-Reply-To: <BANLkTimKB8PtFF72rOeDAmkbM_oq=ZMRgg@mail.gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2422 bytes --]

> From: anish singh [mailto:anish198519851985@gmail.com] 
>
> I am no expert on HWMON but just want to 
> add some points.
> @@ -454,7 +477,7 @@ static struct lm90_data *lm90_update_device(struct device *dev)
>
>               if (data->flags & LM90_HAVE_LOCAL_EXT) {
>                       lm90_read16(client, LM90_REG_R_LOCAL_TEMP,
> -                                   MAX6657_REG_R_LOCAL_TEMPL,
> +                                   data->reg_local_ext,
>                                   &data->temp11[4]);
> I don't think this variable reg_local_ext should exist as 
> register address should be "# defined" and should not be
> part of lm90_data but i do see a case here where we are
> assuming MAX6657 is only having this LM90_HAVE_LOCAL_EXT
> flag set.So i think we should have some more branching here
> to detect the device and pass the corresponding register but as
> i said i am no expert.
> 

Only MAX6657 and SA56004 have the local temperature extension
register and unfortunately they reside at different offsets.
Therefore the probing will detect the right chip and, if supported,
use the correct register.

>               } else {
>                       if (lm90_read_reg(client, LM90_REG_R_LOCAL_TEMP,
> @@ -1372,6 +1400,11 @@ static int lm90_probe(struct i2c_client *new_client,
>       /* Set maximum conversion rate */
>       data->max_convrate = lm90_params[data->kind].max_convrate;
>
> +       if (data->flags & LM90_HAVE_LOCAL_EXT) {
> +               data->reg_local_ext = lm90_params[data->kind].reg_local_ext;
> +               BUG_ON(data->reg_local_ext == 0);
> +       }
> +
> I think this BUG_ON is too harsh in probe.We generally use pr_err
> to print if something which is supposed to be set is not set.As BUG_ON
> will call kernel panic,right?

The reason for adding the BUG_ON rather than the error was that it is
in fact a coding error when the flag is set without specifying the offset.
Such a condition should never make it into a running system and should be
caught during coding or review.
BUG_ON only does an oops, panic is optional depending on panic_on_oops being
set.

Regards,
Stijn
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  parent reply	other threads:[~2011-06-04 16:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-04 10:37 [PATCH] Add support for the Philips SA56004 temperature sensor Stijn Devriendt
     [not found] ` <BANLkTimKB8PtFF72rOeDAmkbM_oq=ZMRgg@mail.gmail.com>
2011-06-04 16:32   ` Stijn Devriendt (sdevrien) [this message]
2011-06-04 16:57     ` Guenter Roeck
  -- strict thread matches above, loose matches on Subject: below --
2011-05-19 14:10 sdevrien

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=6E4D2678AC543844917CA081C9D6B33F049B1DE3@XMB-AMS-103.cisco.com \
    --to=sdevrien@cisco.com \
    --cc=anish198519851985@gmail.com \
    --cc=guenter.roeck@ericsson.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).