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
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
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;
>> }
>>
>
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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)(
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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:
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
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
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
>>
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
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
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
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
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
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
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
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
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
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
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
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
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_
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
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
>
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:
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
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
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
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
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
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
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
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
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
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
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
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
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
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
69 matches
Mail list logo