Re: [PATCH v1 3/6] spi: pxa2xx: Remove no more needed PCI ID table

Andy Shevchenko
2022-10-20T17:55:22Z

On Thu, Oct 20, 2022 at 06:45:19PM +0100, Mark Brown wrote:
> On Thu, Oct 20, 2022 at 08:41:43PM +0300, Andy Shevchenko wrote:
>
> > Okay, would it work for you if we check the named resource and only if it's
> > found take a property? In such case we can guarantee (AFAICS) that the 3rd
> > parties (like unknown firmware) won't mess up with the driver.
>
> Not sure I quite get what you're proposing here but I *think* so,
> assuming you mean checking the values if the property is present (and
> error out if the property isn't there at all and you're instantiating
> via a MFD rather than direct PCI/DT binding I guess)?

When we instantiate via MFD, we (semi-)manually create resources for each of
the children. These resources may or may not have a dedicated names. Those
names can be given _only_ inside the source code in the kernel, so it means
it is _explicit_ telling, that we are know where the device in question comes
from.

In the code it will be like

if (resource_with_name_present()) {
ret = device_property_...
if (ret)
return ERROR "No mandatory property provided";
}

Like you said, checking property only when we have resource present _by name_
and bail out if there is none.

--
With Best Regards,
Andy Shevchenko