diff mbox series

[v2,3/3] can: flexcan: lack of stop mode dts properity should not block driver probe

Message ID 20230726090909.3417030-3-haibo.chen@nxp.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [v2,1/3] arm64: dts: imx93: add the Flex-CAN stop mode by GPR | expand

Checks

Context Check Description
netdev/series_format warning Series does not have a cover letter
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1342 this patch: 1342
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 1365 this patch: 1365
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1365 this patch: 1365
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Bough Chen July 26, 2023, 9:09 a.m. UTC
From: Haibo Chen <haibo.chen@nxp.com>

If SoC claim to support stop mode, but dts file do not contain the stop
mode properity, this should not block the driver probe. For this case,
the driver only need to skip the wakeup capable setting which means this
device do not support the feature to wakeup system.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/net/can/flexcan/flexcan-core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Marc Kleine-Budde July 26, 2023, 10:16 a.m. UTC | #1
On 26.07.2023 17:09:09, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
> 
> If SoC claim to support stop mode, but dts file do not contain the stop
> mode properity, this should not block the driver probe. For this case,
> the driver only need to skip the wakeup capable setting which means this
> device do not support the feature to wakeup system.

This still breaks old DTS on kernels with patch 2 applied, but not 3.
Please squash this into 2.

> 
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> ---
>  drivers/net/can/flexcan/flexcan-core.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> index a3f3a9c909be..d8be69f4a0c3 100644
> --- a/drivers/net/can/flexcan/flexcan-core.c
> +++ b/drivers/net/can/flexcan/flexcan-core.c
> @@ -1987,7 +1987,14 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev)
>  		/* return 0 directly if doesn't support stop mode feature */
>  		return 0;
>  
> -	if (ret)
> +	/* If ret is -EINVAL, this means SoC claim to support stop mode, but
> +	 * dts file lack the stop mode property definition. For this case,
> +	 * directly return 0, this will skip the wakeup capable setting and
> +	 * will not block the driver probe.
> +	 */
> +	if (ret == -EINVAL)
> +		return 0;
> +	else if (ret)
>  		return ret;
>  
>  	device_set_wakeup_capable(&pdev->dev, true);
> -- 
> 2.34.1
> 
> 

regards,
Marc
Bough Chen July 26, 2023, 11:10 a.m. UTC | #2
> -----Original Message-----
> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Sent: 2023年7月26日 18:17
> To: Bough Chen <haibo.chen@nxp.com>
> Cc: robh+dt@kernel.org; krzysztof.kozlowski+dt@linaro.org;
> conor+dt@kernel.org; shawnguo@kernel.org; s.hauer@pengutronix.de;
> wg@grandegger.com; kernel@pengutronix.de; dl-linux-imx
> <linux-imx@nxp.com>; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com; devicetree@vger.kernel.org;
> linux-can@vger.kernel.org; netdev@vger.kernel.org
> Subject: Re: [PATCH v2 3/3] can: flexcan: lack of stop mode dts properity should
> not block driver probe
> 
> On 26.07.2023 17:09:09, haibo.chen@nxp.com wrote:
> > From: Haibo Chen <haibo.chen@nxp.com>
> >
> > If SoC claim to support stop mode, but dts file do not contain the
> > stop mode properity, this should not block the driver probe. For this
> > case, the driver only need to skip the wakeup capable setting which
> > means this device do not support the feature to wakeup system.
> 
> This still breaks old DTS on kernels with patch 2 applied, but not 3.
> Please squash this into 2.

Okay.

> 
> >
> > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> > ---
> >  drivers/net/can/flexcan/flexcan-core.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/can/flexcan/flexcan-core.c
> > b/drivers/net/can/flexcan/flexcan-core.c
> > index a3f3a9c909be..d8be69f4a0c3 100644
> > --- a/drivers/net/can/flexcan/flexcan-core.c
> > +++ b/drivers/net/can/flexcan/flexcan-core.c
> > @@ -1987,7 +1987,14 @@ static int flexcan_setup_stop_mode(struct
> platform_device *pdev)
> >  		/* return 0 directly if doesn't support stop mode feature */
> >  		return 0;
> >
> > -	if (ret)
> > +	/* If ret is -EINVAL, this means SoC claim to support stop mode, but
> > +	 * dts file lack the stop mode property definition. For this case,
> > +	 * directly return 0, this will skip the wakeup capable setting and
> > +	 * will not block the driver probe.
> > +	 */
> > +	if (ret == -EINVAL)
> > +		return 0;
> > +	else if (ret)
> >  		return ret;
> >
> >  	device_set_wakeup_capable(&pdev->dev, true);
> > --
> > 2.34.1
> >
> >
> 
> regards,
> Marc
> 
> --
> Pengutronix e.K.                 | Marc Kleine-Budde          |
> Embedded Linux                   | https://www.pengutronix.de |
> Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
> Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |
diff mbox series

Patch

diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index a3f3a9c909be..d8be69f4a0c3 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -1987,7 +1987,14 @@  static int flexcan_setup_stop_mode(struct platform_device *pdev)
 		/* return 0 directly if doesn't support stop mode feature */
 		return 0;
 
-	if (ret)
+	/* If ret is -EINVAL, this means SoC claim to support stop mode, but
+	 * dts file lack the stop mode property definition. For this case,
+	 * directly return 0, this will skip the wakeup capable setting and
+	 * will not block the driver probe.
+	 */
+	if (ret == -EINVAL)
+		return 0;
+	else if (ret)
 		return ret;
 
 	device_set_wakeup_capable(&pdev->dev, true);