Re: [PATCH v2 00/28] drivers: Consolidate device lookup helpers

From: Suzuki K Poulose
Date: Mon Jun 24 2019 - 04:32:00 EST


Greg,

On 24/06/2019 04:23, Greg KH wrote:
On Fri, Jun 14, 2019 at 06:53:55PM +0100, Suzuki K Poulose wrote:
We have device iterators to find a particular device matching a criteria
for a given bus/class/driver. i.e, {bus,class,driver}_find_device() APIs.
The matching criteria is a function pointer for the APIs. Often the lookup
is based on a generic property of a device (e.g, name, fwnode, of node pointer
or device type) rather than a driver specific information. However, each driver
writes up its own "match" function, spilling the similar match functions all
over the driver subsystems.

Additionally the prototype for the "match" functions accepted by the above APIs
have a minute difference which prevents us otherwise sharing the match functions.
i.e,
int (*match)(struct device *dev, void *data) for {bus/driver}_find_device()
vs
int (*match)(struct device *dev, const void *) for class_find_device()

If we promote the former to accept a "const void*" parameter, we could share one
single match function for all the helpers. This series achieves the following:

a) [Patches 03-05] Unify the prototype for "match" functions accepted by the
device lookup APIs.

I've applied the first 6 patches of this series to my tree now. Let's
see how that goes, and this should give you a more solid base to redo
the rest of the series off of.

Thanks for that. I will rebase my next version on top your tree sometime soon.

Cheers
Suzuki