mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Joe Perches <joe@perches.com>
Cc: Len Brown <len.brown@intel.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] thermal_sys: Remove obfuscating used-once macros
Date: Thu, 26 Jan 2012 15:31:49 -0800	[thread overview]
Message-ID: <20120126153149.c1d9044f.akpm@linux-foundation.org> (raw)
In-Reply-To: <af64842337355cb336a98563bba79007709a6d00.1327447797.git.joe@perches.com>

On Tue, 24 Jan 2012 15:35:36 -0800
Joe Perches <joe@perches.com> wrote:

> These don't add any value as they are used
> only once and the surrounding code uses similar
> variable.

And they were buggy if passed an expression-with-side-effects.  Geeze
we make this mistake often, and it's C programming 101!  Or maybe 102.

> --- a/drivers/thermal/thermal_sys.c
> +++ b/drivers/thermal/thermal_sys.c
> @@ -312,22 +312,6 @@ static struct device_attribute trip_point_attrs[] = {
>  	__ATTR(trip_point_11_temp, 0444, trip_point_temp_show, NULL),
>  };
>  
> -#define TRIP_POINT_ATTR_ADD(_dev, _index, result)     \
> -do {    \
> -	result = device_create_file(_dev,	\
> -				&trip_point_attrs[_index * 2]);	\
> -	if (result)	\
> -		break;	\
> -	result = device_create_file(_dev,	\
> -			&trip_point_attrs[_index * 2 + 1]);	\
> -} while (0)
> -
> -#define TRIP_POINT_ATTR_REMOVE(_dev, _index)	\
> -do {	\
> -	device_remove_file(_dev, &trip_point_attrs[_index * 2]);	\
> -	device_remove_file(_dev, &trip_point_attrs[_index * 2 + 1]);	\
> -} while (0)

I don't forsee many tears being shed over the above ;)


  reply	other threads:[~2012-01-26 23:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24 23:35 [PATCH 0/4] thermal_sys: Cleanups Joe Perches
2012-01-24 23:35 ` [PATCH 1/4] thermal_sys: Remove unnecessary line continuations Joe Perches
2012-01-24 23:41   ` Jesper Juhl
2012-01-24 23:35 ` [PATCH 2/4] thermal_sys: Remove obfuscating used-once macros Joe Perches
2012-01-26 23:31   ` Andrew Morton [this message]
2012-01-24 23:35 ` [PATCH 3/4] thermal_sys: Kernel style cleanups Joe Perches
2012-01-24 23:39   ` Jesper Juhl
2012-01-24 23:35 ` [PATCH 4/4] thermal_sys: Convert printks to pr_<level> Joe Perches

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=20120126153149.c1d9044f.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome