From: rmk+kernel@arm.linux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/8] pcmcia: sa1111: simplify clk handing in sa1111_pcmcia_add()
Date: Wed, 15 Jul 2015 19:04:24 +0100 [thread overview]
Message-ID: <E1ZFR2e-0007Mf-Sp@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20150715180342.GB7557@n2100.arm.linux.org.uk>
clk_get(dev, NULL) will always refer to the same clock, so it's
pointless calling this multiple times for the same device. As we no
longer have to worry about the cleanup (via use of devm_clk_get()) we
can simplify sa1111_pcmcia_add() too.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
drivers/pcmcia/sa1111_generic.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
index fb902af8a5b7..a1531feb8460 100644
--- a/drivers/pcmcia/sa1111_generic.c
+++ b/drivers/pcmcia/sa1111_generic.c
@@ -135,8 +135,13 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
int (*add)(struct soc_pcmcia_socket *))
{
struct sa1111_pcmcia_socket *s;
+ struct clk *clk;
int i, ret = 0;
+ clk = devm_clk_get(&dev->dev, NULL);
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+
ops->socket_state = sa1111_pcmcia_socket_state;
for (i = 0; i < ops->nr; i++) {
@@ -145,12 +150,8 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
return -ENOMEM;
s->soc.nr = ops->first + i;
- s->soc.clk = devm_clk_get(&dev->dev, NULL);
- if (IS_ERR(s->soc.clk)) {
- ret = PTR_ERR(s->soc.clk);
- kfree(s);
- return ret;
- }
+ s->soc.clk = clk;
+
soc_pcmcia_init_one(&s->soc, ops, &dev->dev);
s->dev = dev;
if (s->soc.nr) {
--
2.1.0
next prev parent reply other threads:[~2015-07-15 18:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 18:03 [PATCH 0/8] sa11x0 PCMCIA updates Russell King - ARM Linux
2015-07-15 18:03 ` [PATCH 1/8] pcmcia: sa11x0: fix missing clk_put() in sa11x0 socket drivers Russell King
2015-07-15 18:04 ` [PATCH 2/8] pcmcia: sa11x0: convert memory allocation to devm_* API Russell King
2015-07-15 18:04 ` [PATCH 3/8] pcmcia: pxa2xx: update socket driver to use devm_clk_get() API Russell King
2015-07-16 19:12 ` Robert Jarzmik
2015-07-15 18:04 ` [PATCH 4/8] pcmcia: pxa2xx: convert memory allocation to devm_* API Russell King
2015-07-16 19:12 ` Robert Jarzmik
2015-07-15 18:04 ` [PATCH 5/8] pcmcia: sa1111: update socket driver to use devm_clk_get() API Russell King
2015-07-15 18:04 ` Russell King [this message]
2015-07-15 18:04 ` [PATCH 7/8] pcmcia: sa11xx_base.c: remove useless init/exit functions Russell King
2015-07-15 18:04 ` [PATCH 8/8] pcmcia: soc_common: remove skt_dev_info's clk pointer Russell King
2015-07-16 19:12 ` Robert Jarzmik
-- strict thread matches above, loose matches on Subject: below --
2015-03-26 11:22 [PATCH 0/8] sa11x0 PCMCIA updates Russell King - ARM Linux
2015-03-26 11:23 ` [PATCH 6/8] pcmcia: sa1111: simplify clk handing in sa1111_pcmcia_add() Russell King
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=E1ZFR2e-0007Mf-Sp@rmk-PC.arm.linux.org.uk \
--to=rmk+kernel@arm.linux.org.uk \
--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).