From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] serial: fsl_lpuart: add eDMA support
Date: Mon, 13 Jan 2014 09:45:52 +0100 [thread overview]
Message-ID: <201401130945.53447.arnd@arndb.de> (raw)
In-Reply-To: <1d437762499348b6aeca3621b151d770@BL2PR03MB338.namprd03.prod.outlook.com>
On Monday 13 January 2014, Yao Yuan wrote:
> I need the functions like this:
> Static A()
> {
> if(condition)
> B();
> }
> Static B()
> {
> callback:C();
> }
> Static C()
> {
> if(condition)
> A();
> }
>
> So, it's hard to avoid forward declarations for "static" functions.
> I'm very glad for a better way.
Ok, that makes sense. It is an unusual pattern from the dmaengine API,
most drivers can more easily do without forward declarations. I think
you'd be able to avoid the lpuart_prepare_tx() forward declation, but
that wouldn't actually improve readability in this case. Just add a
comment above the declarations describing that they are needed for the
callbacks and that no recursion is possible. The important problem
to avoid really is having unbounded recursion between multple
functions, because that could blow the kernel stack size limit.
A small improvement that you can try is to have forward declarations
for the completion functions rather than the dma start functions, but
it won't be a big difference in the end. Your choice.
Arnd
next prev parent reply other threads:[~2014-01-13 8:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 3:04 [PATCH 0/2] serial: fsl_lpuart: add eDMA support Yuan Yao
2014-01-09 3:04 ` [PATCH 1/2] ARM: dts: vf610: lpuart: Add " Yuan Yao
2014-01-09 3:04 ` [PATCH 2/2] serial: fsl_lpuart: add " Yuan Yao
2014-01-09 8:56 ` Arnd Bergmann
2014-01-13 6:47 ` Yao Yuan
2014-01-13 8:45 ` Arnd Bergmann [this message]
2014-01-09 9:35 ` Lothar Waßmann
2014-01-09 10:58 ` Arnd Bergmann
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=201401130945.53447.arnd@arndb.de \
--to=arnd@arndb.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).