Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp926403imj; Sat, 9 Feb 2019 10:58:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IbAUaAIWO4bL0LPDaALY8gcbnADye2K8EX6jyGpb6DBAuqXgnYmy5lnf9ux7A1Pt6PrCvce X-Received: by 2002:a63:9b11:: with SMTP id r17mr26737678pgd.416.1549738724548; Sat, 09 Feb 2019 10:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549738724; cv=none; d=google.com; s=arc-20160816; b=Y/muvjnZvTstGjGnsqoK26sXdjZgnyTddCjqDBvPlv+o3FnT4GHqTw+rzVop/SwzF6 mwXoTYzgOetwLgEcxYla5NR4rTvKSoEObybhHT4FrfFu25vBM72KLAmIvtnhodjKGv3o olRKQQcCs8mEOkM+C53Q1yy0o1FC1pIDzgTq1kV+WBNNi1vY/lrtmiQ/P24C5tfDMV0Y D1t+5QODGpnoTPKAj2QwIWD8cYkE2fFMbED4rr++oE0Xg8s3GDTeSIcbk6RHvODXf7F1 J1freD6L6bmJYbE5SFg2iTXCqVnZ7wJUVPYveCbl53+ae1wq2HBI6sOs5D++mTMwm+qP /P4w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=g1vQtrMzSJBOpxZiNlEvjWT1VUNRvlBXleY3eINxXHg=; b=WQQ6CRFEhfM7hR4C1w8x1twvQne9OlsrVopppNuX9+DEcTVy3THZRgtE5krISw1Ag+ AWXhu6YT0a2vIyQGk7UfarZx9Ll/kt7C1ih0/ZdSHYH+z0ap97l/00bcVA1+rqm7K6GN A8u7jPpurwCU1QQUz5RMRp7kFiZxWl0pxs1UnI1hwfpdtrUBPC482K/BPiWsYZj5Lpvf ktAjJRPiyT74v5MRBY8CIspCFk+F/929561Cup8Te2KcSy+LAsCjnDR59v6mHN4HC3q6 AadtFMPeeiSGcR99eX1Go/uNunGLcIYc67KFGPGLyNzKroTj0YFfgX0oGWL2YCcuI4aS E/nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b="Ra/i5C11"; 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 c9si2992702pfm.127.2019.02.09.10.58.28; Sat, 09 Feb 2019 10:58:44 -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; dkim=fail header.i=@lechnology.com header.s=default header.b="Ra/i5C11"; 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 S1728059AbfBIS4T (ORCPT + 99 others); Sat, 9 Feb 2019 13:56:19 -0500 Received: from vern.gendns.com ([98.142.107.122]:42554 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727478AbfBIS4R (ORCPT ); Sat, 9 Feb 2019 13:56:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=g1vQtrMzSJBOpxZiNlEvjWT1VUNRvlBXleY3eINxXHg=; b=Ra/i5C113gY8Oa0rKOxB2hbJir nMvZ4qCGmgG1As47600fQD4pQ88IiJnQ+r6qO3xfgmijmKZFwAqj+KWOVE4hnUiZM5gZjXjo7liDY 6aSQy+r8WveCYo6d/LC7TeCKblXy0m5YqDLEJNuWY0h39QX2z3UgZLG6HMzt41mm9P15LI3C/eUe/ AQJfFu3/ZibvfeCDqUD6OafJCYeRRBXjy18ODS+aKrIP5oH6tmV1v6IOmYY2LJyBxD93zAjYGvW9e lWpSgS9XBlLpylmBWzHR9y8YX1WrM3byKo7X5VacjG+F0r/1blwzuMf6Oj/0Nl9ot4ACtbZgESZcv x7WQgmTA==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:41636 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1gsXjm-0006ae-PV; Sat, 09 Feb 2019 13:52:26 -0500 Subject: Re: [PATCH] iio: adc: ti-ads7950: add GPIO support To: Jonathan Cameron , justinpopo6@gmail.com Cc: linux-iio@vger.kernel.org, linux-gpio@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, f.fainelli@gmail.com, bgolaszewski@baylibre.com, linus.walleij@linaro.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-kernel@vger.kernel.org References: <1549653856-47409-1-git-send-email-justinpopo6@gmail.com> <20190209170042.69a78684@archlinux> From: David Lechner Message-ID: <2e692086-4be5-10ea-34b0-4444995c4275@lechnology.com> Date: Sat, 9 Feb 2019 12:56:11 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190209170042.69a78684@archlinux> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/9/19 11:00 AM, Jonathan Cameron wrote: > Nope. This is a state lock used to protect against transitions between > different modes of the IIO device (buffered vs polled), it > isn't suitable for general use. > > The driver should be modified to handle that correctly. > We have iio_claim_direct_mode etc that deal with the case > where a device can't do certain operations whilst in buffered > mode. Note it can fail and should. > > Seems there are more drivers still doing this than I thought. > If anyone is bored and wants to clean them out, that would be > most appreciated! > > If you need locking to protect a local buffer or the device > state, define a new lock to do it with clearly documented > scope. Just as a reminder, there is a use case for this particular chip that requires buffered mode and direct mode at the same time. https://patchwork.kernel.org/patch/10539021/ https://patchwork.kernel.org/patch/10527757/