From patchwork Thu Jun 8 10:04:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 103371 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2360381qgd; Thu, 8 Jun 2017 03:05:39 -0700 (PDT) X-Received: by 10.84.169.3 with SMTP id g3mr33518346plb.37.1496916339506; 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=v/+TpTvpL5ZHKsHB9BwCCzfY8B6tNhreXvYBTqBrDnPN/9FMmVfBcRs73pi73P6EUk WjugwvI96MCqabv9Sz7NiarZh5UBwFmuliW7LwYLAoWUxULGGVeEISjuLWI6S+QHsm70 sgS0ot6BLzU63lLzjEXUwreJe2wJJv8Kj8hH0KWEUlMjIOa2U836Gf78csIZI2yLzIVc ShUv6MMlfqKyLMdwkuUt1zrTwEYhgzEVED4QsnPUgpdLoPOvRaLOgonft/QVGn8hfnLW 4OSXkgIS+ALpcu6TuQqBfcFIVHbB223yPjG2Fg2rBwVJzq+aXLVTq1ES3ELitYVbhuc6 OH3A== 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=CVuLlXJLWV/zJvJg7cDWQl4smkFoGDEPRJzoMd4fNak=; b=GPlJrLPEK8lUj7GhrnLZvCcVkf7ALryzFQj7pLlJPjHOP0a6vQXbm/7HWir1+LNBF9 FKlyU+59651qjzfA5YnYCrmO7Ia7gHSxRW0RmQ981onKaQ6Fc3aAzxXS3kKeqfRWcSr9 wVNvVxL3RP92Koh8Ctdr7FO8StMGZr1um0p5VhoTcbliLe9vGu+SHqCG5aHTBaqewnUc YCc6PhAXb/M0lDymC4WzvwceJExIf4cnHFTC+h+xEW078fupU8X3aFHlhOf3MiOCYFu4 zoxWBVqVy5YrCdDbyV5fXKi8s7iuzLV+k/x0hJVMtvQ0bR9vwAr6oOQ3KP9oNH61/2wS qiqg== 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 S1751755AbdFHKF2 (ORCPT + 4 others); Thu, 8 Jun 2017 06:05:28 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:36225 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751695AbdFHKF0 (ORCPT ); Thu, 8 Jun 2017 06:05:26 -0400 Received: by mail-pf0-f175.google.com with SMTP id x63so15546631pff.3 for ; Thu, 08 Jun 2017 03:05:26 -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=CVuLlXJLWV/zJvJg7cDWQl4smkFoGDEPRJzoMd4fNak=; b=Q3p+KsRT848qDIOLLaCD6MICYIG/pw00NirVvu4P4smh2xfVUEx1hotuyu4DSbbldM Sm389BEHfR+Cf2cOGK3Lj6lm6J9mns7f1vKv5awbEvVZO1R3QZMpOV25Ue3WZR0klAiX ibGJIjuO2QZuvU3z4ZeiqtwFH3P+r4xuVrR7E= 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=CVuLlXJLWV/zJvJg7cDWQl4smkFoGDEPRJzoMd4fNak=; b=lCxHWv5BpxqzekOCYK0hAJs1qSo6hxUIHRcTm1mE5Unipy4S63NCviPkXSaKnB1mp1 iSyBDrumMF8tVZibDjViWF11BWDPkIygDQVoxpt4op4OUsyt3Uj2qTGEpq9wHdhjPgC5 gwUhIiHoaIWHIeQmH+HXZXiCZlWMeGFUhv3+P0plG+uzeTjRCtsktGSsThfo6H62uqxQ 2WC0gf5z93D9S7NoHdX9pTnIV4TblnCWnzj5siMyUR4rehRc5F17zoF0F/6uVySMk1pd 8LVGEcF6LnxWn8zXLevOpc6235kaN/b4sFdC+5gpGQ+cjBEzOVsxNoMSicmOoTKNo7RI ZViA== X-Gm-Message-State: AODbwcDYzxsmwkNmETeIvQyP4t4MGe0eDt816AXuVv3KW6Qo9DejavUL IkJiExU1VlKaMfyx X-Received: by 10.99.37.70 with SMTP id l67mr5399161pgl.212.1496916315696; Thu, 08 Jun 2017 03:05:15 -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.12 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 03:05:15 -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 1/3] media: ngene: Replace semaphore cmd_mutex with mutex Date: Thu, 8 Jun 2017 15:34:56 +0530 Message-Id: <1496916298-5909-2-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 'cmd_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 | 12 ++++++------ drivers/media/pci/ngene/ngene.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) -- Binoy Jayan diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c index ce69e64..dfbd1e0 100644 --- a/drivers/media/pci/ngene/ngene-core.c +++ b/drivers/media/pci/ngene/ngene-core.c @@ -336,9 +336,9 @@ int ngene_command(struct ngene *dev, struct ngene_command *com) { int result; - down(&dev->cmd_mutex); + mutex_lock(&dev->cmd_mutex); result = ngene_command_mutex(dev, com); - up(&dev->cmd_mutex); + mutex_unlock(&dev->cmd_mutex); return result; } @@ -1283,7 +1283,7 @@ static int ngene_load_firm(struct ngene *dev) static void ngene_stop(struct ngene *dev) { - down(&dev->cmd_mutex); + mutex_lock(&dev->cmd_mutex); i2c_del_adapter(&(dev->channel[0].i2c_adapter)); i2c_del_adapter(&(dev->channel[1].i2c_adapter)); ngwritel(0, NGENE_INT_ENABLE); @@ -1346,7 +1346,7 @@ static int ngene_start(struct ngene *dev) init_waitqueue_head(&dev->cmd_wq); init_waitqueue_head(&dev->tx_wq); init_waitqueue_head(&dev->rx_wq); - sema_init(&dev->cmd_mutex, 1); + mutex_init(&dev->cmd_mutex); sema_init(&dev->stream_mutex, 1); sema_init(&dev->pll_mutex, 1); sema_init(&dev->i2c_switch_mutex, 1); @@ -1606,10 +1606,10 @@ static void ngene_unlink(struct ngene *dev) com.in_len = 3; com.out_len = 1; - down(&dev->cmd_mutex); + mutex_lock(&dev->cmd_mutex); ngwritel(0, NGENE_INT_ENABLE); ngene_command_mutex(dev, &com); - up(&dev->cmd_mutex); + mutex_unlock(&dev->cmd_mutex); } void ngene_shutdown(struct pci_dev *pdev) diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h index 10d8f74..e600b70 100644 --- a/drivers/media/pci/ngene/ngene.h +++ b/drivers/media/pci/ngene/ngene.h @@ -762,7 +762,7 @@ struct ngene { wait_queue_head_t cmd_wq; int cmd_done; - struct semaphore cmd_mutex; + struct mutex cmd_mutex; struct semaphore stream_mutex; struct semaphore pll_mutex; struct semaphore i2c_switch_mutex; 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;