[10/10] spi: rzv2m-csi: Make use of device_set_node

Message ID 20230715010407.1751715-11-fabrizio.castro.jz@renesas.com
State New
Headers
Series spi: rzv2m-csi: Code refactoring |

Commit Message

Fabrizio Castro July 15, 2023, 1:04 a.m. UTC
  Use device_set_node instead of assigning controller->dev.of_node
directly.

Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
---
 drivers/spi/spi-rzv2m-csi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Andy Shevchenko July 15, 2023, 7:58 a.m. UTC | #1
On Sat, Jul 15, 2023 at 4:04 AM Fabrizio Castro
<fabrizio.castro.jz@renesas.com> wrote:
>
> Use device_set_node instead of assigning controller->dev.of_node
> directly.

"...because it also sets the firmware node."

You probably need to add property.h, if not added yet.
  
Fabrizio Castro July 17, 2023, 3:05 p.m. UTC | #2
Hi Andy,

> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> Subject: Re: [PATCH 10/10] spi: rzv2m-csi: Make use of device_set_node
> 
> On Sat, Jul 15, 2023 at 4:04 AM Fabrizio Castro
> <fabrizio.castro.jz@renesas.com> wrote:
> >
> > Use device_set_node instead of assigning controller->dev.of_node
> > directly.
> 
> "...because it also sets the firmware node."
> 
> You probably need to add property.h, if not added yet.

You are right, I'll send a v2 for this.
I'll also add the related Suggested-by and Reviewed-by tags in v2.

Cheers,
Fab

> 
> --
> With Best Regards,
> Andy Shevchenko
  

Patch

diff --git a/drivers/spi/spi-rzv2m-csi.c b/drivers/spi/spi-rzv2m-csi.c
index 1874ca1c2747..ad7ca514eb09 100644
--- a/drivers/spi/spi-rzv2m-csi.c
+++ b/drivers/spi/spi-rzv2m-csi.c
@@ -575,12 +575,13 @@  static int rzv2m_csi_probe(struct platform_device *pdev)
 	init_waitqueue_head(&csi->wait);
 
 	controller->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
-	controller->dev.of_node = pdev->dev.of_node;
 	controller->bits_per_word_mask = SPI_BPW_MASK(16) | SPI_BPW_MASK(8);
 	controller->setup = rzv2m_csi_setup;
 	controller->transfer_one = rzv2m_csi_transfer_one;
 	controller->use_gpio_descriptors = true;
 
+	device_set_node(&controller->dev, dev_fwnode(dev));
+
 	ret = devm_request_irq(dev, irq, rzv2m_csi_irq_handler, 0,
 			       dev_name(dev), csi);
 	if (ret)