Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp577007pxa; Tue, 4 Aug 2020 12:28:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSSZFJBbidWmOPPYFKD1++3r7eenwQ56rY7HQWihFBF8B5E9Eiq024prDXjaDKuiVYArC8 X-Received: by 2002:a17:906:1f88:: with SMTP id t8mr22685646ejr.241.1596569332178; Tue, 04 Aug 2020 12:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596569332; cv=none; d=google.com; s=arc-20160816; b=bt+CLC/UgW3/j6GX0qng37Yc5ULuMtMJMn178Xl+pU3wX7rjUzOqYglP6a2mvKOxZU vnYNI83LPuo/2t5WZ/0xe2uIwS5d9nOhaaTU901+9XyB1W9jSTdhrGJXbPAtiXrCeDsK yNXytqf5xgtmTRpWXrY/5EzuvZf6Jz7ukZ4BiFUn56BZv7QcTMy1h7j4DQURd19s1jzr 5mRjqSF9fJBCiC8P28CVczuKFqR2Z9EsSyVhUnpp+NsryjoNO+mSJg8dTKoeCuLvHkJp gW+e8FUo5z0grBfwBIcEGguag92CUdd6pilR8zmxeGFYc796xhncXzfqF3xXaiWDOo0r qJow== 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=QZPv3vyb9T7Ph9oNjo817uichWZWclCWnCIRIilrMbI=; b=ENNQ+B6FcjLCilrT6kyGwIakAaHwdymOiNR1hlsDnMrUL6kUHSfXgeGMPw1/KskjB6 dAaLdHTbFTEAe16tpH1JuH/ABHH4wkcG7R0xuEqz6UTXR8yBf5gMwct6GLH7wTAktEjc lwI/b3tQA5WEG2qU4K79vpw1FfoWj8FZqA5O0F7kIrtEJcLp3Nb7FKTGH3IIbomQVdYY OCwWWrNPu+pOvZTSRHXFtBfHi+yHDp3R73KO5KcsZ0o30/D9wzxQ5s/4rQw2vY2pDwf8 Tu3i7U5enYhEl5jJzaqi5ZwaIYlZhW3ro4CuSch7zCEfNWiVmj2QVWsHV1vM5bXnYohg 3Z8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=luRCZFvN; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u6si11592912edd.428.2020.08.04.12.28.29; Tue, 04 Aug 2020 12:28:52 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=luRCZFvN; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728244AbgHDT2R (ORCPT + 99 others); Tue, 4 Aug 2020 15:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727124AbgHDT2Q (ORCPT ); Tue, 4 Aug 2020 15:28:16 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C5C5C061756 for ; Tue, 4 Aug 2020 12:28:16 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id o22so31604790qtt.13 for ; Tue, 04 Aug 2020 12:28:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QZPv3vyb9T7Ph9oNjo817uichWZWclCWnCIRIilrMbI=; b=luRCZFvNv1qw6XK0lP5bctiCtoKipS1zkSan+vF/4w0QNcp7tvBGPSXhl2Hu55Zni2 IVovI6W03P4sCwu3UjBAbkx9wSEIM5mQM1b/oB7V1Z/USbGH+S+9dq8ORM02WibWYy9b bgog7iYT5g2zlN7dzdekrUfbBalT2olGkwJrp7/9NhFWIV2ca2WOjnWPWf+Dn0IvLV1u /rmJodWFshUyd/AfAbXgpT+mnlWds6J8r8y3ipFHdaov9xAMXc+gV2A4Kn6NNbfyijtK RC6Atw7BnwPqoTwMP2okxisEmbqsqUZo0D27Afy3247WVNWN8l89zGmUWslqyy5QQDiD eWjg== 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=QZPv3vyb9T7Ph9oNjo817uichWZWclCWnCIRIilrMbI=; b=KRCRluwDMf15XMBoEe3zkkWglQNhdZdJBxtcFKXrSYjVBkgEmFN7UgCZqWh+KrBI/Z MBpznshM8VzINwQLIgzHFfBS23NZhAEkVHGnFc0BX6uQ+arKEg2WvFpL89RwQHtF21eU xjoZXvvUVG1qU/Kk9A9UFGIaD0UWp0/wDxn982FP/3lkEu9F6V6xulMDXxooaNpH1MtQ VBGAUGvKtQSSexbbqiGxwnHA4ZvDY/2COMvdcAkFZmxMv9wkMsUZvtzjHBpYjC5Nsy3g Vru7BbLlVX1L5SKWT81Ohw9bGEdQd8NTgBTcvnG2TYTgo0yuQaRU6PR072Ae7piLD+Rd U4LA== X-Gm-Message-State: AOAM5318uBBdn5KyXDdiMnqYzM1D3IsLSa1FCcRc+V+e7y8km7gAUohP 2vww1YUXqvuHalxJrQCjTfRWbNdgZ+Sv3StFKk3cUA== X-Received: by 2002:aed:21da:: with SMTP id m26mr23617075qtc.197.1596569295695; Tue, 04 Aug 2020 12:28:15 -0700 (PDT) MIME-Version: 1.0 References: <20200725041955.9985-1-warthog618@gmail.com> <20200725041955.9985-8-warthog618@gmail.com> In-Reply-To: <20200725041955.9985-8-warthog618@gmail.com> From: Bartosz Golaszewski Date: Tue, 4 Aug 2020 21:28:04 +0200 Message-ID: Subject: Re: [PATCH v2 07/18] gpiolib: cdev: support edge detection for uAPI v2 To: Kent Gibson Cc: LKML , linux-gpio , Linus Walleij 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 Sat, Jul 25, 2020 at 6:21 AM Kent Gibson wrote: > > Add support for edge detection to lines requested using > GPIO_GET_LINE_IOCTL. > > Signed-off-by: Kent Gibson > --- [snip!] > + > +static irqreturn_t edge_irq_thread(int irq, void *p) > +{ > + struct edge_detector *edet = p; > + struct line *line = edet->line; > + struct gpio_desc *desc = edge_detector_desc(edet); > + struct gpioline_event le; > + int ret; > + > + /* Do not leak kernel stack to userspace */ > + memset(&le, 0, sizeof(le)); > + > + /* > + * We may be running from a nested threaded interrupt in which case > + * we didn't get the timestamp from edge_irq_handler(). > + */ > + if (!edet->timestamp) { > + le.timestamp = ktime_get_ns(); IIRC Marc suggested using smp_rmw() here before reading the timestamp. Do we still need it or something changed? Bartosz