Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1066500pxk; Fri, 25 Sep 2020 05:29:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSO1K+aM6R/AbCooYv+m7slQIQ9NG/BeEFgd6u7xyhgkIpp+RhzJNq2AJXfjMSIXjtqsLr X-Received: by 2002:a17:906:d97b:: with SMTP id rp27mr2585126ejb.18.1601036985126; Fri, 25 Sep 2020 05:29:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601036985; cv=none; d=google.com; s=arc-20160816; b=ds18MELeUuKHsjlTopbmGu3QgRA6hO4Ttr4uoMs29EuzLHS3m8XVORtFfiQd/xBA2s nbImxYTg9sbX/PrXGnmsdG35bEpqj39c170pnnS/rQXW0CpjjpPkA2wnRuKT2LNtahKH +rAtHg6/MfbPh2F66VXJGXf79rhF1Dfal8FOumExGg1TTssoDODw8W7np2vsqAKMmTm2 LxDNmkPxRCOaJ0m5egVr+BhBUuQhK33Q1Tfzp0ULJmSVapl0723wNsEU2LxkZ7c5PJJo KtotRmaulOXXGhDZWEYdY/rzhSfyqAVUy0WZeO05U/aG3X0jN9pKDBGhGssgmjjmtVsS 3ShQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RoiAde1p6ZmKXc4tv5yOThyibmUIJZp91/MLEmdbNTg=; b=ARjpu3d1Zucspn48WVxSIsK4HD2NpUVmiY5oMHL89lG3REX/hQafz4pMmG0TZ8r/Bf uy5GWwXhah4w00zK5XfFogOqKrbrwY9PTIxZeKgpLjeWVdubdCYZ/8KigsPsnuprm+MO f75fcNHpWWhxNfRA44uckPCQx1egBWBbPiA88x3v21hWc393uGpD03BLZgKpBN1uF1xJ GajPPihXngjmoXybjJh+0a6C3Nju3nqMTRYVh+38JLSXCHN2IqpNPUXBKJQTZu68O/Tr gvVYsE2D+U8wZMFR+RvC74neZDtkRWI9pqpPZNf1otPWXDaoh5qPc1LsctHTCUtj7KVY Us3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kHRduUco; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id r8si1621357edw.288.2020.09.25.05.29.20; Fri, 25 Sep 2020 05:29:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kHRduUco; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728038AbgIYM07 (ORCPT + 99 others); Fri, 25 Sep 2020 08:26:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726368AbgIYM07 (ORCPT ); Fri, 25 Sep 2020 08:26:59 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DA93C0613CE; Fri, 25 Sep 2020 05:26:59 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id k13so3038878pfg.1; Fri, 25 Sep 2020 05:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RoiAde1p6ZmKXc4tv5yOThyibmUIJZp91/MLEmdbNTg=; b=kHRduUcogysuAj/XjTDEPr7Z6lI82xo2KmMCMHhaliwBu8fDmzN5/ebY1h2jFxY5K/ kK9w0fbHmRsBezY0Vy6twWptBFCaBoyl7c1SozQdBMI/NMSIT0lbtt2ckOk75dERMPKt yktAhIsW5+CnVulca+5OvM0lOEwTfn7OU55xiTnygs8QB0M3I2bqV9UprHA4Ci+3mlDD J11xCXkgYRrXuegoEcERztlzDXc0iwk4czO2PU4NpgQ4J6wZxaa2AU2tJOKS5UVekmUF LIizollp4YXmWdC1OKtx7BHB9tEV69A5jHwTH0+50NUFA0wlKB8vDkmRHf4wQjh5jSaQ 6s/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RoiAde1p6ZmKXc4tv5yOThyibmUIJZp91/MLEmdbNTg=; b=kLo3C+VrWkNKqLrnxkl6xJ7jlir34rmnfr3JGzozwmnuf4+0igu9niP1/zirYs/9y8 N7jXu0nhS0cyDIgcbGdwZYoj+AtchZ/Vj9SilN7FVDQQzybqiNc/TDJJJAiVUuGaaOh5 n9tRUisrTdvWxRnkuOtveoWlh6VUcbkERR8c/pW6C5Ym7QOMrCK6YU+b/8D7VoQHCMGZ UIexkvEEBDakjSo5ZDkIVE8npLyOj17klMPV/zIMo4SDbE9K7qMbtiRGBK3k67MDMhw2 NGNEQUUnovkmtHwqJ5v0sJqKfBaODyt4XLYnqD1nALUs0jTVh4BnczwT/gelUTfCes7q XqEQ== X-Gm-Message-State: AOAM532AYcGxsfrpOZuLoLhy1SPPPGHIQlq/zwW1yv8dhrZp4D1whxa7 bhbbgp8dSn/6NKdsVyiieRg= X-Received: by 2002:a62:1850:0:b029:142:2501:35e8 with SMTP id 77-20020a6218500000b0290142250135e8mr3635546pfy.72.1601036817467; Fri, 25 Sep 2020 05:26:57 -0700 (PDT) Received: from sol (106-69-189-59.dyn.iinet.net.au. [106.69.189.59]) by smtp.gmail.com with ESMTPSA id 75sm2305666pgg.22.2020.09.25.05.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2020 05:26:56 -0700 (PDT) Date: Fri, 25 Sep 2020 20:26:51 +0800 From: Kent Gibson To: Andy Shevchenko Cc: Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Bartosz Golaszewski , Linus Walleij , Arnd Bergmann Subject: Re: [PATCH v9 09/20] gpiolib: cdev: support edge detection for uAPI v2 Message-ID: <20200925122651.GA218809@sol> References: <20200922023151.387447-1-warthog618@gmail.com> <20200922023151.387447-10-warthog618@gmail.com> <20200924030732.GB11575@sol> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2020 at 12:35:49PM +0300, Andy Shevchenko wrote: > On Thu, Sep 24, 2020 at 6:07 AM Kent Gibson wrote: > > On Wed, Sep 23, 2020 at 06:47:28PM +0300, Andy Shevchenko wrote: > > > On Tue, Sep 22, 2020 at 5:35 AM Kent Gibson wrote: > > ... > > > Also, this code is drawn from lineevent_irq_thread(), which is ordered > > this way. > > Negative conditionals are slightly harder to read. > > ... > > > > > + if (!line->timestamp_ns) { > > > > + le.timestamp_ns = ktime_get_ns(); > > > > + if (lr->num_lines != 1) > > > > + line->req_seqno = atomic_inc_return(&lr->seqno); > > > > + } else { > > > > + le.timestamp_ns = line->timestamp_ns; > > > > > + } > > > > > > Ditto. > > > > Firstly, drawn from lineevent_irq_thread() which is structured this way. > > > > In this case the comment relates to the condition being true, so > > re-ordering the if/else would be confusing - unless the comment were > > moved into the corresponding body?? > > Yes. > Does that mean I should re-order and move the comment into the body? That would work for me - the normal case is line->timestamp_ns being set. > ... > > > > > + irq = gpiod_to_irq(line->desc); > > > > + if (irq <= 0) > > > > + return -ENODEV; > > > > > > So, you mean this is part of ABI. Can we return more appropriate code, > > > because getting no IRQ doesn't mean we don't have a device. > > > Also does 0 case have the same meaning? > > > > Firstly, this code is drawn from lineevent_create(), so any changes > > here should be considered for there as well - though this may > > constitute an ABI change?? > > For v1 probably, for v2 we are free to fix this. > > > I agree ENODEV doesn't seem right here. Are you ok with ENXIO? > > Yes. > Will do. And in the debounce patch as well. > > From gpiod_to_irq(): > > > > /* Zero means NO_IRQ */ > > if (!retirq) > > return -ENXIO; > > > > so it can't even return a 0 :-| - we're just being cautious. > > I would drop = part then. > ok, but you'd better not come after me in a subsequent review for not checking the 0 case! Cheers, Kent.