Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-gpio@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v1 3/4] pinctrl: intel: Convert revision conditional to switch-case
Date: Fri, 8 Jan 2021 09:05:51 +0200	[thread overview]
Message-ID: <20210108070551.GW968855@lahna.fi.intel.com> (raw)
In-Reply-To: <20210107190200.41221-3-andriy.shevchenko@linux.intel.com>

On Thu, Jan 07, 2021 at 09:01:59PM +0200, Andy Shevchenko wrote:
> switch-case is slightly better to maintain in case some new features will come
> in new revisions of the hardware.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/pinctrl/intel/pinctrl-intel.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
> index 1a479112ed85..00979acb0203 100644
> --- a/drivers/pinctrl/intel/pinctrl-intel.c
> +++ b/drivers/pinctrl/intel/pinctrl-intel.c
> @@ -1483,9 +1483,13 @@ static int intel_pinctrl_probe(struct platform_device *pdev,
>  
>  		/* Determine community features based on the revision */
>  		value = readl(regs + REVID);
> -		if (((value & REVID_MASK) >> REVID_SHIFT) >= 0x94) {
> +		switch ((value & REVID_MASK) >> REVID_SHIFT) {
> +		case 0x0094 ... 0xffff:
>  			community->features |= PINCTRL_FEATURE_DEBOUNCE;
>  			community->features |= PINCTRL_FEATURE_1K_PD;
> +			break;
> +		default:
> +			break;

This adds 4 new lines and I don't think it improves anything so I
suggest we leave it as is for now. Once we have hardware that actually
implements some new features we can reconsider something like this.

  reply	other threads:[~2021-01-08  7:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 19:01 [PATCH v1 1/4] pinctrl: intel: Split intel_pinctrl_add_padgroups() for better maintenance Andy Shevchenko
2021-01-07 19:01 ` [PATCH v1 2/4] pinctrl: intel: Drop unnecessary check for predefined features Andy Shevchenko
2021-01-08  7:08   ` Mika Westerberg
2021-01-07 19:01 ` [PATCH v1 3/4] pinctrl: intel: Convert revision conditional to switch-case Andy Shevchenko
2021-01-08  7:05   ` Mika Westerberg [this message]
2021-01-07 19:02 ` [PATCH v1 4/4] pinctrl: intel: Convert capability list to features Andy Shevchenko
2021-01-08  7:07   ` Mika Westerberg
2021-01-08 12:22     ` Andy Shevchenko
2021-01-08 12:31       ` Andy Shevchenko
2021-01-08 12:46         ` Mika Westerberg
2021-01-08 12:51           ` Andy Shevchenko
2021-01-08 13:11             ` Mika Westerberg
2021-01-08 13:45               ` Andy Shevchenko
2021-01-08  7:07 ` [PATCH v1 1/4] pinctrl: intel: Split intel_pinctrl_add_padgroups() for better maintenance Mika Westerberg

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=20210108070551.GW968855@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@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