Re: [RFC PATCHv2 1/4] drivers/otp: add initial support for OTP memory

Arnd Bergmann
2011-03-25T22:53:51Z

On Friday 25 March 2011 23:38:00 Mike Frysinger wrote:
> On Fri, Mar 25, 2011 at 18:35, Arnd Bergmann wrote:
> > One more thing that I just realized:
> > I think it would be better not to allow arbitrary ioctl commands to
> > be interpreted by the individual drivers. Instead, interpret them
> > in the common code and pass the data to the drivers through separate
> > otp_device_ops function pointers, one per ioctl command.
> >
> > This will reduce the amount of code needed in each driver when you
> > have multiple ones implementing the same ioctls, and help to
> > ensure that they all treat the arguments in the same way.
>
> i think we should do what the rtc framework did ... there are common
> ioctls which call specific function pointers in the driver, and any
> unhandled ioctls get passed to the driver-specific ioctl function.
> this should cover everyone's needs.

It depends on how obscure the ioctls get, but I think the first
attempt should always be to standardize them across the subsystem.
A lot of things are wrong with the whole concept, but when they
are needed, you should at least try to shield individual drivers
from them.

Many subsystems end up needing both common and driver specific
ioctls as they grow, I just wouldn't do that to start out with.
There's always hope that the latest subsystem will be better than
the others ;-).

Arnd