Skip to content

Commit d5ad8ec

Browse files
committed
Merge tag 'media/v5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media fixes from Mauro Carvalho Chehab: - regression fix for the rtl28xxu I2C logic - build fix for the atmel driver - videobuf2-core: dequeue if start_streaming fails * tag 'media/v5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: media: atmel: fix build when ISC=m and XISC=y media: videobuf2-core: dequeue if start_streaming fails media: rtl28xxu: fix zero-length control request media: Revert "media: rtl28xxu: fix zero-length control request"
2 parents 785ee98 + f1de1c7 commit d5ad8ec

File tree

5 files changed

+45
-6
lines changed

5 files changed

+45
-6
lines changed

drivers/media/common/videobuf2/videobuf2-core.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,7 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb,
15731573
struct media_request *req)
15741574
{
15751575
struct vb2_buffer *vb;
1576+
enum vb2_buffer_state orig_state;
15761577
int ret;
15771578

15781579
if (q->error) {
@@ -1673,6 +1674,7 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb,
16731674
* Add to the queued buffers list, a buffer will stay on it until
16741675
* dequeued in dqbuf.
16751676
*/
1677+
orig_state = vb->state;
16761678
list_add_tail(&vb->queued_entry, &q->queued_list);
16771679
q->queued_count++;
16781680
q->waiting_for_buffers = false;
@@ -1703,8 +1705,17 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb,
17031705
if (q->streaming && !q->start_streaming_called &&
17041706
q->queued_count >= q->min_buffers_needed) {
17051707
ret = vb2_start_streaming(q);
1706-
if (ret)
1708+
if (ret) {
1709+
/*
1710+
* Since vb2_core_qbuf will return with an error,
1711+
* we should return it to state DEQUEUED since
1712+
* the error indicates that the buffer wasn't queued.
1713+
*/
1714+
list_del(&vb->queued_entry);
1715+
q->queued_count--;
1716+
vb->state = orig_state;
17071717
return ret;
1718+
}
17081719
}
17091720

17101721
dprintk(q, 2, "qbuf of buffer %d succeeded\n", vb->index);

drivers/media/platform/atmel/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ config VIDEO_ATMEL_ISC
88
select VIDEOBUF2_DMA_CONTIG
99
select REGMAP_MMIO
1010
select V4L2_FWNODE
11+
select VIDEO_ATMEL_ISC_BASE
1112
help
1213
This module makes the ATMEL Image Sensor Controller available
1314
as a v4l2 device.
@@ -19,10 +20,17 @@ config VIDEO_ATMEL_XISC
1920
select VIDEOBUF2_DMA_CONTIG
2021
select REGMAP_MMIO
2122
select V4L2_FWNODE
23+
select VIDEO_ATMEL_ISC_BASE
2224
help
2325
This module makes the ATMEL eXtended Image Sensor Controller
2426
available as a v4l2 device.
2527

28+
config VIDEO_ATMEL_ISC_BASE
29+
tristate
30+
default n
31+
help
32+
ATMEL ISC and XISC common code base.
33+
2634
config VIDEO_ATMEL_ISI
2735
tristate "ATMEL Image Sensor Interface (ISI) support"
2836
depends on VIDEO_V4L2 && OF

drivers/media/platform/atmel/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
atmel-isc-objs = atmel-sama5d2-isc.o atmel-isc-base.o
3-
atmel-xisc-objs = atmel-sama7g5-isc.o atmel-isc-base.o
2+
atmel-isc-objs = atmel-sama5d2-isc.o
3+
atmel-xisc-objs = atmel-sama7g5-isc.o
44

55
obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o
6+
obj-$(CONFIG_VIDEO_ATMEL_ISC_BASE) += atmel-isc-base.o
67
obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel-isc.o
78
obj-$(CONFIG_VIDEO_ATMEL_XISC) += atmel-xisc.o

drivers/media/platform/atmel/atmel-isc-base.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ int isc_clk_init(struct isc_device *isc)
378378

379379
return 0;
380380
}
381+
EXPORT_SYMBOL_GPL(isc_clk_init);
381382

382383
void isc_clk_cleanup(struct isc_device *isc)
383384
{
@@ -392,6 +393,7 @@ void isc_clk_cleanup(struct isc_device *isc)
392393
clk_unregister(isc_clk->clk);
393394
}
394395
}
396+
EXPORT_SYMBOL_GPL(isc_clk_cleanup);
395397

396398
static int isc_queue_setup(struct vb2_queue *vq,
397399
unsigned int *nbuffers, unsigned int *nplanes,
@@ -1578,6 +1580,7 @@ irqreturn_t isc_interrupt(int irq, void *dev_id)
15781580

15791581
return ret;
15801582
}
1583+
EXPORT_SYMBOL_GPL(isc_interrupt);
15811584

15821585
static void isc_hist_count(struct isc_device *isc, u32 *min, u32 *max)
15831586
{
@@ -2212,6 +2215,7 @@ const struct v4l2_async_notifier_operations isc_async_ops = {
22122215
.unbind = isc_async_unbind,
22132216
.complete = isc_async_complete,
22142217
};
2218+
EXPORT_SYMBOL_GPL(isc_async_ops);
22152219

22162220
void isc_subdev_cleanup(struct isc_device *isc)
22172221
{
@@ -2224,6 +2228,7 @@ void isc_subdev_cleanup(struct isc_device *isc)
22242228

22252229
INIT_LIST_HEAD(&isc->subdev_entities);
22262230
}
2231+
EXPORT_SYMBOL_GPL(isc_subdev_cleanup);
22272232

22282233
int isc_pipeline_init(struct isc_device *isc)
22292234
{
@@ -2264,6 +2269,7 @@ int isc_pipeline_init(struct isc_device *isc)
22642269

22652270
return 0;
22662271
}
2272+
EXPORT_SYMBOL_GPL(isc_pipeline_init);
22672273

22682274
/* regmap configuration */
22692275
#define ATMEL_ISC_REG_MAX 0xd5c
@@ -2273,4 +2279,9 @@ const struct regmap_config isc_regmap_config = {
22732279
.val_bits = 32,
22742280
.max_register = ATMEL_ISC_REG_MAX,
22752281
};
2282+
EXPORT_SYMBOL_GPL(isc_regmap_config);
22762283

2284+
MODULE_AUTHOR("Songjun Wu");
2285+
MODULE_AUTHOR("Eugen Hristev");
2286+
MODULE_DESCRIPTION("Atmel ISC common code base");
2287+
MODULE_LICENSE("GPL v2");

drivers/media/usb/dvb-usb-v2/rtl28xxu.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,16 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req)
3737
} else {
3838
/* read */
3939
requesttype = (USB_TYPE_VENDOR | USB_DIR_IN);
40-
pipe = usb_rcvctrlpipe(d->udev, 0);
40+
41+
/*
42+
* Zero-length transfers must use usb_sndctrlpipe() and
43+
* rtl28xxu_identify_state() uses a zero-length i2c read
44+
* command to determine the chip type.
45+
*/
46+
if (req->size)
47+
pipe = usb_rcvctrlpipe(d->udev, 0);
48+
else
49+
pipe = usb_sndctrlpipe(d->udev, 0);
4150
}
4251

4352
ret = usb_control_msg(d->udev, pipe, 0, requesttype, req->value,
@@ -612,9 +621,8 @@ static int rtl28xxu_read_config(struct dvb_usb_device *d)
612621
static int rtl28xxu_identify_state(struct dvb_usb_device *d, const char **name)
613622
{
614623
struct rtl28xxu_dev *dev = d_to_priv(d);
615-
u8 buf[1];
616624
int ret;
617-
struct rtl28xxu_req req_demod_i2c = {0x0020, CMD_I2C_DA_RD, 1, buf};
625+
struct rtl28xxu_req req_demod_i2c = {0x0020, CMD_I2C_DA_RD, 0, NULL};
618626

619627
dev_dbg(&d->intf->dev, "\n");
620628

0 commit comments

Comments
 (0)