summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorTerry Lv <r65388@freescale.com>2011-01-26 02:34:56 +0800
committerJason Liu <r64343@freescale.com>2012-01-09 20:07:56 +0800
commit41c3525fbf0093c74d056a64f8d3c37edf4ddb92 (patch)
tree507c403f1003090415ab6ff45c67bee6c0a4da88 /drivers/char
parente2eb19c0f83f9b0517dca4af2e5fad82354ad619 (diff)
ENGR00138480: mxc_iim can't be open twice
mxc_iim can't be open twice. The reason is that request_irq failed when open mxc_iim again. So put request_irq function to probe function. Signed-off-by: Terry Lv <r65388@freescale.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/mxc_iim.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/drivers/char/mxc_iim.c b/drivers/char/mxc_iim.c
index 77132fe0b148..44b1de3d1046 100644
--- a/drivers/char/mxc_iim.c
+++ b/drivers/char/mxc_iim.c
@@ -1,14 +1,21 @@
/*
- * Copyright 2009-2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2009-2011 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- *
- * http://www.opensource.org/licenses/gpl-license.html
- * http://www.gnu.org/copyleft/gpl.html
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <linux/fs.h>
#include <linux/init.h>
@@ -415,9 +422,13 @@ static ssize_t mxc_iim_write(struct file *filp, const char __user *buf,
retval = count;
out:
+ if (tmp_buf)
+ kfree(tmp_buf);
dev_dbg(iim_data->dev, "<= %s\n", __func__);
return retval;
invald_arg_out:
+ if (tmp_buf)
+ kfree(tmp_buf);
retval = -EINVAL;
return retval;
}
@@ -477,10 +488,6 @@ static int mxc_iim_open(struct inode *inode, struct file *filp)
(u32)ioremap(iim_data->reg_base, iim_data->reg_size);
mxc_iim_disable_irq();
- ret = request_irq(iim_data->irq, mxc_iim_irq, IRQF_DISABLED,
- iim_data->name, iim_data);
- if (ret)
- return ret;
dev_dbg(iim_data->dev, "<= %s\n", __func__);
@@ -499,7 +506,6 @@ static int mxc_iim_release(struct inode *inode, struct file *filp)
{
clk_disable(iim_data->clk);
clk_put(iim_data->clk);
- free_irq(iim_data->irq, iim_data);
iounmap((void *)iim_data->virt_base);
return 0;
}
@@ -533,12 +539,12 @@ static __devinit int mxc_iim_probe(struct platform_device *pdev)
struct resource *res;
int ret;
- dev_dbg(iim_data->dev, "=> %s\n", __func__);
-
iim_data = pdev->dev.platform_data;
iim_data->dev = &pdev->dev;
iim_data->name = mxc_iim_miscdev.name;
+ dev_dbg(iim_data->dev, "=> %s\n", __func__);
+
dev_dbg(iim_data->dev, "iim_data addr: 0x%08x "
"bank_start: 0x%04x bank_end: 0x%04x "
"enable_fuse: 0x%08x disable_fuse: 0x%08x\n",
@@ -560,6 +566,11 @@ static __devinit int mxc_iim_probe(struct platform_device *pdev)
return ret;
}
+ ret = request_irq(iim_data->irq, mxc_iim_irq, IRQF_DISABLED,
+ iim_data->name, iim_data);
+ if (ret)
+ return ret;
+
iim_data->reg_base = res->start;
iim_data->reg_end = res->end;
iim_data->reg_size =
@@ -579,6 +590,7 @@ static __devinit int mxc_iim_probe(struct platform_device *pdev)
static int __devexit mxc_iim_remove(struct platform_device *pdev)
{
+ free_irq(iim_data->irq, iim_data);
misc_deregister(&mxc_iim_miscdev);
return 0;
}