From patchwork Tue Jun 13 08:58:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 104345 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp301573qgd; Tue, 13 Jun 2017 01:59:19 -0700 (PDT) X-Received: by 10.84.178.101 with SMTP id y92mr61208016plb.116.1497344359574; Tue, 13 Jun 2017 01:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497344359; cv=none; d=google.com; s=arc-20160816; b=UL66FRA/ryvBqb51wCRTTSXr6Y+K+Q/tW7eFjJXOinte93jKbKvvEbh1khHyJhlMJS VaE1sBHCOmBOF8EsghbXSBxKjPAyksK6+tLU/CeLJ9XLJV2CgGhUZItvH0GOktSUa5bD MkkpIpa6Evh92JqO2BxgSvjEw5Ual9ep24pnuv1JDiP1kpYpExSfGKMXQBk++wsq7/UL B83iMrInbgfA+NYxI90gnrxu/YuaZHMmKe+L96VBFK1xjjcMJWG57DFPywANdd8Fe4MA pBtvLGNj7nzJpwC0oc5SFOpbHmBNx64obCqtZct1UtPPtN7jhUWzFJb+/6i6j90yYFGB pMUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=a9LoKXwMk2/21R4rerfGXiJrrHiBH6r6zEAJG9XQEZY=; b=Iq6bdo1VOt3ZfStvX2Jd+8hwt0xD9nOW+Sf9rSeIdGR2iLjnIvhAUwqycDPQHTKUUQ R6avAUOnYXd+Q/WjQGQ7WjNg09OTqgbCCrPwaZRmHdS8f3Z+rO+rhRPBp2hZzQ6JyKcA dUUpuBlWY2l29oCD+hla3IyGaDSl23qiP74+kHXQpyzjaXF2UMCakbGgcRdTFvjfHPKb wqYscQfYV1tW7B8b8Z8dcjsLexi4PZAG5x6gYL1aPVjOVcXZxU/Xl+tWG8zuuNc3Ycaq 3Z5phCivquLpB+D8ylDdCJj4oDOQ9ITNd9OaJCoFBudCUsIKyaJSz06utfj0b+q5Hc5l tkow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8si8580262plh.94.2017.06.13.01.59.19; Tue, 13 Jun 2017 01:59:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752515AbdFMI7O (ORCPT + 25 others); Tue, 13 Jun 2017 04:59:14 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:36133 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752401AbdFMI7L (ORCPT ); Tue, 13 Jun 2017 04:59:11 -0400 Received: by mail-pf0-f177.google.com with SMTP id x63so64570028pff.3 for ; Tue, 13 Jun 2017 01:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=a9LoKXwMk2/21R4rerfGXiJrrHiBH6r6zEAJG9XQEZY=; b=ILdlZXnw2SBAZzAxbuc0b7nGgKLeQSRHwVMY3P8+zKO+mC7e1eQ9Wue/0R7pzYyYXU CKciJbZv/UIxSWxJt32mcDIHaWj6f7q5XqVzWR/x3+ZgHLYsO/Lozgj0G0i1i7GRRy/F FfPpO4rcvmB9OrstyWJfwOXixWH3WqX1J7F5o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=a9LoKXwMk2/21R4rerfGXiJrrHiBH6r6zEAJG9XQEZY=; b=Y9tOoo9oC4UWXFLKpRJs9XNbG03YSqupsY53PNO8eGi83zV581JjRv9S2m1cWC7+38 JCSp7BV1TyOU0zE4cfEcMIEctFqZJKDG2d8inGBRgEVZajYHF9w/3ych96k09V2+ngmF uOZ0I1lSug76tR3+q05mbIz4hp6H+Ee6sUpjfNGkhQjkkmQA4E028rbajYGeHDJOpWfg SUHqt+0eVlmcUWwzTO4vZYXIlxy61GUX0/WpogsPIHZeEqzjZz5BvCLgNVE+oTBC8s1W I5Id2BlThGi/NgXjhXQvx49m7GahF2qSN5Gr3FRV5zOt9E1Uh0OkrxHj5q1XW/Q/6BR+ /Ckg== X-Gm-Message-State: AODbwcBG0b16FUvJSEYRqaC/0G7+bT5+X7YHo+HfaRTlrlCJiozTxH9H 8eHwmDhi4CWdSKRg X-Received: by 10.99.47.69 with SMTP id v66mr60403966pgv.47.1497344345980; Tue, 13 Jun 2017 01:59:05 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id p89sm24054354pfk.67.2017.06.13.01.59.02 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jun 2017 01:59:05 -0700 (PDT) From: Binoy Jayan To: Binoy Jayan Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Rajendra , Mark Brown , Mauro Carvalho Chehab , Sakari Ailus , Julia Lawall , "Michael S. Tsirkin" , Cao jin , linux-media@vger.kernel.org Subject: [PATCH v2 3/3] media: ngene: Replace semaphore i2c_switch_mutex with mutex Date: Tue, 13 Jun 2017 14:28:50 +0530 Message-Id: <1497344330-13915-4-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497344330-13915-1-git-send-email-binoy.jayan@linaro.org> References: <1497344330-13915-1-git-send-email-binoy.jayan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The semaphore 'i2c_switch_mutex' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/media/pci/ngene/ngene-core.c | 2 +- drivers/media/pci/ngene/ngene-i2c.c | 6 +++--- drivers/media/pci/ngene/ngene.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) -- Binoy Jayan diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c index ea64901..8c92cb7 100644 --- a/drivers/media/pci/ngene/ngene-core.c +++ b/drivers/media/pci/ngene/ngene-core.c @@ -1345,7 +1345,7 @@ static int ngene_start(struct ngene *dev) mutex_init(&dev->cmd_mutex); mutex_init(&dev->stream_mutex); sema_init(&dev->pll_mutex, 1); - sema_init(&dev->i2c_switch_mutex, 1); + mutex_init(&dev->i2c_switch_mutex); spin_lock_init(&dev->cmd_lock); for (i = 0; i < MAX_STREAM; i++) spin_lock_init(&dev->channel[i].state_lock); diff --git a/drivers/media/pci/ngene/ngene-i2c.c b/drivers/media/pci/ngene/ngene-i2c.c index cf39fcf..fbf3635 100644 --- a/drivers/media/pci/ngene/ngene-i2c.c +++ b/drivers/media/pci/ngene/ngene-i2c.c @@ -118,7 +118,7 @@ static int ngene_i2c_master_xfer(struct i2c_adapter *adapter, (struct ngene_channel *)i2c_get_adapdata(adapter); struct ngene *dev = chan->dev; - down(&dev->i2c_switch_mutex); + mutex_lock(&dev->i2c_switch_mutex); ngene_i2c_set_bus(dev, chan->number); if (num == 2 && msg[1].flags & I2C_M_RD && !(msg[0].flags & I2C_M_RD)) @@ -136,11 +136,11 @@ static int ngene_i2c_master_xfer(struct i2c_adapter *adapter, msg[0].buf, msg[0].len, 0)) goto done; - up(&dev->i2c_switch_mutex); + mutex_unlock(&dev->i2c_switch_mutex); return -EIO; done: - up(&dev->i2c_switch_mutex); + mutex_unlock(&dev->i2c_switch_mutex); return num; } diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h index 0dd15d6..7c7cd21 100644 --- a/drivers/media/pci/ngene/ngene.h +++ b/drivers/media/pci/ngene/ngene.h @@ -765,7 +765,7 @@ struct ngene { struct mutex cmd_mutex; struct mutex stream_mutex; struct semaphore pll_mutex; - struct semaphore i2c_switch_mutex; + struct mutex i2c_switch_mutex; int i2c_current_channel; int i2c_current_bus; spinlock_t cmd_lock;