diff options
| author | Zijun Hu <[email protected]> | 2024-12-24 13:05:03 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2025-01-03 10:19:35 +0000 |
| commit | f1e8bf56320a7fb32095b6c51b707459361b403b (patch) | |
| tree | eb3d636aab796bf613249cb7e7a71d06dce61a31 /drivers/firmware/efi/dev-path-parser.c | |
| parent | bus: fsl-mc: Constify fsl_mc_device_match() (diff) | |
| download | kernel-f1e8bf56320a7fb32095b6c51b707459361b403b.tar.gz kernel-f1e8bf56320a7fb32095b6c51b707459361b403b.zip | |
driver core: Constify API device_find_child() and adapt for various usages
Constify the following API:
struct device *device_find_child(struct device *dev, void *data,
int (*match)(struct device *dev, void *data));
To :
struct device *device_find_child(struct device *dev, const void *data,
device_match_t match);
typedef int (*device_match_t)(struct device *dev, const void *data);
with the following reasons:
- Protect caller's match data @*data which is for comparison and lookup
and the API does not actually need to modify @*data.
- Make the API's parameters (@match)() and @data have the same type as
all of other device finding APIs (bus|class|driver)_find_device().
- All kinds of existing device match functions can be directly taken
as the API's argument, they were exported by driver core.
Constify the API and adapt for various existing usages.
BTW, various subsystem changes are squashed into this commit to meet
'git bisect' requirement, and this commit has the minimal and simplest
changes to complement squashing shortcoming, and that may bring extra
code improvement.
Reviewed-by: Alison Schofield <[email protected]>
Reviewed-by: Takashi Sakamoto <[email protected]>
Acked-by: Uwe Kleine-König <[email protected]> # for drivers/pwm
Signed-off-by: Zijun Hu <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Mathieu Poirier <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/firmware/efi/dev-path-parser.c')
| -rw-r--r-- | drivers/firmware/efi/dev-path-parser.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/firmware/efi/dev-path-parser.c b/drivers/firmware/efi/dev-path-parser.c index 937be269fee8..13ea141c0def 100644 --- a/drivers/firmware/efi/dev-path-parser.c +++ b/drivers/firmware/efi/dev-path-parser.c @@ -47,9 +47,9 @@ static long __init parse_acpi_path(const struct efi_dev_path *node, return 0; } -static int __init match_pci_dev(struct device *dev, void *data) +static int __init match_pci_dev(struct device *dev, const void *data) { - unsigned int devfn = *(unsigned int *)data; + unsigned int devfn = *(const unsigned int *)data; return dev_is_pci(dev) && to_pci_dev(dev)->devfn == devfn; } |
