Re: [PATCH] fbdev/nvidiafb: Correct const string length in nvidiafb_setup()

2025-04-25 Thread Zijun Hu
On 2025/4/25 16:55, Jani Nikula wrote: >> } else if (!strncmp(this_opt, "noscale", 7)) { >> noscale = 1; > A further cleanup could be to replace all of the strncmp's with > str_has_prefix(this_opt, "...") to avoid this class of errors > altogether. It also returns

[PATCH] fbdev/nvidiafb: Correct const string length in nvidiafb_setup()

2025-04-07 Thread Zijun Hu
From: Zijun Hu The actual length of const string "noaccel" is 7, but the strncmp() branch in nvidiafb_setup() wrongly hard codes it as 6. Fix by using actual length 7 as argument of the strncmp(). Signed-off-by: Zijun Hu --- drivers/video/fbdev/nvidia/nvidia.c | 2 +- 1 file

Re: [PATCH v4 01/11] libnvdimm: Replace namespace_match() with device_find_child_by_name()

2025-01-02 Thread Zijun Hu
On 2025/1/3 02:17, Fan Ni wrote: >> - >> static bool is_idle(struct device *dev, struct nd_namespace_common *ndns) >> { >> struct nd_region *nd_region = to_nd_region(dev->parent); >> @@ -168,7 +161,7 @@ ssize_t nd_namespace_store(struct device *dev, >> goto out; >> } >> >

[PATCH v5 12/12] usb: typec: class: Remove both cable_match() and partner_match()

2024-12-24 Thread Zijun Hu
From: Zijun Hu cable_match(), as matching function of device_find_child(), matches a device with device type @typec_cable_dev_type, and its task can be simplified by the recently introduced API device_match_type(). partner_match() is similar with cable_match() but with a different device type

[PATCH v5 10/12] cxl/pmem: Replace match_nvdimm_bridge() with API device_match_type()

2024-12-24 Thread Zijun Hu
From: Zijun Hu Static match_nvdimm_bridge(), as matching function of device_find_child() matches a device with device type @cxl_nvdimm_bridge_type, and its task can be simplified by the recently introduced API device_match_type(). Replace match_nvdimm_bridge() usage with device_match_type

[PATCH v5 11/12] cxl/pmem: Remove is_cxl_nvdimm_bridge()

2024-12-24 Thread Zijun Hu
From: Zijun Hu Remove is_cxl_nvdimm_bridge() which has no caller now. Signed-off-by: Zijun Hu --- drivers/cxl/core/pmem.c | 6 -- drivers/cxl/cxl.h | 1 - 2 files changed, 7 deletions(-) diff --git a/drivers/cxl/core/pmem.c b/drivers/cxl/core/pmem.c index

[PATCH v5 09/12] driver core: Introduce an device matching API device_match_type()

2024-12-24 Thread Zijun Hu
From: Zijun Hu Introduce device_match_type() for purposes below: - Test if a device matches with a specified device type. - As argument of various device finding APIs to find a device with specified type. device_find_child() will use it to simplify operations later. Reviewed-by: Jonathan

[PATCH v5 08/12] gpio: sim: Remove gpio_sim_dev_match_fwnode()

2024-12-24 Thread Zijun Hu
From: Zijun Hu gpio_sim_dev_match_fwnode() is a simple wrapper of API device_match_fwnode(). Remove the needless wrapper and use the API instead. Acked-by: Bartosz Golaszewski Reviewed-by: Jonathan Cameron Signed-off-by: Zijun Hu --- drivers/gpio/gpio-sim.c | 7 +-- 1 file changed, 1

[PATCH v5 07/12] slimbus: core: Remove of_slim_match_dev()

2024-12-24 Thread Zijun Hu
From: Zijun Hu static of_slim_match_dev() has same function as API device_match_of_node(). Remove the former and use the later instead. Reviewed-by: Jonathan Cameron Signed-off-by: Zijun Hu --- drivers/slimbus/core.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff

[PATCH v5 06/12] driver core: Remove match_any()

2024-12-24 Thread Zijun Hu
From: Zijun Hu Static match_any() is now exactly same as API device_match_any(). Remove the former and use the later instead. Reviewed-by: Jonathan Cameron Signed-off-by: Zijun Hu --- drivers/base/core.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/base

[PATCH v5 04/12] driver core: Constify API device_find_child() and adapt for various usages

2024-12-24 Thread Zijun Hu
From: Zijun Hu 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

[PATCH v5 05/12] driver core: Simplify API device_find_child_by_name() implementation

2024-12-24 Thread Zijun Hu
From: Zijun Hu Simplify device_find_child_by_name() implementation by both existing API device_find_child() and device_match_name(). Reviewed-by: Jonathan Cameron Signed-off-by: Zijun Hu --- drivers/base/core.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a

[PATCH v5 02/12] slimbus: core: Constify slim_eaddr_equal()

2024-12-24 Thread Zijun Hu
From: Zijun Hu bool slim_eaddr_equal(struct slim_eaddr *a, struct slim_eaddr *b) does not modify @*a or @*b. To prepare for constifying API device_find_child() later. Constify this comparison function by simply changing its parameter type to 'const struct slim_eaddr *'. Reviewed-by

[PATCH v5 03/12] bus: fsl-mc: Constify fsl_mc_device_match()

2024-12-24 Thread Zijun Hu
From: Zijun Hu fsl_mc_device_match() does not modify caller's inputs. To prepare for constifying API device_find_child() later. Constify this comparison function by simply changing its parameter types to const pointer. Reviewed-by: Jonathan Cameron Signed-off-by: Zijun Hu --- driver

[PATCH v5 01/12] libnvdimm: Replace namespace_match() with device_find_child_by_name()

2024-12-24 Thread Zijun Hu
From: Zijun Hu Simplify nd_namespace_store() implementation by using device_find_child_by_name(). Reviewed-by: Alison Schofield Reviewed-by: Jonathan Cameron Signed-off-by: Zijun Hu --- drivers/nvdimm/claim.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a

[PATCH v5 00/12] driver core: Constify API device_find_child()

2024-12-24 Thread Zijun Hu
nd are posted a long time ago, so may ignore differences. - Link to v1: https://lore.kernel.org/r/20240811-const_dfc_done-v1-0-9d85e3f94...@quicinc.com - Motivation link: https://lore.kernel.org/lkml/917359cc-a421-41dd-93f4-d28937fe2...@icloud.com --- Zijun Hu (12): libnvdimm: Replace

Re: [PATCH v4 10/11] cxl/pmem: Replace match_nvdimm_bridge() with API device_match_type()

2024-12-24 Thread Zijun Hu
On 2024/12/24 04:48, Jonathan Cameron wrote: >> From: Zijun Hu >> >> Static match_nvdimm_bridge(), as matching function of device_find_child() >> matches a device with device type @cxl_nvdimm_bridge_type, and its task >> can be simplified by the recently in

Re: [PATCH v4 05/11] driver core: Simplify API device_find_child_by_name() implementation

2024-12-24 Thread Zijun Hu
On 2024/12/24 04:39, Jonathan Cameron wrote: > There is a subtle difference. In theory old code could dereference a NULL > if parent->p == NULL, now it can't. Sounds at most like a harmless change but > maybe you should mention it. > i did not correct parameter checking for device_find_child_by

Re: [PATCH v4 04/11] driver core: Constify API device_find_child() then adapt for various usages

2024-12-24 Thread Zijun Hu
On 2024/12/24 04:33, Jonathan Cameron wrote: > On Wed, 11 Dec 2024 08:08:06 +0800 > Zijun Hu wrote: > >> From: Zijun Hu >> >> Constify the following API: >> struct device *device_find_child(struct device *dev, void *data, >> int (*match)(

Re: [PATCH v4 03/11] bus: fsl-mc: Constify fsl_mc_device_match()

2024-12-24 Thread Zijun Hu
On 2024/12/24 04:26, Jonathan Cameron wrote: > On Wed, 11 Dec 2024 08:08:05 +0800 > Zijun Hu wrote: > >> From: Zijun Hu >> >> fsl_mc_device_match() does not modify caller's inputs. >> >> Constify it by simply changing its parameter types to

[PATCH v4 08/11] gpio: sim: Remove gpio_sim_dev_match_fwnode()

2024-12-10 Thread Zijun Hu
From: Zijun Hu gpio_sim_dev_match_fwnode() is a simple wrapper of API device_match_fwnode(). Remove the needless wrapper and use the API instead. Signed-off-by: Zijun Hu --- drivers/gpio/gpio-sim.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpio/gpio

[PATCH v4 06/11] driver core: Remove match_any()

2024-12-10 Thread Zijun Hu
From: Zijun Hu Static match_any() is exactly same as API device_match_any(). Remove the former and use the later instead. Signed-off-by: Zijun Hu --- drivers/base/core.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index

[PATCH v4 11/11] usb: typec: class: Remove both cable_match() and partner_match()

2024-12-10 Thread Zijun Hu
From: Zijun Hu cable_match(), as matching function of device_find_child(), matches a device with device type @typec_cable_dev_type, and its task can be simplified by the recently introduced API device_match_type(). partner_match() is similar with cable_match() but with a different device type

[PATCH v4 09/11] driver core: Introduce an device matching API device_match_type()

2024-12-10 Thread Zijun Hu
From: Zijun Hu Introduce device_match_type() for purposes below: - Test if a device matches with a specified device type. - As argument of various device finding APIs to find a device with specified type. device_find_child() will use it to simplify operations later. Signed-off-by: Zijun Hu

[PATCH v4 10/11] cxl/pmem: Replace match_nvdimm_bridge() with API device_match_type()

2024-12-10 Thread Zijun Hu
From: Zijun Hu Static match_nvdimm_bridge(), as matching function of device_find_child() matches a device with device type @cxl_nvdimm_bridge_type, and its task can be simplified by the recently introduced API device_match_type(). Replace match_nvdimm_bridge() usage with device_match_type

[PATCH v4 07/11] slimbus: core: Remove of_slim_match_dev()

2024-12-10 Thread Zijun Hu
From: Zijun Hu static of_slim_match_dev() has same function as API device_match_of_node(). Remove the former and use the later instead. Signed-off-by: Zijun Hu --- drivers/slimbus/core.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/slimbus/core.c b

[PATCH v4 05/11] driver core: Simplify API device_find_child_by_name() implementation

2024-12-10 Thread Zijun Hu
From: Zijun Hu Simplify device_find_child_by_name() implementation by both existing API device_find_child() and device_match_name(). Signed-off-by: Zijun Hu --- drivers/base/core.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/base/core.c b/drivers

[PATCH v4 04/11] driver core: Constify API device_find_child() then adapt for various usages

2024-12-10 Thread Zijun Hu
From: Zijun Hu 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

[PATCH v4 03/11] bus: fsl-mc: Constify fsl_mc_device_match()

2024-12-10 Thread Zijun Hu
From: Zijun Hu fsl_mc_device_match() does not modify caller's inputs. Constify it by simply changing its parameter types to const pointer. Signed-off-by: Zijun Hu --- drivers/bus/fsl-mc/dprc-driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bus/f

[PATCH v4 02/11] slimbus: core: Constify slim_eaddr_equal()

2024-12-10 Thread Zijun Hu
From: Zijun Hu bool slim_eaddr_equal(struct slim_eaddr *a, struct slim_eaddr *b) does not modify @*a or @*b. Constify it by simply changing its parameter type to 'const struct slim_eaddr *'. Signed-off-by: Zijun Hu --- drivers/slimbus/core.c | 3 ++- 1 file changed, 2 insert

[PATCH v4 00/11] driver core: Constify API device_find_child()

2024-12-10 Thread Zijun Hu
2...@icloud.com --- Zijun Hu (11): libnvdimm: Replace namespace_match() with device_find_child_by_name() slimbus: core: Constify slim_eaddr_equal() bus: fsl-mc: Constify fsl_mc_device_match() driver core: Constify API device_find_child() then adapt for various usages

[PATCH v4 01/11] libnvdimm: Replace namespace_match() with device_find_child_by_name()

2024-12-10 Thread Zijun Hu
From: Zijun Hu Simplify nd_namespace_store() implementation by using device_find_child_by_name(). Reviewed-by: Alison Schofield Signed-off-by: Zijun Hu --- drivers/nvdimm/claim.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/nvdimm/claim.c b/drivers

Re: [PATCH v3 04/11] driver core: Constify API device_find_child() then adapt for various usages

2024-12-08 Thread Zijun Hu
On 2024/12/6 21:52, Takashi Sakamoto wrote: > Hi, > > On Thu, Dec 05, 2024 at 08:10:13AM +0800, Zijun Hu wrote: >> From: Zijun Hu >> >> Constify the following API: >> struct device *device_find_child(struct device *dev, void *data, >> int

Re: [PATCH v3 04/11] driver core: Constify API device_find_child() then adapt for various usages

2024-12-06 Thread Zijun Hu
On 2024/12/6 15:21, Uwe Kleine-König wrote: > Hello, > > On Thu, Dec 05, 2024 at 08:10:13AM +0800, Zijun Hu wrote: >> From: Zijun Hu >> >> Constify the following API: >> struct device *device_find_child(struct device *dev, void *data, >> int

Re: [PATCH v3 10/11] cxl/pmem: Remove match_nvdimm_bridge()

2024-12-05 Thread Zijun Hu
On 2024/12/6 06:49, Alison Schofield wrote: > On Thu, Dec 05, 2024 at 08:10:19AM +0800, Zijun Hu wrote: >> From: Zijun Hu > > Suggest conveying more detail in the commit msg: > > cxl/pmem> Replace match_nvdimm_bridge() w device_match_type() > good sug

Re: [PATCH v3 08/11] gpio: sim: Remove gpio_sim_dev_match_fwnode()

2024-12-05 Thread Zijun Hu
On 2024/12/6 00:24, Bartosz Golaszewski wrote: > On Thu, Dec 5, 2024 at 1:15 AM Zijun Hu wrote: >> >> From: Zijun Hu >> >> gpio_sim_dev_match_fwnode() is a simple wrapper of device_match_fwnode() >> Remvoe the unnecessary wrapper. >> >> Signed-off-by:

Re: [PATCH v3 01/11] libnvdimm: Simplify nd_namespace_store() implementation

2024-12-05 Thread Zijun Hu
On 2024/12/6 07:30, Alison Schofield wrote: > On Thu, Dec 05, 2024 at 08:10:10AM +0800, Zijun Hu wrote: >> From: Zijun Hu > > Hi Zihun, > > Similar to my comment on Patch 10/11, this commit msg can be > explicit: > > libnvdimm: Replace namespace_match

Re: [PATCH v3 08/11] gpio: sim: Remove gpio_sim_dev_match_fwnode()

2024-12-05 Thread Zijun Hu
On 2024/12/5 18:37, Uwe Kleine-König wrote: > On Thu, Dec 05, 2024 at 04:37:08PM +0800, quic_zijuhu wrote: >> On 12/5/2024 4:10 PM, Uwe Kleine-König wrote: >>> On Thu, Dec 05, 2024 at 08:10:17AM +0800, Zijun Hu wrote: >>>> From: Zijun Hu >>>> >>&g

Re: [PATCH v3 04/11] driver core: Constify API device_find_child() then adapt for various usages

2024-12-05 Thread Zijun Hu
On 2024/12/5 18:41, Uwe Kleine-König wrote: > On Thu, Dec 05, 2024 at 08:10:13AM +0800, Zijun Hu wrote: >> diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c >> index >> 07933d75ac815160a2580dce39fde7653a9502e1..1a1a9d6b8f2e8dfedefafde846315a06a167fbfb >>

Re: [PATCH v3 00/11] driver core: Constify API device_find_child()

2024-12-04 Thread Zijun Hu
On 2024/12/5 08:10, Zijun Hu wrote: > This patch series is to constify the following API: This patch series is based on the lasted mainline commit Commit: feffde684ac2 ("Merge tag 'for-6.13-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux") to avoid pot

[PATCH v3 11/11] usb: typec: class: Remove both cable_match() and partner_match()

2024-12-04 Thread Zijun Hu
From: Zijun Hu cable_match(), as matching function of device_find_child(), is to match a device with device type @typec_cable_dev_type, and is unnecessary. partner_match() is similar with cable_match() but with different device type @typec_partner_dev_type. Remove both functions and directly

[PATCH v3 10/11] cxl/pmem: Remove match_nvdimm_bridge()

2024-12-04 Thread Zijun Hu
From: Zijun Hu match_nvdimm_bridge(), as matching function of device_find_child(), is to match a device with device type @cxl_nvdimm_bridge_type, and is unnecessary Remove it and use API device_match_type() plus the device type instead. Signed-off-by: Zijun Hu --- drivers/cxl/core/pmem.c | 9

[PATCH v3 09/11] driver core: Introduce an device matching API device_match_type()

2024-12-04 Thread Zijun Hu
From: Zijun Hu Introduce device_match_type() for purposes below: - Test if a device matches with a specified device type. - As argument of various device finding APIs to find a device with specified type. device_find_child() will use it to simplify operations later. Signed-off-by: Zijun Hu

[PATCH v3 08/11] gpio: sim: Remove gpio_sim_dev_match_fwnode()

2024-12-04 Thread Zijun Hu
From: Zijun Hu gpio_sim_dev_match_fwnode() is a simple wrapper of device_match_fwnode() Remvoe the unnecessary wrapper. Signed-off-by: Zijun Hu --- drivers/gpio/gpio-sim.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio

[PATCH v3 07/11] slimbus: core: Simplify of_find_slim_device() implementation

2024-12-04 Thread Zijun Hu
From: Zijun Hu Simplify of_find_slim_device() implementation by device_match_of_node(). Signed-off-by: Zijun Hu --- drivers/slimbus/core.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c index

[PATCH v3 06/11] driver core: Remove match_any()

2024-12-04 Thread Zijun Hu
From: Zijun Hu Static match_any() is same as API device_match_any() Remove the former and use the later instead. Signed-off-by: Zijun Hu --- drivers/base/core.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index

[PATCH v3 05/11] driver core: Simplify API device_find_child_by_name() implementation

2024-12-04 Thread Zijun Hu
From: Zijun Hu Simplify device_find_child_by_name() implementation by both existing API device_find_child() and device_match_name(). Signed-off-by: Zijun Hu --- drivers/base/core.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/base/core.c b/drivers

[PATCH v3 04/11] driver core: Constify API device_find_child() then adapt for various usages

2024-12-04 Thread Zijun Hu
From: Zijun Hu 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

[PATCH v3 03/11] bus: fsl-mc: Constify fsl_mc_device_match()

2024-12-04 Thread Zijun Hu
From: Zijun Hu fsl_mc_device_match() does not modify caller's inputs. Constify it by simply changing its parameter types to const pointer. Signed-off-by: Zijun Hu --- drivers/bus/fsl-mc/dprc-driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bus/f

[PATCH v3 02/11] slimbus: core: Constify slim_eaddr_equal()

2024-12-04 Thread Zijun Hu
From: Zijun Hu bool slim_eaddr_equal(struct slim_eaddr *a, struct slim_eaddr *b) does not modify @*a or @*b. Constify it by simply changing its parameter type to 'const struct slim_eaddr *'. Signed-off-by: Zijun Hu --- drivers/slimbus/core.c | 3 ++- 1 file changed, 2 insert

[PATCH v3 01/11] libnvdimm: Simplify nd_namespace_store() implementation

2024-12-04 Thread Zijun Hu
From: Zijun Hu Simplify nd_namespace_store() implementation by device_find_child_by_name() Signed-off-by: Zijun Hu --- drivers/nvdimm/claim.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c index

[PATCH v3 00/11] driver core: Constify API device_find_child()

2024-12-04 Thread Zijun Hu
t_dfc_done-v1-0-9d85e3f94...@quicinc.com - Motivation link: https://lore.kernel.org/lkml/917359cc-a421-41dd-93f4-d28937fe2...@icloud.com --- Zijun Hu (11): libnvdimm: Simplify nd_namespace_store() implementation slimbus: core: Constify slim_eaddr_equal() bus: fsl-mc: Constify fsl_

Re: [PATCH v2 00/32] driver core: Constify API device_find_child() and adapt for various existing usages

2024-12-04 Thread Zijun Hu
On 2024/12/5 00:42, James Bottomley wrote:  introduce extra device_find_child_new() which is constified  -> use *_new() replace ALL device_find_child() instances one by one -> remove device_find_child() -> rename *_new() to device_find_child() once. >>> Why bother with the last

Re: [PATCH v2 00/32] driver core: Constify API device_find_child() and adapt for various existing usages

2024-12-04 Thread Zijun Hu
On 2024/12/3 23:34, James Bottomley wrote: >>> This also enables an incremental migration. >> change the API prototype from: >> device_find_child(..., void *data_0, int (*match)(struct device *dev, >> void *data)); >> >> to: >> device_find_child(..., const void *data_0, int (*match)(struct device >

Re: [PATCH v2 00/32] driver core: Constify API device_find_child() and adapt for various existing usages

2024-12-03 Thread Zijun Hu
On 2024/12/3 22:07, Thomas Weißschuh wrote: > On 2024-12-03 08:58:26-0500, James Bottomley wrote: >> On Tue, 2024-12-03 at 21:02 +0800, Zijun Hu wrote: >>> On 2024/12/3 20:41, Greg Kroah-Hartman wrote: >>>> On Tue, Dec 03, 2024 at 08:23:45PM +0800, Zijun Hu wrote:

Re: [PATCH v2 00/32] driver core: Constify API device_find_child() and adapt for various existing usages

2024-12-03 Thread Zijun Hu
On 2024/12/3 20:41, Greg Kroah-Hartman wrote: > On Tue, Dec 03, 2024 at 08:23:45PM +0800, Zijun Hu wrote: >> On 2024/12/3 20:00, Uwe Kleine-König wrote: >>> Hello, >>> >>> On Tue, Dec 03, 2024 at 08:33:22AM +0800, Zijun Hu wrote: >>>> This patch seri

Re: [PATCH v2 00/32] driver core: Constify API device_find_child() and adapt for various existing usages

2024-12-03 Thread Zijun Hu
On 2024/12/3 20:00, Uwe Kleine-König wrote: > Hello, > > On Tue, Dec 03, 2024 at 08:33:22AM +0800, Zijun Hu wrote: >> This patch series is to constify the following API: >> struct device *device_find_child(struct device *dev, void *data, >> int (*match)(str

[PATCH v2 11/32] libnvdimm: Simplify nd_namespace_store() implementation

2024-12-02 Thread Zijun Hu
From: Zijun Hu Simplify nd_namespace_store() implementation by device_find_child_by_name() Signed-off-by: Zijun Hu --- drivers/nvdimm/claim.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c index

[PATCH v2 10/32] nvdimm: Adapt for constified device_find_child()

2024-12-02 Thread Zijun Hu
From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); Make match_dimm() take a const pointer to adapt for the new type. Signed-off-by: Zijun Hu --- drivers/nvdimm/bus.c | 2 +- 1 file

[PATCH v2 09/32] pwm: Adapt for constified device_find_child()

2024-12-02 Thread Zijun Hu
From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); Make pwm_unexport_match() take a const pointer to adapt for the new type. Signed-off-by: Zijun Hu --- drivers/pwm/core.c | 2 +- 1 file

[PATCH v2 08/32] net: dsa: Adapt for constified device_find_child()

2024-12-02 Thread Zijun Hu
From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); Make dev_is_class() take a const pointer to adapt for the new type. Signed-off-by: Zijun Hu --- net/dsa/dsa.c | 2 +- 1 file changed, 1

[PATCH v2 07/32] gpio: sim: Remove gpio_sim_dev_match_fwnode()

2024-12-02 Thread Zijun Hu
From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); So device_match_fwnode() is applicable for the new type directly, and remove its unnecessary wrapper gpio_sim_dev_match_fwnode(). Signed

[PATCH v2 06/32] thunderbolt: Adapt for constified device_find_child()

2024-12-02 Thread Zijun Hu
From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); Make its match functions take a const pointer to adapt for the new type. Signed-off-by: Zijun Hu --- drivers/thunderbolt/retimer.c | 2

[PATCH v2 05/32] media: pci: mgb4: Adapt for constified device_find_child()

2024-12-02 Thread Zijun Hu
From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); Make its match functions take a const pointer to adapt for the new type. Signed-off-by: Zijun Hu --- drivers/media/pci/mgb4/mgb4_core.c

[PATCH v2 04/32] hwmon: Adapt for constified device_find_child()

2024-12-02 Thread Zijun Hu
From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); Make hwmon_match_device() take a const pointer to adapt for the new type. Signed-off-by: Zijun Hu --- drivers/hwmon/hwmon.c | 2 +- 1

[PATCH v2 03/32] drm/mediatek: Adapt for constified device_find_child()

2024-12-02 Thread Zijun Hu
From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); Make mtk_drm_match() take a const pointer to adapt for the new type. Signed-off-by: Zijun Hu --- drivers/gpu/drm/mediatek/mtk_drm_drv.c

[PATCH v2 02/32] driver core: Introduce device_match_type() to match device with a device type

2024-12-02 Thread Zijun Hu
From: Zijun Hu Introduce device_match_type() to simplify operations below: - Test if a device matches with specified device type. - Find a device with specified device type via various device finding APIs. device_find_child() will use it as argument to simplify operations later. Signed-off-by

[PATCH v2 01/32] driver core: Constify API device_find_child()

2024-12-02 Thread Zijun Hu
From: Zijun Hu 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

[PATCH v2 00/32] driver core: Constify API device_find_child() and adapt for various existing usages

2024-12-02 Thread Zijun Hu
es is modifying its match data @*data after previous cleanup, so it is easy and safe to make its parameter @data take const void * as type. - Simplify involved codes further if it is possbile with benefits brought by constifying the API. Signed-off-by: Zijun Hu --- Changes in v2: - Series