[lm-sensors] [Patch] max1236-9 ADC support

Paulius Zaleckas paulius.zaleckas at teltonika.lt
Mon May 5 22:01:02 CEST 2008


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




More information about the lm-sensors mailing list