mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: xiaomin1 <xiaoming.wang@intel.com>
To: arnd@arndb.de, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, chuansheng.liu@intel.com
Cc: xiaomin1 <xiaoming.wang@intel.com>,
	Zhang Dongxing <dongxing.zhang@intel.com>
Subject: [PATCH] move file->f_op->open out of mutex (misc_mtx) in misc_open
Date: Tue,  6 Jan 2015 08:34:07 +0800	[thread overview]
Message-ID: <1420504447-9670-1-git-send-email-xiaoming.wang@intel.com> (raw)

misc_mtx was used to mutex misc_list.
But file->f_op->open may be blocked by downloading
firmware in some devices' open.
So move file->f_op->open out of mutex (misc_mtx)
in misc_open to avoid this block.
It also make code more efficiency.

Signed-off-by: Zhang Dongxing <dongxing.zhang@intel.com>
Signed-off-by: xiaoming wang <xiaoming.wang@intel.com>
---
 drivers/char/misc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index ffa97d2..289c59e 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -144,7 +144,8 @@ static int misc_open(struct inode * inode, struct file * file)
 	replace_fops(file, new_fops);
 	if (file->f_op->open) {
 		file->private_data = c;
-		err = file->f_op->open(inode,file);
+		mutex_unlock(&misc_mtx);
+		return file->f_op->open(inode,file);
 	}
 fail:
 	mutex_unlock(&misc_mtx);
-- 
1.7.9.5


             reply	other threads:[~2015-01-05  8:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-06  0:34 xiaomin1 [this message]
2015-01-05 13:58 ` One Thousand Gnomes
2015-01-09 22:47 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2015-01-05  9:14 Hillf Danton

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=1420504447-9670-1-git-send-email-xiaoming.wang@intel.com \
    --to=xiaoming.wang@intel.com \
    --cc=arnd@arndb.de \
    --cc=chuansheng.liu@intel.com \
    --cc=dongxing.zhang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome