From: viresh.kumar@st.com (Viresh Kumar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 2/4] pinctrl: Add SPEAr pinctrl drivers
Date: Thu, 5 Apr 2012 10:26:26 +0530 [thread overview]
Message-ID: <4F7D25FA.8040501@st.com> (raw)
In-Reply-To: <4F7CC713.8040409@wwwdotorg.org>
On 4/5/2012 3:41 AM, Stephen Warren wrote:
> On 04/04/2012 05:35 AM, Viresh Kumar wrote:
>> +int __devinit spear_pinctrl_probe(struct platform_device *pdev,
>> + struct spear_pinctrl_machdata *machdata)
>> +{
> ...
>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> ...
>> + pmx->vbase = devm_ioremap(&pdev->dev, res->start, resource_size(res));
>
> If this driver is DT-only, you can replace those two calls with of_iomap().
Ya. This is DT-only. Will do that.
>> + platform_set_drvdata(pdev, pmx);
>
> This should probably before the pinctrl_register() call, just in case
> pinctrl_register() starts calling the pinctrl driver ops immediately,
> and the drvdata is needed by the callbacks.
I don't use platform_get_drvdata in ops. Only used in remove routine.
Still would move it up.
> (Yes, I should fix up the Tegra driver for both of those)
:)
>> + dev_info(&pdev->dev, "Registered with virtual address 0x%08x, physical address 0x%08x\n",
>> + (u32)pmx->vbase, res->start);
>
> Is that useful?
It does. Can easily check from boot prints that everything worked as planned.
>> +int __devexit spear_pinctrl_remove(struct platform_device *pdev)
>> +{
>> + struct spear_pmx *pmx = platform_get_drvdata(pdev);
>> +
>> + platform_set_drvdata(pdev, NULL);
>
> You don't need to do that; nothing should be touching the drvdata once
> the driver has been removed, so the value doesn't matter.
Why do most of the drivers do this? What can get called for them?
--
viresh
next prev parent reply other threads:[~2012-04-05 4:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-04 11:35 [PATCH V2 0/4] pinctrl: Add SPEAr pinctrl support Viresh Kumar
2012-04-04 11:35 ` [PATCH V2 1/4] SPEAr: Remove existing padmux support for SPEAr Viresh Kumar
2012-04-04 11:35 ` [PATCH V2 2/4] pinctrl: Add SPEAr pinctrl drivers Viresh Kumar
2012-04-04 22:11 ` Stephen Warren
2012-04-05 4:56 ` Viresh Kumar [this message]
2012-04-04 11:35 ` [PATCH V2 4/4] SPEAr3xx: Add pinctrl support for boards Viresh Kumar
2012-04-04 22:32 ` Stephen Warren
2012-04-05 5:06 ` Viresh Kumar
[not found] ` <2a78bbfab59b531adef0820f34f683dd736d3a3a.1333538870.git.viresh.kumar@st.com>
2012-04-04 22:26 ` [PATCH V2 3/4] pinctrl: Add SPEAr3xx pinctrl drivers Stephen Warren
2012-04-05 5:05 ` Viresh Kumar
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=4F7D25FA.8040501@st.com \
--to=viresh.kumar@st.com \
--cc=linux-arm-kernel@lists.infradead.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 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.