[PATCH v3 08/32] media: usb/msi2500: Follow renaming of SPI "master" to "controller"

Uwe Kleine-König posted 32 patches 9 months, 1 week ago
[PATCH v3 08/32] media: usb/msi2500: Follow renaming of SPI "master" to "controller"
Posted by Uwe Kleine-König 9 months, 1 week ago
In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/media/usb/msi2500/msi2500.c | 38 ++++++++++++++---------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c
index 9759996ee6a4..5138486abfa0 100644
--- a/drivers/media/usb/msi2500/msi2500.c
+++ b/drivers/media/usb/msi2500/msi2500.c
@@ -107,7 +107,7 @@ struct msi2500_dev {
 	struct video_device vdev;
 	struct v4l2_device v4l2_dev;
 	struct v4l2_subdev *v4l2_subdev;
-	struct spi_master *master;
+	struct spi_controller *ctlr;
 
 	/* videobuf2 queue and queued buffers list */
 	struct vb2_queue vb_queue;
@@ -574,7 +574,7 @@ static void msi2500_disconnect(struct usb_interface *intf)
 	dev->udev = NULL;
 	v4l2_device_disconnect(&dev->v4l2_dev);
 	video_unregister_device(&dev->vdev);
-	spi_unregister_master(dev->master);
+	spi_unregister_controller(dev->ctlr);
 	mutex_unlock(&dev->v4l2_lock);
 	mutex_unlock(&dev->vb_queue_lock);
 
@@ -1136,10 +1136,10 @@ static void msi2500_video_release(struct v4l2_device *v)
 	kfree(dev);
 }
 
-static int msi2500_transfer_one_message(struct spi_master *master,
+static int msi2500_transfer_one_message(struct spi_controller *ctlr,
 					struct spi_message *m)
 {
-	struct msi2500_dev *dev = spi_master_get_devdata(master);
+	struct msi2500_dev *dev = spi_controller_get_devdata(ctlr);
 	struct spi_transfer *t;
 	int ret = 0;
 	u32 data;
@@ -1154,7 +1154,7 @@ static int msi2500_transfer_one_message(struct spi_master *master,
 	}
 
 	m->status = ret;
-	spi_finalize_current_message(master);
+	spi_finalize_current_message(ctlr);
 	return ret;
 }
 
@@ -1163,7 +1163,7 @@ static int msi2500_probe(struct usb_interface *intf,
 {
 	struct msi2500_dev *dev;
 	struct v4l2_subdev *sd;
-	struct spi_master *master;
+	struct spi_controller *ctlr;
 	int ret;
 	static struct spi_board_info board_info = {
 		.modalias		= "msi001",
@@ -1220,30 +1220,30 @@ static int msi2500_probe(struct usb_interface *intf,
 	}
 
 	/* SPI master adapter */
-	master = spi_alloc_master(dev->dev, 0);
-	if (master == NULL) {
+	ctlr = spi_alloc_master(dev->dev, 0);
+	if (ctlr == NULL) {
 		ret = -ENOMEM;
 		goto err_unregister_v4l2_dev;
 	}
 
-	dev->master = master;
-	master->bus_num = -1;
-	master->num_chipselect = 1;
-	master->transfer_one_message = msi2500_transfer_one_message;
-	spi_master_set_devdata(master, dev);
-	ret = spi_register_master(master);
+	dev->ctlr = ctlr;
+	ctlr->bus_num = -1;
+	ctlr->num_chipselect = 1;
+	ctlr->transfer_one_message = msi2500_transfer_one_message;
+	spi_controller_set_devdata(ctlr, dev);
+	ret = spi_register_controller(ctlr);
 	if (ret) {
-		spi_master_put(master);
+		spi_controller_put(ctlr);
 		goto err_unregister_v4l2_dev;
 	}
 
 	/* load v4l2 subdevice */
-	sd = v4l2_spi_new_subdev(&dev->v4l2_dev, master, &board_info);
+	sd = v4l2_spi_new_subdev(&dev->v4l2_dev, ctlr, &board_info);
 	dev->v4l2_subdev = sd;
 	if (sd == NULL) {
 		dev_err(dev->dev, "cannot get v4l2 subdevice\n");
 		ret = -ENODEV;
-		goto err_unregister_master;
+		goto err_unregister_controller;
 	}
 
 	/* Register controls */
@@ -1276,8 +1276,8 @@ static int msi2500_probe(struct usb_interface *intf,
 	return 0;
 err_free_controls:
 	v4l2_ctrl_handler_free(&dev->hdl);
-err_unregister_master:
-	spi_unregister_master(dev->master);
+err_unregister_controller:
+	spi_unregister_controller(dev->ctlr);
 err_unregister_v4l2_dev:
 	v4l2_device_unregister(&dev->v4l2_dev);
 err_free_mem:
-- 
2.43.0

Re: [PATCH v3 08/32] media: usb/msi2500: Follow renaming of SPI "master" to "controller"
Posted by Hans Verkuil 9 months ago
On 07/02/2024 19:40, Uwe Kleine-König wrote:
> In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
> some functions and struct members were renamed. To not break all drivers
> compatibility macros were provided.
> 
> To be able to remove these compatibility macros push the renaming into
> this driver.
> 
> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> ---
>  drivers/media/usb/msi2500/msi2500.c | 38 ++++++++++++++---------------
>  1 file changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c
> index 9759996ee6a4..5138486abfa0 100644
> --- a/drivers/media/usb/msi2500/msi2500.c
> +++ b/drivers/media/usb/msi2500/msi2500.c
> @@ -107,7 +107,7 @@ struct msi2500_dev {
>  	struct video_device vdev;
>  	struct v4l2_device v4l2_dev;
>  	struct v4l2_subdev *v4l2_subdev;
> -	struct spi_master *master;
> +	struct spi_controller *ctlr;
>  
>  	/* videobuf2 queue and queued buffers list */
>  	struct vb2_queue vb_queue;
> @@ -574,7 +574,7 @@ static void msi2500_disconnect(struct usb_interface *intf)
>  	dev->udev = NULL;
>  	v4l2_device_disconnect(&dev->v4l2_dev);
>  	video_unregister_device(&dev->vdev);
> -	spi_unregister_master(dev->master);
> +	spi_unregister_controller(dev->ctlr);
>  	mutex_unlock(&dev->v4l2_lock);
>  	mutex_unlock(&dev->vb_queue_lock);
>  
> @@ -1136,10 +1136,10 @@ static void msi2500_video_release(struct v4l2_device *v)
>  	kfree(dev);
>  }
>  
> -static int msi2500_transfer_one_message(struct spi_master *master,
> +static int msi2500_transfer_one_message(struct spi_controller *ctlr,
>  					struct spi_message *m)
>  {
> -	struct msi2500_dev *dev = spi_master_get_devdata(master);
> +	struct msi2500_dev *dev = spi_controller_get_devdata(ctlr);
>  	struct spi_transfer *t;
>  	int ret = 0;
>  	u32 data;
> @@ -1154,7 +1154,7 @@ static int msi2500_transfer_one_message(struct spi_master *master,
>  	}
>  
>  	m->status = ret;
> -	spi_finalize_current_message(master);
> +	spi_finalize_current_message(ctlr);
>  	return ret;
>  }
>  
> @@ -1163,7 +1163,7 @@ static int msi2500_probe(struct usb_interface *intf,
>  {
>  	struct msi2500_dev *dev;
>  	struct v4l2_subdev *sd;
> -	struct spi_master *master;
> +	struct spi_controller *ctlr;
>  	int ret;
>  	static struct spi_board_info board_info = {
>  		.modalias		= "msi001",
> @@ -1220,30 +1220,30 @@ static int msi2500_probe(struct usb_interface *intf,
>  	}
>  
>  	/* SPI master adapter */
> -	master = spi_alloc_master(dev->dev, 0);
> -	if (master == NULL) {
> +	ctlr = spi_alloc_master(dev->dev, 0);
> +	if (ctlr == NULL) {
>  		ret = -ENOMEM;
>  		goto err_unregister_v4l2_dev;
>  	}
>  
> -	dev->master = master;
> -	master->bus_num = -1;
> -	master->num_chipselect = 1;
> -	master->transfer_one_message = msi2500_transfer_one_message;
> -	spi_master_set_devdata(master, dev);
> -	ret = spi_register_master(master);
> +	dev->ctlr = ctlr;
> +	ctlr->bus_num = -1;
> +	ctlr->num_chipselect = 1;
> +	ctlr->transfer_one_message = msi2500_transfer_one_message;
> +	spi_controller_set_devdata(ctlr, dev);
> +	ret = spi_register_controller(ctlr);
>  	if (ret) {
> -		spi_master_put(master);
> +		spi_controller_put(ctlr);
>  		goto err_unregister_v4l2_dev;
>  	}
>  
>  	/* load v4l2 subdevice */
> -	sd = v4l2_spi_new_subdev(&dev->v4l2_dev, master, &board_info);
> +	sd = v4l2_spi_new_subdev(&dev->v4l2_dev, ctlr, &board_info);
>  	dev->v4l2_subdev = sd;
>  	if (sd == NULL) {
>  		dev_err(dev->dev, "cannot get v4l2 subdevice\n");
>  		ret = -ENODEV;
> -		goto err_unregister_master;
> +		goto err_unregister_controller;
>  	}
>  
>  	/* Register controls */
> @@ -1276,8 +1276,8 @@ static int msi2500_probe(struct usb_interface *intf,
>  	return 0;
>  err_free_controls:
>  	v4l2_ctrl_handler_free(&dev->hdl);
> -err_unregister_master:
> -	spi_unregister_master(dev->master);
> +err_unregister_controller:
> +	spi_unregister_controller(dev->ctlr);
>  err_unregister_v4l2_dev:
>  	v4l2_device_unregister(&dev->v4l2_dev);
>  err_free_mem: