On Fri, Nov 20, 2015 at 11:18:42AM +0100, Martin Sperl wrote: > > On 19.11.2015, at 18:15, Mark Brown wrote: > > Please don't do things this way, please make this more data driven - > > have the drivers declare their capabilities so the core can just do > > these things based on those flags rather than requiring active code in > > drivers. This keeps the code central which in turn helps keep things > > maintainable. > Well - I was thinking about starting with this approach for simplicity. > Making it automatic/data-driven by just defining limits that the core > can then handle transparently is something that could come as a next > step. It makes things more complicated in the long run, people start open coding things and then making any changes involves changing per-driver code and we can't use the information in any way other than the one specific way the transformation functions were written. > Also the bus master driver knows what its limitations are, so putting > them inside prepare_message seems reasonable to me - that is unless > you really have spi_device drivers that would handle those as separate > facts and not refuse to work. Every line of code that's in a driver that could be in the core is a maintainence burden, people will want to start doing things like combining functions in fun ways and if we want to try to do things like figure out if we can coalesce adjacent transfers in the core (which we really ought to) it won't know what the limitations that exist are. > > You've got this back to front - drivers are responsible for initialising > > the master when they instantiate it. There's nothing stopping them > > using the data if they have variants to handle but they shouldn't be > > speculatively looking at it on the off chance there's some limit. > I wonder if such a variant-construct does not create more headaches in > the long run as each spi_driver wanting to do something “something” > special would then need to get updated for any additional constraint… I'm sorry but I don't understand what you mean here. However we implement things anything that wants to know about constraints is going to need to be updated to use them.