From patchwork Mon Sep 2 14:04:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 99222 Received: from sy.mirrors.kernel.org ([147.75.48.161]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sl7g1-00055d-3C for patchwork@linuxtv.org; Mon, 02 Sep 2024 14:05:06 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 37FADB211E3 for ; Mon, 2 Sep 2024 14:05:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2605520FAA7; Mon, 2 Sep 2024 14:04:59 +0000 (UTC) X-Original-To: linux-media@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4211201243 for ; Mon, 2 Sep 2024 14:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725285898; cv=none; b=DQWgsjtkyvGJVB85vYpCzcx9XYW/uG7qrVPn/L0JMFuVQRmpS2KwiN4p8oV1QleN/MGecmfsLnoRaD5UlZsrUoM1LT/YYUctKaUGCJeM+6nj0kswZXDKfKiRQcjiA+NqFCVRDCClb8eFh1odCraPT9LB0+4Fev5+suWgbAfz9E8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725285898; c=relaxed/simple; bh=XGPgfbKsT7IznRyLXUdzXXUETuBBH1ynLiAlO079i6g=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=TP229nVbgNm+/1C5juJ/ACPwm/pDHjr07DAN1Z9GJlpNY8cfgzFa7zUeRnqxLZtVHptrkOUPx8wvfBJTQcUnY+iH+V/N1z8u2l8jd8BidwRTFWJsfiazMrLMldok1A2YkBQPq7Qh2YRhmO7rdTMHdkZKs/xAI+Hhsp8DlyWf9JM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36526C4CEC2; Mon, 2 Sep 2024 14:04:57 +0000 (UTC) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Hans de Goede , Ramesh Shanmugasundaram , Jacopo Mondi , Matt Ranostay Subject: [PATCH 0/9] media: vb2: prepare for vb2_ops_wait_prepare/finish removal Date: Mon, 2 Sep 2024 16:04:46 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-LSpam-Score: -5.3 (-----) X-LSpam-Report: No, score=-5.3 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DMARC_NONE=0.898,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_VALIDITY_CERTIFIED=-3,RCVD_IN_VALIDITY_RPBL=1.31,RCVD_IN_VALIDITY_SAFE=-2,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no This patch series sits on top of: https://patchwork.linuxtv.org/project/linux-media/list/?series=13513 This series makes it possible for drivers to drop the wait_prepare/finish callbacks if the queue lock pointer is set. Analyzing the code shows that in a few places the lock is set after the call to vb2_queue_init, so the first 7 patches move that lock assignment up. Then two additional WARN_ONs are added to vb2_queue_init to ensure that either q->lock is set, or wait_prepare/finish are set. The last patch will just unlock/lock the queue lock if wait_prepare/finish isn't set. Once this is in, we can start dropping the wait_prepare/finish ops in almost all drivers. Regards, Hans Hans Verkuil (9): media: staging: atomisp: set lock before calling vb2_queue_init() media: pwc: set lock before calling vb2_queue_init() media: msi2500: set lock before calling vb2_queue_init() media: hackrf: set lock before calling vb2_queue_init() media: airspy: set lock before calling vb2_queue_init() media: rcar_drif.c: set lock before calling vb2_queue_init() media: video-i2c: set lock before calling vb2_queue_init() media: vb2: vb2_core_queue_init(): sanity check lock and wait_prepare/finish media: vb2: use lock if wait_prepare/finish are NULL .../media/common/videobuf2/videobuf2-core.c | 21 ++++++++++++++++--- drivers/media/i2c/video-i2c.c | 2 +- drivers/media/platform/renesas/rcar_drif.c | 2 +- drivers/media/usb/airspy/airspy.c | 2 +- drivers/media/usb/hackrf/hackrf.c | 4 ++-- drivers/media/usb/msi2500/msi2500.c | 2 +- drivers/media/usb/pwc/pwc-if.c | 2 +- .../media/atomisp/pci/atomisp_subdev.c | 2 +- 8 files changed, 26 insertions(+), 11 deletions(-)