diff mbox series

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

Message ID 20241211-const_dfc_done-v4-2-583cc60329df@quicinc.com
State Superseded
Headers show
Series driver core: Constify API device_find_child() | expand

Commit Message

Zijun Hu Dec. 11, 2024, 12:08 a.m. UTC
From: Zijun Hu <quic_zijuhu@quicinc.com>

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 <quic_zijuhu@quicinc.com>
---
 drivers/slimbus/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jonathan Cameron Dec. 23, 2024, 8:25 p.m. UTC | #1
On Wed, 11 Dec 2024 08:08:04 +0800
Zijun Hu <zijun_hu@icloud.com> wrote:

> From: Zijun Hu <quic_zijuhu@quicinc.com>
> 
> 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 <quic_zijuhu@quicinc.com>

Absolutely makes sense given later patches mean one of the inputs
is of type constant pointer, but maybe worth calling that out as
the reason for the change here.

Other than that looks good.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/slimbus/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
> index 65e5515f7555e2eb840fedaf2dc4cc5d76dbc089..b5d5bbb9fdb6614ffd578f5754226b50e394f0df 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 &&
>
diff mbox series

Patch

diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index 65e5515f7555e2eb840fedaf2dc4cc5d76dbc089..b5d5bbb9fdb6614ffd578f5754226b50e394f0df 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 &&