From: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
Cc: linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>,
Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
Sebastian Hesselbarth
<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Gregory Clement
<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Thomas Petazzoni
<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Lior Amsalem <alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Tawfik Bayouk <tawfik-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH v2 1/7] watchdog: orion: Introduce a SoC-specific RSTOUT mapping
Date: Tue, 11 Mar 2014 17:06:03 -0300 [thread overview]
Message-ID: <20140311200603.GB8506@arch.cereza> (raw)
In-Reply-To: <531D1EC7.4090701-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
Hi Guenter,
Thanks for reviewing this patchset.
On Mar 09, Guenter Roeck wrote:
[..]
> >@@ -317,6 +313,7 @@ MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
> > static int orion_wdt_probe(struct platform_device *pdev)
> > {
> > struct orion_watchdog *dev;
> >+ struct device_node *node = pdev->dev.of_node;
> > const struct of_device_id *match;
> > unsigned int wdt_max_duration; /* (seconds) */
> > struct resource *res;
> >@@ -346,10 +343,27 @@ static int orion_wdt_probe(struct platform_device *pdev)
> > if (!dev->reg)
> > return -ENOMEM;
> >
> >- dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
> >- INTERNAL_REGS_MASK);
> >- if (!dev->rstout)
> >+ if (of_device_is_compatible(node, "marvell,orion-wdt")) {
> >+
> >+ dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
> >+ INTERNAL_REGS_MASK);
> >+ if (!dev->rstout)
> >+ return -ENODEV;
> >+
> >+ } else if (of_device_is_compatible(node, "marvell,armada-370-wdt") ||
> >+ of_device_is_compatible(node, "marvell,armada-xp-wdt")) {
> >+
> >+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> >+ if (!res)
> >+ return -ENODEV;
> >+ dev->rstout = devm_ioremap(&pdev->dev, res->start,
> >+ resource_size(res));
>
> Better use devm_ioremap_resource, and then you don't have to check for
> the error from platform_get_resource() since devm_ioremap_resource()
> takes care of it.
>
> The same change should be made for the other calls call to devm_ioremap;
> different patch though.
>
Hm... well, could be. However it's not that simple! devm_ioremap_resource()
calls request_region() and since the RSTOUT register is shared, we can't
request it for this driver. This applies on orion-wdt only, though,
and not on armada-{370,xp}-wdt, so we can do it as long as we keep two
different paths.
> On a side note, the resource is always assigned, only a workaround exists
> for "marvell,orion-wdt" if it isn't. Wonder if it would make sense
> to move the calls to platform_get_resource and devm_ioremap[_resource]
> further up and have it just in this function.
>
Aside from the above discussion about requesting the resource, I think it's
more readable this way, hiding the complexity of the firmware bug fallback
on a function, and use different paths.
> >+ if (!dev->rstout)
> >+ return -ENOMEM;
> >+
> >+ } else {
> > return -ENODEV;
>
> Is this stricter than the original code on purpose ?
>
> Previously the driver would instantiate successfully in this case
> as long as IORESOURCE_MEM, 1 was defined.
>
Uh? This patch is not changing that. We're just splitting the way we
ioremap the RSTOUT register, as preparation work to add another compatible
string. Unless I've done something wrong, this is not *stricter* in any
way.
--
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-03-11 20:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-04 16:07 [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC Ezequiel Garcia
[not found] ` <1393949244-5011-1-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-04 16:07 ` [PATCH v2 1/7] watchdog: orion: Introduce a SoC-specific RSTOUT mapping Ezequiel Garcia
[not found] ` <1393949244-5011-2-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-10 2:09 ` Guenter Roeck
[not found] ` <531D1EC7.4090701-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-03-11 20:06 ` Ezequiel Garcia [this message]
2014-03-04 16:07 ` [PATCH v2 2/7] watchdog: orion: Introduce per-SoC stop() function Ezequiel Garcia
[not found] ` <1393949244-5011-3-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-10 2:30 ` Guenter Roeck
2014-03-04 16:07 ` [PATCH v2 3/7] watchdog: orion: Introduce per-SoC enabled() function Ezequiel Garcia
[not found] ` <1393949244-5011-4-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-10 2:30 ` Guenter Roeck
2014-03-04 16:07 ` [PATCH v2 4/7] watchdog: orion: Add Armada 375/380 SoC support Ezequiel Garcia
[not found] ` <1393949244-5011-5-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-10 2:12 ` Guenter Roeck
[not found] ` <531D1F9B.8090804-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-03-11 20:16 ` Ezequiel Garcia
2014-03-04 16:07 ` [PATCH v2 5/7] ARM: mvebu: Enable Armada 375 watchdog in the devicetree Ezequiel Garcia
2014-03-04 16:07 ` [PATCH v2 6/7] ARM: mvebu: Enable Armada 380/385 " Ezequiel Garcia
2014-03-04 16:07 ` [PATCH v2 7/7] ARM: mvebu: Add A375/A380 watchdog binding documentation Ezequiel Garcia
2014-03-04 17:53 ` [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC Jason Cooper
[not found] ` <20140304175341.GO1872-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2014-03-04 20:03 ` Ezequiel Garcia
2014-03-07 0:13 ` Ezequiel Garcia
[not found] ` <20140307001346.GB13690-nAQHv47ARr+vIlHkl8J1cg@public.gmane.org>
2014-03-11 21:45 ` Jason Gunthorpe
[not found] ` <20140311214525.GA3564-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-03-12 21:12 ` Ezequiel Garcia
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=20140311200603.GB8506@arch.cereza \
--to=ezequiel.garcia-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
--cc=alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
--cc=andrew-g2DYL2Zd6BY@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
--cc=linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=tawfik-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
--cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.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