netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: rcar_canfd: Register the CAN device when fully ready
@ 2022-02-21 22:59 Lad Prabhakar
  2022-02-22  9:53 ` Ulrich Hecht
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lad Prabhakar @ 2022-02-21 22:59 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller,
	Jakub Kicinski, linux-can, Pavel Machek
  Cc: netdev, linux-kernel, linux-renesas-soc, Ulrich Hecht,
	Lad Prabhakar, Prabhakar, Biju Das

Register the CAN device only when all the necessary initialization
is completed. This patch makes sure all the data structures and locks are
initialized before registering the CAN device.

Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/net/can/rcar/rcar_canfd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 3ad3a6f6a1dd..8c378b20b2aa 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -1783,15 +1783,15 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
 
 	netif_napi_add(ndev, &priv->napi, rcar_canfd_rx_poll,
 		       RCANFD_NAPI_WEIGHT);
+	spin_lock_init(&priv->tx_lock);
+	devm_can_led_init(ndev);
+	gpriv->ch[priv->channel] = priv;
 	err = register_candev(ndev);
 	if (err) {
 		dev_err(&pdev->dev,
 			"register_candev() failed, error %d\n", err);
 		goto fail_candev;
 	}
-	spin_lock_init(&priv->tx_lock);
-	devm_can_led_init(ndev);
-	gpriv->ch[priv->channel] = priv;
 	dev_info(&pdev->dev, "device registered (channel %u)\n", priv->channel);
 	return 0;
 
-- 
2.17.1


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

* Re: [PATCH] can: rcar_canfd: Register the CAN device when fully ready
  2022-02-21 22:59 [PATCH] can: rcar_canfd: Register the CAN device when fully ready Lad Prabhakar
@ 2022-02-22  9:53 ` Ulrich Hecht
  2022-02-22 13:43 ` Pavel Machek
  2022-02-25 16:47 ` Marc Kleine-Budde
  2 siblings, 0 replies; 5+ messages in thread
From: Ulrich Hecht @ 2022-02-22  9:53 UTC (permalink / raw)
  To: Lad Prabhakar, Wolfgang Grandegger, Marc Kleine-Budde,
	David S. Miller, Jakub Kicinski, linux-can, Pavel Machek
  Cc: netdev, linux-kernel, linux-renesas-soc, Ulrich Hecht, Prabhakar,
	Biju Das


> On 02/21/2022 11:59 PM Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> 
>  
> Register the CAN device only when all the necessary initialization
> is completed. This patch makes sure all the data structures and locks are
> initialized before registering the CAN device.
> 
> Reported-by: Pavel Machek <pavel@denx.de>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
>  drivers/net/can/rcar/rcar_canfd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
> index 3ad3a6f6a1dd..8c378b20b2aa 100644
> --- a/drivers/net/can/rcar/rcar_canfd.c
> +++ b/drivers/net/can/rcar/rcar_canfd.c
> @@ -1783,15 +1783,15 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
>  
>  	netif_napi_add(ndev, &priv->napi, rcar_canfd_rx_poll,
>  		       RCANFD_NAPI_WEIGHT);
> +	spin_lock_init(&priv->tx_lock);
> +	devm_can_led_init(ndev);
> +	gpriv->ch[priv->channel] = priv;
>  	err = register_candev(ndev);
>  	if (err) {
>  		dev_err(&pdev->dev,
>  			"register_candev() failed, error %d\n", err);
>  		goto fail_candev;
>  	}
> -	spin_lock_init(&priv->tx_lock);
> -	devm_can_led_init(ndev);
> -	gpriv->ch[priv->channel] = priv;
>  	dev_info(&pdev->dev, "device registered (channel %u)\n", priv->channel);
>  	return 0;
>  
> -- 
> 2.17.1

Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>

CU
Uli

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

* Re: [PATCH] can: rcar_canfd: Register the CAN device when fully ready
  2022-02-21 22:59 [PATCH] can: rcar_canfd: Register the CAN device when fully ready Lad Prabhakar
  2022-02-22  9:53 ` Ulrich Hecht
@ 2022-02-22 13:43 ` Pavel Machek
  2022-02-22 13:48   ` Marc Kleine-Budde
  2022-02-25 16:47 ` Marc Kleine-Budde
  2 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2022-02-22 13:43 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller,
	Jakub Kicinski, linux-can, Pavel Machek, netdev, linux-kernel,
	linux-renesas-soc, Ulrich Hecht, Prabhakar, Biju Das

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

On Mon 2022-02-21 22:59:35, Lad Prabhakar wrote:
> Register the CAN device only when all the necessary initialization
> is completed. This patch makes sure all the data structures and locks are
> initialized before registering the CAN device.

Reviewed-by: Pavel Machek <pavel@denx.de>

I guess it will go to mainline and then -stable so that we don't have
to do anything special?

Best regards,

								Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

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

* Re: [PATCH] can: rcar_canfd: Register the CAN device when fully ready
  2022-02-22 13:43 ` Pavel Machek
@ 2022-02-22 13:48   ` Marc Kleine-Budde
  0 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2022-02-22 13:48 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Lad Prabhakar, Wolfgang Grandegger, David S. Miller,
	Jakub Kicinski, linux-can, netdev, linux-kernel,
	linux-renesas-soc, Ulrich Hecht, Prabhakar, Biju Das

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

On 22.02.2022 14:43:58, Pavel Machek wrote:
> On Mon 2022-02-21 22:59:35, Lad Prabhakar wrote:
> > Register the CAN device only when all the necessary initialization
> > is completed. This patch makes sure all the data structures and locks are
> > initialized before registering the CAN device.
> 
> Reviewed-by: Pavel Machek <pavel@denx.de>
> 
> I guess it will go to mainline and then -stable so that we don't have
> to do anything special?

ACK

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] 5+ messages in thread

* Re: [PATCH] can: rcar_canfd: Register the CAN device when fully ready
  2022-02-21 22:59 [PATCH] can: rcar_canfd: Register the CAN device when fully ready Lad Prabhakar
  2022-02-22  9:53 ` Ulrich Hecht
  2022-02-22 13:43 ` Pavel Machek
@ 2022-02-25 16:47 ` Marc Kleine-Budde
  2 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2022-02-25 16:47 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Wolfgang Grandegger, David S. Miller, Jakub Kicinski, linux-can,
	Pavel Machek, netdev, linux-kernel, linux-renesas-soc,
	Ulrich Hecht, Prabhakar, Biju Das

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

On 21.02.2022 22:59:35, Lad Prabhakar wrote:
> Register the CAN device only when all the necessary initialization
> is completed. This patch makes sure all the data structures and locks are
> initialized before registering the CAN device.

Applied to can/testing.

Thanks,
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] 5+ messages in thread

end of thread, other threads:[~2022-02-25 16:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21 22:59 [PATCH] can: rcar_canfd: Register the CAN device when fully ready Lad Prabhakar
2022-02-22  9:53 ` Ulrich Hecht
2022-02-22 13:43 ` Pavel Machek
2022-02-22 13:48   ` Marc Kleine-Budde
2022-02-25 16:47 ` 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;
as well as URLs for NNTP newsgroup(s).