devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Jens Kuske <jenskuske@gmail.com>
Cc: "Emilio López" <emilio@elopez.com.ar>,
	"Mike Turquette" <mturquette@linaro.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Vishnu Patekar" <vishnupatekar0510@gmail.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com
Subject: Re: [PATCH v2 04/10] pinctrl: sunxi: Prepare for building SoC specific drivers as modules
Date: Tue, 19 May 2015 09:55:37 +0200	[thread overview]
Message-ID: <20150519075537.GU4004@lukather> (raw)
In-Reply-To: <5559B1AF.2010200@gmail.com>

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

On Mon, May 18, 2015 at 11:32:31AM +0200, Jens Kuske wrote:
> Hi,
> 
> On 05/17/15 16:19, Maxime Ripard wrote:
> > On Fri, May 15, 2015 at 06:38:54PM +0200, Jens Kuske wrote:
> >> Add a remove function and export the init and remove function
> >> to allow us to build the SoC specific drivers as modules.
> >>
> >> Signed-off-by: Jens Kuske <jenskuske@gmail.com>
> >> ---
> >>  drivers/pinctrl/sunxi/pinctrl-sunxi.c | 25 +++++++++++++++++++------
> >>  drivers/pinctrl/sunxi/pinctrl-sunxi.h |  2 ++
> >>  2 files changed, 21 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> >> index f8e171b..4ef6b3d 100644
> >> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> >> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> >> @@ -856,7 +856,6 @@ int sunxi_pinctrl_init(struct platform_device *pdev,
> >>  	struct sunxi_pinctrl *pctl;
> >>  	struct resource *res;
> >>  	int i, ret, last_pin;
> >> -	struct clk *clk;
> >>  
> >>  	pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
> >>  	if (!pctl)
> >> @@ -954,13 +953,13 @@ int sunxi_pinctrl_init(struct platform_device *pdev,
> >>  			goto gpiochip_error;
> >>  	}
> >>  
> >> -	clk = devm_clk_get(&pdev->dev, NULL);
> >> -	if (IS_ERR(clk)) {
> >> -		ret = PTR_ERR(clk);
> >> +	pctl->clk = devm_clk_get(&pdev->dev, NULL);
> >> +	if (IS_ERR(pctl->clk)) {
> >> +		ret = PTR_ERR(pctl->clk);
> >>  		goto gpiochip_error;
> >>  	}
> >>  
> >> -	ret = clk_prepare_enable(clk);
> >> +	ret = clk_prepare_enable(pctl->clk);
> >>  	if (ret)
> >>  		goto gpiochip_error;
> >>  
> >> @@ -1015,10 +1014,24 @@ int sunxi_pinctrl_init(struct platform_device *pdev,
> >>  	return 0;
> >>  
> >>  clk_error:
> >> -	clk_disable_unprepare(clk);
> >> +	clk_disable_unprepare(pctl->clk);
> >>  gpiochip_error:
> >>  	gpiochip_remove(pctl->chip);
> >>  pinctrl_error:
> >>  	pinctrl_unregister(pctl->pctl_dev);
> >>  	return ret;
> >>  }
> >> +EXPORT_SYMBOL(sunxi_pinctrl_init);
> >> +
> >> +int sunxi_pinctrl_remove(struct platform_device *pdev)
> >> +{
> >> +	struct sunxi_pinctrl *pctl = platform_get_drvdata(pdev);
> >> +
> >> +	gpiochip_remove(pctl->chip);
> >> +	pinctrl_unregister(pctl->pctl_dev);
> >> +
> >> +	clk_disable_unprepare(pctl->clk);
> > 
> > We should also remove the domain and the interrupt mapping here.
> 
> Ouch, I missed that. Only looked at the *_error: labels.
> 
> Apart from that, currently the kernel panics some seconds after removing
> the pinctrl module because mmc wants to access a gpio. Can this be
> prevented somehow? I think pinctrl must not be removed once other
> devices use any pin-related things.

pinctrl_unregister doesn't look like it cares about whether or not
there's users left in the system.

Maybe the easiest path would be to just make this builtin like Paul
suggested then ... :/

Maxime

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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-05-19  7:55 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 16:38 [PATCH v2 00/10] ARM: sunxi: Introduce Allwinner H3 support Jens Kuske
     [not found] ` <1431707940-19372-1-git-send-email-jenskuske-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-15 16:38   ` [PATCH v2 01/10] Documentation: sunxi: Update Allwinner SoC documentation Jens Kuske
     [not found]     ` <1431707940-19372-2-git-send-email-jenskuske-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-17 12:52       ` Maxime Ripard
2015-05-15 16:38   ` [PATCH v2 02/10] clk: sunxi: Add support for multiple parents to gates Jens Kuske
     [not found]     ` <1431707940-19372-3-git-send-email-jenskuske-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-17 12:50       ` Maxime Ripard
2015-05-18  9:11         ` Jens Kuske
     [not found]           ` <5559ACC6.6050202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-19  7:53             ` Maxime Ripard
2015-05-15 16:38   ` [PATCH v2 03/10] clk: sunxi: Let divs clocks read the base factor clock name from devicetree Jens Kuske
     [not found]     ` <1431707940-19372-4-git-send-email-jenskuske-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-16  2:10       ` Chen-Yu Tsai
     [not found]         ` <CAGb2v64y8+bdya3N=gK-YEie3A9nVM5nuxRZTVPXYSaN6WzPoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-18  9:15           ` Jens Kuske
     [not found]             ` <5559ADBE.7060506-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-18 14:45               ` Chen-Yu Tsai
2015-05-17 13:06       ` Maxime Ripard
2015-05-18  9:22         ` Jens Kuske
     [not found]           ` <5559AF58.60508-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-19  8:26             ` Maxime Ripard
2015-05-15 16:38   ` [PATCH v2 04/10] pinctrl: sunxi: Prepare for building SoC specific drivers as modules Jens Kuske
     [not found]     ` <1431707940-19372-5-git-send-email-jenskuske-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-17 14:19       ` Maxime Ripard
2015-05-18  9:32         ` Jens Kuske
2015-05-19  7:55           ` Maxime Ripard [this message]
2015-05-19  8:02             ` Chen-Yu Tsai
     [not found]               ` <CAGb2v6608XVsxN0f2DEmqmts1zDo223t+fBv46WjGQVQbw7+CA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-19  8:16                 ` Maxime Ripard
2015-05-19 14:58             ` Linus Walleij
2015-05-15 16:38   ` [PATCH v2 05/10] ARM: sunxi: Introduce Allwinner H3 support Jens Kuske
     [not found]     ` <1431707940-19372-6-git-send-email-jenskuske-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-17 14:21       ` Maxime Ripard
2015-05-15 16:38   ` [PATCH v2 06/10] clk: sunxi: Add H3 clocks support Jens Kuske
     [not found]     ` <1431707940-19372-7-git-send-email-jenskuske-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-17 14:27       ` Maxime Ripard
2015-05-18  9:45         ` Jens Kuske
     [not found]           ` <5559B4CE.2050703-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-19  8:50             ` Maxime Ripard
2015-05-15 16:38   ` [PATCH v2 07/10] pinctrl: sunxi: Add H3 PIO controller support Jens Kuske
     [not found]     ` <1431707940-19372-8-git-send-email-jenskuske-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-16 15:32       ` Paul Bolle
2015-05-17 14:30       ` Maxime Ripard
2015-05-18  9:52         ` Jens Kuske
2015-05-19 14:04       ` Linus Walleij
     [not found]         ` <CACRpkdZnWavNK_o04-mNmA0eDV+ppQJz8Kt+-OF5M=jgysuO_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-19 15:03           ` Maxime Ripard
2015-05-15 16:38   ` [PATCH v2 08/10] reset: sunxi: Add compatible for Allwinner H3 bus resets Jens Kuske
     [not found]     ` <1431707940-19372-9-git-send-email-jenskuske-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-17 14:31       ` Maxime Ripard
2015-05-18  9:55         ` Jens Kuske
2015-05-15 16:38   ` [PATCH v2 09/10] ARM: dts: sunxi: Add Allwinner H3 DTSI Jens Kuske
2015-05-15 16:39   ` [PATCH v2 10/10] ARM: dts: sun8i: Add Orange Pi Plus support Jens Kuske

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=20150519075537.GU4004@lukather \
    --to=maxime.ripard@free-electrons.com \
    --cc=devicetree@vger.kernel.org \
    --cc=emilio@elopez.com.ar \
    --cc=hdegoede@redhat.com \
    --cc=jenskuske@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=mturquette@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=vishnupatekar0510@gmail.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).