From patchwork Thu Jun 8 10:04:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 103369 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2360377qgd; Thu, 8 Jun 2017 03:05:39 -0700 (PDT) X-Received: by 10.98.74.5 with SMTP id x5mr23442715pfa.149.1496916339056; 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=Qxb0WNlHR+NobyfwNNXCTMYSTgTShpzwBnrO+IGj70qcq1WwKHEDjY8UFrRNFNItN3 zBZcY6TLuwljjzmPP/EAj+qnDSm3Yj3uYrXkAcUUox0wuEVhs0KaeqhNgyrJcmCHbiMz glZjKChgEpQtDXLV4mb1Smeduze7B5DRLrkMQCL+6RJynp/g/D+j1cuXGA3VxOcjHvdL biQxQ6ON5o1SiL7VTPoPIuIt5hC8yIau73UzEMfttd2eGqhnGAQmLOp3FusEN4S0LZbm ElRDwBu9OYJzfNL4MlBBE+d7O/JIRuGKTHUkTCL/6KD6Jt9V1HLcq/Zq5cpBqdJM27Fa Qq8A== 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=8/ixsiV5NVHI67vqUTMP4gHnl4xy64CEcxfFMKguvho=; b=j1JXPlHC+7fFyECv7FcYmNzqo4XHyG0SJAosDw1Mop7LeCj6vobo/hjJoWqGccHJrI s1jlebMGmo4pFjifYdzud8sj7zfN+QTsuvU+C6R3Co6cXtw/ArDyjVzuU+ifJe9m5mFH HJp6Q+Grpvwq4Kaka67Y+SY1tIRG+/fMSwOboOrPLVTmxA9/6IrkR6SZganslHvR8S/r D+DFyYBBJFdX0d7BVgvrti4fX1/eM3OJYFJHN2Y3W+c7vN2Y6YoHC2YZSPEljuVCbWie 9ztJB3jQvRKlWFO1AY9eG8Oz2VmBQw4WrYQI7zwI8+cSc6BLakrDMDzYfffrMaPBH4TU o57w== 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 a27si4040770pfg.415.2017.06.08.03.05.38; Thu, 08 Jun 2017 03:05:39 -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 S1751734AbdFHKFW (ORCPT + 25 others); Thu, 8 Jun 2017 06:05:22 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:33433 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751639AbdFHKFT (ORCPT ); Thu, 8 Jun 2017 06:05:19 -0400 Received: by mail-pf0-f172.google.com with SMTP id 83so15594232pfr.0 for ; Thu, 08 Jun 2017 03:05:19 -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=8/ixsiV5NVHI67vqUTMP4gHnl4xy64CEcxfFMKguvho=; b=h2fHLsuc5Irp4TH6Te/IdyiVis6ZTMn+W1nMH5+PN1J+8W38Ye44dsMPvI0Zf8Ot6C xgMGKDySdffGaKtxhSxF0GbkYKpoyVElFV+ccEaQpNbG7lr9YyyJgGrXQJwWktWa7r5X sCRu+HTAqoHljg4/w55sMRMxx5dy7Oo3pYzXA= 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=8/ixsiV5NVHI67vqUTMP4gHnl4xy64CEcxfFMKguvho=; b=FMU/zEHOEcP6qV0DYnfEGFTlHCh4HkbNjjhWhkOMS631c8YVlbTb2bpRuCqW469Sx2 WbMl5lt6oKhYF5Yg4tXjQbYDLNPNk9uV9YyN0X+/5ARiIOMKuT91eaVvXwr7WURWMokZ HGLBncuZyOa+aw3pCo+lF+rSosbgejks8GiWILYqmVAXhDtVZAtF6D9BBhPPO0iOv/56 6vRiZYTRHe34GVJ79NyLxKvVes2WiaX+z13SFt7beTRJXNpfBdxQHQHK0F5oWLvTOQc3 pJ9gMfqxOO95vu4fWH4ft4D7p1L4wYbVN8oFZHXCedoEAFLcbpalvXKOBljJUnGTrL9i X+4g== X-Gm-Message-State: AODbwcA6OXaEYQG+cS4iJ/2lEiKHcKfzmIZ7ph0JVBayranI56A+mn7P vhCluXgwi8hyOb33 X-Received: by 10.99.96.9 with SMTP id u9mr37218454pgb.97.1496916319224; Thu, 08 Jun 2017 03:05:19 -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.15 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 03:05:18 -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 2/3] media: ngene: Replace semaphore stream_mutex with mutex Date: Thu, 8 Jun 2017 15:34:57 +0530 Message-Id: <1496916298-5909-3-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The semaphore 'stream_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 | 14 +++++++------- drivers/media/pci/ngene/ngene.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) -- Binoy Jayan diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c index dfbd1e0..59f2e5f 100644 --- a/drivers/media/pci/ngene/ngene-core.c +++ b/drivers/media/pci/ngene/ngene-core.c @@ -560,7 +560,7 @@ static int ngene_command_stream_control(struct ngene *dev, u8 stream, u16 BsSPI = ((stream & 1) ? 0x9800 : 0x9700); u16 BsSDO = 0x9B00; - down(&dev->stream_mutex); + mutex_lock(&dev->stream_mutex); memset(&com, 0, sizeof(com)); com.cmd.hdr.Opcode = CMD_CONTROL; com.cmd.hdr.Length = sizeof(struct FW_STREAM_CONTROL) - 2; @@ -587,16 +587,16 @@ static int ngene_command_stream_control(struct ngene *dev, u8 stream, chan->HWState = HWSTATE_STOP; spin_unlock_irq(&chan->state_lock); if (ngene_command(dev, &com) < 0) { - up(&dev->stream_mutex); + mutex_unlock(&dev->stream_mutex); return -1; } /* clear_buffers(chan); */ flush_buffers(chan); - up(&dev->stream_mutex); + mutex_unlock(&dev->stream_mutex); return 0; } spin_unlock_irq(&chan->state_lock); - up(&dev->stream_mutex); + mutex_unlock(&dev->stream_mutex); return 0; } @@ -693,10 +693,10 @@ static int ngene_command_stream_control(struct ngene *dev, u8 stream, spin_unlock_irq(&chan->state_lock); if (ngene_command(dev, &com) < 0) { - up(&dev->stream_mutex); + mutex_unlock(&dev->stream_mutex); return -1; } - up(&dev->stream_mutex); + mutex_unlock(&dev->stream_mutex); return 0; } @@ -1347,7 +1347,7 @@ static int ngene_start(struct ngene *dev) init_waitqueue_head(&dev->tx_wq); init_waitqueue_head(&dev->rx_wq); mutex_init(&dev->cmd_mutex); - sema_init(&dev->stream_mutex, 1); + mutex_init(&dev->stream_mutex); sema_init(&dev->pll_mutex, 1); sema_init(&dev->i2c_switch_mutex, 1); spin_lock_init(&dev->cmd_lock); diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h index e600b70..0dd15d6 100644 --- a/drivers/media/pci/ngene/ngene.h +++ b/drivers/media/pci/ngene/ngene.h @@ -763,7 +763,7 @@ struct ngene { wait_queue_head_t cmd_wq; int cmd_done; struct mutex cmd_mutex; - struct semaphore stream_mutex; + struct mutex stream_mutex; struct semaphore pll_mutex; struct semaphore i2c_switch_mutex; int i2c_current_channel;