Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH v2][RFC] pinctrl: sh-pfc: share/reuse same PORT_GP_x() macros
Date: Wed, 25 Nov 2015 02:18:01 +0200	[thread overview]
Message-ID: <11321076.yAsIxzsHHx@avalon> (raw)
In-Reply-To: <877flmjnp5.wl%kuninori.morimoto.gx@renesas.com>

Hi Morimoto-san,

On Friday 13 November 2015 08:47:07 Kuninori Morimoto wrote:
> Hi Geert, Laurent
> 
> > > #define _PORT_GP_CFG_2(bank, pin, fn, sfx, cfg) \
> > > -        _PORT_GP_CFG_1(bank, 0, fn, sfx, cfg) _PORT_GP_CFG_1(bank, 1,
> > > fn, sfx, cfg) +        _PORT_GP_CFG_1(bank, pin, fn, sfx, cfg)
> > > _PORT_GP_CFG_1(bank, pin + 1, fn, sfx, cfg)
> (snip)
> 
> > > I noticed it seems difficult, because it is based on
> > > 
> > >         #define PORT_GP_CFG_1(bank, pin, fn, sfx, cfg) fn(bank, pin,
> > >         GP_##bank##_##pin, sfx, cfg)> >         
> > >                                     ~~~                                 
> > >                                               ~~~
> > > 
> > > we can't use (pin + x) style.
> > > It seems we need all 0 - 32 definition anyway...
> > 
> > Oh right. CPP cannot evaluate the pin number arithmetic :-(
> > 
> > Then your previous patch is indeed the best we can do, I'm afraid.
> 
> I think your idea was good, but unfortunately we can't use it.
> Laurent, what do you think about this patch ?

It would be great to have a more powerful C preprocessor to create a single 
macro that would take the number of pins as a parameter. I think C++ templates 
could do so ;-)

I think your patch is indeed the best that can be done.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2015-11-25  0:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10  8:56 [PATCH][RFC] pinctrl: sh-pfc: share/reuse same PORT_GP_x() macros Kuninori Morimoto
2015-11-11  3:28 ` Kuninori Morimoto
2015-11-11  5:29   ` [PATCH v2][RFC] " Kuninori Morimoto
2015-11-12 12:17     ` Geert Uytterhoeven
2015-11-13  0:30       ` Kuninori Morimoto
2015-11-13  4:02         ` Kuninori Morimoto
2015-11-13  7:44           ` Geert Uytterhoeven
2015-11-13  8:47             ` Kuninori Morimoto
2015-11-25  0:18               ` Laurent Pinchart [this message]
2015-11-25  6:45                 ` Kuninori Morimoto
2015-11-25  9:31                   ` Geert Uytterhoeven
2015-11-24  8:57     ` Geert Uytterhoeven
2015-11-24  9:09       ` Kuninori Morimoto
2015-11-24  9:35         ` Geert Uytterhoeven

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=11321076.yAsIxzsHHx@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-sh@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