From: w.sang@pengutronix.de (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] drivers: base: add support for stmp-style devices
Date: Wed, 16 Nov 2011 20:19:02 +0100 [thread overview]
Message-ID: <20111116191902.GA8843@pengutronix.de> (raw)
In-Reply-To: <201111161744.19733.arnd@arndb.de>
On Wed, Nov 16, 2011 at 05:44:19PM +0000, Arnd Bergmann wrote:
> On Wednesday 16 November 2011, Wolfram Sang wrote:
> > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
>
> Introducing new core code definitely requires a long patch description.
> How about copying the description from the introductory mail here?
What I mainly forgot was s/PATCH/RFC/, and I'm sorry about that. I know this
series is not suitable to be applied directly, I was mainly looking for
comments from the arm people who are affected by this change.
> > +static int stmp_clear_poll_bit(void __iomem *addr, u32 mask)
> > +{
> > + int timeout = 0x400;
> > +
> > + writel(mask, addr + STMP_CLR_ADDR);
> > + udelay(1);
> > + while ((readl(addr) & mask) && --timeout)
> > + /* nothing */;
> > +
> > + return !timeout;
> > +}
>
> For portable code, you should use cpu_relax() inside of the loop.
>
> Is the udelay() actually necessary here?
I am just copying the code from the current mxs-implementation. I think fixups
(yes, needed!) should go in with seperate patches. Should have said so
explicitly.
> > + ret = stmp_clear_poll_bit(reset_addr, STMP_MODULE_SFTRST);
> > + if (unlikely(ret))
> > + goto error;
>
> Please don't use likely()/unlikely() in code that is not very
> performance sensitive. It will usually just increase the code size
> but not actually have a measurable benefit.
Ditto.
> > + if (unlikely(!timeout))
> > + goto error;
>
> Since the run-time of a readl() may vary greatly, counting to 400
> for a timeout seems completely arbitrary and unhelpful.
Ditto, I know. I talked about such things in Prague this year :)
> long timeout = jiffies + HZ / 10; /* wait for at most 100ms */
>
> do {
> ...
> } while (time_before(jiffies, timeout));
Better, but not perfect ;) But I'll skip the discussion here...
> > +EXPORT_SYMBOL(stmp_reset_block);
>
> EXPORT_SYMBOL_GPL?
Fine with me.
> > +#define STMP_SET_ADDR 0x4
> > +#define STMP_CLR_ADDR 0x8
> > +#define STMP_TOG_ADDR 0xc
>
> The register numbers should probably go into the implementation file,
> they are not an interface.
As said, those are offsets. Especially useful for:
offset = enabled ? STMP_SET_ADDR : STMP_CLR_ADDR;
writel(bits1, reg1 + offset);
writel(bits2, reg2 + offset);
...
That will either set or clear bits, depending on 'enabled'.
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20111116/64590afd/attachment.sig>
next prev parent reply other threads:[~2011-11-16 19:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 10:47 [PATCH 0/3] make stmp-style devices mach-independent Wolfram Sang
2011-11-16 10:47 ` [PATCH 1/3] drivers: base: add support for stmp-style devices Wolfram Sang
2011-11-16 17:44 ` Arnd Bergmann
2011-11-16 17:57 ` Michał Mirosław
2011-11-16 19:19 ` Wolfram Sang
2011-11-16 19:19 ` Wolfram Sang [this message]
2011-11-16 10:47 ` [PATCH 2/3] i2c: mxs: use global reset function Wolfram Sang
2011-11-16 10:47 ` [PATCH 3/3] rtc: stmp3xxx: use global stmp_device functionality Wolfram Sang
2011-11-17 1:49 ` [PATCH 0/3] make stmp-style devices mach-independent Shawn Guo
2011-11-17 10:32 ` Wolfram Sang
2011-11-17 6:57 ` Dong Aisheng-B29396
-- strict thread matches above, loose matches on Subject: below --
2012-03-07 22:28 [PATCH 0/3] introduce stmp-style devices Wolfram Sang
2012-03-07 22:28 ` [PATCH 1/3] drivers: base: add support for " Wolfram Sang
2012-03-07 22:40 ` Fabio Estevam
2012-03-08 7:45 ` Wolfram Sang
2012-03-08 2:09 ` Huang Shijie
2012-03-08 12:14 ` Shawn Guo
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=20111116191902.GA8843@pengutronix.de \
--to=w.sang@pengutronix.de \
--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 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).