From: Huang Shijie <b32955@freescale.com>
To: <dwmw2@infradead.org>
Cc: Huang Shijie <b32955@freescale.com>,
computersforpeace@gmail.com, linux-mtd@lists.infradead.org,
dedekind1@gmail.com
Subject: [PATCH 6/8] mtd: gpmi: use devm_request_irq
Date: Thu, 14 Nov 2013 14:25:49 +0800 [thread overview]
Message-ID: <1384410351-2169-7-git-send-email-b32955@freescale.com> (raw)
In-Reply-To: <1384410351-2169-1-git-send-email-b32955@freescale.com>
Use devm_request_irq to simplify the code.
Also remove the unused fields of structure resources{}.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 27 +++++----------------------
drivers/mtd/nand/gpmi-nand/gpmi-nand.h | 2 --
2 files changed, 5 insertions(+), 24 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 1f99038..5617876 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -503,7 +503,6 @@ static int acquire_register_block(struct gpmi_nand_data *this,
static int acquire_bch_irq(struct gpmi_nand_data *this, irq_handler_t irq_h)
{
struct platform_device *pdev = this->pdev;
- struct resources *res = &this->resources;
const char *res_name = GPMI_NAND_BCH_INTERRUPT_RES_NAME;
struct resource *r;
int err;
@@ -514,24 +513,11 @@ static int acquire_bch_irq(struct gpmi_nand_data *this, irq_handler_t irq_h)
return -ENODEV;
}
- err = request_irq(r->start, irq_h, 0, res_name, this);
- if (err) {
- pr_err("Can't own %s\n", res_name);
- return err;
- }
-
- res->bch_low_interrupt = r->start;
- res->bch_high_interrupt = r->end;
- return 0;
-}
-
-static void release_bch_irq(struct gpmi_nand_data *this)
-{
- struct resources *res = &this->resources;
- int i = res->bch_low_interrupt;
+ err = devm_request_irq(this->dev, r->start, irq_h, 0, res_name, this);
+ if (err)
+ dev_err(this->dev, "error requesting BCH IRQ\n");
- for (; i <= res->bch_high_interrupt; i++)
- free_irq(i, this);
+ return err;
}
static void release_dma_channels(struct gpmi_nand_data *this)
@@ -635,7 +621,7 @@ static int acquire_resources(struct gpmi_nand_data *this)
ret = acquire_dma_channels(this);
if (ret)
- goto exit_dma_channels;
+ goto exit_regs;
ret = gpmi_get_clks(this);
if (ret)
@@ -644,15 +630,12 @@ static int acquire_resources(struct gpmi_nand_data *this)
exit_clock:
release_dma_channels(this);
-exit_dma_channels:
- release_bch_irq(this);
exit_regs:
return ret;
}
static void release_resources(struct gpmi_nand_data *this)
{
- release_bch_irq(this);
release_dma_channels(this);
}
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.h b/drivers/mtd/nand/gpmi-nand/gpmi-nand.h
index a7685e3..4c801fa 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.h
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.h
@@ -26,8 +26,6 @@
struct resources {
void __iomem *gpmi_regs;
void __iomem *bch_regs;
- unsigned int bch_low_interrupt;
- unsigned int bch_high_interrupt;
unsigned int dma_low_channel;
unsigned int dma_high_channel;
struct clk *clock[GPMI_CLK_MAX];
--
1.7.2.rc3
next prev parent reply other threads:[~2013-11-14 6:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-14 6:25 [PATCH 0/8] the clean-up for gpmi Huang Shijie
2013-11-14 6:25 ` [PATCH 1/8] mtd: gpmi: do not use the local array to do the DMA transfer Huang Shijie
2013-11-14 13:46 ` Ezequiel Garcia
2013-11-15 3:53 ` Huang Shijie
2013-11-14 16:23 ` David Woodhouse
2013-11-15 2:14 ` Huang Shijie
2013-11-14 6:25 ` [PATCH 2/8] mtd: gpmi: delete the gpmi_pre_bbt_scan Huang Shijie
2013-11-14 6:25 ` [PATCH 3/8] mtd: gpmi: remove the unused line Huang Shijie
2013-11-14 6:25 ` [PATCH 4/8] mtd: gpmi: rename the functions from gpmi_nfc_* to gpmi_nand_* Huang Shijie
2013-11-14 6:25 ` [PATCH 5/8] mtd: gpmi: use devm_ioremap_resource Huang Shijie
2013-11-14 13:50 ` Ezequiel Garcia
2013-11-15 3:51 ` Huang Shijie
2013-11-14 6:25 ` Huang Shijie [this message]
2013-11-14 6:25 ` [PATCH 7/8] mtd: gpmi: change pr_err to dev_err Huang Shijie
2013-11-18 20:23 ` Brian Norris
2013-11-19 2:30 ` Huang Shijie
2013-11-14 6:25 ` [PATCH 8/8] mtd: gpmi: change pr_debug to dev_dbg Huang Shijie
2013-11-18 20:24 ` Brian Norris
2013-11-18 20:25 ` [PATCH 0/8] the clean-up for gpmi Brian Norris
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=1384410351-2169-7-git-send-email-b32955@freescale.com \
--to=b32955@freescale.com \
--cc=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@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