linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Quentin Schulz <quentin.schulz@free-electrons.com>
Cc: linus.walleij@linaro.org, robh+dt@kernel.org,
	mark.rutland@arm.com, wens@csie.org, linux@armlinux.org.uk,
	lee.jones@linaro.org, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	thomas.petazzoni@free-electrons.com,
	linux-sunxi@googlegroups.com
Subject: Re: [PATCH v4 02/10] pinctrl: axp209: add pinctrl features
Date: Fri, 1 Dec 2017 16:57:02 +0100	[thread overview]
Message-ID: <20171201155702.irfox7vf3kfjvpjx@flea.lan> (raw)
In-Reply-To: <71c9da94df2a5938cb8c092e40f8e36eec0b01c3.1512135804.git-series.quentin.schulz@free-electrons.com>

[-- Attachment #1: Type: text/plain, Size: 1544 bytes --]

On Fri, Dec 01, 2017 at 02:44:43PM +0100, Quentin Schulz wrote:
> +static void axp20x_gpio_set(struct gpio_chip *chip, unsigned offset,
> +			    int value)
> +{

checkpatch output:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

> +static int axp20x_pmx_set_mux(struct pinctrl_dev *pctldev,
> +			      unsigned int function, unsigned int group)
> +{
> +	struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
> +	unsigned int mask;
> +
> +	/* Every pin supports GPIO_OUT and GPIO_IN functions */
> +	if (function <= AXP20X_FUNC_GPIO_IN)
> +		return axp20x_pmx_set(pctldev, group,
> +				      gpio->funcs[function].muxval);
> +
> +	if (function == AXP20X_FUNC_LDO)
> +		mask = gpio->desc->ldo_mask;
> +	else
> +		mask = gpio->desc->adc_mask;

What is the point of this test...

> +	if (!(BIT(group) & mask))
> +		return -EINVAL;
> +
> +	/*
> +	 * We let the regulator framework handle the LDO muxing as muxing bits
> +	 * are basically also regulators on/off bits. It's better not to enforce
> +	 * any state of the regulator when selecting LDO mux so that we don't
> +	 * interfere with the regulator driver.
> +	 */
> +	if (function == AXP20X_FUNC_LDO)
> +		return 0;

... if you know that you're not going to do anything with one of the
outcomes. It would be better to just move that part above, instead of
doing the same test twice.

It looks good otherwise, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-12-02 15:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 13:44 [PATCH v4 00/10] add pinmuxing support for pins in AXP209 and AXP813 PMICs Quentin Schulz
2017-12-01 13:44 ` [PATCH v4 01/10] pinctrl: move gpio-axp209 to pinctrl Quentin Schulz
2017-12-01 13:44 ` [PATCH v4 02/10] pinctrl: axp209: add pinctrl features Quentin Schulz
2017-12-01 15:57   ` Maxime Ripard [this message]
2017-12-04  8:07     ` Quentin Schulz
2017-12-05  8:53       ` Maxime Ripard
2017-12-05 23:21   ` kbuild test robot
2017-12-01 13:44 ` [PATCH v4 03/10] dt-bindings: gpio: gpio-axp209: " Quentin Schulz
2017-12-02 15:55   ` Linus Walleij
2017-12-01 13:44 ` [PATCH v4 04/10] pinctrl: axp209: rename everything from gpio to pctl Quentin Schulz
2017-12-01 13:44 ` [PATCH v4 05/10] pinctrl: axp209: add programmable gpio_status_offset Quentin Schulz
2017-12-01 13:44 ` [PATCH v4 06/10] pinctrl: axp209: add programmable ADC muxing value Quentin Schulz
2017-12-01 15:57   ` Maxime Ripard
2017-12-01 13:44 ` [PATCH v4 07/10] pinctrl: axp209: add support for AXP813 GPIOs Quentin Schulz
2017-12-01 13:44 ` [PATCH v4 08/10] mfd: axp20x: add pinctrl cell for AXP813 Quentin Schulz
2017-12-02 15:57   ` Linus Walleij
2017-12-04  9:02     ` Lee Jones
2017-12-01 13:44 ` [PATCH v4 09/10] ARM: dtsi: axp81x: add GPIO DT node Quentin Schulz
2017-12-02 15:58   ` Linus Walleij
2017-12-05  9:24   ` [linux-sunxi] " Chen-Yu Tsai
2017-12-05  9:39     ` Maxime Ripard
2017-12-01 13:44 ` [PATCH v4 10/10] ARM: dtsi: axp81x: set pinmux for GPIO0/1 when used as LDOs Quentin Schulz
2017-12-01 15:58   ` Maxime Ripard
2017-12-05  9:25     ` Chen-Yu Tsai
2017-12-02 16:00 ` [PATCH v4 00/10] add pinmuxing support for pins in AXP209 and AXP813 PMICs Linus Walleij
2017-12-05  8:55   ` Maxime Ripard

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=20171201155702.irfox7vf3kfjvpjx@flea.lan \
    --to=maxime.ripard@free-electrons.com \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=quentin.schulz@free-electrons.com \
    --cc=robh+dt@kernel.org \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=wens@csie.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).