Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp7323977pxu; Fri, 25 Dec 2020 09:32:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzKso+yCPN7nw1oaMQQ8GvMq/gSvAzk0cksdqXmXWdhXJcTlFjAx/UGOiBX/cuch6TVAaB X-Received: by 2002:a17:906:391b:: with SMTP id f27mr31290813eje.195.1608917555368; Fri, 25 Dec 2020 09:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608917555; cv=none; d=google.com; s=arc-20160816; b=mMCuz42IO/TvUSGPS2Cd+Wsj07n9DWmp8c2A4GIPlVHgNPfsBCpOzS6cfJfoUThUL+ eoQ0pPb7PM4rOmdihg4duqpJPpV+GDH4LKgQSe0s+ruSC4iFCDe9P0ZiGWzUESjNpoDN RgoSNJ/HUQo5I4M5OPKMy1LzTLcszbxoZH47cT14r1gUpZJSYBkgq0+XKoOCE4ZA5eCT JUwgMpuMDnTJt+hSkIEp/wnGv4u8364WhoilSkEPYyjfoF3eXlKKnaPs3qgYVg03QdkU BkRIgRdlXqbcjWq9PZrXh3cGY0rlvITNEtORNlfyXYltovN5h6w4PMazCObJMTOEBc5o ZDUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6tNoeU4rdX0Rp7YesclVSlEoPPasvtmAb8rPCs2D1UA=; b=eiC0dnQIvweIKASc7nOf/nhnBEVhXQmHNEY70IxqkVL8ig0xw3ngYdwly9K4z4G/6r k4oTIh3tJiZtnM1CL6trZ83w50jDxiII+dK8seaUhIw1k4q4GbXAtXQ4XBSzF5xP389p HA0rzqCBDfmhZhEAPnrVSvFrV793fLDuH1teN53oLNeG47QBVHY4uj1e/heLY8D9cxpU JOC1+L8cmZt/XbeqE0U8HIwU7h4QLVZJgYhwk4+gbEdP7IkU7yEfBjUtK1XEh2ptc/aA jzcJVmPtUCwaSnv+zhwABl0JU2/jAcuVDynaOlDZ72CAzp6OjwGv6XzFoTp4fCd7FR/M qaHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IIbk73+3; 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 d1si16240200edr.28.2020.12.25.09.32.12; Fri, 25 Dec 2020 09:32:35 -0800 (PST) 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=IIbk73+3; 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 S1726737AbgLYRat (ORCPT + 99 others); Fri, 25 Dec 2020 12:30:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725953AbgLYRas (ORCPT ); Fri, 25 Dec 2020 12:30:48 -0500 Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 975A7C061757; Fri, 25 Dec 2020 09:30:08 -0800 (PST) Received: by mail-qk1-x729.google.com with SMTP id w79so4335507qkb.5; Fri, 25 Dec 2020 09:30:08 -0800 (PST) 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=6tNoeU4rdX0Rp7YesclVSlEoPPasvtmAb8rPCs2D1UA=; b=IIbk73+3Kn9m25AbiWeCyLcszXZliqbmEyDL1AOj0RVNhCQYa3sLxEQIqXZBW3Ypic DQ4wzgFr5B4rLcyjNdl29h0/7/ozhfpbDAocjKdrhtE2hO6WAEXbSpgu+JcR17vgO+sa rQhPpLky45RnexFX4O4NU7kW+Yu2yJBXHMJcLcGRrcFkuwEcTYEHk2G13VPL9sSen70j hSb/9en/J29uqP5MdAdokGjqlxKm4Dhuhv3vLtTcgjZkJhyIDqdlvQ02S5HhEn9hMPGO zktoLKSE4Re4ZHtqIBCUPKVtxs9/k+iyh7tTUzAe1vd+nBFPIspR9ejhvtS0sF/nfH/X gVbw== 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=6tNoeU4rdX0Rp7YesclVSlEoPPasvtmAb8rPCs2D1UA=; b=KLGT+B5iL0Hr6J0kKoz0sdEaPI+J1dMnH1FjSpVgcY5yIaWFv14KgrUdoeSFj+oqkY al2ELnvyIP6dlma6rdneAHrVdzfC8RIJlP+35Ow7vDDanJb0ZtHq35vZOy9dS5xAhRwa a5lBfBhWF0ttr1ZLOoXvyb/dgEhn0S3EsuRy629P1Sk2GyDxNUtGDvQlMX3nKfhSPrZm teZtXEGM7T/UDuWVmH42xQVwEygAl3QMpAkqxoLxGY7dhmVw6wDutZeA65RjFccvKxqy v+VzKUUZRyjP5oqu5cyyjVXMha0cja+mQ64wP/xlFA63LK1T1u25hJVNbQqfT3wfXZv9 W3Uw== X-Gm-Message-State: AOAM531bJw93frHGG7jFX8d24XzMnKYas3TfLtxQ5pnh19XTazjCORSK ZdeWvgEnJNY4Z/gmXnhWGcTfLNXTaj60vA== X-Received: by 2002:a37:a796:: with SMTP id q144mr35953703qke.38.1608917407683; Fri, 25 Dec 2020 09:30:07 -0800 (PST) Received: from shinobu (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id p34sm15771442qtd.62.2020.12.25.09.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 09:30:06 -0800 (PST) Date: Fri, 25 Dec 2020 12:30:04 -0500 From: William Breathitt Gray To: David Lechner Cc: jic23@kernel.org, kernel@pengutronix.de, linux-stm32@st-md-mailman.stormreply.com, a.fatoum@pengutronix.de, kamel.bouhara@bootlin.com, gwendal@chromium.org, alexandre.belloni@bootlin.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, 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, Dan Carpenter Subject: Re: [PATCH v6 3/5] counter: Add character device interface Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Bi9bW/svyG+8ZjzL" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Bi9bW/svyG+8ZjzL Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi David, I agree with your suggested changes -- just a couple select comments following below. On Sun, Dec 13, 2020 at 05:58:26PM -0600, David Lechner wrote: > > +static int counter_add_watch(struct counter_device *const counter, > > + const unsigned long arg) > > +{ [...] > > + > > +dummy_component: > > + comp_node.component =3D watch.component; >=20 >=20 > In my experiments, I added a events_validate driver callback here to > validate each event as it is added. This way the user can know exactly > which event caused the problem rather than waiting for the event_config > callback. Yes, this is a good idea and I have use for this in the 104-quad-8 driver as well. I'm going to name this "watch_validate" however, because I need to validate the requested channel as well as the requested event here (both part of the struct counter_watch). > > diff --git a/include/linux/counter.h b/include/linux/counter.h > > index 3f3f8ba6c1b4..98cd7c035968 100644 > > --- a/include/linux/counter.h >=20 >=20 > >=20 > > +/** > > + * struct counter_event_node - Counter Event node > > + * @l: list of current watching Counter events > > + * @event: event that triggers > > + * @channel: event channel > > + * @comp_list: list of components to watch when event triggers > > + */ > > +struct counter_event_node { > > + struct list_head l; > > + u8 event; > > + u8 channel; > > + struct list_head comp_list; > > +}; > > + >=20 >=20 > Unless this is needed outside of the drivers/counter/ directory, I > would suggest putting it in drivers/counter/counter-chrdev.h instead > of include/linux/counter.h. The "events_list" member of the struct counter_device is a list of struct counter_event_node. The events_configure() callback should parse through this list to determine the current events configuration request. As such, driver authors will need this structure available via include/linux/counter.h so they can parse "events_list". William Breathitt Gray --Bi9bW/svyG+8ZjzL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEk5I4PDJ2w1cDf/bghvpINdm7VJIFAl/mIZwACgkQhvpINdm7 VJIZxxAAhAKczPADq8u05OkOAmgVD7IeT9cUBIB/XnT0VVSVX46G473g78mZwlsx qnfK1l4uDvwjAY+YFFKanUztxg/j60BzJOt9BK4NqWR4ic7J0FPj9i4YgN9J+9oo JmFSjqT8Abo7rEdB426yT9Fof9cBU/oPdOpNSufDNidrxXnTIOKnjA9odG/vgOzl mlXTQHs2glKeLrHIvJOnK7mwy3l11Ew2xhRvBEsMfbzXIYoOkVC8Ax146tHpqBVl hN/vCEU49+JCbZrSOk9EmtjRZ7DiF8AoV7GFUjqGWxkECKx1ov2WeR62DFhUJMvI qC/boNu0BZW2N8HgIvgsgKP0r/v0E+RuRFzcahpS/0YhsNh8fgEVfeIWS2ZaVXWT 7e4FZIOw4Vuk0E2DXw0rWRzvNCCstRsqY9fQ7ee1/WruCHRvZEeiifJADx7E7LBv XwQynYXOgFe1hxXFejwSTgTCMl5y25CaT8JVU8GLYgHYnPKkIVSsOJ5dUgTbRCOu RBbMgZbcBuB1tUy45SP6Rx8in4joA+AGAt6oj4kxrd+/+O2+uvUoNILqoYHAMyV6 EBP78O/sAHNObYnwVJNaM1Bc1VYIF7+pMjotOTtHmkZhs5Ac8qxXih4r+mIZgItu yGeJ9cG82fkziDp+TtNuYXsfLQQhxtdicKmAqzZeg5VSyGQWkQY= =vH3L -----END PGP SIGNATURE----- --Bi9bW/svyG+8ZjzL--