mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Stefani Seibold <stefani@seibold.net>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>, Andi Kleen <andi@firstfloor.org>,
	Amerigo Wang <xiyou.wangcong@gmail.com>
Subject: Re: [PATCH 4/6] new kfifo API v0.3 - add DEFINE_KFIFO and friends, add very tiny functions
Date: Fri, 14 Aug 2009 08:20:54 -0700	[thread overview]
Message-ID: <1250263254.15269.456.camel@Joe-Laptop.home> (raw)
In-Reply-To: <1250250262.19690.95.camel@wall-e>

On Fri, 2009-08-14 at 13:44 +0200, Stefani Seibold wrote:

Couple of trivial comments

> This is patch 4/6 of the new kfifo API:
>  Add KFIFO_INIT - macro to generate a kfifo initializer

Is it really necessary to use KFIFO_INIT and INIT_KFIFO?
I think it'll cause confusion and misuse.

> Add INIT_KFIFO - macro to initialize a with DECLARE_KFIFO declared kfifo 

What does the description mean?

> Add DEFINE_KFIFO - macro to define and initialize a kfifo as a global or local object

What does this mean?  Is scope relevant to the macro?

I think you should mention somewhere that these macros
actually define 2 objects.  "name##_buffer" might have
unexpected clashes and be prefixed with kfifo.
maybe something like "kfifo_##name##_buffer"?

> + * KFIFO_INIT - macro to generate a kfifo initializer
> + * @s: size of the fifo buffer
> + * @b: address of the fifo buffer
> + */
> +#define KFIFO_INIT(s, b) \
> +	(struct kfifo) { \
> +		.size	= s, \
> +		.in	= 0, \
> +		.out	= 0, \
> +		.buffer = b \
> +	}

> +/**
> + * INIT_KFIFO - macro to initialize a with DECLARE_KFIFO declared kfifo
> + * @name: name of the declared kfifo datatype
> + * @size: size of the fifo buffer
> + */
> +#define INIT_KFIFO(name) \
> +	name = KFIFO_INIT(sizeof(name##_buffer) - sizeof(struct kfifo), \
> +				name##_buffer)

Perhaps

#define __kfifo_initializer ?



  parent reply	other threads:[~2009-08-14 15:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-14 11:44 Stefani Seibold
2009-08-14 12:23 ` Arnd Bergmann
2009-08-14 15:20 ` Joe Perches [this message]
2009-08-14 17:03   ` Stefani Seibold
2009-08-14 17:23     ` 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=1250263254.15269.456.camel@Joe-Laptop.home \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefani@seibold.net \
    --cc=xiyou.wangcong@gmail.com \
    /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

all inboxes | Powered by JetHome®