All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] V3, TI ads7871 a/d converter,
Date: Wed, 31 Mar 2010 15:45:32 +0000	[thread overview]
Message-ID: <20100331174532.3a17c87e@hyperion.delvare> (raw)
In-Reply-To: <1269124170-11623-1-git-send-email-pthomas8589@gmail.com>

Hi Jonathan,

On Wed, 31 Mar 2010 15:52:57 +0100, Jonathan Cameron wrote:
> There are a few things I'd like to see in addition, but
> they can easily occur later in an incremental patch...
> > (...)
> > +	if (mux_cnv = 0) {
> > +		val = ads7871_read_reg16(spi, REG_LS_BYTE);
> > +		/*result in volts*10000 = (val/8192)*2.5*10000*/
> > +		val = ((val>>2) * 25000) / 8192;
> > +		return sprintf(buf, "%d\n", val);
> > +	} else {
> This shouldn't have gotten through check patch.  You never have 
> brackets round a single line like this.  Should be,
> 
> } else
> 	return -1;

Some developers don't like it when the if branch has braces and the
else branch doesn't, or vice-versa. For this reason, checkpatch no
longer complains about single line branches using braces as long as at
least one other branch needs braces (which is the case here.)

> sizeof(*pdata) is neater.
> > +	pdata = kzalloc(sizeof(struct ads7871_data), GFP_KERNEL);

I beg to disagree. It's really a matter of personal taste. I prefer
sizeof(struct foo) because you can't accidentally ask for the size of
the pointer that way. In the end there is no consensus, which is why
checkpatch doesn't complain either way.

-- 
Jean Delvare

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

  parent reply	other threads:[~2010-03-31 15:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-20 22:29 [lm-sensors] [PATCH] V3, TI ads7871 a/d converter, Paul Thomas
2010-03-31 14:52 ` Jonathan Cameron
2010-03-31 15:02 ` Paul Thomas
2010-03-31 15:45 ` Jean Delvare [this message]
2010-03-31 15:51 ` Jonathan Cameron
2010-03-31 15:55 ` Jonathan Cameron
2010-04-05 18:57 ` Paul Thomas
2010-04-06 12:16 ` Jonathan Cameron

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=20100331174532.3a17c87e@hyperion.delvare \
    --to=khali@linux-fr.org \
    --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.