]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: hackrf: set lock before calling vb2_queue_init()
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 2 Sep 2024 14:04:50 +0000 (16:04 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 12 Oct 2024 13:53:53 +0000 (15:53 +0200)
The vb2_queue_init() will expect the vb2_queue lock pointer to be set in
the future. So for those drivers that set the lock later, move it up to
before the vb2_queue_init() call.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/usb/hackrf/hackrf.c

index 9c0ecd5f056c08ab0c23d56d0172cff9795627dc..a1a7690a344a5bc8add88f7d0c5cda6cfc52509b 100644 (file)
@@ -1398,6 +1398,7 @@ static int hackrf_probe(struct usb_interface *intf,
        dev->rx_vb2_queue.drv_priv = dev;
        dev->rx_vb2_queue.buf_struct_size = sizeof(struct hackrf_buffer);
        dev->rx_vb2_queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+       dev->rx_vb2_queue.lock = &dev->vb_queue_lock;
        ret = vb2_queue_init(&dev->rx_vb2_queue);
        if (ret) {
                dev_err(dev->dev, "Could not initialize rx vb2 queue\n");
@@ -1413,6 +1414,7 @@ static int hackrf_probe(struct usb_interface *intf,
        dev->tx_vb2_queue.drv_priv = dev;
        dev->tx_vb2_queue.buf_struct_size = sizeof(struct hackrf_buffer);
        dev->tx_vb2_queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+       dev->tx_vb2_queue.lock = &dev->vb_queue_lock;
        ret = vb2_queue_init(&dev->tx_vb2_queue);
        if (ret) {
                dev_err(dev->dev, "Could not initialize tx vb2 queue\n");
@@ -1474,7 +1476,6 @@ static int hackrf_probe(struct usb_interface *intf,
        /* Init video_device structure for receiver */
        dev->rx_vdev = hackrf_template;
        dev->rx_vdev.queue = &dev->rx_vb2_queue;
-       dev->rx_vdev.queue->lock = &dev->vb_queue_lock;
        dev->rx_vdev.v4l2_dev = &dev->v4l2_dev;
        dev->rx_vdev.ctrl_handler = &dev->rx_ctrl_handler;
        dev->rx_vdev.lock = &dev->v4l2_lock;
@@ -1494,7 +1495,6 @@ static int hackrf_probe(struct usb_interface *intf,
        /* Init video_device structure for transmitter */
        dev->tx_vdev = hackrf_template;
        dev->tx_vdev.queue = &dev->tx_vb2_queue;
-       dev->tx_vdev.queue->lock = &dev->vb_queue_lock;
        dev->tx_vdev.v4l2_dev = &dev->v4l2_dev;
        dev->tx_vdev.ctrl_handler = &dev->tx_ctrl_handler;
        dev->tx_vdev.lock = &dev->v4l2_lock;