From: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: 'Mark Brown' <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
'Jingoo Han' <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
'Gerhard Sittig' <gsi-ynQEQJNshbs@public.gmane.org>,
'Anatolij Gustschin' <agust-ynQEQJNshbs@public.gmane.org>
Subject: [PATCH 02/11] spi: mpc512x: Use devm_*() functions
Date: Mon, 09 Dec 2013 19:13:38 +0900 [thread overview]
Message-ID: <000e01cef4c7$53d9e060$fb8da120$%han@samsung.com> (raw)
In-Reply-To: <000801cef4c7$1b84a470$528ded50$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
drivers/spi/spi-mpc512x-psc.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 2babea2..77c03e2 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -503,7 +503,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
master->cleanup = mpc512x_psc_spi_cleanup;
master->dev.of_node = dev->of_node;
- tempp = ioremap(regaddr, size);
+ tempp = devm_ioremap(dev, regaddr, size);
if (!tempp) {
dev_err(dev, "could not ioremap I/O port range\n");
ret = -EFAULT;
@@ -513,8 +513,8 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
mps->fifo =
(struct mpc512x_psc_fifo *)(tempp + sizeof(struct mpc52xx_psc));
- ret = request_irq(mps->irq, mpc512x_psc_spi_isr, IRQF_SHARED,
- "mpc512x-psc-spi", mps);
+ ret = devm_request_irq(dev, mps->irq, mpc512x_psc_spi_isr, IRQF_SHARED,
+ "mpc512x-psc-spi", mps);
if (ret)
goto free_master;
init_completion(&mps->txisrdone);
@@ -522,11 +522,11 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
clk = devm_clk_get(dev, "mclk");
if (IS_ERR(clk)) {
ret = PTR_ERR(clk);
- goto free_irq;
+ goto free_master;
}
ret = clk_prepare_enable(clk);
if (ret)
- goto free_irq;
+ goto free_master;
mps->clk_mclk = clk;
mps->mclk_rate = clk_get_rate(clk);
@@ -554,11 +554,7 @@ free_ipg_clock:
clk_disable_unprepare(mps->clk_ipg);
free_mclk_clock:
clk_disable_unprepare(mps->clk_mclk);
-free_irq:
- free_irq(mps->irq, mps);
free_master:
- if (mps->psc)
- iounmap(mps->psc);
spi_master_put(master);
return ret;
@@ -571,9 +567,6 @@ static int mpc512x_psc_spi_do_remove(struct device *dev)
clk_disable_unprepare(mps->clk_mclk);
clk_disable_unprepare(mps->clk_ipg);
- free_irq(mps->irq, mps);
- if (mps->psc)
- iounmap(mps->psc);
return 0;
}
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" 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:[~2013-12-09 10:13 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-09 10:12 [PATCH 01/11] spi: davinci: Use devm_*() functions Jingoo Han
[not found] ` <000801cef4c7$1b84a470$528ded50$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-09 10:13 ` Jingoo Han [this message]
[not found] ` <000e01cef4c7$53d9e060$fb8da120$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-09 13:12 ` [PATCH 02/11] spi: mpc512x: " Gerhard Sittig
[not found] ` <20131209131213.GL2982-kDjWylLy9wD0K7fsECOQyeGNnDKD8DIp@public.gmane.org>
2013-12-10 2:13 ` Jingoo Han
[not found] ` <005601cef54d$7c9b1bf0$75d153d0$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-12 16:38 ` Gerhard Sittig
2013-12-17 22:53 ` Mark Brown
[not found] ` <20131217225313.GT28455-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-12-18 1:31 ` [PATCH V2] " Jingoo Han
[not found] ` <007001cefb90$d7b07050$871150f0$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-18 11:29 ` Mark Brown
2013-12-09 10:14 ` [PATCH 03/11] spi: ath79: " Jingoo Han
[not found] ` <000f01cef4c7$837d0180$8a770480$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-17 22:53 ` Mark Brown
2013-12-09 10:16 ` [PATCH 04/11] spi: designware: " Jingoo Han
2013-12-09 10:18 ` [PATCH 05/11] spi: nuc900: " Jingoo Han
[not found] ` <001101cef4c7$fb071e20$f1155a60$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-10 5:51 ` Wan ZongShun
2013-12-10 5:57 ` Jingoo Han
2013-12-17 22:44 ` Mark Brown
2013-12-09 10:19 ` [PATCH 06/11] spi: s3c24xx: " Jingoo Han
[not found] ` <001201cef4c8$1b78a110$5269e330$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-17 22:55 ` Mark Brown
2013-12-09 10:20 ` [PATCH 07/11] spi: bcm63xx: Use devm_clk_get() Jingoo Han
[not found] ` <001301cef4c8$40d2b3b0$c2781b10$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-17 20:28 ` Jonas Gorski
2013-12-17 22:36 ` Mark Brown
2013-12-09 10:20 ` [PATCH 08/11] spi: bcm63xx-hsspi: " Jingoo Han
[not found] ` <001401cef4c8$52cf31b0$f86d9510$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-17 20:29 ` Jonas Gorski
2013-12-17 22:31 ` Mark Brown
2013-12-09 10:21 ` [PATCH 09/11] spi: orion: " Jingoo Han
[not found] ` <001501cef4c8$68a7b160$39f71420$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-09 11:27 ` Jason Cooper
2013-12-09 10:23 ` [PATCH 10/11] spi: txx9: " Jingoo Han
[not found] ` <001601cef4c8$aa1f7d30$fe5e7790$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-17 22:56 ` Mark Brown
2013-12-09 10:25 ` [PATCH 11/11] spi: bcm2835: Use devm_request_irq() Jingoo Han
[not found] ` <001701cef4c8$eaa87c30$bff97490$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-17 22:59 ` Mark Brown
2013-12-18 2:18 ` Stephen Warren
2013-12-17 22:51 ` [PATCH 01/11] spi: davinci: Use devm_*() functions Mark Brown
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='000e01cef4c7$53d9e060$fb8da120$%han@samsung.com' \
--to=jg1.han-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
--cc=agust-ynQEQJNshbs@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=gsi-ynQEQJNshbs@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@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;
as well as URLs for NNTP newsgroup(s).