bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0510-staging-mmal-vchiq-Reset-buffers_with_vpu-on-port_en.patch
1 From 346d7cf505387721ec8b2e678eada08be2179a0b Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 21 Sep 2021 17:17:57 +0100
4 Subject: [PATCH] staging: mmal-vchiq: Reset buffers_with_vpu on
5 port_enable
6
7 Should we go through the timeout failure case with port_disable
8 not returning all buffers for whatever reason, the
9 buffers_with_vpu counter gets left at a non-zero value, which
10 will cause reference counting issues should the instance be
11 reused.
12
13 Reset the count when the port is enabled again, but before
14 any buffers have been sent to the VPU.
15
16 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 ---
18 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 ++
19 1 file changed, 2 insertions(+)
20
21 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
22 +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
23 @@ -1500,6 +1500,8 @@ static int port_enable(struct vchiq_mmal
24
25 port->enabled = 1;
26
27 + atomic_set(&port->buffers_with_vpu, 0);
28 +
29 if (port->buffer_cb) {
30 /* send buffer headers to videocore */
31 hdr_count = 1;