Received: by 10.223.164.202 with SMTP id h10csp218905wrb; Mon, 13 Nov 2017 05:27:56 -0800 (PST) X-Google-Smtp-Source: AGs4zMbS9RxhAFOUtwblAPZocT6pwHqVDar1FAAAbQvE4sWXiLFYR3npffGM8XtVEnVG79UnEY0G X-Received: by 10.99.120.5 with SMTP id t5mr8599092pgc.138.1510579676679; Mon, 13 Nov 2017 05:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510579676; cv=none; d=google.com; s=arc-20160816; b=ry8sZoSCki5DHAg2rcBOoI5XX8qHCbLEcpooraYYbzOCBobfsxAUtDlN+LUN4wJBnB jOj48Qln5MKNwlEH5VZJ1/YcZRTV7hrhRQ6fCPiS/eqJyag7n8GZKzLeyjTWg9mLINhI PIF2Ha1puNTzZ+zazhU1X1eZ9U2UkZ2F4mzHo1WYqms+avuuE3MNzFu4Jp3ZX0rzUQkV Q/PC8ZzmXVZYDG1KwknPTEXVCYJYIUIvt2IRI59cAx+ugLSYkX5Gh6EBM/u2/yizr9UY dLI6ZKtuIy4hlEz9kqrrBtIj6fCnRbLA4SvxKQkqzUjEbl9qZmLAuuF0jKs/Gpj1ABBO 6XKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=z2n09J7mALLuTOhajwIDiFLjabsc2P8jefiG02Ii1ng=; b=P9+n+pp5By9Ig+vM/XYb1qw91hgua8mLqHRrnBVg0RKcov1L8Z/5hpAITSL9APFF/0 R69RBTpKXhjLns7JQNgnJdQCZ/RGtVL5wE0HmPE80zBpfbpRInlnR18KoP2k4xzAross YlLl2Ue0eoGpH7GVhW16ftg7us6LPHjEC/PdzQRHTIYIvZGlN0ZAuFiIACDjEJJen51D W+pZvt111wX810x2HPvrKoifeBxmQVb1P7p/j7UpUvR+viKqfpSTWWmmwpFII2zDS6kF SIVWYpe5og7eV8UD/WEg86Q9tMCLmYarIbJS/CnUyYoc5sbsFKJ2Ivd/cebGWaqHLZlD 6GCQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si14235076plh.820.2017.11.13.05.27.43; Mon, 13 Nov 2017 05:27:56 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754196AbdKMNAF (ORCPT + 95 others); Mon, 13 Nov 2017 08:00:05 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:49882 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754151AbdKMNAD (ORCPT ); Mon, 13 Nov 2017 08:00:03 -0500 Received: from localhost (LFbn-1-12253-150.w90-92.abo.wanadoo.fr [90.92.67.150]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AA934AA6; Mon, 13 Nov 2017 13:00:02 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alison Schofield , Vlad Dogaru , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.9 24/87] iio: proximity: sx9500: claim direct mode during raw proximity reads Date: Mon, 13 Nov 2017 13:55:41 +0100 Message-Id: <20171113125617.574583696@linuxfoundation.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171113125615.304035578@linuxfoundation.org> References: <20171113125615.304035578@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alison Schofield [ Upstream commit 6b2e7589b82ff534dd5c6d67dd83c53f13691bec ] Driver was checking for direct mode but not locking it. Use the claim/release helper functions to guarantee the device stays in direct mode during raw reads of proximity data. Signed-off-by: Alison Schofield Reviewed-by: Vlad Dogaru Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/iio/proximity/sx9500.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/iio/proximity/sx9500.c +++ b/drivers/iio/proximity/sx9500.c @@ -387,14 +387,18 @@ static int sx9500_read_raw(struct iio_de int *val, int *val2, long mask) { struct sx9500_data *data = iio_priv(indio_dev); + int ret; switch (chan->type) { case IIO_PROXIMITY: switch (mask) { case IIO_CHAN_INFO_RAW: - if (iio_buffer_enabled(indio_dev)) - return -EBUSY; - return sx9500_read_proximity(data, chan, val); + ret = iio_device_claim_direct_mode(indio_dev); + if (ret) + return ret; + ret = sx9500_read_proximity(data, chan, val); + iio_device_release_direct_mode(indio_dev); + return ret; case IIO_CHAN_INFO_SAMP_FREQ: return sx9500_read_samp_freq(data, val, val2); default: From 1586637138478878246@xxx Wed Dec 13 03:18:08 +0000 2017 X-GM-THRID: 1586637138478878246 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread