From patchwork Fri Jan 5 08:37:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 760380 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 828142136D for ; Fri, 5 Jan 2024 08:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none 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="cNoub7JO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704443893; x=1735979893; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=S6W48cSmTzLROrbu167lGwePe8bDOGdIsCBUY7tUM6Q=; b=cNoub7JOHkIszDg0xAk/2oeo3wvS2Op8zuN04RMaeNIj+SOvQENL/0fw kmhc013NlHKwW9E49Ncw6gl66mGm5YMhWTENoXsM1KXoRib171Z905k1o xovi85QrCHC9mVZxCI3ihkKDE0DwsztMiyR4wBi10iuglzVRgqZ41nAIA cWhqnDtfyaa9tweND8ZzAj0K75HtZJfnPGIN7fHZA4NDNh/0X81I+Yi2r GbZhx5Puz0AWLfdCgtDG0ory5Y1NSay1YUf+T7k6yEXMrC1VMx0G0qjzQ v77FWl1SGqQM8ZqnO1Vcm9pvVFp7F3SLcYP4Zbr6+oWWQEXpJf88mHzPd g==; X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="4834102" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="4834102" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2024 00:38:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="953888655" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="953888655" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2024 00:38:02 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id C2EB711FC24; Fri, 5 Jan 2024 10:37:59 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: bingbu.cao@intel.com, laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v2 1/3] media: ipu3-cio2: Further clean up async subdev link creation Date: Fri, 5 Jan 2024 10:37:55 +0200 Message-Id: <20240105083757.197846-2-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240105083757.197846-1-sakari.ailus@linux.intel.com> References: <20240105083757.197846-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 Use v4l2_create_fwnode_links_to_pad() to create links from async sub-devices to the CSI-2 receiver subdevs. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart --- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c index ed08bf4178f0..83e29c56fe33 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -1407,7 +1408,6 @@ static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier, static int cio2_notifier_complete(struct v4l2_async_notifier *notifier) { struct cio2_device *cio2 = to_cio2_device(notifier); - struct device *dev = &cio2->pci_dev->dev; struct sensor_async_subdev *s_asd; struct v4l2_async_connection *asd; struct cio2_queue *q; @@ -1417,23 +1417,10 @@ static int cio2_notifier_complete(struct v4l2_async_notifier *notifier) s_asd = to_sensor_asd(asd); q = &cio2->queue[s_asd->csi2.port]; - ret = media_entity_get_fwnode_pad(&q->sensor->entity, - s_asd->asd.match.fwnode, - MEDIA_PAD_FL_SOURCE); - if (ret < 0) { - dev_err(dev, "no pad for endpoint %pfw (%d)\n", - s_asd->asd.match.fwnode, ret); - return ret; - } - - ret = media_create_pad_link(&q->sensor->entity, ret, - &q->subdev.entity, CIO2_PAD_SINK, - 0); - if (ret) { - dev_err(dev, "failed to create link for %s (endpoint %pfw, error %d)\n", - q->sensor->name, s_asd->asd.match.fwnode, ret); + ret = v4l2_create_fwnode_links_to_pad(asd->sd, + &q->subdev_pads[CIO2_PAD_SINK], 0); + if (ret) return ret; - } } return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev); @@ -1572,6 +1559,7 @@ static int cio2_queue_init(struct cio2_device *cio2, struct cio2_queue *q) v4l2_subdev_init(subdev, &cio2_subdev_ops); subdev->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; subdev->owner = THIS_MODULE; + subdev->dev = dev; snprintf(subdev->name, sizeof(subdev->name), CIO2_ENTITY_NAME " %td", q - cio2->queue); subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; From patchwork Fri Jan 5 08:37:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 760639 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 E2200219FF for ; Fri, 5 Jan 2024 08:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none 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="GLgJAwWk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704443894; x=1735979894; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nX/PQF2hgBlPJcxGsYQXT3HHTW7tHLAaloJk9J1JhsE=; b=GLgJAwWk4ujpIU+Pe2ctdLkJBW/rLOI9mgPzjOKfQYZ8Gg7XneDDxW3w 9SiLs1WyUK9GSAD2USVrT6uwCmRtzp2P92Rp4jpPS7LJwnnEqINsGsphm t9BkV3XV/Gt9NFcQncvetz1GIazeHtDEMXgJTeBUd/lJWvd2leb2FgR/P aDGSiZ0WXAHq/RWK5L+flKA81wrtpLRgxzteY2M7h3KQ1grgu+8ozb12A cPEv1/PwltOBm9nsLHzIAsbtYnbes/npfx1XFmiFZnCb6F8pl22k52y3T j8Ob1kUWUpy9kCiN2VEHy/sPFaLNHOV6pXNhJwZDO2RG4Q74BKMIh+lSf g==; X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="4834106" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="4834106" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2024 00:38:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="953888658" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="953888658" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2024 00:38:03 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 5E9E71202B6; Fri, 5 Jan 2024 10:38:00 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: bingbu.cao@intel.com, laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v2 2/3] media: v4l2-mc: Add debug prints for v4l2_fwnode_create_links_for_pad() Date: Fri, 5 Jan 2024 10:37:56 +0200 Message-Id: <20240105083757.197846-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240105083757.197846-1-sakari.ailus@linux.intel.com> References: <20240105083757.197846-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 Add relevant debug prints for v4l2_fwnode_create_links_for_pad(). This should help debugging when things go wrong. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart --- drivers/media/v4l2-core/v4l2-mc.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c index 52d349e72b8c..e394f3e505d8 100644 --- a/drivers/media/v4l2-core/v4l2-mc.c +++ b/drivers/media/v4l2-core/v4l2-mc.c @@ -337,12 +337,18 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, src_idx = media_entity_get_fwnode_pad(&src_sd->entity, endpoint, MEDIA_PAD_FL_SOURCE); - if (src_idx < 0) + if (src_idx < 0) { + dev_dbg(src_sd->dev, "no pad found for %pfw\n", + endpoint); continue; + } remote_ep = fwnode_graph_get_remote_endpoint(endpoint); - if (!remote_ep) + if (!remote_ep) { + dev_dbg(src_sd->dev, "no remote ep found for %pfw\n", + endpoint); continue; + } /* * ask the sink to verify it owns the remote endpoint, @@ -353,8 +359,12 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, MEDIA_PAD_FL_SINK); fwnode_handle_put(remote_ep); - if (sink_idx < 0 || sink_idx != sink->index) + if (sink_idx < 0 || sink_idx != sink->index) { + dev_dbg(src_sd->dev, + "sink pad index mismatch or error (is %d, expected %u)\n", + sink_idx, sink->index); continue; + } /* * the source endpoint corresponds to one of its source pads, @@ -367,8 +377,13 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, src = &src_sd->entity.pads[src_idx]; /* skip if link already exists */ - if (media_entity_find_link(src, sink)) + if (media_entity_find_link(src, sink)) { + dev_dbg(src_sd->dev, + "link %s:%d -> %s:%d already exists\n", + src_sd->entity.name, src_idx, + sink->entity->name, sink_idx); continue; + } dev_dbg(src_sd->dev, "creating link %s:%d -> %s:%d\n", src_sd->entity.name, src_idx, From patchwork Fri Jan 5 08:37:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 760379 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 0891921A1C for ; Fri, 5 Jan 2024 08:38:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none 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="LnMG4BGx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704443895; x=1735979895; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Tq/3fF8IV/O60b8KwvuuOmqL8bbw+kLVtmOYtfocM0M=; b=LnMG4BGx3KKKax4DCNkQgivDmDzqfYyrhx1L+pEKhE2u3RTFtMwu/CQQ akuBmT66GD/aQOADoNRlSLVRUwcUcj5svPBRPI2FqnIkf+Nnno3mqu3zu OcO5kUX/vnv3Oxn7/dxawY+FhEG58x18NwKFCcR7RdjH6pWnT103nmweg fKXtfuPndnvvzWZkNYDrFGW0IhDw1kCIkySGXD7ry1LJugwskvOMtfhHl ljN3o5Mg1OhPbs+R0YSMQk5iMUTiFk/LZvtaC5NVcnMFP4PEXNaoEfaYm Z7wGJwB2ZYvNfpRVil72HAZCfmgBfCke/a0k4Hy6tQCkgIUGtC3pGHKoW w==; X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="4834113" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="4834113" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2024 00:38:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="953888660" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="953888660" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2024 00:38:04 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 09E331203E8; Fri, 5 Jan 2024 10:38:00 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: bingbu.cao@intel.com, laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v2 3/3] media: mc: Drop useless debug print on file handle release Date: Fri, 5 Jan 2024 10:37:57 +0200 Message-Id: <20240105083757.197846-4-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240105083757.197846-1-sakari.ailus@linux.intel.com> References: <20240105083757.197846-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 Drop a debug print in media_release(), which is a release callback for a file handle. Printing a debug message here is simply not necessary. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart --- drivers/media/mc/mc-devnode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/mc/mc-devnode.c b/drivers/media/mc/mc-devnode.c index 680fbb3a9340..9c8fe9335dc1 100644 --- a/drivers/media/mc/mc-devnode.c +++ b/drivers/media/mc/mc-devnode.c @@ -190,7 +190,6 @@ static int media_release(struct inode *inode, struct file *filp) return value is ignored. */ put_device(&devnode->dev); - pr_debug("%s: Media Release\n", __func__); return 0; }