From patchwork Sun May 1 09:31:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Nieder X-Patchwork-Id: 745072 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p419W0t4019246 for ; Sun, 1 May 2011 09:32:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753473Ab1EAJbp (ORCPT ); Sun, 1 May 2011 05:31:45 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:43895 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753068Ab1EAJbo (ORCPT ); Sun, 1 May 2011 05:31:44 -0400 Received: by iyb14 with SMTP id 14so4006325iyb.19 for ; Sun, 01 May 2011 02:31:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=XgWbyS2SojNLgsdOr+x+slWdtvy4kYwpBfA+sp3a0eo=; b=KNOiUk/QD4m6HOO1UbD4LZrF1hvgTtxCHKfKsz2SrI3SBVuhkDt2fXNjoFkJ7Z8Wcl eLc/bSYY1gI43XJr40XLdLLsRT05C7QTr92L8buinJxLYHV3rInhrs8vnntF4iDHrUzL P/LqRmnTfNQTs0jDWl2VLJho1ZAV+us/TKCDg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=Np+zAxFY5vRD7COhl5uNTV1CBzlD2JSXPZJKBzCaXB72FwA6iXof1J/gVMHxGP2qQW /UUFtLZHUSxjgkJ21aySbwu0S/qkHufdWFV5ChwavHw3bwNwWroc/Tx9QNSjm8p9btW0 gWe+rjdYtgo/fH/JfY1QL+hOtQL52anGXGUks= Received: by 10.42.144.194 with SMTP id c2mr8534214icv.120.1304242303841; Sun, 01 May 2011 02:31:43 -0700 (PDT) Received: from elie (adsl-69-209-62-211.dsl.chcgil.ameritech.net [69.209.62.211]) by mx.google.com with ESMTPS id wu17sm1693191icb.23.2011.05.01.02.31.42 (version=SSLv3 cipher=OTHER); Sun, 01 May 2011 02:31:43 -0700 (PDT) Date: Sun, 1 May 2011 04:31:40 -0500 From: Jonathan Nieder To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Dan Carpenter , Hans Verkuil , Andi Huber , Marlon de Boer , Damien Churchill Subject: [PATCH 7/7] [media] cx88: don't use atomic_t for core->users Message-ID: <20110501093140.GG18380@elie> References: <20110501091710.GA18263@elie> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110501091710.GA18263@elie> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 01 May 2011 09:32:00 +0000 (UTC) users is always read or written with core->lock held. A plain int is simpler and faster. Tested-by: Andi Huber Tested-by: Marlon de Boer Signed-off-by: Jonathan Nieder --- That's the end of the series. Thanks for reading. drivers/media/video/cx88/cx88-video.c | 5 +++-- drivers/media/video/cx88/cx88.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 508dabb..51d1b09 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -823,7 +823,7 @@ static int video_open(struct file *file) call_all(core, tuner, s_radio); } - atomic_inc(&core->users); + core->users++; mutex_unlock(&core->lock); return 0; @@ -921,7 +921,8 @@ static int video_release(struct file *file) file->private_data = NULL; kfree(fh); - if(atomic_dec_and_test(&dev->core->users)) + dev->core->users--; + if (!dev->core->users) call_all(dev->core, core, s_power, 0); mutex_unlock(&dev->core->lock); diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 09e329f..887a978 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -383,7 +383,7 @@ struct cx88_core { struct mutex lock; /* various v4l controls */ u32 freq; - atomic_t users; + int users; int mpeg_users; /* cx88-video needs to access cx8802 for hybrid tuner pll access. */