Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp821851lqj; Mon, 3 Jun 2024 01:32:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWdYytpgMFuxNJV4ZitHq2yWf14hZ75LWFdnuCYyoxwV4FxlClYFjhFRK6wfQD0e4c6XbDsOzcDDtytkl2it4sLiRzPd7LTY/Wmhe3aOg== X-Google-Smtp-Source: AGHT+IFnQZkSSKW0sLd7k9FDjEvSsNPt3gWgyHkrigflM5v1yhFkeM62V9xb4xVTscoPcKgFz8FE X-Received: by 2002:a17:906:b0c6:b0:a67:7d34:3205 with SMTP id a640c23a62f3a-a68208fe45emr562447866b.35.1717403535414; Mon, 03 Jun 2024 01:32:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717403535; cv=pass; d=google.com; s=arc-20160816; b=y6rCjheR7cYBdNK9sJivh3eajDiAZue8InNApNlvDi+/aG4H+hQNcilEIsAqvqamsp xLh46ZwnR99cycwiZGYqJTDa56lWzP+/L3GYw6xrwH1S1Jo/ZfQ/sLz1Iq8bkIzHt8Ji 9nbp8Zi5P4YVP2Ncrph2FkxfyZBCH26uqDVj2rGvC7HbrK78ZXsK7XDZBLKKCv2Jdu4b NvYCj3gveOS7gPpjzRTVIl5UuQo/vHGmU5rKJmIMjGgfZasTIzJxEWWk4cxqs0tHxSxw Z2NrppdFOtLbaxwD6jqqr9XREQtYQ5x+u5DtiL4c0RmbVaPjSNLuz/btO6pNG8s0vXpF SXUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=3SR+OQhYkTg9lzBQDK1gFJ8R3TWRUSp36xtonngLD3E=; fh=YM2OiY2l4dDz6+ml3PI0JPhNlWdVRpUgHmIzNb1QIkw=; b=QGAI8PnljaPXuetzn7o9gLFNRXiiUo/g2AC/W3fk5DLDqVCR7XI4sU+5FnI8RYKn/S wnyBkJEwPFqAgvEQaNFIMFKYHi5IDiTBMwuIZlR1TpSTaUc98UK9VoP1KJ8TdgokNRGh eLnuQCAcyGmt9PDJYGIX/YWkqpf8QOCzpo6B3Q/MX2cNZm3V4OKmI37prQT0lo1rdTIG yMbJi7+zEYHmymUPpO+4GSsXMm3QZU1HiNcjqnbx0BK85NKf6MZB6/nNKcw4UmbFubob 8zC67wiWjD0ZXQkJv1wqvLTOe8ALgX1zoMgEETvCc99+2ARolrB+f1ec508Xe4DtH0wa 5ciQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b="k6ZltS/1"; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-198787-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198787-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a68ae2bf695si258641466b.1053.2024.06.03.01.32.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 01:32:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198787-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b="k6ZltS/1"; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-198787-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198787-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 206DE1F2315D for ; Mon, 3 Jun 2024 08:32:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A1EC5F876; Mon, 3 Jun 2024 08:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="k6ZltS/1" Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1704B111AD for ; Mon, 3 Jun 2024 08:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717403526; cv=none; b=AwN5sLiiGR/O9bBU58MMKoAoiPGpxKuYUWLndatsdKROHB/6WB7nVKzgDX1NW6bxh+4t6DeZLsmc/mn/g9JKBdV4K6IaXN5eWieEPpERaSPMLkWKNn9uKZnjn5FsFcM/WMmTW8eWwtGqN9jLlsavrcGCGey1HmyLJZC37ijc/og= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717403526; c=relaxed/simple; bh=YRW7PjUYem427Q9e1TQrMgKat4e5UnvaCX8B8ou59PM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=S239ALhOi2soSEtIqBt2ixMJeZI4rkXZeSiBCaQKf4L+XTHqGdUbV4JrTSzNnhtyoo9b6rgcJYI2iQ4SiMOl7cAoRPkCcAYLS98WP4zQa1rrpm4zOVFY8Chl10tNu2annpSIUOBkOXNLT7raCU2/mEcWfu/wW2KfWxmINGp0YfI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=k6ZltS/1; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2eaa794eb9fso18750011fa.2 for ; Mon, 03 Jun 2024 01:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1717403523; x=1718008323; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3SR+OQhYkTg9lzBQDK1gFJ8R3TWRUSp36xtonngLD3E=; b=k6ZltS/1TUQYlHTdWHBAOsvrJ6kWb3rWAGST7FpFhrsS2b1/4I0yxn1TyFbrMcTPnZ 9hfDiWWUmDuN9sNKrAVxuKXNhuVWh0K6N0eJzn3BPm6GDAarKkVzgNBObpVaZxJwTAjn Z/ln1i+WlL4WCpPrBJ/5d2xsYA3FTHWEZgv4GDDViQ0ViswCAbrAojB+q8ABZq2wAYoD vfRtQt27iBtnTB3EFElLgreiecE9vgHOv0bFhXRk0Yhlbwp8epT0JQl8xLwXvgym5sJj 8NFQT078BQL4pFh9jACikdOHZEcGPy4m/BqpBmqIW3skJZEGYLzEQLYm2/hNf1/A7lMf OgKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717403523; x=1718008323; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3SR+OQhYkTg9lzBQDK1gFJ8R3TWRUSp36xtonngLD3E=; b=LPjiT110HHz9OCZpH+DPAQbBKbKMaY8+MvQfgkL0LjynpgfFt3dxYcLP3Kj6TY2lh6 5i/2hNYQxbILcwLErG2aOW1/oYJDjkTEdyo87xFlzoWdUxHtkue2xfCS3eM+CqU/o4zm ef8SYLU9DDnsxNtwsYuYcGfL9QmOD8K+z0aJiWRO41cFKGG6ct5lxHZszjr6Tz+6K+ge QVT7RoBTP7jou08xyDJ2eeal0WtDuZirDS5doFRAOe7s/NSLKS2708hcewOh6dFlUDc9 HssL+yq7pNq+LG1Ocd3TpNxQY2tSbYfn7K27ulo00PVB79TOiRVmGhzXN/zDNZh01F7h YA7g== X-Forwarded-Encrypted: i=1; AJvYcCVNZ5AKaxHkRYreBxCoWmuRGoNwO7SzlWlZfxEg1giHovDc24JDeUjrIllNiziyVnLZ5HnSWFcSB6ooxMHDt3wKcYesDPVwaCsM0so+ X-Gm-Message-State: AOJu0YwoZhdsddmHCv70xXEGAQMnfZdzymOevdzE3ANflhOf/w2wzcaV kd5wetePNYcAbOOm/o6UXpJf120JJoflkPe8ja7tSZi9ohuCSQtlBBfXhkRHz6eiqrjAHmm1j7B 546IWHpPaYeMjSwbJvmPAmzxCw+DcKq2IoOqSMA== X-Received: by 2002:a2e:870d:0:b0:2e9:8a16:fe31 with SMTP id 38308e7fff4ca-2ea950aee36mr62217721fa.2.1717403523221; Mon, 03 Jun 2024 01:32:03 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240602074925.2489486-1-foxhoundsk.tw@gmail.com> In-Reply-To: <20240602074925.2489486-1-foxhoundsk.tw@gmail.com> From: Bartosz Golaszewski Date: Mon, 3 Jun 2024 10:31:52 +0200 Message-ID: Subject: Re: [PATCH] docs: gpio: prefer pread(2) for interrupt reading To: Huichun Feng Cc: corbet@lwn.net, linus.walleij@linaro.org, linux-doc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, warthog618@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Jun 2, 2024 at 9:49=E2=80=AFAM Huichun Feng wrote: > > In legacy sysfs GPIO, when using poll(2) on the sysfs GPIO value for > state change awaiting, a subsequent read(2) is required for consuming > the event, which the doc recommends the use of lseek(2) or > close-and-reopen to reset the file offset afterwards. > > The recommendations however, require at least 2 syscalls to consume > the event. Gladly, use of pread(2) require only 1 syscall for the > consumption. Let's advertise this usage by prioritizing its placement. > > Signed-off-by: Huichun Feng > --- > Documentation/userspace-api/gpio/sysfs.rst | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/Documentation/userspace-api/gpio/sysfs.rst b/Documentation/u= serspace-api/gpio/sysfs.rst > index 116921048..bd64896de 100644 > --- a/Documentation/userspace-api/gpio/sysfs.rst > +++ b/Documentation/userspace-api/gpio/sysfs.rst > @@ -97,9 +97,10 @@ and have the following read/write attributes: > poll(2) will return whenever the interrupt was triggered.= If > you use poll(2), set the events POLLPRI and POLLERR. If y= ou > use select(2), set the file descriptor in exceptfds. Afte= r > - poll(2) returns, either lseek(2) to the beginning of the = sysfs > - file and read the new value or close the file and re-open= it > - to read the value. > + poll(2) returns, use pread(2) to read the value at offset > + zero. Alternatively, either lseek(2) to the beginning of = the > + sysfs file and read the new value or close the file and > + re-open it to read the value. > > "edge" ... > reads as either "none", "rising", "falling", or > -- > 2.34.1 > Please don't send new versions of a patch as responses in an email thread. Otherwise tools such as b4 cannot tell if it's a new version or part of a larger series. Please always start a new thread with get send-email or - better yet - start using b4 and let it manage the series for you. Please resend this correctly. Bart