The driver_find_device() accepts a match function pointer to filter the devices for lookup, similar to bus/class_find_device(). However, there is a minor difference in the prototype for the match parameter for driver_find_device() with the now unified version accepted by {bus/class}_find_device(), where it doesn't accept a "const" qualifier for the data argument. This prevents us from reusing the generic match functions for driver_find_device(). For this reason, change the prototype of the driver_find_device() to make the "match" parameter in line with {bus/class}_find_device() and adjust its callers to use the const qualifier. Also, we could now promote the "data" parameter to const as we pass it down as a const parameter to the match functions.
Showing the changes to include/linux (1 of 12 files). Show all
Unified · Split
| @@ -336,8 +336,8 @@ extern int __must_check driver_for_each_device(struct device_driver *drv, · 335 unmodified lines | ||
| 336 | 336 | int (*fn)(struct device *dev, |
| 337 | 337 | void *)); |
| 338 | 338 | struct device *driver_find_device(struct device_driver *drv, |
| 339 | − struct device *start, void *data, | |
| 340 | − int (*match)(struct device *dev, void *data)); | |
| 339 | + struct device *start, const void *data, | |
| 340 | + int (*match)(struct device *dev, const void *data)); | |
| 341 | 341 | |
| 342 | 342 | void driver_deferred_probe_add(struct device *dev); |
| 343 | 343 | int driver_deferred_probe_check_state(struct device *dev); |