From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: dmaengine@vger.kernel.org
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 0/6] tree-wide: simplify getting .drvdata
Date: Sun, 22 Apr 2018 11:14:08 +0200 [thread overview]
Message-ID: <20180422091415.7587-1-wsa+renesas@sang-engineering.com> (raw)
I got tired of fixing this in Renesas drivers manually, so I took the big
hammer. Remove this cumbersome code pattern which got copy-pasted too much
already:
- struct platform_device *pdev = to_platform_device(dev);
- struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
+ struct ep93xx_keypad *keypad = dev_get_drvdata(dev);
I send this out as one patch per directory per subsystem. I think they should
be applied individually. If you prefer a broken out series per subsystem, I can
provide this as well. Just mail me.
A branch (tested by buildbot; only with all commits squashed into one commit
before) can be found here:
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git coccinelle/get_drvdata
Open for other comments, suggestions, too, of course.
Here is the cocci-script I created:
@@
struct device* d;
identifier pdev;
expression *ptr;
@@
(
- struct platform_device *pdev = to_platform_device(d);
|
- struct platform_device *pdev;
...
- pdev = to_platform_device(d);
)
<... when != pdev
- &pdev->dev
+ d
...>
ptr =
- platform_get_drvdata(pdev)
+ dev_get_drvdata(d)
<... when != pdev
- &pdev->dev
+ d
...>
Kind regards,
Wolfram
Wolfram Sang (6):
dmaengine: at_hdmac: simplify getting .drvdata
dmaengine: at_xdmac: simplify getting .drvdata
dmaengine: fsldma: simplify getting .drvdata
dmaengine: idma64: simplify getting .drvdata
dmaengine: ste_dma40: simplify getting .drvdata
dmaengine: txx9dmac: simplify getting .drvdata
drivers/dma/at_hdmac.c | 9 +++------
drivers/dma/at_xdmac.c | 9 +++------
drivers/dma/fsldma.c | 6 ++----
drivers/dma/idma64.c | 6 ++----
drivers/dma/ste_dma40.c | 12 ++++--------
drivers/dma/txx9dmac.c | 8 +++-----
6 files changed, 17 insertions(+), 33 deletions(-)
--
2.11.0
next reply other threads:[~2018-04-22 9:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-22 9:14 Wolfram Sang [this message]
2018-04-22 9:14 ` [PATCH 3/6] dmaengine: fsldma: simplify getting .drvdata Wolfram Sang
2018-04-22 16:11 ` [PATCH 0/6] tree-wide: " Vinod Koul
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=20180422091415.7587-1-wsa+renesas@sang-engineering.com \
--to=wsa+renesas@sang-engineering.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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).