From patchwork Sun Mar 4 01:49:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Masney X-Patchwork-Id: 10257547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5E18E6037F for ; Sun, 4 Mar 2018 01:57:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E0E428249 for ; Sun, 4 Mar 2018 01:57:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4144A283C3; Sun, 4 Mar 2018 01:57:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D690B28249 for ; Sun, 4 Mar 2018 01:57:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932247AbeCDB5K (ORCPT ); Sat, 3 Mar 2018 20:57:10 -0500 Received: from onstation.org ([52.200.56.107]:52838 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751756AbeCDByy (ORCPT ); Sat, 3 Mar 2018 20:54:54 -0500 Received: from xilitla.hsd1.wv.comcast.net (c-98-236-77-125.hsd1.wv.comcast.net [98.236.77.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id 6F5ED1AF0; Sun, 4 Mar 2018 01:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=onstation.org; s=default; t=1520128192; bh=DtlPznV72PpeM+RrlIKn93Fs8tCML0KK4sbyu9ErYXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OrK86R/75a4CVLtvSd/TH6PpC6nI8Osn8Sh2gxZnCnktdoUOeysU89sSIEqIi027r aD7ksoWRSrDxN6FBFJIsAjMogKFeCGmYDITT6vllwMf8pXpX1g9SUvsviLcWxjXdCc 5fL0drUQlmlsGgJIIPZn8L3Dc1eBe5thdb297KHU= From: Brian Masney To: jic23@kernel.org, linux-iio@vger.kernel.org Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-kernel@vger.kernel.org, Jon.Brenner@ams.com Subject: [PATCH 05/12] staging: iio: tsl2x7x: convert mutex_trylock() to mutex_lock() Date: Sat, 3 Mar 2018 20:49:35 -0500 Message-Id: <20180304014942.18727-6-masneyb@onstation.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180304014942.18727-1-masneyb@onstation.org> References: <20180304014942.18727-1-masneyb@onstation.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver uses mutex_lock() and mutex_trylock() in several places. Convert the mutex_trylock() to mutex_lock() for consistency with other IIO light drivers in mainline. Signed-off-by: Brian Masney --- drivers/staging/iio/light/tsl2x7x.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c index cf16dd206c0b..5c611250127f 100644 --- a/drivers/staging/iio/light/tsl2x7x.c +++ b/drivers/staging/iio/light/tsl2x7x.c @@ -350,8 +350,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) u32 ch0lux = 0; u32 ch1lux = 0; - if (mutex_trylock(&chip->als_mutex) == 0) - return chip->als_cur_info.lux; /* busy, so return LAST VALUE */ + mutex_lock(&chip->als_mutex); if (chip->tsl2x7x_chip_status != TSL2X7X_CHIP_WORKING) { /* device is not enabled */ @@ -478,11 +477,7 @@ static int tsl2x7x_get_prox(struct iio_dev *indio_dev) u8 chdata[2]; struct tsl2X7X_chip *chip = iio_priv(indio_dev); - if (mutex_trylock(&chip->prox_mutex) == 0) { - dev_err(&chip->client->dev, - "%s: Can't get prox mutex\n", __func__); - return -EBUSY; - } + mutex_lock(&chip->prox_mutex); ret = tsl2x7x_read_status(chip); if (ret < 0)