All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [Patch] max1236-9 ADC support
Date: Mon, 05 May 2008 20:01:02 +0000	[thread overview]
Message-ID: <481F677E.9040303@teltonika.lt> (raw)
In-Reply-To: <481F3FD6.6090605@cam.ac.uk>

Jonathan Cameron wrote:
> +/* The max123x registers */
> +#define MAX123X_SETUP_BYTE(a)     0x80 | a
> +#define MAX123X_CONF_BYTE(a)      0x00 | a

Avoid defining macros like this. Should be:
#define MAX123X_SETUP_BYTE(a)     (0x80 | (a))
#define MAX123X_CONF_BYTE(a)      (0x00 | (a)) /* what is the point to OR it with 0x00??? */

For example MAX123X_SETUP_BYTE(0x02 & 0x03) & 0x01 in your case will be expanded as:
0x80 | 0x02 & 0x03 & 0x01 = 0x80
in my case:
(0x80 | (0x02 & 0x03)) & 0x01 = 0x00

As you can see the result will be totally different!

Regards,
Paulius Zaleckas


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

      reply	other threads:[~2008-05-05 20:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-05 17:11 [lm-sensors] [Patch] max1236-9 ADC support Jonathan Cameron
2008-05-05 20:01 ` Paulius Zaleckas [this message]

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=481F677E.9040303@teltonika.lt \
    --to=paulius.zaleckas@teltonika.lt \
    --cc=lm-sensors@vger.kernel.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.