mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] can: mscan: mpc5xxx: Use of_property_present() helper
@ 2023-02-21  2:45 Yang Li
  2023-02-21  4:35 ` Pavan Chebbi
  2023-02-21  8:42 ` Marc Kleine-Budde
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Li @ 2023-02-21  2:45 UTC (permalink / raw)
  To: kuba
  Cc: davem, wg, mkl, edumazet, pabeni, linux-can, netdev,
	linux-kernel, Yang Li

Use of_property_present() instead of of_get_property/of_find_property()
in places where we just need to test presence of a property.

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/net/can/mscan/mpc5xxx_can.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index b0ed798ae70f..8981c223181f 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -315,7 +315,7 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
 	priv->reg_base = base;
 	dev->irq = irq;
 
-	clock_name = of_get_property(np, "fsl,mscan-clock-source", NULL);
+	clock_name = of_property_present(np, "fsl,mscan-clock-source");
 
 	priv->type = data->type;
 	priv->can.clock.freq = data->get_clock(ofdev, clock_name,
-- 
2.20.1.7.g153144c


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] can: mscan: mpc5xxx: Use of_property_present() helper
  2023-02-21  2:45 [PATCH -next] can: mscan: mpc5xxx: Use of_property_present() helper Yang Li
@ 2023-02-21  4:35 ` Pavan Chebbi
  2023-02-21  8:42 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Pavan Chebbi @ 2023-02-21  4:35 UTC (permalink / raw)
  To: Yang Li
  Cc: kuba, davem, wg, mkl, edumazet, pabeni, linux-can, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

On Tue, Feb 21, 2023 at 8:15 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
>
> Use of_property_present() instead of of_get_property/of_find_property()
> in places where we just need to test presence of a property.
>

Please fix the subject and make sure validation is done. I doubt this will pass.
What problem is the patch trying to solve?

> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/net/can/mscan/mpc5xxx_can.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
> index b0ed798ae70f..8981c223181f 100644
> --- a/drivers/net/can/mscan/mpc5xxx_can.c
> +++ b/drivers/net/can/mscan/mpc5xxx_can.c
> @@ -315,7 +315,7 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
>         priv->reg_base = base;
>         dev->irq = irq;
>
> -       clock_name = of_get_property(np, "fsl,mscan-clock-source", NULL);
> +       clock_name = of_property_present(np, "fsl,mscan-clock-source");
>
>         priv->type = data->type;
>         priv->can.clock.freq = data->get_clock(ofdev, clock_name,
> --
> 2.20.1.7.g153144c
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] can: mscan: mpc5xxx: Use of_property_present() helper
  2023-02-21  2:45 [PATCH -next] can: mscan: mpc5xxx: Use of_property_present() helper Yang Li
  2023-02-21  4:35 ` Pavan Chebbi
@ 2023-02-21  8:42 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2023-02-21  8:42 UTC (permalink / raw)
  To: Yang Li
  Cc: kuba, davem, wg, edumazet, pabeni, linux-can, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1389 bytes --]

On 21.02.2023 10:45:41, Yang Li wrote:
> Use of_property_present() instead of of_get_property/of_find_property()
> in places where we just need to test presence of a property.
> 
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

NAK!

Besides the things Pavan Chebbi says, this is not even compile:

| drivers/net/can/mscan/mpc5xxx_can.c: In function ‘mpc5xxx_can_probe’:
| drivers/net/can/mscan/mpc5xxx_can.c:318:22: error: implicit declaration of function ‘of_property_present’; did you mean ‘fwnode_property_present’? [-Werror=implicit-function-declaration]
|   318 |         clock_name = of_property_present(np, "fsl,mscan-clock-source");
|       |                      ^~~~~~~~~~~~~~~~~~~
|       |                      fwnode_property_present
| drivers/net/can/mscan/mpc5xxx_can.c:318:20: error: assignment to ‘const char *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
|   318 |         clock_name = of_property_present(np, "fsl,mscan-clock-source");
|       |                    ^
| cc1: all warnings being treated as errors

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-21  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21  2:45 [PATCH -next] can: mscan: mpc5xxx: Use of_property_present() helper Yang Li
2023-02-21  4:35 ` Pavan Chebbi
2023-02-21  8:42 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®