From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (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 D02E5354AD4 for ; Wed, 11 Feb 2026 09:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770800976; cv=none; b=JFnIvNMl72KTZ0lJBqr5ZWnZBCSgy3U2FiMrvCDSip9XNHrqalhDGnI7uLQ9kDZL0DupMypzcaC9ga//pROn/gvvDKJoqAMIxsRUtcWTupivMqzL804kjxEHI5fZVi0r8Wae0tYx7fD8vui7mxQevyK5T858VrNLiyroXFZP/N8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770800976; c=relaxed/simple; bh=B85jHD4wx7Kvu+IP+/42lW/E6wWsYYRigfJ4suOVatw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VgPiLPfu0+C8VdU6esJoZsSaaVQLHDzO4YYj0DauNyqzAJ9oAYWL/Z1s6XQGo9cbVrtgql0fYzMsqayqdfGXHSHDXaB1Is+CPK4HOIF/y0t38QIJ+yEaJEHirSPPdCXoht9JPwmcZKZb8AULMtsbos1lNZ3SuZNKGvNggZdG+IY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fT2aQbkD; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fT2aQbkD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770800975; x=1802336975; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B85jHD4wx7Kvu+IP+/42lW/E6wWsYYRigfJ4suOVatw=; b=fT2aQbkDQT0tmOvdZZkWYn4k9nLzYptmQKvkGfldJZN2gYOmoqqnU0Fa YCsJxCghbq45pIJqv71nWMjjmYvjQVcxpLlP7ohR41u5g7w6ry7TZQb7i 8eTCBuIXAsdMOzMw2jsblZCxHP1vrn4iSusUAv+q9tBMqloLcwyCrTEnI mhvIoWc29LrBQjwQ8EbdO2J9wVq4MKb6lRBpvJOTceTA3zFSRyj9Fc0bE 3CmJ5UWUR+yyfBKcnIWiQ5323sWXHCWxVDa1lYCm/6rwKQDjdQgraBhHS gKn2Lk54hEqtC3VIysyQM9c6EoWIWfpG3IE+WgBbNkqyANwG6Q/FkRtuZ Q==; X-CSE-ConnectionGUID: K2Mc1kSjSceBHMreWNq/XA== X-CSE-MsgGUID: mHiRgjEdQXCwUXEykL7keQ== X-IronPort-AV: E=McAfee;i="6800,10657,11697"; a="72019032" X-IronPort-AV: E=Sophos;i="6.21,283,1763452800"; d="scan'208";a="72019032" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2026 01:09:32 -0800 X-CSE-ConnectionGUID: DR5hW469QbSI2m13HIe5Xw== X-CSE-MsgGUID: h4SE5X3VRVmF9xXRiyDr5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,283,1763452800"; d="scan'208";a="212222863" Received: from pgcooper-mobl3.ger.corp.intel.com (HELO kekkonen.fi.intel.com) ([10.245.244.208]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2026 01:09:24 -0800 Received: from punajuuri.localdomain (unknown [192.168.240.130]) by kekkonen.fi.intel.com (Postfix) with ESMTP id D3082121D6E; Wed, 11 Feb 2026 11:09:31 +0200 (EET) Received: from sailus by punajuuri.localdomain with local (Exim 4.98.2) (envelope-from ) id 1vq6Do-00000007laW-2uVf; Wed, 11 Feb 2026 11:09:20 +0200 Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hans@jjverkuil.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Dave Stevenson , Tommaso Merciai , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , Stefan Klug , Mirela Rabulea , =?UTF-8?q?Andr=C3=A9=20Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede , Jacopo Mondi , Tomi Valkeinen , David Plowman , "Yu, Ong Hock" , "Ng, Khai Wen" Subject: [PATCH v2 12/14] media: v4l2-subdev: Add v4l2_subdev_call_ci_active_state Date: Wed, 11 Feb 2026 11:09:18 +0200 Message-ID: <20260211090920.1851141-13-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260211090920.1851141-1-sakari.ailus@linux.intel.com> References: <20260211090920.1851141-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add v4l2_subdev_call_ci_active_state(), to call sub-device pad ops that take struct v4l2_subdev_client_info pointer as an argument. Signed-off-by: Sakari Ailus --- include/media/v4l2-subdev.h | 49 ++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 20cf0560c7f9..b22b05534447 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -1912,6 +1912,22 @@ extern const struct v4l2_subdev_ops v4l2_subdev_call_wrappers; __result; \ }) +#define v4l2_subdev_call_waive_fourth(first, second, third, fourth, rest...) \ + v4l2_subdev_call(first, second, third, ##rest) + +#define __v4l2_subdev_call_state_active(call, sd, o, f, args...) \ + ({ \ + int __result; \ + struct v4l2_subdev_state *state; \ + state = v4l2_subdev_get_unlocked_active_state(sd); \ + if (state) \ + v4l2_subdev_lock_state(state); \ + __result = call(sd, o, f, NULL, state, ##args); \ + if (state) \ + v4l2_subdev_unlock_state(state); \ + __result; \ + }) + /** * v4l2_subdev_call_state_active - call an operation of a v4l2_subdev which * takes state as a parameter, passing the @@ -1930,17 +1946,28 @@ extern const struct v4l2_subdev_ops v4l2_subdev_call_wrappers; * active state, lock it before calling the op and unlock it after the call. */ #define v4l2_subdev_call_state_active(sd, o, f, args...) \ - ({ \ - int __result; \ - struct v4l2_subdev_state *state; \ - state = v4l2_subdev_get_unlocked_active_state(sd); \ - if (state) \ - v4l2_subdev_lock_state(state); \ - __result = v4l2_subdev_call(sd, o, f, state, ##args); \ - if (state) \ - v4l2_subdev_unlock_state(state); \ - __result; \ - }) + __v4l2_subdev_call_state_active(v4l2_subdev_call_waive_fourth, \ + sd, o, f, ##args) + +/** + * v4l2_subdev_call_ci_state_active - call an operation of a v4l2_subdev which + * takes state as a parameter, passing the + * subdev its active state. + * + * @sd: pointer to the &struct v4l2_subdev + * @o: name of the element at &struct v4l2_subdev_ops that contains @f. + * Each element there groups a set of callbacks functions. + * @f: callback function to be called. + * The callback functions are defined in groups, according to + * each element at &struct v4l2_subdev_ops. + * @args: arguments for @f. + * + * This macro is just as v4l2_subdev_call_state_active(), with the exception + * that it passes NULL as the client info to sub-device ops that need it + * (currently pad ops get_fmt, set_fmt, get_selection and set_selection). + */ +#define v4l2_subdev_call_ci_state_active(sd, o, f, args...) \ + __v4l2_subdev_call_state_active(v4l2_subdev_call, sd, o, f, ##args) /** * v4l2_subdev_call_state_try - call an operation of a v4l2_subdev which -- 2.47.3