Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1165416pxk; Fri, 25 Sep 2020 07:50:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2OS15y7udUMNxLyFDJVR0CuFHBKeOhKQNKjx3fj1ND2uRyIgm1xcz5fnPvcU0W5Bzx73h X-Received: by 2002:a17:906:288d:: with SMTP id o13mr3180788ejd.195.1601045426839; Fri, 25 Sep 2020 07:50:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601045426; cv=none; d=google.com; s=arc-20160816; b=eXeE5VAOZTgXys7jJ37em6VjtNIUkrkC+u51URRQ0eL8lAPlZ0PJ0vOAlITCRCeusJ 9AW9crZa7DhFtWduIqFG/S+9rxc4xgNtxIB+WCkP7wTNJk6zeTo2rvaYca9mr2oCHDZH +yHc49eStKgIeMNNpbn1z+SAfyykTpBcyovmwvEQlMPLOUgYaDidrBge3gj+CUb6aqGw m53q1Wl6d+EZwTwz/mc7fwk1rkdZLWbw/asGc/l3/PSirHJhmywXOjZO3WwSmZtlOSaa JyrWGeHodzq3qcmBukhmjYJzdxJVaGc/oBlP60o2ttj3xeQvDUD2o02lmyvH7v4eeTcF 6C9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KVqS3zBnRdVRz+9mXTOOAoznlEAtOOoAuXzzPbgOnlM=; b=x8cc6LgxH5d4DEwDR91Ah2A/6puHuZfcuG7HgDRC83DQ4S+uJec3FkdMqD8AP2fgoX pi0FlqjAGm+zhLfh46HKWWqndYPbGO2DQCnm8sc0h8398N4Bp7Yxxb/AEHeL0nMx2k19 lCpWeyWMuO3JvJkWh+tK3mEdFceB7FTW5bBQ9PbSbFquNZpv/zOciyG4dAZQ1PyC6TF5 05AEOtzihAnO/Ohz/FHLaARcFZ1YifC5PhJKeyC7LM6APy1C5GzL9PIm/ltt2+LtiO4b wPyscA1feaz8ydb1d8v/qfcQrfS57HFgQpcAwsbblZpuo1fjC5ZY5EvN6+F/7hd3pyb/ Mp2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fjdEyy0l; 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 r25si2521840edc.505.2020.09.25.07.50.02; Fri, 25 Sep 2020 07:50:26 -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=fjdEyy0l; 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 S1729135AbgIYOso (ORCPT + 99 others); Fri, 25 Sep 2020 10:48:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729097AbgIYOso (ORCPT ); Fri, 25 Sep 2020 10:48:44 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83306C0613CE; Fri, 25 Sep 2020 07:48:44 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id t7so1964038pjd.3; Fri, 25 Sep 2020 07:48:44 -0700 (PDT) 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=KVqS3zBnRdVRz+9mXTOOAoznlEAtOOoAuXzzPbgOnlM=; b=fjdEyy0lm0lfbMd8quwV5EcORq/59e7GsjxrSeIHl4IpI7gmZHLKr4xHvmJQRxU6js 5MwCGBxPkkHeo+4L2LG4d8kP29PmmBQEnVjq8LeHavzI3UEeGGDkvkRnMl99xKOCwuc2 +igt7GJkFanZLWu/nER20z3IFcqCIXW/5zBRg4iWKIjfloATCP4+3NPBgKILqvAjlwvX SfmlXREqP5Vx5SFEXJptfG51HKDJqB0zJul52Pc4uRWORF4k+A8TYgzVz9d/Kca/9PcZ dfSWTSDNg9SfWXmth7/xLpv14bIqh6YWY3Dce3ZTbe6uhTsSQNOxtZRN72LBMXOzJIA4 JhPw== 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=KVqS3zBnRdVRz+9mXTOOAoznlEAtOOoAuXzzPbgOnlM=; b=X9kk94CKIQDh9JicE57kNR9hnyA/lM+G5Jxr6iVWBrCHLzIb3Srhhtq2bLjJQ+7gj+ dBBy9Y7Hr9YzqIPBZ0AGsyAlmlJlb5K1v8Ip3C++HH3R+/yKPSMNPvZ9dy89Wd0XCF83 mAoOnqE4O3eui9g4uqO1ORbVGTEEb4APs5H+MuMxuQseIi+lV5yWsCQ1sCU85krSrCoI j/HO6MhdlagRIUowKaFLJQ97HwmzjrciuDNRCNyIQDNxHwvJVhcjxFEqjLsELV0ATaqh Wk3axPzIKiPyZ5JzlAjzOAb5rYbd9hxoW/8KhUkisdyIWehFAiPXtHmWzJN7/T54d6g4 fNnw== X-Gm-Message-State: AOAM531r9E6i8Qr17uu/bCvO42lj1QG1ITU99LxY+OQrbCegXP9wLF4v EefRbvADREja+1+6KnSF3WoQ17rbsK8HLsA07xIQysMcqFqTww== X-Received: by 2002:a17:90b:fc4:: with SMTP id gd4mr639852pjb.129.1601045324033; Fri, 25 Sep 2020 07:48:44 -0700 (PDT) MIME-Version: 1.0 References: <20200922023151.387447-1-warthog618@gmail.com> <20200922023151.387447-10-warthog618@gmail.com> <20200924030732.GB11575@sol> <20200925122651.GA218809@sol> In-Reply-To: <20200925122651.GA218809@sol> From: Andy Shevchenko Date: Fri, 25 Sep 2020 17:48:25 +0300 Message-ID: Subject: Re: [PATCH v9 09/20] gpiolib: cdev: support edge detection for uAPI v2 To: Kent Gibson Cc: Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Bartosz Golaszewski , Linus Walleij , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2020 at 3:26 PM Kent Gibson wrote: > 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: ... > > > > > + 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. Yes, that's what I meant. ... > > > 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! For IRQ?! Maybe if I'll be drunk (quite unlikely). I really don't like to check IRQ against 0. To me it should be transparent to the caller. If IRQ == 0 in certain API or entirely in Linux is considered NO_IRQ, then it should be either correctly handled (means all following actions on it shouldn't fail, or it shouldn't be returned in the first place). -- With Best Regards, Andy Shevchenko