From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D8BEC43467 for ; Thu, 8 Oct 2020 12:30:53 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 05D232083B for ; Thu, 8 Oct 2020 12:30:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2f4zgJ3j"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GWZH4Wsc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05D232083B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HL0gpgroGXovOwzuGIFUz+HDWrgpT4VH/m0hBvBDfOg=; b=2f4zgJ3jq/EeoLUtRWavk6DS+ s70LtTogXJo5u7wN29Cc2ziFt28a7QKulz4MCGvrtCTxAIW40RpY6xhf//VvRIrRwr9F23V1NnZi0 e4YIPjDJWLPBmfxSsjhKejptf2+VEmzZLyznQICVGNNSQMLcT9XqcO+xuUrqUiOcQ/wK2nkGBs6Hb MYRca+hMUJ4LVCBtBrTWz0QMkaDcCT4YB7OradQHgObMhF1MceBy1x1FOXMu1duZT//lslxKTR5YS gvK51B8IDFYfldI+wz7kRj7zUiYhPJ7+s6DHU13xOxCQFj6xBEc0dPGofyO1vgDQOl6d1Gg5dg0sp F9xt+un3g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQV2h-000211-HN; Thu, 08 Oct 2020 12:29:07 +0000 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQV2e-0001zx-Ic for linux-arm-kernel@lists.infradead.org; Thu, 08 Oct 2020 12:29:05 +0000 Received: by mail-qk1-x744.google.com with SMTP id q63so6733356qkf.3 for ; Thu, 08 Oct 2020 05:29:02 -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=L+T+Mlm/JCxCYUqi0t2sTT67u00gxB27VW90eip5Nu4=; b=GWZH4Wsc2aHIRWPhTfI/wUW1Cvrdnj7YM0r+U76Azji2t1Q7bjTZ8EBdQEZps/R8EA ak/CwZurudp06MPVVduv2rKZzDw1sosX6CPZHd+gqkVcSi3gIMaUb+/yF/6Z5qU2vo// MCsjt1+d6bQLCFMXcs9wf9bCJJAi1UkxqjSsj+DD8ppuX2C8BwcCoDmCXYUZMooodgg5 xKUUOZZYiqygUgjxAeHAzJZkoxLa0etoSJHbSVtyJxe+DcJo5fvgYgwzCSw4j93b1KDw ilYKaxchkMZMP4paXNLq+yefqbXz/vTQ1QXK9V6QV++9U8gyG3kbYrVLMs0YOZ/7PR/A sC9Q== 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=L+T+Mlm/JCxCYUqi0t2sTT67u00gxB27VW90eip5Nu4=; b=lIhKCLZGqGSdug+hP0U5jw24PchlmUmu3wYMGN4OnM2oS4xG7Z7qr1+WHI3FiIt3ZY 2EPSZH9RdjbPRJ0cu7cgI6KJ+Y2SalFmQM5lYep5JWoqxwa5etdF22YkbjsMoYAPf17x lqBcncDeduE0f0DsKg6PGChESe0UfRhEU5qJipBtlDsaxsCxV+sxvKes5Jio98oVTZPb 7Ckl+lMiPN2YvA5G/xjEqicrGb+I/5WfENWjl5eIUBWDwB4t7556XlbQS23oFkCzqAZQ EWEVOUNVo9vuEPza4qks88zuudnKmbVUe7RqPD5Ecf3cX3hVml77UYyG2dbOXBErJLmH GfIQ== X-Gm-Message-State: AOAM532IK7FP9/EdbHrdMWjjQzmxBfbaxG7pZI+JoznE2KBdxfNCCKqK tdvjXae6p1hKga6dMAE3W+s= X-Google-Smtp-Source: ABdhPJwUp1exFR9P/8N0SjYBSQyJ3/neiSlBncodafR8VBncaGZtGzbfV8NnSx5b2OLKgJHopawzIw== X-Received: by 2002:a05:620a:99d:: with SMTP id x29mr1825111qkx.415.1602160141227; Thu, 08 Oct 2020 05:29:01 -0700 (PDT) Received: from shinobu (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id 184sm27349qkl.34.2020.10.08.05.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 05:29:00 -0700 (PDT) Date: Thu, 8 Oct 2020 08:28:45 -0400 From: William Breathitt Gray To: Pavel Machek Subject: Re: [PATCH v5 4/5] docs: counter: Document character device interface Message-ID: <20201008122845.GA3314@shinobu> References: <54190f9875b81b6aa5483a7710b084053a44abb8.1601170670.git.vilhelm.gray@gmail.com> <20201008080909.GA31561@amd> MIME-Version: 1.0 In-Reply-To: <20201008080909.GA31561@amd> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201008_082904_633587_C61604CC X-CRM114-Status: GOOD ( 15.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kamel.bouhara@bootlin.com, gwendal@chromium.org, david@lechnology.com, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mcoquelin.stm32@gmail.com, syednwaris@gmail.com, linux-stm32@st-md-mailman.stormreply.com, jic23@kernel.org, alexandre.torgue@st.com Content-Type: multipart/mixed; boundary="===============5048612281988313076==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============5048612281988313076== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline --/04w6evG8XlLl3ft Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 08, 2020 at 10:09:09AM +0200, Pavel Machek wrote: > Hi! >=20 > > + int main(void) > > + { > > + struct pollfd pfd =3D { .events =3D POLLIN }; > > + struct counter_event event_data[2]; > > + > > + pfd.fd =3D open("/dev/counter0", O_RDWR); > > + > > + ioctl(pfd.fd, COUNTER_SET_WATCH_IOCTL, watches); > > + ioctl(pfd.fd, COUNTER_SET_WATCH_IOCTL, watches + 1); > > + ioctl(pfd.fd, COUNTER_LOAD_WATCHES_IOCTL); > > + > > + for (;;) { > > + poll(&pfd, 1, -1); >=20 > Why do poll, when you are doing blocking read? >=20 > > + read(pfd.fd, event_data, sizeof(event_data)); >=20 > Does your new chrdev always guarantee returning complete buffer? >=20 > If so, should it behave like that? >=20 > Best regards, > Pavel > --=20 > (english) http://www.livejournal.com/~pavelmachek > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/b= log.html I suppose you're right: a poll() should be redundant now with this version of the character device implementation because buffers will always return complete; so a blocking read() should achieve the same behavior that a poll() with read() would. I'll give some more time for additional feedback to come in for this version of the patchset, and then likely remove support for poll() in the v6 submission. William Breathitt Gray --/04w6evG8XlLl3ft Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEk5I4PDJ2w1cDf/bghvpINdm7VJIFAl9/BfMACgkQhvpINdm7 VJLlWxAA6P8iWbbwKdj7bkiAQIaSMh8Os/F1sO6AcUBqYxmMS2284jYpB1PWYm86 WMOfpjzE1TL+qc8Zl0/McZydw2huS5HvhRq4++PM/W+5Ohv/uajZiQyoC5jlmBIF 7u4ewc+X37t0T7SSdtdOPM6+em8Qdq/8ghPEgEWGHfBe/ls/eTcD4I1IZikpHyft PM776AufGoc8A/IIaLYtO5UEI1dNXmyRrK+GOZJft+lRtMZWTjd5j6nK+vfiCaw9 hS2dJofatgyjZBxvqD6t8D+PRhyebaeKyAaK0TQPtu9P+61cZcVcCJ6iKV7Ugh/T 41kYb7opP8j9gxv9HoJbBbYtTTB5yGGO8fRBQ1vO2pLXNXuaEE9v/w+LyagKi/Kh j+crZFgPJIpvYcm6vi7Vr5KP+jl8Rbm1i4UjoAv4a07RR+D7H3c+v9jFAQDezB48 dIww19g41Yig28jQ7Un5n4drOxPbc4lIYJDYYncsHlJea6/I2K8eM8pTakOSiv9j aBQSoG+PaDfQnsM462KMpgiNn25Nz/WLz2dbJP6phwRJGr5auPue8EbxW5m1Cu5y KhX7B1QALpZWo76BFYcst6GMD/dz1T5XeGGCkGZvS/8RiIfRVMLefBc9DY0QPxJz QPrc+N2DCihZhAKPQRtptqgh36cm37FZV0jAE3YGJH4AZOxEFjM= =kkTp -----END PGP SIGNATURE----- --/04w6evG8XlLl3ft-- --===============5048612281988313076== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============5048612281988313076==--