public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] I2C Monitor Chip ADT7460 support
Date: Fri, 11 Jul 2008 10:46:49 +0200	[thread overview]
Message-ID: <200807111046.49213.sr@denx.de> (raw)
In-Reply-To: <1215764625-8670-2-git-send-email-ricardo.ribalda@uam.es>

On Friday 11 July 2008, Ricardo Ribalda Delgado wrote:
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>

Please find some comments below (mostly nitpicking).

>  drivers/hwmon/Makefile  |    1 +
>  drivers/hwmon/adt7460.c |   81
> +++++++++++++++++++++++++++++++++++++++++++++++ drivers/hwmon/adt7460.h |  
> 49 ++++++++++++++++++++++++++++
>  include/dtt.h           |    3 +-
>  4 files changed, 133 insertions(+), 1 deletions(-)
>  create mode 100644 drivers/hwmon/adt7460.c
>  create mode 100644 drivers/hwmon/adt7460.h
>
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index 065433a..e301eaa 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -37,6 +37,7 @@ COBJS-y += ds1775.o
>  COBJS-$(CONFIG_DTT_LM73) += lm73.o
>  COBJS-y += lm75.o
>  COBJS-y += lm81.o
> +COBJS-$(CONFIG_DTT_ADT7460) += adt7460.o
>
>  COBJS	:= $(COBJS-y)
>  SRCS	:= $(COBJS:.o=.c)
> diff --git a/drivers/hwmon/adt7460.c b/drivers/hwmon/adt7460.c
> new file mode 100644
> index 0000000..3fbd6fa
> --- /dev/null
> +++ b/drivers/hwmon/adt7460.c
> @@ -0,0 +1,81 @@
> +/*
> +    (C) Copyright 2008
> +    Ricado Ribalda-Universidad Autonoma de Madrid, ricardo.ribalda at uam.es
> +    This work has been supported by: Q-Technology  http://qtec.com/
> +
> +    This program is free software: you can redistribute it and/or modify
> +    it under the terms of the GNU General Public License as published by
> +    the Free Software Foundation, either version 2 of the License, or
> +    (at your option) any later version.
> +
> +    This program is distributed in the hope that it will be useful,
> +    but WITHOUT ANY WARRANTY; without even the implied warranty of
> +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +    GNU General Public License for more details.
> +
> +    You should have received a copy of the GNU General Public License
> +    along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +*/
> +
> +#include <common.h>
> +
> +#include <i2c.h>
> +#include <dtt.h>
> +#include "adt7460.h"
> +
> +#define ADT7460_ADDRESS 0x2c
> +int dtt_read(int sensor, int reg)
> +{
> +	u8 dir=reg;

Codingstyle:

	u8 dir = reg;

> +	u8 data;
> +
> +	if (i2c_read(ADT7460_ADDRESS,dir,1,&data,1)==-1)

Spaces are sometimes nice too:

	if (i2c_read(ADT7460_ADDRESS, dir, 1, &data, 1) == -1)

> +		return -1;
> +
> +	if (data==ADT7460_INVALID)

Again spaces missing:

	if (data == ADT7460_INVALID)

I'll stop here with it. Please fix all this codingstyle issues in this file.

<snip>

> diff --git a/drivers/hwmon/adt7460.h b/drivers/hwmon/adt7460.h
> new file mode 100644
> index 0000000..d915d1b
> --- /dev/null
> +++ b/drivers/hwmon/adt7460.h
> @@ -0,0 +1,49 @@
> +/*
> +    (C) Copyright 2008
> +    Ricado Ribalda-Universidad Autonoma de Madrid, ricardo.ribalda at uam.es
> +    This work has been supported by: Q-Technology  http://qtec.com/
> +
> +    This program is free software: you can redistribute it and/or modify
> +    it under the terms of the GNU General Public License as published by
> +    the Free Software Foundation, either version 2 of the License, or
> +    (at your option) any later version.
> +
> +    This program is distributed in the hope that it will be useful,
> +    but WITHOUT ANY WARRANTY; without even the implied warranty of
> +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +    GNU General Public License for more details.
> +
> +    You should have received a copy of the GNU General Public License
> +    along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +*/
> +#ifndef ADT7460
> +#define ADT7460
> +
> +
> +#define ADT7460_INVALID 128
> +
> +#define ADT7460_2_5V		0x20
> +#define ADT7460_VCCP		0x21
> +#define ADT7460_VCC		0x22
> +#define ADT7460_V5		0x23
> +#define ADT7460_V12		0x24
> +#define ADT7460_REM1_TEMP	0x25
> +#define ADT7460_LOCAL_TEMP	0x26
> +#define ADT7460_REM2_TEMP	0x27
> +#define ADT7460_TACH1L		0x28
> +#define ADT7460_TACH1H		0x29
> +#define ADT7460_TACH2L		0x2a
> +#define ADT7460_TACH2H		0x2b
> +#define ADT7460_TACH3L		0x2c
> +#define ADT7460_TACH3H		0x2d
> +#define ADT7460_TACH4L		0x2e
> +#define ADT7460_TACH4H		0x2f
> +#define ADT7460_TACH5L		0xa9
> +#define ADT7460_TACH5H		0xaa
> +#define ADT7460_TACH6L		0xab
> +#define ADT7460_TACH6H		0xac
> +#define ADT7460_REVISION	0x3f
> +#define ADT7460_CONFIG		0x40
> +
> +
> +#endif

Do you really think this header is necessary? I would prefer to move those 
defines into the C file instead and drop the header completely.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

  reply	other threads:[~2008-07-11  8:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-11  8:23 [U-Boot-Users] ADT7460 I2C Monitor Chip Support Ricardo Ribalda Delgado
2008-07-11  8:23 ` [U-Boot-Users] [PATCH] I2C Monitor Chip ADT7460 support Ricardo Ribalda Delgado
2008-07-11  8:46   ` Stefan Roese [this message]
2008-07-11  8:54   ` Michal Simek
2008-07-11  9:36     ` Stefan Roese
2008-07-13 13:21     ` Wolfgang Denk
2008-07-14 10:32       ` [U-Boot-Users] [PATCH] " Ricardo Ribalda Delgado
  -- strict thread matches above, loose matches on Subject: below --
2008-07-11  9:49 [U-Boot-Users] [PATCH] I2C Monitor Chip ADT7460 support (fixed) Ricardo Ribalda Delgado
2008-07-11  9:49 ` [U-Boot-Users] [PATCH] I2C Monitor Chip ADT7460 support Ricardo Ribalda Delgado
2008-07-11  9:53   ` Michal Simek
2008-07-11 10:15 Ricardo Ribalda Delgado
2008-07-11 10:15 ` Ricardo Ribalda Delgado
2008-07-11 10:58   ` Stefan Roese
2008-07-11 11:12     ` Ricardo Ribalda Delgado
2008-07-14 17:30 [U-Boot-Users] [PATCH] I2C Monitor Chip ADT7460 support (new version) Ricardo Ribalda Delgado
2008-07-16  1:05 ` [U-Boot-Users] [PATCH] I2C Monitor chip ADT7460 support Ricardo Ribalda Delgado

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=200807111046.49213.sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /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