* [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer
@ 2024-08-11 2:24 Zijun Hu
2024-08-11 2:24 ` [PATCH 01/27] driver core: Constify driver API device_find_child() Zijun Hu
` (26 more replies)
0 siblings, 27 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
This patch series is to constify the following core driver 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);
It mainly make various device_find_child()'s match functions take
const void * as match data type.
Why to constify the API?
(1) It does not make sense, also does not need to, for such device
finding operation to modify caller's match data which is mainly
used for comparison.
(2) It will make the API's match function parameter have the same
signature as all other APIs (bus|class|driver)_find_device().
Previous discussion link:
https://lore.kernel.org/lkml/917359cc-a421-41dd-93f4-d28937fe2325@icloud.com
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
Zijun Hu (27):
driver core: Constify driver API device_find_child()
Bluetooth: hci_sysfs: Make device_find_child()'s match function take a const pointer
serial: core: Make device_find_child()'s match function take a const pointer
usb: typec: class: Make device_find_child()'s match function take a const pointer
gpio: sim: Make device_find_child()'s match function take a const pointer
slimbus: core: Make device_find_child()'s match function take a const pointer
scsi: iscsi: Make device_find_child()'s match function take a const pointer
scsi: iscsi: Constify driver API iscsi_find_flashnode_sess()
scsi: qla4xxx: Make iscsi_find_flashnode_sess()'s match function take a const pointer
pwm: Make device_find_child()'s match function take a const pointer
media: pci: mgb4: Make device_find_child()'s match function take a const pointer
range.h: Make range_contains() take const struct range * as parameter type
cxl/region: Make device_find_child()'s match function take a const pointer
cxl/pmem: Make device_find_child()'s match function take a const pointer
cxl/core/pci: Make device_find_child()'s match function take a const pointer
sparc: vio: Make device_find_child()'s match function take a const pointer
bus: fsl-mc: Make device_find_child()'s match function take a const pointer
block: sunvdc: Make device_find_child()'s match function take a const pointer
firmware: arm_scmi: Make device_find_child()'s match function take a const pointer
efi: dev-path-parser: Make device_find_child()'s match function take a const pointer
drm/mediatek: Make device_find_child()'s match function take a const pointer
nvdimm: Make device_find_child()'s match function take a const pointer
libnvdimm: Make device_find_child()'s match function take a const pointer
rpmsg: core: Make device_find_child()'s match function take a const pointer
thunderbolt: Make device_find_child()'s match function take a const pointer
net: dsa: Make device_find_child()'s match function take a const pointer
cxl/test: Make device_find_child()'s match function take a const pointer
arch/sparc/kernel/vio.c | 6 +++---
drivers/base/core.c | 11 +++--------
drivers/block/sunvdc.c | 8 ++++----
drivers/bus/fsl-mc/dprc-driver.c | 8 ++++----
drivers/cxl/core/pci.c | 4 ++--
drivers/cxl/core/pmem.c | 2 +-
drivers/cxl/core/region.c | 19 +++++++++++--------
drivers/firmware/arm_scmi/bus.c | 4 ++--
drivers/firmware/efi/dev-path-parser.c | 4 ++--
drivers/gpio/gpio-sim.c | 2 +-
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 +-
drivers/media/pci/mgb4/mgb4_core.c | 4 ++--
drivers/nvdimm/bus.c | 2 +-
drivers/nvdimm/claim.c | 4 ++--
drivers/pwm/core.c | 2 +-
drivers/rpmsg/rpmsg_core.c | 4 ++--
drivers/scsi/qla4xxx/ql4_os.c | 3 ++-
drivers/scsi/scsi_transport_iscsi.c | 10 +++++-----
drivers/slimbus/core.c | 11 ++++++-----
drivers/thunderbolt/retimer.c | 2 +-
drivers/thunderbolt/xdomain.c | 2 +-
drivers/tty/serial/serial_core.c | 4 ++--
drivers/usb/typec/class.c | 8 ++++----
include/linux/device.h | 4 ++--
include/linux/range.h | 3 ++-
include/scsi/scsi_transport_iscsi.h | 4 ++--
net/bluetooth/hci_sysfs.c | 2 +-
net/dsa/dsa.c | 2 +-
tools/testing/cxl/test/cxl.c | 2 +-
29 files changed, 72 insertions(+), 71 deletions(-)
---
base-commit: bfa54a793ba77ef696755b66f3ac4ed00c7d1248
change-id: 20240811-const_dfc_done-c5c206675c6b
prerequisite-change-id: 20240801-dev_match_api-415a755fcffb:v2
prerequisite-patch-id: 475b810c1ccacab955c654c223d5214f70c4f6c8
prerequisite-change-id: 20240811-const_dfc_prepare-3ff23c6598e5:v1
prerequisite-patch-id: 81a5ccaa144a7732cae29fc5ea1a13426becee5b
prerequisite-patch-id: 9b77254186b7366809f949f5643f9437fa2528a0
prerequisite-patch-id: 95308bb3eedcf8c4a5e30aa3071116148495329e
prerequisite-patch-id: ee643a52674e2aead02f7be3d011d88507970436
prerequisite-patch-id: 0625de1f03ef4350b1828f0faff7a9d9bdebae94
Best regards,
--
Zijun Hu <quic_zijuhu@quicinc.com>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 01/27] driver core: Constify driver API device_find_child()
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
@ 2024-08-11 2:24 ` Zijun Hu
2024-08-13 9:48 ` Greg Kroah-Hartman
2024-08-11 2:24 ` [PATCH 02/27] Bluetooth: hci_sysfs: Make device_find_child()'s match function take a const pointer Zijun Hu
` (25 subsequent siblings)
26 siblings, 1 reply; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
Constify the following driver 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);
Since it should not modify caller's match data @*data.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/base/core.c | 11 +++--------
include/linux/device.h | 4 ++--
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 3f3ebdb5aa0b..f152e0f8fb03 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -4062,8 +4062,8 @@ EXPORT_SYMBOL_GPL(device_for_each_child_reverse);
*
* NOTE: you will need to drop the reference with put_device() after use.
*/
-struct device *device_find_child(struct device *parent, void *data,
- int (*match)(struct device *dev, void *data))
+struct device *device_find_child(struct device *parent, const void *data,
+ device_match_t match)
{
struct klist_iter i;
struct device *child;
@@ -4108,11 +4108,6 @@ struct device *device_find_child_by_name(struct device *parent,
}
EXPORT_SYMBOL_GPL(device_find_child_by_name);
-static int match_any(struct device *dev, void *unused)
-{
- return 1;
-}
-
/**
* device_find_any_child - device iterator for locating a child device, if any.
* @parent: parent struct device
@@ -4124,7 +4119,7 @@ static int match_any(struct device *dev, void *unused)
*/
struct device *device_find_any_child(struct device *parent)
{
- return device_find_child(parent, NULL, match_any);
+ return device_find_child(parent, NULL, device_match_any);
}
EXPORT_SYMBOL_GPL(device_find_any_child);
diff --git a/include/linux/device.h b/include/linux/device.h
index b2423fca3d45..76f10bdbb4ea 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1073,8 +1073,8 @@ int device_for_each_child(struct device *dev, void *data,
int (*fn)(struct device *dev, void *data));
int device_for_each_child_reverse(struct device *dev, void *data,
int (*fn)(struct device *dev, void *data));
-struct device *device_find_child(struct device *dev, void *data,
- int (*match)(struct device *dev, void *data));
+struct device *device_find_child(struct device *dev, const void *data,
+ device_match_t match);
struct device *device_find_child_by_name(struct device *parent,
const char *name);
struct device *device_find_any_child(struct device *parent);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 02/27] Bluetooth: hci_sysfs: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
2024-08-11 2:24 ` [PATCH 01/27] driver core: Constify driver API device_find_child() Zijun Hu
@ 2024-08-11 2:24 ` Zijun Hu
2024-08-11 2:24 ` [PATCH 03/27] serial: core: " Zijun Hu
` (24 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make __match_tty()
as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
net/bluetooth/hci_sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 367e32fe30eb..36642813d2db 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -26,7 +26,7 @@ static const struct device_type bt_link = {
* is down, and sysfs doesn't support move zombie device,
* so we should move the device before conn device is destroyed.
*/
-static int __match_tty(struct device *dev, void *data)
+static int __match_tty(struct device *dev, const void *data)
{
return !strncmp(dev_name(dev), "rfcomm", 6);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 03/27] serial: core: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
2024-08-11 2:24 ` [PATCH 01/27] driver core: Constify driver API device_find_child() Zijun Hu
2024-08-11 2:24 ` [PATCH 02/27] Bluetooth: hci_sysfs: Make device_find_child()'s match function take a const pointer Zijun Hu
@ 2024-08-11 2:24 ` Zijun Hu
2024-08-11 2:24 ` [PATCH 04/27] usb: typec: class: " Zijun Hu
` (23 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
serial_match_port() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/tty/serial/serial_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 9a18d0b95a41..d22a9db8f54e 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2368,9 +2368,9 @@ struct uart_match {
struct uart_driver *driver;
};
-static int serial_match_port(struct device *dev, void *data)
+static int serial_match_port(struct device *dev, const void *data)
{
- struct uart_match *match = data;
+ const struct uart_match *match = data;
struct tty_driver *tty_drv = match->driver->tty_driver;
dev_t devt = MKDEV(tty_drv->major, tty_drv->minor_start) +
match->port->line;
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 04/27] usb: typec: class: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (2 preceding siblings ...)
2024-08-11 2:24 ` [PATCH 03/27] serial: core: " Zijun Hu
@ 2024-08-11 2:24 ` Zijun Hu
2024-08-11 2:24 ` [PATCH 05/27] gpio: sim: " Zijun Hu
` (22 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make its match
functions take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/usb/typec/class.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 9262fcd4144f..eaaa51ffca04 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -222,10 +222,10 @@ static DEVICE_ATTR_RO(usb_power_delivery_revision);
/* ------------------------------------------------------------------------- */
/* Alternate Modes */
-static int altmode_match(struct device *dev, void *data)
+static int altmode_match(struct device *dev, const void *data)
{
struct typec_altmode *adev = to_typec_altmode(dev);
- struct typec_device_id *id = data;
+ const struct typec_device_id *id = data;
if (!is_typec_altmode(dev))
return 0;
@@ -1161,7 +1161,7 @@ const struct device_type typec_cable_dev_type = {
.release = typec_cable_release,
};
-static int cable_match(struct device *dev, void *data)
+static int cable_match(struct device *dev, const void *data)
{
return is_typec_cable(dev);
}
@@ -1840,7 +1840,7 @@ const struct device_type typec_port_dev_type = {
/* --------------------------------------- */
/* Driver callbacks to report role updates */
-static int partner_match(struct device *dev, void *data)
+static int partner_match(struct device *dev, const void *data)
{
return is_typec_partner(dev);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 05/27] gpio: sim: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (3 preceding siblings ...)
2024-08-11 2:24 ` [PATCH 04/27] usb: typec: class: " Zijun Hu
@ 2024-08-11 2:24 ` Zijun Hu
2024-08-11 2:24 ` [PATCH 06/27] slimbus: core: " Zijun Hu
` (21 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
gpio_sim_dev_match_fwnode() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/gpio/gpio-sim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index dcca1d7f173e..39af176eaa3c 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -413,7 +413,7 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip)
return devm_add_action_or_reset(dev, gpio_sim_sysfs_remove, chip);
}
-static int gpio_sim_dev_match_fwnode(struct device *dev, void *data)
+static int gpio_sim_dev_match_fwnode(struct device *dev, const void *data)
{
return device_match_fwnode(dev, data);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 06/27] slimbus: core: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (4 preceding siblings ...)
2024-08-11 2:24 ` [PATCH 05/27] gpio: sim: " Zijun Hu
@ 2024-08-11 2:24 ` Zijun Hu
2024-08-11 2:24 ` [PATCH 07/27] scsi: iscsi: " Zijun Hu
` (20 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make its match
functions take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/slimbus/core.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index 65e5515f7555..ab927fd077cb 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -328,7 +328,8 @@ void slim_report_absent(struct slim_device *sbdev)
}
EXPORT_SYMBOL_GPL(slim_report_absent);
-static bool slim_eaddr_equal(struct slim_eaddr *a, struct slim_eaddr *b)
+static bool slim_eaddr_equal(const struct slim_eaddr *a,
+ const struct slim_eaddr *b)
{
return (a->manf_id == b->manf_id &&
a->prod_code == b->prod_code &&
@@ -336,9 +337,9 @@ static bool slim_eaddr_equal(struct slim_eaddr *a, struct slim_eaddr *b)
a->instance == b->instance);
}
-static int slim_match_dev(struct device *dev, void *data)
+static int slim_match_dev(struct device *dev, const void *data)
{
- struct slim_eaddr *e_addr = data;
+ const struct slim_eaddr *e_addr = data;
struct slim_device *sbdev = to_slim_device(dev);
return slim_eaddr_equal(&sbdev->e_addr, e_addr);
@@ -384,9 +385,9 @@ struct slim_device *slim_get_device(struct slim_controller *ctrl,
}
EXPORT_SYMBOL_GPL(slim_get_device);
-static int of_slim_match_dev(struct device *dev, void *data)
+static int of_slim_match_dev(struct device *dev, const void *data)
{
- struct device_node *np = data;
+ const struct device_node *np = data;
struct slim_device *sbdev = to_slim_device(dev);
return (sbdev->dev.of_node == np);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 07/27] scsi: iscsi: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (5 preceding siblings ...)
2024-08-11 2:24 ` [PATCH 06/27] slimbus: core: " Zijun Hu
@ 2024-08-11 2:24 ` Zijun Hu
2024-08-11 2:24 ` [PATCH 08/27] scsi: iscsi: Constify driver API iscsi_find_flashnode_sess() Zijun Hu
` (19 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make its match
functions take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/scsi/scsi_transport_iscsi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index fde7de3b1e55..b4aa091c687a 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1324,7 +1324,7 @@ EXPORT_SYMBOL_GPL(iscsi_create_flashnode_conn);
* 1 on success
* 0 on failure
*/
-static int iscsi_is_flashnode_conn_dev(struct device *dev, void *data)
+static int iscsi_is_flashnode_conn_dev(struct device *dev, const void *data)
{
return dev->bus == &iscsi_flashnode_bus;
}
@@ -1335,7 +1335,7 @@ static int iscsi_destroy_flashnode_conn(struct iscsi_bus_flash_conn *fnode_conn)
return 0;
}
-static int flashnode_match_index(struct device *dev, void *data)
+static int flashnode_match_index(struct device *dev, const void *data)
{
struct iscsi_bus_flash_session *fnode_sess = NULL;
int ret = 0;
@@ -1344,7 +1344,7 @@ static int flashnode_match_index(struct device *dev, void *data)
goto exit_match_index;
fnode_sess = iscsi_dev_to_flash_session(dev);
- ret = (fnode_sess->target_id == *((int *)data)) ? 1 : 0;
+ ret = (fnode_sess->target_id == *((const int *)data)) ? 1 : 0;
exit_match_index:
return ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 08/27] scsi: iscsi: Constify driver API iscsi_find_flashnode_sess()
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (6 preceding siblings ...)
2024-08-11 2:24 ` [PATCH 07/27] scsi: iscsi: " Zijun Hu
@ 2024-08-11 2:24 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 09/27] scsi: qla4xxx: Make iscsi_find_flashnode_sess()'s match function take a const pointer Zijun Hu
` (18 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
Constify iscsi_find_flashnode_sess() as well since it is a a simple
and specific wrapper of constified device_find_child().
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/scsi/scsi_transport_iscsi.c | 4 ++--
include/scsi/scsi_transport_iscsi.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index b4aa091c687a..0d474de2d960 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1389,8 +1389,8 @@ iscsi_get_flashnode_by_index(struct Scsi_Host *shost, uint32_t idx)
* %NULL on failure
*/
struct device *
-iscsi_find_flashnode_sess(struct Scsi_Host *shost, void *data,
- int (*fn)(struct device *dev, void *data))
+iscsi_find_flashnode_sess(struct Scsi_Host *shost, const void *data,
+ device_match_t fn)
{
return device_find_child(&shost->shost_gendev, data, fn);
}
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index bd1243657c01..4d3baf324900 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -497,8 +497,8 @@ extern void iscsi_destroy_all_flashnode(struct Scsi_Host *shost);
extern int iscsi_flashnode_bus_match(struct device *dev,
const struct device_driver *drv);
extern struct device *
-iscsi_find_flashnode_sess(struct Scsi_Host *shost, void *data,
- int (*fn)(struct device *dev, void *data));
+iscsi_find_flashnode_sess(struct Scsi_Host *shost, const void *data,
+ device_match_t fn);
extern struct device *
iscsi_find_flashnode_conn(struct iscsi_bus_flash_session *fnode_sess);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 09/27] scsi: qla4xxx: Make iscsi_find_flashnode_sess()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (7 preceding siblings ...)
2024-08-11 2:24 ` [PATCH 08/27] scsi: iscsi: Constify driver API iscsi_find_flashnode_sess() Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 10/27] pwm: Make device_find_child()'s " Zijun Hu
` (17 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified iscsi_find_flashnode_sess(), make
qla4xxx_sysfs_ddb_is_non_persistent() as its match function take
a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/scsi/qla4xxx/ql4_os.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 17cccd14765f..34242a25cc07 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -7189,7 +7189,8 @@ static void qla4xxx_build_new_nt_list(struct scsi_qla_host *ha,
* 1: if flashnode entry is non-persistent
* 0: if flashnode entry is persistent
**/
-static int qla4xxx_sysfs_ddb_is_non_persistent(struct device *dev, void *data)
+static int qla4xxx_sysfs_ddb_is_non_persistent(struct device *dev,
+ const void *data)
{
struct iscsi_bus_flash_session *fnode_sess;
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 10/27] pwm: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (8 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 09/27] scsi: qla4xxx: Make iscsi_find_flashnode_sess()'s match function take a const pointer Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 11/27] media: pci: mgb4: " Zijun Hu
` (16 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
pwm_unexport_match() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/pwm/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 8acbcf5b6673..8e58b95d69e1 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -753,7 +753,7 @@ static int pwm_export_child(struct device *pwmchip_dev, struct pwm_device *pwm)
return 0;
}
-static int pwm_unexport_match(struct device *pwm_dev, void *data)
+static int pwm_unexport_match(struct device *pwm_dev, const void *data)
{
return pwm_from_dev(pwm_dev) == data;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 11/27] media: pci: mgb4: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (9 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 10/27] pwm: Make device_find_child()'s " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 12/27] range.h: Make range_contains() take const struct range * as parameter type Zijun Hu
` (15 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make its match
functions take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/media/pci/mgb4/mgb4_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/pci/mgb4/mgb4_core.c b/drivers/media/pci/mgb4/mgb4_core.c
index ab4f07e2e560..4707ed1a8298 100644
--- a/drivers/media/pci/mgb4/mgb4_core.c
+++ b/drivers/media/pci/mgb4/mgb4_core.c
@@ -123,7 +123,7 @@ static const struct hwmon_chip_info temp_chip_info = {
};
#endif
-static int match_i2c_adap(struct device *dev, void *data)
+static int match_i2c_adap(struct device *dev, const void *data)
{
return i2c_verify_adapter(dev) ? 1 : 0;
}
@@ -139,7 +139,7 @@ static struct i2c_adapter *get_i2c_adap(struct platform_device *pdev)
return dev ? to_i2c_adapter(dev) : NULL;
}
-static int match_spi_adap(struct device *dev, void *data)
+static int match_spi_adap(struct device *dev, const void *data)
{
return to_spi_device(dev) ? 1 : 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 12/27] range.h: Make range_contains() take const struct range * as parameter type
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (10 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 11/27] media: pci: mgb4: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 13/27] cxl/region: Make device_find_child()'s match function take a const pointer Zijun Hu
` (14 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
Make range_contains() take const struct range * as parameter type since
it does not modify these caller's ranges.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
include/linux/range.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/range.h b/include/linux/range.h
index 6ad0b73cb7ad..7dc5e835e079 100644
--- a/include/linux/range.h
+++ b/include/linux/range.h
@@ -13,7 +13,8 @@ static inline u64 range_len(const struct range *range)
return range->end - range->start + 1;
}
-static inline bool range_contains(struct range *r1, struct range *r2)
+static inline bool range_contains(const struct range *r1,
+ const struct range *r2)
{
return r1->start <= r2->start && r1->end >= r2->end;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 13/27] cxl/region: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (11 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 12/27] range.h: Make range_contains() take const struct range * as parameter type Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 14/27] cxl/pmem: " Zijun Hu
` (13 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make its match
functions take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/cxl/core/region.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 266231d69dff..b5ac52959f5c 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -816,9 +816,9 @@ static int match_free_decoder(struct device *dev, void *data)
return 0;
}
-static int match_auto_decoder(struct device *dev, void *data)
+static int match_auto_decoder(struct device *dev, const void *data)
{
- struct cxl_region_params *p = data;
+ const struct cxl_region_params *p = data;
struct cxl_decoder *cxld;
struct range *r;
@@ -1716,10 +1716,12 @@ static struct cxl_port *next_port(struct cxl_port *port)
return port->parent_dport->port;
}
-static int match_switch_decoder_by_range(struct device *dev, void *data)
+static int match_switch_decoder_by_range(struct device *dev,
+ const void *data)
{
struct cxl_switch_decoder *cxlsd;
- struct range *r1, *r2 = data;
+ const struct range *r1, *r2 = data;
+
if (!is_switch_decoder(dev))
return 0;
@@ -3193,9 +3195,10 @@ static int devm_cxl_add_dax_region(struct cxl_region *cxlr)
return rc;
}
-static int match_root_decoder_by_range(struct device *dev, void *data)
+static int match_root_decoder_by_range(struct device *dev,
+ const void *data)
{
- struct range *r1, *r2 = data;
+ const struct range *r1, *r2 = data;
struct cxl_root_decoder *cxlrd;
if (!is_root_decoder(dev))
@@ -3206,11 +3209,11 @@ static int match_root_decoder_by_range(struct device *dev, void *data)
return range_contains(r1, r2);
}
-static int match_region_by_range(struct device *dev, void *data)
+static int match_region_by_range(struct device *dev, const void *data)
{
struct cxl_region_params *p;
struct cxl_region *cxlr;
- struct range *r = data;
+ const struct range *r = data;
int rc = 0;
if (!is_cxl_region(dev))
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 14/27] cxl/pmem: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (12 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 13/27] cxl/region: Make device_find_child()'s match function take a const pointer Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 15/27] cxl/core/pci: " Zijun Hu
` (12 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
match_nvdimm_bridge() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/cxl/core/pmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cxl/core/pmem.c b/drivers/cxl/core/pmem.c
index c00f3a933164..015759595aaa 100644
--- a/drivers/cxl/core/pmem.c
+++ b/drivers/cxl/core/pmem.c
@@ -57,7 +57,7 @@ bool is_cxl_nvdimm_bridge(struct device *dev)
}
EXPORT_SYMBOL_NS_GPL(is_cxl_nvdimm_bridge, CXL);
-static int match_nvdimm_bridge(struct device *dev, void *data)
+static int match_nvdimm_bridge(struct device *dev, const void *data)
{
return is_cxl_nvdimm_bridge(dev);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 15/27] cxl/core/pci: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (13 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 14/27] cxl/pmem: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 16/27] sparc: vio: " Zijun Hu
` (11 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
dvsec_range_allowed() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/cxl/core/pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
index a663e7566c48..e1bc565d7801 100644
--- a/drivers/cxl/core/pci.c
+++ b/drivers/cxl/core/pci.c
@@ -283,9 +283,9 @@ static int devm_cxl_enable_mem(struct device *host, struct cxl_dev_state *cxlds)
}
/* require dvsec ranges to be covered by a locked platform window */
-static int dvsec_range_allowed(struct device *dev, void *arg)
+static int dvsec_range_allowed(struct device *dev, const void *arg)
{
- struct range *dev_range = arg;
+ const struct range *dev_range = arg;
struct cxl_decoder *cxld;
if (!is_root_decoder(dev))
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 16/27] sparc: vio: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (14 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 15/27] cxl/core/pci: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 17/27] bus: fsl-mc: " Zijun Hu
` (10 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
vio_md_node_match() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
arch/sparc/kernel/vio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index 07933d75ac81..1a1a9d6b8f2e 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -419,13 +419,13 @@ struct vio_remove_node_data {
u64 node;
};
-static int vio_md_node_match(struct device *dev, void *arg)
+static int vio_md_node_match(struct device *dev, const void *arg)
{
struct vio_dev *vdev = to_vio_dev(dev);
- struct vio_remove_node_data *node_data;
+ const struct vio_remove_node_data *node_data;
u64 node;
- node_data = (struct vio_remove_node_data *)arg;
+ node_data = (const struct vio_remove_node_data *)arg;
node = vio_vdev_node(node_data->hp, vdev);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 17/27] bus: fsl-mc: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (15 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 16/27] sparc: vio: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 18/27] block: sunvdc: " Zijun Hu
` (9 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
__fsl_mc_device_match() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/bus/fsl-mc/dprc-driver.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c
index 4b68c84ef485..a3dfaa508724 100644
--- a/drivers/bus/fsl-mc/dprc-driver.c
+++ b/drivers/bus/fsl-mc/dprc-driver.c
@@ -23,10 +23,10 @@ struct fsl_mc_child_objs {
};
static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev,
- struct fsl_mc_obj_desc *obj_desc)
+ const struct fsl_mc_obj_desc *obj_desc)
{
return mc_dev->obj_desc.id == obj_desc->id &&
- strcmp(mc_dev->obj_desc.type, obj_desc->type) == 0;
+ strcmp(mc_dev->obj_desc.type, obj_desc->type) == 0;
}
static bool fsl_mc_obj_desc_is_allocatable(struct fsl_mc_obj_desc *obj)
@@ -112,9 +112,9 @@ void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev,
}
EXPORT_SYMBOL_GPL(dprc_remove_devices);
-static int __fsl_mc_device_match(struct device *dev, void *data)
+static int __fsl_mc_device_match(struct device *dev, const void *data)
{
- struct fsl_mc_obj_desc *obj_desc = data;
+ const struct fsl_mc_obj_desc *obj_desc = data;
struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
return fsl_mc_device_match(mc_dev, obj_desc);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 18/27] block: sunvdc: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (16 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 17/27] bus: fsl-mc: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 19/27] firmware: arm_scmi: " Zijun Hu
` (8 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
vdc_device_probed() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/block/sunvdc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 2d38331ee667..5e0759c8d459 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -918,16 +918,16 @@ struct vdc_check_port_data {
char *type;
};
-static int vdc_device_probed(struct device *dev, void *arg)
+static int vdc_device_probed(struct device *dev, const void *arg)
{
struct vio_dev *vdev = to_vio_dev(dev);
- struct vdc_check_port_data *port_data;
+ const struct vdc_check_port_data *port_data;
- port_data = (struct vdc_check_port_data *)arg;
+ port_data = (const struct vdc_check_port_data *)arg;
if ((vdev->dev_no == port_data->dev_no) &&
(!(strcmp((char *)&vdev->type, port_data->type))) &&
- dev_get_drvdata(dev)) {
+ dev_get_drvdata(dev)) {
/* This device has already been configured
* by vdc_port_probe()
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 19/27] firmware: arm_scmi: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (17 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 18/27] block: sunvdc: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 20/27] efi: dev-path-parser: " Zijun Hu
` (7 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
scmi_match_by_id_table() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/firmware/arm_scmi/bus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index 96b2e5f9a8ef..14c2cc141d8c 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -238,10 +238,10 @@ static int scmi_dev_match(struct device *dev, const struct device_driver *drv)
return 0;
}
-static int scmi_match_by_id_table(struct device *dev, void *data)
+static int scmi_match_by_id_table(struct device *dev, const void *data)
{
struct scmi_device *sdev = to_scmi_dev(dev);
- struct scmi_device_id *id_table = data;
+ const struct scmi_device_id *id_table = data;
return sdev->protocol_id == id_table->protocol_id &&
(id_table->name && !strcmp(sdev->name, id_table->name));
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 20/27] efi: dev-path-parser: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (18 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 19/27] firmware: arm_scmi: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 21/27] drm/mediatek: " Zijun Hu
` (6 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
match_pci_dev() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/firmware/efi/dev-path-parser.c | 4 ++--
1 file 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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 21/27] drm/mediatek: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (19 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 20/27] efi: dev-path-parser: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 22/27] nvdimm: " Zijun Hu
` (5 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
mtk_drm_match() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index ae5c6ec24a1e..341c33443e46 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -357,7 +357,7 @@ static const struct of_device_id mtk_drm_of_ids[] = {
};
MODULE_DEVICE_TABLE(of, mtk_drm_of_ids);
-static int mtk_drm_match(struct device *dev, void *data)
+static int mtk_drm_match(struct device *dev, const void *data)
{
if (!strncmp(dev_name(dev), "mediatek-drm", sizeof("mediatek-drm") - 1))
return true;
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 22/27] nvdimm: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (20 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 21/27] drm/mediatek: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 23/27] libnvdimm: " Zijun Hu
` (4 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
match_dimm() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/nvdimm/bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 2237715e42eb..0ccf4a9e523a 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -1212,7 +1212,7 @@ enum nd_ioctl_mode {
DIMM_IOCTL,
};
-static int match_dimm(struct device *dev, void *data)
+static int match_dimm(struct device *dev, const void *data)
{
long id = (long) data;
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 23/27] libnvdimm: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (21 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 22/27] nvdimm: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 24/27] rpmsg: core: " Zijun Hu
` (3 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
namespace_match() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/nvdimm/claim.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
index 030dbde6b088..b33fa340068b 100644
--- a/drivers/nvdimm/claim.c
+++ b/drivers/nvdimm/claim.c
@@ -67,9 +67,9 @@ bool nd_attach_ndns(struct device *dev, struct nd_namespace_common *attach,
return claimed;
}
-static int namespace_match(struct device *dev, void *data)
+static int namespace_match(struct device *dev, const void *data)
{
- char *name = data;
+ const char *name = data;
return strcmp(name, dev_name(dev)) == 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 24/27] rpmsg: core: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (22 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 23/27] libnvdimm: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 25/27] thunderbolt: " Zijun Hu
` (2 subsequent siblings)
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
rpmsg_device_match() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/rpmsg/rpmsg_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index 712c06c02696..207b64c0a2fe 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -377,9 +377,9 @@ EXPORT_SYMBOL(rpmsg_get_mtu);
* this is used to make sure we're not creating rpmsg devices for channels
* that already exist.
*/
-static int rpmsg_device_match(struct device *dev, void *data)
+static int rpmsg_device_match(struct device *dev, const void *data)
{
- struct rpmsg_channel_info *chinfo = data;
+ const struct rpmsg_channel_info *chinfo = data;
struct rpmsg_device *rpdev = to_rpmsg_device(dev);
if (chinfo->src != RPMSG_ADDR_ANY && chinfo->src != rpdev->src)
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 25/27] thunderbolt: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (23 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 24/27] rpmsg: core: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 26/27] net: dsa: " Zijun Hu
2024-08-11 2:25 ` [PATCH 27/27] cxl/test: " Zijun Hu
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make its match
functions take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/thunderbolt/retimer.c | 2 +-
drivers/thunderbolt/xdomain.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thunderbolt/retimer.c b/drivers/thunderbolt/retimer.c
index 721319329afa..ebda5f996f19 100644
--- a/drivers/thunderbolt/retimer.c
+++ b/drivers/thunderbolt/retimer.c
@@ -461,7 +461,7 @@ struct tb_retimer_lookup {
u8 index;
};
-static int retimer_match(struct device *dev, void *data)
+static int retimer_match(struct device *dev, const void *data)
{
const struct tb_retimer_lookup *lookup = data;
struct tb_retimer *rt = tb_to_retimer(dev);
diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c
index 11a50c86a1e4..b0630e6d9472 100644
--- a/drivers/thunderbolt/xdomain.c
+++ b/drivers/thunderbolt/xdomain.c
@@ -1026,7 +1026,7 @@ static int remove_missing_service(struct device *dev, void *data)
return 0;
}
-static int find_service(struct device *dev, void *data)
+static int find_service(struct device *dev, const void *data)
{
const struct tb_property *p = data;
struct tb_service *svc;
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 26/27] net: dsa: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (24 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 25/27] thunderbolt: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
2024-08-11 2:25 ` [PATCH 27/27] cxl/test: " Zijun Hu
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
dev_is_class() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
net/dsa/dsa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 668c729946ea..a12b35f34c73 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -1367,7 +1367,7 @@ static int dsa_switch_parse_of(struct dsa_switch *ds, struct device_node *dn)
return dsa_switch_parse_ports_of(ds, dn);
}
-static int dev_is_class(struct device *dev, void *class)
+static int dev_is_class(struct device *dev, const void *class)
{
if (dev->class != NULL && !strcmp(dev->class->name, class))
return 1;
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 27/27] cxl/test: Make device_find_child()'s match function take a const pointer
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
` (25 preceding siblings ...)
2024-08-11 2:25 ` [PATCH 26/27] net: dsa: " Zijun Hu
@ 2024-08-11 2:25 ` Zijun Hu
26 siblings, 0 replies; 31+ messages in thread
From: Zijun Hu @ 2024-08-11 2:25 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
In order to adapt for constified device_find_child(), make
first_decoder() as its match function take a const pointer.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
tools/testing/cxl/test/cxl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index 90d5afd52dd0..6e82a4816ee7 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -729,7 +729,7 @@ static void default_mock_decoder(struct cxl_decoder *cxld)
cxld->reset = mock_decoder_reset;
}
-static int first_decoder(struct device *dev, void *data)
+static int first_decoder(struct device *dev, const void *data)
{
struct cxl_decoder *cxld;
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 01/27] driver core: Constify driver API device_find_child()
2024-08-11 2:24 ` [PATCH 01/27] driver core: Constify driver API device_find_child() Zijun Hu
@ 2024-08-13 9:48 ` Greg Kroah-Hartman
2024-08-13 10:39 ` quic_zijuhu
0 siblings, 1 reply; 31+ messages in thread
From: Greg Kroah-Hartman @ 2024-08-13 9:48 UTC (permalink / raw)
To: Zijun Hu; +Cc: Rafael J. Wysocki, linux-kernel, Zijun Hu
On Sun, Aug 11, 2024 at 10:24:52AM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@quicinc.com>
>
> Constify the following driver 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);
> Since it should not modify caller's match data @*data.
>
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> ---
> drivers/base/core.c | 11 +++--------
> include/linux/device.h | 4 ++--
> 2 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 3f3ebdb5aa0b..f152e0f8fb03 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -4062,8 +4062,8 @@ EXPORT_SYMBOL_GPL(device_for_each_child_reverse);
> *
> * NOTE: you will need to drop the reference with put_device() after use.
> */
> -struct device *device_find_child(struct device *parent, void *data,
> - int (*match)(struct device *dev, void *data))
> +struct device *device_find_child(struct device *parent, const void *data,
> + device_match_t match)
> {
> struct klist_iter i;
> struct device *child;
> @@ -4108,11 +4108,6 @@ struct device *device_find_child_by_name(struct device *parent,
> }
> EXPORT_SYMBOL_GPL(device_find_child_by_name);
>
> -static int match_any(struct device *dev, void *unused)
> -{
> - return 1;
> -}
> -
> /**
> * device_find_any_child - device iterator for locating a child device, if any.
> * @parent: parent struct device
> @@ -4124,7 +4119,7 @@ static int match_any(struct device *dev, void *unused)
> */
> struct device *device_find_any_child(struct device *parent)
> {
> - return device_find_child(parent, NULL, match_any);
> + return device_find_child(parent, NULL, device_match_any);
> }
> EXPORT_SYMBOL_GPL(device_find_any_child);
>
> diff --git a/include/linux/device.h b/include/linux/device.h
> index b2423fca3d45..76f10bdbb4ea 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -1073,8 +1073,8 @@ int device_for_each_child(struct device *dev, void *data,
> int (*fn)(struct device *dev, void *data));
> int device_for_each_child_reverse(struct device *dev, void *data,
> int (*fn)(struct device *dev, void *data));
> -struct device *device_find_child(struct device *dev, void *data,
> - int (*match)(struct device *dev, void *data));
> +struct device *device_find_child(struct device *dev, const void *data,
> + device_match_t match);
> struct device *device_find_child_by_name(struct device *parent,
> const char *name);
> struct device *device_find_any_child(struct device *parent);
>
> --
> 2.34.1
>
This patch breaks the build:
./include/linux/device.h:1077:6: error: unknown type name 'device_match_t'
1077 | device_match_t match);
| ^
1 error generated.
make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1
make[1]: *** [/mnt/fast_t2/linux/work/driver-core/Makefile:1193: prepare0] Error 2
How did you test it?
And as you are changing the parameters here, doesn't the build break
also because of that?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 01/27] driver core: Constify driver API device_find_child()
2024-08-13 9:48 ` Greg Kroah-Hartman
@ 2024-08-13 10:39 ` quic_zijuhu
2024-08-13 10:52 ` Greg Kroah-Hartman
0 siblings, 1 reply; 31+ messages in thread
From: quic_zijuhu @ 2024-08-13 10:39 UTC (permalink / raw)
To: Greg Kroah-Hartman, Zijun Hu; +Cc: Rafael J. Wysocki, linux-kernel
On 8/13/2024 5:48 PM, Greg Kroah-Hartman wrote:
> On Sun, Aug 11, 2024 at 10:24:52AM +0800, Zijun Hu wrote:
>> From: Zijun Hu <quic_zijuhu@quicinc.com>
>>
>> Constify the following driver 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);
>> Since it should not modify caller's match data @*data.
>>
>> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
>> ---
>> drivers/base/core.c | 11 +++--------
>> include/linux/device.h | 4 ++--
>> 2 files changed, 5 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/base/core.c b/drivers/base/core.c
>> index 3f3ebdb5aa0b..f152e0f8fb03 100644
>> --- a/drivers/base/core.c
>> +++ b/drivers/base/core.c
>> @@ -4062,8 +4062,8 @@ EXPORT_SYMBOL_GPL(device_for_each_child_reverse);
>> *
>> * NOTE: you will need to drop the reference with put_device() after use.
>> */
>> -struct device *device_find_child(struct device *parent, void *data,
>> - int (*match)(struct device *dev, void *data))
>> +struct device *device_find_child(struct device *parent, const void *data,
>> + device_match_t match)
>> {
>> struct klist_iter i;
>> struct device *child;
>> @@ -4108,11 +4108,6 @@ struct device *device_find_child_by_name(struct device *parent,
>> }
>> EXPORT_SYMBOL_GPL(device_find_child_by_name);
>>
>> -static int match_any(struct device *dev, void *unused)
>> -{
>> - return 1;
>> -}
>> -
>> /**
>> * device_find_any_child - device iterator for locating a child device, if any.
>> * @parent: parent struct device
>> @@ -4124,7 +4119,7 @@ static int match_any(struct device *dev, void *unused)
>> */
>> struct device *device_find_any_child(struct device *parent)
>> {
>> - return device_find_child(parent, NULL, match_any);
>> + return device_find_child(parent, NULL, device_match_any);
>> }
>> EXPORT_SYMBOL_GPL(device_find_any_child);
>>
>> diff --git a/include/linux/device.h b/include/linux/device.h
>> index b2423fca3d45..76f10bdbb4ea 100644
>> --- a/include/linux/device.h
>> +++ b/include/linux/device.h
>> @@ -1073,8 +1073,8 @@ int device_for_each_child(struct device *dev, void *data,
>> int (*fn)(struct device *dev, void *data));
>> int device_for_each_child_reverse(struct device *dev, void *data,
>> int (*fn)(struct device *dev, void *data));
>> -struct device *device_find_child(struct device *dev, void *data,
>> - int (*match)(struct device *dev, void *data));
>> +struct device *device_find_child(struct device *dev, const void *data,
>> + device_match_t match);
>> struct device *device_find_child_by_name(struct device *parent,
>> const char *name);
>> struct device *device_find_any_child(struct device *parent);
>>
>> --
>> 2.34.1
>>
>
> This patch breaks the build:
>
> ./include/linux/device.h:1077:6: error: unknown type name 'device_match_t'
> 1077 | device_match_t match);
> | ^
> 1 error generated.
> make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1
> make[1]: *** [/mnt/fast_t2/linux/work/driver-core/Makefile:1193: prepare0] Error 2
>
> How did you test it?
>
> And as you are changing the parameters here, doesn't the build break
> also because of that?
>
it seems these dependency patches listed within [PATCH 00/27] are not
picked up.
let me summarize my recently patch serials
A)
Subject: [PATCH v2] drivers/base: Introduce device_match_t for device
finding APIs
https://lore.kernel.org/all/20240811-dev_match_api-v2-1-dd22ff555a30@quicinc.com/
B)
[PATCH 0/5] driver core: Prevent device_find_child() from modifying
caller's match data
https://lore.kernel.org/all/20240811-const_dfc_prepare-v1-0-d67cc416b3d3@quicinc.com/
C) // this depends on both A) and B)
Subject: [PATCH 00/27] driver core: Make device_find_child()'s match
function take a const pointer
https://lore.kernel.org/all/20240811-const_dfc_done-v1-0-9d85e3f943cb@quicinc.com/
D)
Subject: [PATCH v2] driver core: Simplify driver API
device_find_child_by_name() implementation
https://lore.kernel.org/all/20240811-simply_api_dfcbn-v2-1-d0398acdc366@quicinc.com/
ALL these patch serials are based on driver-core tree with branch
driver-core-next, ALL of them can be built PASS.
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 01/27] driver core: Constify driver API device_find_child()
2024-08-13 10:39 ` quic_zijuhu
@ 2024-08-13 10:52 ` Greg Kroah-Hartman
0 siblings, 0 replies; 31+ messages in thread
From: Greg Kroah-Hartman @ 2024-08-13 10:52 UTC (permalink / raw)
To: quic_zijuhu; +Cc: Zijun Hu, Rafael J. Wysocki, linux-kernel
On Tue, Aug 13, 2024 at 06:39:48PM +0800, quic_zijuhu wrote:
> On 8/13/2024 5:48 PM, Greg Kroah-Hartman wrote:
> > On Sun, Aug 11, 2024 at 10:24:52AM +0800, Zijun Hu wrote:
> >> From: Zijun Hu <quic_zijuhu@quicinc.com>
> >>
> >> Constify the following driver 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);
> >> Since it should not modify caller's match data @*data.
> >>
> >> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> >> ---
> >> drivers/base/core.c | 11 +++--------
> >> include/linux/device.h | 4 ++--
> >> 2 files changed, 5 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/drivers/base/core.c b/drivers/base/core.c
> >> index 3f3ebdb5aa0b..f152e0f8fb03 100644
> >> --- a/drivers/base/core.c
> >> +++ b/drivers/base/core.c
> >> @@ -4062,8 +4062,8 @@ EXPORT_SYMBOL_GPL(device_for_each_child_reverse);
> >> *
> >> * NOTE: you will need to drop the reference with put_device() after use.
> >> */
> >> -struct device *device_find_child(struct device *parent, void *data,
> >> - int (*match)(struct device *dev, void *data))
> >> +struct device *device_find_child(struct device *parent, const void *data,
> >> + device_match_t match)
> >> {
> >> struct klist_iter i;
> >> struct device *child;
> >> @@ -4108,11 +4108,6 @@ struct device *device_find_child_by_name(struct device *parent,
> >> }
> >> EXPORT_SYMBOL_GPL(device_find_child_by_name);
> >>
> >> -static int match_any(struct device *dev, void *unused)
> >> -{
> >> - return 1;
> >> -}
> >> -
> >> /**
> >> * device_find_any_child - device iterator for locating a child device, if any.
> >> * @parent: parent struct device
> >> @@ -4124,7 +4119,7 @@ static int match_any(struct device *dev, void *unused)
> >> */
> >> struct device *device_find_any_child(struct device *parent)
> >> {
> >> - return device_find_child(parent, NULL, match_any);
> >> + return device_find_child(parent, NULL, device_match_any);
> >> }
> >> EXPORT_SYMBOL_GPL(device_find_any_child);
> >>
> >> diff --git a/include/linux/device.h b/include/linux/device.h
> >> index b2423fca3d45..76f10bdbb4ea 100644
> >> --- a/include/linux/device.h
> >> +++ b/include/linux/device.h
> >> @@ -1073,8 +1073,8 @@ int device_for_each_child(struct device *dev, void *data,
> >> int (*fn)(struct device *dev, void *data));
> >> int device_for_each_child_reverse(struct device *dev, void *data,
> >> int (*fn)(struct device *dev, void *data));
> >> -struct device *device_find_child(struct device *dev, void *data,
> >> - int (*match)(struct device *dev, void *data));
> >> +struct device *device_find_child(struct device *dev, const void *data,
> >> + device_match_t match);
> >> struct device *device_find_child_by_name(struct device *parent,
> >> const char *name);
> >> struct device *device_find_any_child(struct device *parent);
> >>
> >> --
> >> 2.34.1
> >>
> >
> > This patch breaks the build:
> >
> > ./include/linux/device.h:1077:6: error: unknown type name 'device_match_t'
> > 1077 | device_match_t match);
> > | ^
> > 1 error generated.
> > make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1
> > make[1]: *** [/mnt/fast_t2/linux/work/driver-core/Makefile:1193: prepare0] Error 2
> >
> > How did you test it?
> >
> > And as you are changing the parameters here, doesn't the build break
> > also because of that?
> >
>
> it seems these dependency patches listed within [PATCH 00/27] are not
> picked up.
Of course not, please send stand-alone series if you need them to be
applied in a specific order.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2024-08-13 10:52 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-11 2:24 [PATCH 00/27] driver core: Make device_find_child()'s match function take a const pointer Zijun Hu
2024-08-11 2:24 ` [PATCH 01/27] driver core: Constify driver API device_find_child() Zijun Hu
2024-08-13 9:48 ` Greg Kroah-Hartman
2024-08-13 10:39 ` quic_zijuhu
2024-08-13 10:52 ` Greg Kroah-Hartman
2024-08-11 2:24 ` [PATCH 02/27] Bluetooth: hci_sysfs: Make device_find_child()'s match function take a const pointer Zijun Hu
2024-08-11 2:24 ` [PATCH 03/27] serial: core: " Zijun Hu
2024-08-11 2:24 ` [PATCH 04/27] usb: typec: class: " Zijun Hu
2024-08-11 2:24 ` [PATCH 05/27] gpio: sim: " Zijun Hu
2024-08-11 2:24 ` [PATCH 06/27] slimbus: core: " Zijun Hu
2024-08-11 2:24 ` [PATCH 07/27] scsi: iscsi: " Zijun Hu
2024-08-11 2:24 ` [PATCH 08/27] scsi: iscsi: Constify driver API iscsi_find_flashnode_sess() Zijun Hu
2024-08-11 2:25 ` [PATCH 09/27] scsi: qla4xxx: Make iscsi_find_flashnode_sess()'s match function take a const pointer Zijun Hu
2024-08-11 2:25 ` [PATCH 10/27] pwm: Make device_find_child()'s " Zijun Hu
2024-08-11 2:25 ` [PATCH 11/27] media: pci: mgb4: " Zijun Hu
2024-08-11 2:25 ` [PATCH 12/27] range.h: Make range_contains() take const struct range * as parameter type Zijun Hu
2024-08-11 2:25 ` [PATCH 13/27] cxl/region: Make device_find_child()'s match function take a const pointer Zijun Hu
2024-08-11 2:25 ` [PATCH 14/27] cxl/pmem: " Zijun Hu
2024-08-11 2:25 ` [PATCH 15/27] cxl/core/pci: " Zijun Hu
2024-08-11 2:25 ` [PATCH 16/27] sparc: vio: " Zijun Hu
2024-08-11 2:25 ` [PATCH 17/27] bus: fsl-mc: " Zijun Hu
2024-08-11 2:25 ` [PATCH 18/27] block: sunvdc: " Zijun Hu
2024-08-11 2:25 ` [PATCH 19/27] firmware: arm_scmi: " Zijun Hu
2024-08-11 2:25 ` [PATCH 20/27] efi: dev-path-parser: " Zijun Hu
2024-08-11 2:25 ` [PATCH 21/27] drm/mediatek: " Zijun Hu
2024-08-11 2:25 ` [PATCH 22/27] nvdimm: " Zijun Hu
2024-08-11 2:25 ` [PATCH 23/27] libnvdimm: " Zijun Hu
2024-08-11 2:25 ` [PATCH 24/27] rpmsg: core: " Zijun Hu
2024-08-11 2:25 ` [PATCH 25/27] thunderbolt: " Zijun Hu
2024-08-11 2:25 ` [PATCH 26/27] net: dsa: " Zijun Hu
2024-08-11 2:25 ` [PATCH 27/27] cxl/test: " Zijun Hu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox