Re: [PATCH v1 1/2] pwm: Add count to sysfs for Intel PWM driver

From: Uwe Kleine-König
Date: Thu Jan 13 2022 - 09:11:42 EST


Hello,

On Tue, Jan 04, 2022 at 03:58:55PM +0200, Andy Shevchenko wrote:
> On Mon, Jan 03, 2022 at 01:14:54PM +0100, Uwe Kleine-König wrote:
> > If we really want to support a count, I request that all drivers that
> > don't support it get updated to refuse a request with count != 0.
>
> Hmm... Not sure it worth it, perhaps taking into account above the -1
> (in unsigned type) returned on ->get_state() can suffice as not supporting
> feature?

In my eyes that's a bad idea. You have to touch most drivers anyhow to
set the -1. So the outcome is the worst possible combination: Many
changes and still much implicit logic distributed between the drivers
and the core about what is supported and what not.

(Or you have to initialize .count = -1 before calling the get_state
callback. Then you get rid of "have to touch most drivers". But that's
still ugly IMO.)

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature