netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: Joe Perches <joe@perches.com>
Cc: "Luis R. Rodriguez" <lrodriguez@atheros.com>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] ath: Make ath_printk void not int and remove unused struct ath_common *
Date: Mon, 29 Aug 2011 14:12:38 -0400	[thread overview]
Message-ID: <20110829181237.GB1406@tuxdriver.com> (raw)
In-Reply-To: <78869fcd8172cd02266b66a71aadbd0c0efbdebc.1314347556.git.joe@perches.com>

On Fri, Aug 26, 2011 at 01:56:39AM -0700, Joe Perches wrote:
> Changing the return type and removing the unused argument from
> ath_printk reduces code size.
> 
> Add an __always_unused struct ath_common * to the macros
> that call ath_printk to avoid unused variable warnings.
> 
> $ size drivers/net/wireless/ath/built-in.o*
>    text	   data	    bss	    dec	    hex	filename
> 1159859	  16235	 212000	1388094	 152e3e	drivers/net/wireless/ath/built-in.o.new
> 1164175	  16235	 212032	1392442	 153f3a	drivers/net/wireless/ath/built-in.o.old
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/net/wireless/ath/ath.h  |   27 ++++++++++++++++-----------
>  drivers/net/wireless/ath/main.c |    8 ++------
>  2 files changed, 18 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
> index a3f8505..9891fb6 100644
> --- a/drivers/net/wireless/ath/ath.h
> +++ b/drivers/net/wireless/ath/ath.h
> @@ -178,24 +178,29 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry);
>  void ath_hw_cycle_counters_update(struct ath_common *common);
>  int32_t ath_hw_get_listen_time(struct ath_common *common);
>  
> -extern __attribute__((format (printf, 3, 4)))
> -int ath_printk(const char *level, struct ath_common *common,
> -	       const char *fmt, ...);
> +extern __attribute__((format (printf, 2, 3)))
> +void ath_printk(const char *level, const char *fmt, ...);
> +
> +#define _ath_printk(level, common, fmt, ...)			\
> +do {								\
> +	__always_unused struct ath_common *unused = common;	\
> +	ath_printk(level, fmt, ##__VA_ARGS__);			\
> +} while (0)
>  
>  #define ath_emerg(common, fmt, ...)				\
> -	ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__)
> +	_ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__)
>  #define ath_alert(common, fmt, ...)				\
> -	ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__)
> +	_ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__)
>  #define ath_crit(common, fmt, ...)				\
> -	ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__)
> +	_ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__)
>  #define ath_err(common, fmt, ...)				\
> -	ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__)
> +	_ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__)
>  #define ath_warn(common, fmt, ...)				\
> -	ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__)
> +	_ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__)
>  #define ath_notice(common, fmt, ...)				\
> -	ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__)
> +	_ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__)
>  #define ath_info(common, fmt, ...)				\
> -	ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__)
> +	_ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__)
>  
>  /**
>   * enum ath_debug_level - atheros wireless debug level

Any reason to preserve all these "common" args?

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

  reply	other threads:[~2011-08-29 18:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26  8:56 [PATCH 0/2] ath: Reduce logging message code size Joe Perches
2011-08-26  8:56 ` [PATCH 1/2] ath: Make ath_dbg void not int Joe Perches
2011-08-26  8:56 ` [PATCH 2/2] ath: Make ath_printk void not int and remove unused struct ath_common * Joe Perches
2011-08-29 18:12   ` John W. Linville [this message]
2011-08-29 18:31     ` 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=20110829181237.GB1406@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lrodriguez@atheros.com \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).