All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Cc: jeff@garzik.org, netdev@vger.kernel.org,
	Liran Liss <liranl@mellanox.co.il>,
	tziporet@mellanox.co.il, Roland Dreier <rdreier@cisco.com>
Subject: Re: [PATCH RFC 01/10] mlx4_en: Include file
Date: Mon, 14 Jul 2008 17:17:25 +0100	[thread overview]
Message-ID: <20080714161724.GS19302@solarflare.com> (raw)
In-Reply-To: <487B6569.5000806@mellanox.co.il>

Yevgeny Petrilin wrote:
[...]
> +#ifdef CONFIG_MLX4_EN_DEBUG
> +#define mlx4_dbg(mdev, format, arg...)	\
> +	printk(KERN_DEBUG "%s %s: " format , DRV_NAME ,\
> +		(&mdev->pdev->dev)->bus_id , ## arg)
> +#else /* CONFIG_MLX4_DEBUG */
> +#define mlx4_dbg(mdev, format, arg...) do { (void) mdev; } while (0)
> +#endif /* CONFIG_MLX4_DEBUG */
> +
> +#define mlx4_err(mdev, format, arg...) \
> +	printk(KERN_ERR "%s %s: " format , DRV_NAME ,\
> +		(&mdev->pdev->dev)->bus_id , ## arg)
> +#define mlx4_info(mdev, format, arg...) \
> +	printk(KERN_INFO "%s %s: " format , DRV_NAME ,\
> +		(&mdev->pdev->dev)->bus_id , ## arg)
> +#define mlx4_warn(mdev, format, arg...) \
> +	printk(KERN_WARNING "%s %s: " format , DRV_NAME ,\
> +		(&mdev->pdev->dev)->bus_id , ## arg)

I think these should be defined in terms of dev_dbg etc.

[...]
> +#ifdef CONFIG_MLX4_EN_PREFETCH
> +	#define PREFETCH(x)		prefetch(x)
> +#else
> +	#define PREFETCH(x)
> +#endif
> +
> +#ifdef CONFIG_MLX4_EN_SW_COUNTERS
> +#define DO_SW_COUNTERS			1
> +#define SET_SW_COUNTER(cnt, val)	((cnt) = (val))
> +#define INC_SW_COUNTER(cnt)		(++(cnt))
> +#define ADD_SW_COUNTER(cnt, add)	((cnt) += (add))
> +#else
> +#define DO_SW_COUNTERS			0
> +#define SET_SW_COUNTER(cnt, val)
> +#define INC_SW_COUNTER(cnt)
> +#define ADD_SW_COUNTER(cnt, add)
> +#endif

The do-nothing implementations should be do {} while (0).

[...]
> +/*
> + * Useful macros
> + */
> +
> +#define ROUNDUP_LOG2(x)		ilog2(roundup_pow_of_two(x))
> +#define XNOR(x, y)		(!(x) == !(y))
> +#define MIN(a, b)		((a) < (b) ? (a) : (b))
> +#define MAX(a, b)		((a) > (b) ? (a) : (b))

So useful that <linux/kernel.h> already has quite a few of them...

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.

  reply	other threads:[~2008-07-14 16:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14 14:40 [PATCH RFC 01/10] mlx4_en: Include file Yevgeny Petrilin
2008-07-14 16:17 ` Ben Hutchings [this message]
2008-07-15 13:46 ` Ben Hutchings
2008-07-15 19:14 ` Roland Dreier
2008-07-15 19:23 ` Roland Dreier
2008-07-15 19:25 ` Roland Dreier
2008-07-15 19:27 ` Roland Dreier
2008-07-15 19:29 ` Roland Dreier
2008-07-15 19:30 ` Roland Dreier
2008-07-16 15:17   ` Yevgeny Petrilin
  -- strict thread matches above, loose matches on Subject: below --
2008-07-14 14:44 [Patch " Yevgeny Petrilin

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=20080714161724.GS19302@solarflare.com \
    --to=bhutchings@solarflare.com \
    --cc=jeff@garzik.org \
    --cc=liranl@mellanox.co.il \
    --cc=netdev@vger.kernel.org \
    --cc=rdreier@cisco.com \
    --cc=tziporet@mellanox.co.il \
    --cc=yevgenyp@mellanox.co.il \
    /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.