Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1033343pxu; Thu, 8 Oct 2020 01:11:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvzAYuY0ID66b0nrOBBbnjFHohpYXWfOhiYCgGoGWeSN5mUPhXHMH8331m5UYPFla+3IbQ X-Received: by 2002:aa7:d65a:: with SMTP id v26mr8042681edr.82.1602144666935; Thu, 08 Oct 2020 01:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602144666; cv=none; d=google.com; s=arc-20160816; b=db2VQ0KX8Cwh/aVgTMx52Txu6E2JrUDubXkj3sctAqqHg5FgLt9OiW9YeYiVbt1cOi vgOwW8/M5jR3E5fFevXHQPX2nrKl+h2wqgIGuXgwgZzzgGWqjRocRqIjYV8H7y0ssHH4 wGDGaoDe9D1ufRErl7zR9A4XTA1V4iD2fYnzX+Ah+UPnNVldFu178EfxfLDK8s1Ij1+l iqu2DcUjd5tM/HrnPsuv9IohlV7+kbZs8Rkiduvv1xDL/F0HRT90bg3hvODMj6Du7X7r XyEvFJRsi6j5dQbdmAfe7eysgyZhbJlIqrAQCGkzbljlcmxTyxnJtsen7OiJOzBbmpx2 UodA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=sBRC6tEwHmFD3PLMObUiUBKeit/Ggouh20SA7G66gfs=; b=QE+JiqK6Act9SI+q5aGKkuVdu5UqQngmsl9Mrp/YrDTx5fnHjBJq3pzRs3O9IF6HnF rcDEbpo3hfbTBovxOPU3cwSQ7aAgzb4EYd8gRtn794mqXrMzRAOGr4+qQFK/yYiFmavt i4xNrS8sL6YFxchgIevZEqZrQ5K82ineYraP2En3Vt8nIzj247hg69axgInWu7fMzQbI 8kqxPc2+xT1ygoe6KajYzQBO9GMr02BZAgWzetcEBHZovfBA6B7JhloF8cPC8M/2ou9a 44ijEayUOELM+2MW0laHxdDhWKBB/nXksRad5mlhYnQDJin6rXonCrI1GWYqx1eRH4og 1jYg== ARC-Authentication-Results: i=1; mx.google.com; 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 i10si3289320ejv.243.2020.10.08.01.10.43; Thu, 08 Oct 2020 01:11:06 -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; 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 S1728526AbgJHIJO (ORCPT + 99 others); Thu, 8 Oct 2020 04:09:14 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:59738 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728004AbgJHIJO (ORCPT ); Thu, 8 Oct 2020 04:09:14 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 7D1C01C0BA3; Thu, 8 Oct 2020 10:09:11 +0200 (CEST) Date: Thu, 8 Oct 2020 10:09:09 +0200 From: Pavel Machek To: William Breathitt Gray Cc: jic23@kernel.org, kamel.bouhara@bootlin.com, gwendal@chromium.org, alexandre.belloni@bootlin.com, david@lechnology.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, syednwaris@gmail.com, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com Subject: Re: [PATCH v5 4/5] docs: counter: Document character device interface Message-ID: <20201008080909.GA31561@amd> References: <54190f9875b81b6aa5483a7710b084053a44abb8.1601170670.git.vilhelm.gray@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5mCyUwZo2JvN/JJP" Content-Disposition: inline In-Reply-To: <54190f9875b81b6aa5483a7710b084053a44abb8.1601170670.git.vilhelm.gray@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > + 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); Why do poll, when you are doing blocking read? > + read(pfd.fd, event_data, sizeof(event_data)); Does your new chrdev always guarantee returning complete buffer? If so, should it behave like that? Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --5mCyUwZo2JvN/JJP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl9+ySUACgkQMOfwapXb+vKILgCdGWcMSFTNlT8BzJiXCxl8XH94 G+kAn1mYy8F8mA++sLAit6PznfuXTwgX =pq8O -----END PGP SIGNATURE----- --5mCyUwZo2JvN/JJP--