All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Mark Rutland <mark.rutland@arm.com>, Andrew Lunn <andrew@lunn.ch>,
	Jason Cooper <jason@lakedaemon.net>,
	devicetree@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-pwm@vger.kernel.org,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	linux-gpio@vger.kernel.org,
	Gregory Clement <gregory.clement@bootlin.com>,
	linux-arm-kernel@lists.infradead.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH RFC 2/6] gpio: mvebu: honour EPROBE_DEFER for devm_clk_get()
Date: Sun, 29 Mar 2020 19:22:36 +0100	[thread overview]
Message-ID: <20200329182236.GC25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200329180056.cwju3zqviwnwwjd6@pengutronix.de>

On Sun, Mar 29, 2020 at 08:00:56PM +0200, Uwe Kleine-König wrote:
> Hello Russell,
> 
> On Sun, Mar 29, 2020 at 02:34:00PM +0100, Russell King - ARM Linux admin wrote:
> > On Sun, Mar 29, 2020 at 03:16:59PM +0200, Uwe Kleine-König wrote:
> > > On Sun, Mar 29, 2020 at 11:48:09AM +0100, Russell King wrote:
> > > > diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> > > > index fa5641615db6..ee13b11c5298 100644
> > > > --- a/drivers/gpio/gpio-mvebu.c
> > > > +++ b/drivers/gpio/gpio-mvebu.c
> > > > @@ -1132,6 +1132,9 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
> > > >  	}
> > > >  
> > > >  	mvchip->clk = devm_clk_get(&pdev->dev, NULL);
> > > > +	if (mvchip->clk == ERR_PTR(-EPROBE_DEFER))
> > > > +		return -EPROBE_DEFER;
> > > > +
> > > >  	/* Not all SoCs require a clock.*/
> > > >  	if (!IS_ERR(mvchip->clk))
> > > >  		clk_prepare_enable(mvchip->clk);
> > > 
> > > I'd say the following is the right thing to do here:
> > > 
> > > 	mvchip->clk = devm_clk_get_optional(...);
> > > 	if (IS_ERR(mvchip->clk))
> > > 		return ...
> > 
> > It's not that simple.  The clock is required for Armada 370, and is
> > optional for Armada 8040.
> 
> I'd say it is still the right approach here. On Armada 370 the dtb then
> has a clk and on Armada 8040 it doesn't. So if with
> devm_clk_get_optional() something goes wrong that's because the dtb is
> wrong. And in fact the handling is even better than with your suggested
> patch as every error (but EPROBE_DEFER) is ignored instead of passed to
> the caller with your (and the existing) approach.

Sort of.  Every error is currently treated as "no clock", and only
later does such an error become fatal in the driver _if_ PWM is
configured into the kernel and we're running on Armada 370.  If PWM
is disabled in the kernel, or on some other SoC, then the driver
doesn't care whether getting the clock reported any kind of error.

Your proposal is to always treat any error getting the clock,
irrespective of whether there is PWM or not, as a fatal error for
the driver.

That is an entirely seperate functional change.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>
To: "Uwe Kleine-König"
	<u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-pwm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Bartosz Golaszewski
	<bgolaszewski-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Gregory Clement
	<gregory.clement-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH RFC 2/6] gpio: mvebu: honour EPROBE_DEFER for devm_clk_get()
Date: Sun, 29 Mar 2020 19:22:36 +0100	[thread overview]
Message-ID: <20200329182236.GC25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200329180056.cwju3zqviwnwwjd6-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

On Sun, Mar 29, 2020 at 08:00:56PM +0200, Uwe Kleine-König wrote:
> Hello Russell,
> 
> On Sun, Mar 29, 2020 at 02:34:00PM +0100, Russell King - ARM Linux admin wrote:
> > On Sun, Mar 29, 2020 at 03:16:59PM +0200, Uwe Kleine-König wrote:
> > > On Sun, Mar 29, 2020 at 11:48:09AM +0100, Russell King wrote:
> > > > diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> > > > index fa5641615db6..ee13b11c5298 100644
> > > > --- a/drivers/gpio/gpio-mvebu.c
> > > > +++ b/drivers/gpio/gpio-mvebu.c
> > > > @@ -1132,6 +1132,9 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
> > > >  	}
> > > >  
> > > >  	mvchip->clk = devm_clk_get(&pdev->dev, NULL);
> > > > +	if (mvchip->clk == ERR_PTR(-EPROBE_DEFER))
> > > > +		return -EPROBE_DEFER;
> > > > +
> > > >  	/* Not all SoCs require a clock.*/
> > > >  	if (!IS_ERR(mvchip->clk))
> > > >  		clk_prepare_enable(mvchip->clk);
> > > 
> > > I'd say the following is the right thing to do here:
> > > 
> > > 	mvchip->clk = devm_clk_get_optional(...);
> > > 	if (IS_ERR(mvchip->clk))
> > > 		return ...
> > 
> > It's not that simple.  The clock is required for Armada 370, and is
> > optional for Armada 8040.
> 
> I'd say it is still the right approach here. On Armada 370 the dtb then
> has a clk and on Armada 8040 it doesn't. So if with
> devm_clk_get_optional() something goes wrong that's because the dtb is
> wrong. And in fact the handling is even better than with your suggested
> patch as every error (but EPROBE_DEFER) is ignored instead of passed to
> the caller with your (and the existing) approach.

Sort of.  Every error is currently treated as "no clock", and only
later does such an error become fatal in the driver _if_ PWM is
configured into the kernel and we're running on Armada 370.  If PWM
is disabled in the kernel, or on some other SoC, then the driver
doesn't care whether getting the clock reported any kind of error.

Your proposal is to always treat any error getting the clock,
irrespective of whether there is PWM or not, as a fatal error for
the driver.

That is an entirely seperate functional change.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Mark Rutland <mark.rutland@arm.com>, Andrew Lunn <andrew@lunn.ch>,
	Jason Cooper <jason@lakedaemon.net>,
	linux-pwm@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	devicetree@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	linux-gpio@vger.kernel.org,
	Gregory Clement <gregory.clement@bootlin.com>,
	linux-arm-kernel@lists.infradead.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH RFC 2/6] gpio: mvebu: honour EPROBE_DEFER for devm_clk_get()
Date: Sun, 29 Mar 2020 19:22:36 +0100	[thread overview]
Message-ID: <20200329182236.GC25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200329180056.cwju3zqviwnwwjd6@pengutronix.de>

On Sun, Mar 29, 2020 at 08:00:56PM +0200, Uwe Kleine-König wrote:
> Hello Russell,
> 
> On Sun, Mar 29, 2020 at 02:34:00PM +0100, Russell King - ARM Linux admin wrote:
> > On Sun, Mar 29, 2020 at 03:16:59PM +0200, Uwe Kleine-König wrote:
> > > On Sun, Mar 29, 2020 at 11:48:09AM +0100, Russell King wrote:
> > > > diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> > > > index fa5641615db6..ee13b11c5298 100644
> > > > --- a/drivers/gpio/gpio-mvebu.c
> > > > +++ b/drivers/gpio/gpio-mvebu.c
> > > > @@ -1132,6 +1132,9 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
> > > >  	}
> > > >  
> > > >  	mvchip->clk = devm_clk_get(&pdev->dev, NULL);
> > > > +	if (mvchip->clk == ERR_PTR(-EPROBE_DEFER))
> > > > +		return -EPROBE_DEFER;
> > > > +
> > > >  	/* Not all SoCs require a clock.*/
> > > >  	if (!IS_ERR(mvchip->clk))
> > > >  		clk_prepare_enable(mvchip->clk);
> > > 
> > > I'd say the following is the right thing to do here:
> > > 
> > > 	mvchip->clk = devm_clk_get_optional(...);
> > > 	if (IS_ERR(mvchip->clk))
> > > 		return ...
> > 
> > It's not that simple.  The clock is required for Armada 370, and is
> > optional for Armada 8040.
> 
> I'd say it is still the right approach here. On Armada 370 the dtb then
> has a clk and on Armada 8040 it doesn't. So if with
> devm_clk_get_optional() something goes wrong that's because the dtb is
> wrong. And in fact the handling is even better than with your suggested
> patch as every error (but EPROBE_DEFER) is ignored instead of passed to
> the caller with your (and the existing) approach.

Sort of.  Every error is currently treated as "no clock", and only
later does such an error become fatal in the driver _if_ PWM is
configured into the kernel and we're running on Armada 370.  If PWM
is disabled in the kernel, or on some other SoC, then the driver
doesn't care whether getting the clock reported any kind of error.

Your proposal is to always treat any error getting the clock,
irrespective of whether there is PWM or not, as a fatal error for
the driver.

That is an entirely seperate functional change.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-03-29 18:22 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-29 10:45 [PATCH RFC 0/6] PWM fan support on Clearfog gt8k Russell King - ARM Linux admin
2020-03-29 10:45 ` Russell King - ARM Linux admin
2020-03-29 10:48 ` [PATCH RFC 1/6] gpio: mvebu: convert pwm to regmap Russell King
2020-03-29 10:48   ` Russell King
2020-03-29 10:48   ` Russell King
2020-03-29 10:48 ` [PATCH RFC 2/6] gpio: mvebu: honour EPROBE_DEFER for devm_clk_get() Russell King
2020-03-29 10:48   ` Russell King
2020-03-29 13:16   ` Uwe Kleine-König
2020-03-29 13:16     ` Uwe Kleine-König
2020-03-29 13:16     ` Uwe Kleine-König
2020-03-29 13:34     ` Russell King - ARM Linux admin
2020-03-29 13:34       ` Russell King - ARM Linux admin
2020-03-29 18:00       ` Uwe Kleine-König
2020-03-29 18:00         ` Uwe Kleine-König
2020-03-29 18:22         ` Russell King - ARM Linux admin [this message]
2020-03-29 18:22           ` Russell King - ARM Linux admin
2020-03-29 18:22           ` Russell King - ARM Linux admin
2020-03-31 16:29           ` Uwe Kleine-König
2020-03-31 16:29             ` Uwe Kleine-König
2020-03-29 10:48 ` [PATCH RFC 3/6] gpio: mvebu: add PWM support for Armada 8k Russell King
2020-03-29 10:48   ` Russell King
2020-03-29 11:00   ` Russell King - ARM Linux admin
2020-03-29 11:00     ` Russell King - ARM Linux admin
2020-03-29 11:00     ` Russell King - ARM Linux admin
2020-03-29 10:48 ` [PATCH RFC 4/6] arm64: dts: armada-cp11x: add pwm support to GPIO blocks Russell King
2020-03-29 10:48   ` Russell King
2020-03-29 10:48 ` [PATCH RFC 5/6] arm64: dts: clearfog-gt-8k: add pwm-fan Russell King
2020-03-29 10:48   ` Russell King
2020-03-29 10:48   ` Russell King
2020-03-29 10:48 ` [PATCH RFC 6/6] arm64: dts: clearfog-gt-8k: add cooling maps Russell King
2020-03-29 10:48   ` Russell King
2020-04-16  7:51 ` [PATCH RFC 0/6] PWM fan support on Clearfog gt8k Linus Walleij
2020-04-16  7:51   ` Linus Walleij
2020-04-16  7:51   ` Linus Walleij
2020-04-16  8:14   ` Russell King - ARM Linux admin
2020-04-16  8:14     ` Russell King - ARM Linux admin
2020-04-16  8:14     ` Russell King - ARM Linux admin
2020-04-16 12:08     ` Linus Walleij
2020-04-16 12:08       ` Linus Walleij
2020-04-16 12:08       ` Linus Walleij
2020-04-16 14:53       ` Russell King - ARM Linux admin
2020-04-16 14:53         ` Russell King - ARM Linux admin
2020-04-16 14:53         ` Russell King - ARM Linux admin
2020-04-16 13:50   ` Andrew Lunn
2020-04-16 13:50     ` Andrew Lunn
2020-04-16 13:50     ` Andrew Lunn
2020-04-16 14:29     ` Russell King - ARM Linux admin
2020-04-16 14:29       ` Russell King - ARM Linux admin
2020-04-16 14:29       ` Russell King - ARM Linux admin
2020-04-16 14:36       ` Andrew Lunn
2020-04-16 14:36         ` Andrew Lunn
2020-04-16 14:36         ` Andrew Lunn
2020-04-16 14:41         ` Russell King - ARM Linux admin
2020-04-16 14:41           ` Russell King - ARM Linux admin
2020-04-16 14:41           ` Russell King - ARM Linux admin
2020-04-16 14:37     ` Robin Murphy
2020-04-16 14:37       ` Robin Murphy
2020-04-16 14:37       ` Robin Murphy
2020-04-16 14:42       ` Andrew Lunn
2020-04-16 14:42         ` Andrew Lunn
2020-04-16 14:42         ` Andrew Lunn
2020-04-16 16:20         ` Robin Murphy
2020-04-16 16:20           ` Robin Murphy
2020-04-16 16:20           ` Robin Murphy
2020-04-16 16:49           ` Andrew Lunn
2020-04-16 16:49             ` Andrew Lunn
2020-04-16 16:49             ` Andrew Lunn
2020-04-16 14:55       ` Russell King - ARM Linux admin
2020-04-16 14:55         ` Russell King - ARM Linux admin
2020-04-16 14:55         ` Russell King - ARM Linux admin
2020-04-16 15:55         ` Robin Murphy
2020-04-16 15:55           ` Robin Murphy
2020-04-16 15:55           ` Robin Murphy
2020-04-16 16:37           ` Russell King - ARM Linux admin
2020-04-16 16:37             ` Russell King - ARM Linux admin
2020-04-16 16:37             ` Russell King - ARM Linux admin
2020-04-16 16:49             ` Russell King - ARM Linux admin
2020-04-16 16:49               ` Russell King - ARM Linux admin
2020-04-16 16:49               ` Russell King - ARM Linux admin

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=20200329182236.GC25745@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=bgolaszewski@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=jason@lakedaemon.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.