From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68AA82F5F; Thu, 1 Dec 2022 14:17:17 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1BED1D6E; Thu, 1 Dec 2022 06:17:23 -0800 (PST) Received: from donnerap.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D0F8B3F73D; Thu, 1 Dec 2022 06:17:09 -0800 (PST) Date: Thu, 1 Dec 2022 14:17:07 +0000 From: Andre Przywara To: Uwe =?UTF-8?B?S2xlaW5lLUvDtm5pZw==?= Cc: Alexandre Belloni , Heiko Stuebner , Linus Walleij , Alexandre Torgue , dri-devel@lists.freedesktop.org, Douglas Anderson , Conor Dooley , Thierry Reding , Satya Priya , Pavel Machek , Guenter Roeck , Nobuhiro Iwamatsu , Fabio Estevam , linux-riscv@lists.infradead.org, linux-leds@vger.kernel.org, Jerome Brunet , chrome-platform@lists.linux.dev, Florian Fainelli , Samuel Holland , Sean Anderson , Kevin Hilman , Bartosz Golaszewski , Michal Simek , linux-stm32@st-md-mailman.stormreply.com, Hammer Hsieh , linux-rockchip@lists.infradead.org, Chen-Yu Tsai , Matthias Kaehlcke , Broadcom internal kernel review list , NXP Linux Team , Orson Zhai , linux-sunxi@lists.linux.dev, linux-pwm@vger.kernel.org, Maxime Coquelin , Martin Blumenstingl , Ray Jui , Sascha Hauer , Stephen Boyd , linux-gpio@vger.kernel.org, Fabrice Gasnier , linux-mediatek@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, Baolin Wang , Paul Walmsley , Matthias Brugger , linux-amlogic@lists.infradead.org, Benson Leung , linux-arm-kernel@lists.infradead.org, Scott Branden , Bjorn Andersson , Nicolas Ferre , Michael Walle , Palmer Dabbelt , Pengutronix Kernel Team , Chunyan Zhang , Shawn Guo , Claudiu Beznea Subject: Re: [PATCH v2 01/11] pwm: Make .get_state() callback return an error code Message-ID: <20221201141707.28af0d1d@donnerap.cambridge.arm.com> In-Reply-To: <20221201131604.beq4l22d42tjy6dm@pengutronix.de> References: <20221130152148.2769768-1-u.kleine-koenig@pengutronix.de> <20221130152148.2769768-2-u.kleine-koenig@pengutronix.de> <20221201102252.52ace284@donnerap.cambridge.arm.com> <20221201131604.beq4l22d42tjy6dm@pengutronix.de> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, 1 Dec 2022 14:16:04 +0100 Uwe Kleine-K=C3=B6nig wrote: Hi Uwe, > Hello Andre, >=20 > On Thu, Dec 01, 2022 at 10:22:52AM +0000, Andre Przywara wrote: > > Just one comment: I don't see a sunxi specific patch later in the serie= s, > > though it seems we have at least one error error exit (see prescaler = =3D=3D 0 > > above). Plus potentially another exit if clk_get_rate() (at the very > > beginning) fails. > > Shall I send a patch for that? =20 >=20 > That would we very welcome. I mentioned that shortly in the cover > letter, I wasn't entirely sure how to handle that prescaler =3D 0 case. Ah right, sorry, I missed that. So the Allwinner manual somehow marks those prescaler encodings as reserved or invalid (it's just a "/" in there), and we never set those values in the driver (there is an explicit check). So it could only be a leftover from firmware/bootloader, or someone poking at this register behind our back. I am tempted to just return some -EINVAL. As the current code stands, we don't manipulate any state flags before that check, so it doesn't really matter, but would be best practise, at least. Cheers, Andre