Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3085528yba; Sat, 11 May 2019 03:26:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpPMP3m/KJpt6TuTtzu2JnvPB9yAqctkY/iHdcNw974cesTaDiZV9aFz8aUHTb+b1NP1qD X-Received: by 2002:a62:6444:: with SMTP id y65mr21107118pfb.148.1557570414512; Sat, 11 May 2019 03:26:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557570414; cv=none; d=google.com; s=arc-20160816; b=Hft2ZLawcHGCHXAQjEsPG5i4FuwSyZoos/aEqhcBhI1I3J/3qsrLTqBqUAlVWaZgWl s0ZFTvpgEkBMOxNade0ALEGN9Fy5i6CEINge1Y/iIfFQXFhhyOfV8GDBHWjZwYcTqPSJ Z3r2UKrsrVZhKUgaATlO6a5qdB/Qv69S5PQH63DzttpyecEXZYrVEbN+G5ECd9b2onLV FWayYdxB784r/VDur+5vcTAbpJ/ns30nszNV18jXBVWqKt8wTxy+WY7flx1/JYklqdMC +GGeE6ontTNcAIQC1U4FTyx8qInZUMQ6licxIj2HJdXDf4T8eqzPqpLe1eLrCLEtb+on BvOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=1vMQEWFQBKs8Rnot74X1l+pFf51rAnWhm6gCMTEb/CQ=; b=hNvsC7s4qfpGBRIOvxY1hR30Sjd7QQzpRuvhlWXyv7G/YCVH7jYHOM/A92ULmSsd1T er5pHTJ3/4vLHetwfP+mzFX7xK5VYcOM2tvby4WVLQm5GmOwwBYxGRpJnaty8Ii4EXqc MFFYg2ims6eM5wN8ifPC6AZ7COxRIaedGH37pbFCrYAhT9ZF/JSprJXBWGwz9PTT9Elz OVqlZwdMYJDZFAhbnyLAMBbsJ30QPnPESgNWdOMiTpanZ9+BhKzPhOUp6/jB0rVNwl61 JtykJfKFsm85uaeTw7HZ1dTpbfS4BsdvBWurPdt90HnJnRMlbsENfk1WyPbu2dNMFmsk ywaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VGf7UATU; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si10798211plb.48.2019.05.11.03.26.36; Sat, 11 May 2019 03:26:54 -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=@kernel.org header.s=default header.b=VGf7UATU; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728553AbfEKKP5 (ORCPT + 99 others); Sat, 11 May 2019 06:15:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:34062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728507AbfEKKP5 (ORCPT ); Sat, 11 May 2019 06:15:57 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7916D208C0; Sat, 11 May 2019 10:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557569755; bh=GVjvzUgaZO5L08Vrif/Gj4NVQZ3V+nUBXORBy/xPtl0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VGf7UATU+wbNMZj8Vn2IfAkAO93ECqaYnkNM0nI0ktDg20F/OWYS4d5STB4IPid8V bJwGWBld4bljFXZoG2vYlPdfr6JILEOLGCkmixATxgCYkevjNLgQrSVoWQqRtQa9mJ m7Z56V8aACpmRetJEsb5WCM9t/TRbG56GmxM5S4k= Date: Sat, 11 May 2019 11:15:48 +0100 From: Jonathan Cameron To: Philippe Schenker Cc: linux-iio@vger.kernel.org, Stefan Agner , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Marcel Ziswiler , David Laight , Philippe Schenker , Max Krummenacher , Alexandre Torgue , linux-kernel@vger.kernel.org, Lee Jones , Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 4/5] iio: stmpe-adc: Use wait_for_completion_timeout Message-ID: <20190511111548.504948ae@archlinux> In-Reply-To: <20190507143615.28477-4-dev@pschenker.ch> References: <20190507143615.28477-1-dev@pschenker.ch> <20190507143615.28477-4-dev@pschenker.ch> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 May 2019 16:36:14 +0200 Philippe Schenker wrote: > From: Philippe Schenker > > Use wait_for_completion_timeout instead of > wait_for_completion_interuptible_timeout. > > The interruptible variant gets constantly interrupted if a user > program is compiled with the -pg option. > The killable variant was not used due to the fact that a second > program, reading on this device, that gets killed is then also killing > that wait. > > Signed-off-by: Philippe Schenker Hi Phillippe This one clashed a little bit with our earlier patch to remove the unnecessary assignment. I've applied it by hand but please check it. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > > drivers/iio/adc/stmpe-adc.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-) > > diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c > index 82b43e4522b6..cc752a47444c 100644 > --- a/drivers/iio/adc/stmpe-adc.c > +++ b/drivers/iio/adc/stmpe-adc.c > @@ -77,17 +77,11 @@ static int stmpe_read_voltage(struct stmpe_adc *info, > stmpe_reg_write(info->stmpe, STMPE_REG_ADC_CAPT, > STMPE_ADC_CH(info->channel)); > > - *val = info->value; > - > - ret = wait_for_completion_interruptible_timeout > - (&info->completion, STMPE_ADC_TIMEOUT); > + ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT); > > if (ret <= 0) { > mutex_unlock(&info->lock); > - if (ret == 0) > - return -ETIMEDOUT; > - else > - return ret; > + return -ETIMEDOUT; > } > > *val = info->value; > @@ -116,15 +110,11 @@ static int stmpe_read_temp(struct stmpe_adc *info, > stmpe_reg_write(info->stmpe, STMPE_REG_TEMP_CTRL, > STMPE_START_ONE_TEMP_CONV); > > - ret = wait_for_completion_interruptible_timeout > - (&info->completion, STMPE_ADC_TIMEOUT); > + ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT); > > if (ret <= 0) { > mutex_unlock(&info->lock); > - if (ret == 0) > - return -ETIMEDOUT; > - else > - return ret; > + return -ETIMEDOUT; > } > > /*