Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3039719imj; Mon, 11 Feb 2019 12:46:09 -0800 (PST) X-Google-Smtp-Source: AHgI3Iay7U1Gp6YzSMzj+gzUPVsicG+5/9v3nwWFFVVmt1tjc+3xWV1/7quY1g/271LA9Sn2D0oG X-Received: by 2002:a63:d52:: with SMTP id 18mr89916pgn.377.1549917969433; Mon, 11 Feb 2019 12:46:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917969; cv=none; d=google.com; s=arc-20160816; b=tccoJ/wDGK5Pxip0e8Z+JITS1M3RbTlMKhbfSYTWG5+jcY7pvcFMtSAt147jzT7tWL LySvpmJT3r3Dma1RS4QPzo1Al0m0vvktMVoNNafVLZH641Z2cqEEbr1Cre3CdePlxzvh 7Gq54YNLWuwSNhbiJnkaROmuAbnCyHXP1lSGSAMANoeYCPvseuG6sF9XUnuNDfVRXh1Y y/ywhgbUSwfZjAKIHtrmT/xaUDM5502ROnQglTMaKp44gPyWNCvKIE5ruRIlM/H4g6yW Q0kZ9k/QfQk+FsXKFuk9+JCnCBSbi07tvV4PVNWGAqe9Th2yrzHWsz4+G57p67f+0FbK BKbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=YPf184+zrdt4QtTJ4m/wSSLQM/wvd6gNxP/hOiuCrD4=; b=mzkz2yCz9XQtE2c6dDIf7jfoDjdvV4JgUnjCFVd4VuhxJ6hISUQChWMvAdB7CXqBTD PeJGjdBTo/dnZhowASkerJkEFE6dMUsvBHBRuGkMylB7EQjIFoRKCtD/2785d01RdRh4 hanGeLx2Enqdb0ixTvABY0qQ7mMCW2EC4sx7OGx4d8pmrjFCkAMOfp/Rjs/fKoYYHQh8 LyD15dG5QhdZzM0srjqoAaZt6l+1c8slp7b6S+lSotwWdiuS0eHoFPEGrY0O++D56xqQ lbHQSVu7RzwTArARlDuQQ7rokgBW1eIvA4MUOGRCigVnWCG0hCe459pJR3S3V14Ztzde dS5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XmWwVFmg; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13si2056060pgh.196.2019.02.11.12.45.53; Mon, 11 Feb 2019 12:46:09 -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=pass header.i=@gmail.com header.s=20161025 header.b=XmWwVFmg; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388668AbfBKURv (ORCPT + 99 others); Mon, 11 Feb 2019 15:17:51 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:40539 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729457AbfBKURt (ORCPT ); Mon, 11 Feb 2019 15:17:49 -0500 Received: by mail-yw1-f65.google.com with SMTP id c67so79398ywa.7; Mon, 11 Feb 2019 12:17:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YPf184+zrdt4QtTJ4m/wSSLQM/wvd6gNxP/hOiuCrD4=; b=XmWwVFmgbUuKt0NERdkZ1wN/pHx6POzXHHLU2OmharbpiUTBMPWfBfOPG+4uXj7bNE NI4EtUAtINrXHOr54IcZ4G+0IIlUpfly8YnkmZVG1uhpDFIrWbSH/OZz7Hif49n4X6al bRepu0GiGYZJUyErzy+mcSPoVMmot5jbjt9uqkTOqeIpUGPlLJ1He36Fb/cpPSpS6wFP kiyfB15hcdi8LVJmKeuve/QLathLLi5B9J1lSJ3NSn6rwpQH8bhqIoJoXySa8IyL/coQ r2/L4Q0wSPedhpg5RwtqMryFxcIvvTAIrDGxmgZ4IrzHKukDUYcuyw+tOEgIQr3AnYGP KAlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YPf184+zrdt4QtTJ4m/wSSLQM/wvd6gNxP/hOiuCrD4=; b=f5ZnzqBZjSuCFVsNBmd2iSaoj0cozkS9giQFgVxVSKBMPT6hGSj4l9/MY09opfnKxg 85fDNJhnljW4a1pb2Kh1DDaVQZwoJDDmRz7kWUTUBju8ecxryMRQ9/Fzdwn8C0kvRY41 sHt8IIUEvg23S6fsPFEFnxGlzOE/SHjVnXlRnpSTt+LUzTstv9dPNjWAMSKawKlQcAju sNY2u9mtHJTI43Ejz5sCzgjk78+lC0UzN45OQEfUa2CMztAWiD/tEzbp0hz2E2lx7IBd T8xaV9UsO/3EvOgtrRHMXIuoR+df+YKwJqs1Q1tpv0EtroaWs7hcUZpPre9ES/Sl+hJE yLxQ== X-Gm-Message-State: AHQUAub6z+Y1HeFyTu6xM5yN5B1JxMg03yRj8yD53ic/oud18NJHalWt E3fAmSxXccURIFAsXDQo1vDUZAjEbP2+zklrUPQ= X-Received: by 2002:a81:4f14:: with SMTP id d20mr39516ywb.16.1549916268570; Mon, 11 Feb 2019 12:17:48 -0800 (PST) MIME-Version: 1.0 References: <1549653856-47409-1-git-send-email-justinpopo6@gmail.com> <20190209170042.69a78684@archlinux> <2e692086-4be5-10ea-34b0-4444995c4275@lechnology.com> <20190211200557.7648d447@archlinux> In-Reply-To: <20190211200557.7648d447@archlinux> From: Justin Chen Date: Mon, 11 Feb 2019 12:17:37 -0800 Message-ID: Subject: Re: [PATCH] iio: adc: ti-ads7950: add GPIO support To: Jonathan Cameron Cc: David Lechner , linux-iio@vger.kernel.org, linux-gpio@vger.kernel.org, bcm-kernel-feedback-list , Florian Fainelli , bgolaszewski@baylibre.com, Linus Walleij , knaack.h@gmx.de, lars@metafoo.de, Peter Meerwald-Stadler , linux-kernel@vger.kernel.org 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 On Mon, Feb 11, 2019 at 12:06 PM Jonathan Cameron wrote: > > On Sat, 9 Feb 2019 12:56:11 -0600 > David Lechner wrote: > > > 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/ > > Thanks, I had indeed forgotten that entirely. > So it should have a local lock and not take mlock explicitly at all. > Thanks for all the feedback. So If I am understanding this correctly. I should create a local lock to synchronize three different type of transactions (buffered, direct, gpio). I do not want to use iio_claim_direct_mode because that doesn't allow simultaneous use of buffered mode and direct mode, which is necessary for this driver because of the above mentioned patch. Justin > Jonathan