From patchwork Thu Jun 8 10:04:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 103370 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2360378qgd; Thu, 8 Jun 2017 03:05:39 -0700 (PDT) X-Received: by 10.98.69.68 with SMTP id s65mr36571018pfa.178.1496916339285; Thu, 08 Jun 2017 03:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496916339; cv=none; d=google.com; s=arc-20160816; b=DAWcKzg9zw4IdskHfr7AMv4rGbjT/T/NXFosEY7GIiwIVHLubb3hDdsgfAjbiZbO+P tI65r00w+cFypSNIKtWFUh/HK8NHQOiDtvLqLq/1GS1vQ7agCc8/2S7R3w/g9VsszNPa x8N/j34NnBZCCL69l23bjMJSQ/X7+3O84oVTuBvh3KDsqknV39eow3gjACGHO4ZGYIEN VJjHAFB3lO+jYz6UoyEA9owqsPix1+0RY/xbUjNuXm7UIqGooSiA2MSFD4p/8do7Fx7H oAjruEjeE2JJjC/Sbu2nS2sceODeOUaVKNydKI4OghZMrsGttxssFCngebERHRFJThwx /bpA== 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=9pw+YqJ9TZE+ieBgVg7Rs9vsQana9bWQcq+N0k09kVs=; b=YMZb2JxWjcBm+FpoV+06lHMIx51Q9z2Hep8i3i6/n8bJ3k1rxAymVzhfDTLoqz55o1 vseLghTpsuje3ussgKMqqNSzhS9ifTJHm2fyBSbGxAKgZTCa0ZLBptF1u5Daa2shcG1q T0MLx4xwNr44kNycFzdxWs6u10zuGBEIpY3PdfKGzAvgpkkPLwbKNSmxAtJvCf4IZl7d HZscdsIblpFFNN54ADn+KorVENfHg9AyImZLwAXfTem5C3H+gbopxxxwPiQoxrO3lPtk gpiD437atjiAW+SfY0nYuHnBGx8YS0bVHJWqJjanwKNUqvjKO0L0E6j/lJpHRpqVl2dD RamQ== 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-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-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 a27si4040770pfg.415.2017.06.08.03.05.39; Thu, 08 Jun 2017 03:05:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-media-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-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-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 S1751748AbdFHKFZ (ORCPT + 4 others); Thu, 8 Jun 2017 06:05:25 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:35717 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751695AbdFHKFX (ORCPT ); Thu, 8 Jun 2017 06:05:23 -0400 Received: by mail-pg0-f54.google.com with SMTP id k71so14580883pgd.2 for ; Thu, 08 Jun 2017 03:05:23 -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=9pw+YqJ9TZE+ieBgVg7Rs9vsQana9bWQcq+N0k09kVs=; b=JbBQRIPzADrcqGM2IaRxQqt4+CgS9zdswWLymMr4un8oI9tbVyDElWoEvIgM7vVh+6 e5TO04qZEAsUF+K0sYwiL0RIoCHFt30QY0hKfvg7cWqm3OdBZsUaSP94M0QIKX/r4+78 IWscBIg3krEaeyA6SJqVV2nL5V/gDIJAewjiY= 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=9pw+YqJ9TZE+ieBgVg7Rs9vsQana9bWQcq+N0k09kVs=; b=EidFqHVprjaZxA0ff4XvJ0P7alBnQTQlolD2ys61FVn6HTBuyQnXZDrwO0kUvw8H7H zvYnCqXbCM5ClpOzBaq3ilMAeIuKP3hyktCW96DE3bOLisk5tY+rp4YVbQwEarLAMDNF dYBSNjHl513HH70wRJtaYDCtC28JbOT3r+19d9H1cJdfdTpliqLpQ1CXNK1z0UHAog8I MXBsxT3kN9r0m8X2r6bGYvW7hBVyd1KXweJlPBmS7LhLlNMwyQ+nWYh3qTJzoZlzX15d GANY7TO3oPGob/zpvAsbsW+PwGOBbCL7L0fsWOmtNt1MoK3HaVMNqhybi32+IyK7R9nS Ee4w== X-Gm-Message-State: AODbwcB1oH1XmMmiQKNrOVKxHivMTOTvI9VRQZOZUvFFa7GLf0cizMeA vd2djtKdrfsSw3dx X-Received: by 10.84.254.11 with SMTP id b11mr22425570plm.209.1496916322984; Thu, 08 Jun 2017 03:05:22 -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 r14sm10528423pfe.9.2017.06.08.03.05.19 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 03:05:22 -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 3/3] media: ngene: Replace semaphore i2c_switch_mutex with mutex Date: Thu, 8 Jun 2017 15:34:58 +0530 Message-Id: <1496916298-5909-4-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496916298-5909-1-git-send-email-binoy.jayan@linaro.org> References: <1496916298-5909-1-git-send-email-binoy.jayan@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 59f2e5f..ca0c0f8 100644 --- a/drivers/media/pci/ngene/ngene-core.c +++ b/drivers/media/pci/ngene/ngene-core.c @@ -1349,7 +1349,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;