From: Terry Lv Date: Tue, 25 Jan 2011 18:34:56 +0000 (+0800) Subject: ENGR00138480: mxc_iim can't be open twice X-Git-Tag: v3.0.35-fsl_4.1.0~2610 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3b410e99f8317f4d20b84c4034e331b4636c0300;p=karo-tx-linux.git 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 --- 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 #include @@ -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; }