Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755924AbZJLKSJ (ORCPT ); Mon, 12 Oct 2009 06:18:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754685AbZJLKSH (ORCPT ); Mon, 12 Oct 2009 06:18:07 -0400 Received: from cantor.suse.de ([195.135.220.2]:38409 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbZJLKSF (ORCPT ); Mon, 12 Oct 2009 06:18:05 -0400 Date: Mon, 12 Oct 2009 12:17:28 +0200 Message-ID: From: Takashi Iwai To: John Kacur Cc: Frederic Weisbecker , Alan Cox , linux-kernel@vger.kernel.org, Thomas Gleixner , Jonathan Corbet , Peter Zijlstra , Christoph Hellwig , Andrew Morton , Vincent^M^J Sanders , Ingo Molnar Subject: Re: [PATCH] sound_core.c: Remove BKL from soundcore_open In-Reply-To: References: <20091011004219.74c30f67@lxorguk.ukuu.org.uk> <20091011113317.GA4901@nowhere> User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.1 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2444 Lines: 73 At Mon, 12 Oct 2009 10:37:05 +0200 (CEST), John Kacur wrote: > > On Mon, 12 Oct 2009, Takashi Iwai wrote: > > > At Sun, 11 Oct 2009 14:41:15 +0200 (CEST), > > John Kacur wrote: > > > > > > @@ -631,17 +629,17 @@ static int soundcore_open(struct inode *inode, struct file *file) > > > file->f_op = new_fops; > > > spin_unlock(&sound_loader_lock); > > > if(file->f_op->open) > > > + lock_kernel(); > > > err = file->f_op->open(inode,file); > > > + unlock_kernel(); > > > > You certainly want braces around here, no? > > > > Oh, I don't know, I was kinda hoping that the spaces would magically > impart bracketnishish to the whole thing. My God yes we want the brackets - > Thank you Takashi! > > What follows is version four. > > >From 90f527d2ae660a3a0e712075479a4cc24504ad45 Mon Sep 17 00:00:00 2001 > From: John Kacur > Date: Sun, 11 Oct 2009 14:25:46 +0200 > Subject: [PATCH] soundcore_open: Reduce the area BKL coverage in this function. > > Most of this function is protected by the sound_loader_lock. > We can push down the BKL to this call out err = file->f_op->open(inode,file); > > Signed-off-by: John Kacur > Acked-by: Alan Cox > --- > sound/sound_core.c | 10 ++++------ > 1 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/sound/sound_core.c b/sound/sound_core.c > index 49c9981..643a61f 100644 > --- a/sound/sound_core.c > +++ b/sound/sound_core.c > @@ -576,8 +576,6 @@ static int soundcore_open(struct inode *inode, struct file *file) > struct sound_unit *s; > const struct file_operations *new_fops = NULL; > > - lock_kernel (); > - > chain=unit&0x0F; > if(chain==4 || chain==5) /* dsp/audio/dsp16 */ > { > @@ -630,18 +628,18 @@ static int soundcore_open(struct inode *inode, struct file *file) > const struct file_operations *old_fops = file->f_op; > file->f_op = new_fops; > spin_unlock(&sound_loader_lock); > - if(file->f_op->open) > + if(file->f_op->open) { > + lock_kernel(); > err = file->f_op->open(inode,file); > - if (err) { > + unlock_kernel(); > + } if (err) { It's better to break the line after the closing brace here. Takashi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/