Message ID | 20231220103713.113386-21-sakari.ailus@linux.intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Sakari Ailus |
Headers |
Received: from am.mirrors.kernel.org ([147.75.80.249]) by www.linuxtv.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <linux-media+bounces-2781-patchwork=linuxtv.org@vger.kernel.org>) id 1rFtyN-00H4Ed-VW for patchwork@linuxtv.org; Wed, 20 Dec 2023 10:38:44 +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 am.mirrors.kernel.org (Postfix) with ESMTPS id A883E1F224DF for <patchwork@linuxtv.org>; Wed, 20 Dec 2023 10:38:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 682C921362; Wed, 20 Dec 2023 10:37:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GdMT92t3" X-Original-To: linux-media@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 DFF6421378 for <linux-media@vger.kernel.org>; Wed, 20 Dec 2023 10:37:30 +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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703068651; x=1734604651; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OJv0/BwKZ5DTc28TXBnAuE0FG/a2mjeyCr2XuQmfLVc=; b=GdMT92t3iZrIo8tuEyn6vOReTPELO2nJ2A2j91IxfAXps3DLY26qowwu 8m9jKKqMrLAFd5hwGTDtS/NBU8hK8B5nWcdmWr0be2+NybOV+1Uk/e7BP xX1nb/PxYqS3oxzRfN13Si1jqDPK39PTMu4Mmfl/VydUN+OBp1X0gGEfU fajmqVUQkgZaWc0t9qAm31dRrA6wuJ2zyvicLj7Zp7jsCt+W+lGMF77Ki ao85azttM5SeDg4b1JJCu3hapPmqZjio7t2vnPGV7sNW9dcu4skRWVx5m 2HuAHap8BDSc0i+LRHoTO2TcmrJZ0gYgVGNM+/p3aijE7wIewuHuih8e7 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="9174377" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="9174377" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 02:37:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="769544271" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="769544271" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 02:37:29 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id BB6B7120788; Wed, 20 Dec 2023 12:37:26 +0200 (EET) From: Sakari Ailus <sakari.ailus@linux.intel.com> To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, Hans Verkuil <hverkuil-cisco@xs4all.nl> Subject: [PATCH v2 20/29] media: ipu3-cio2: Call v4l2_device_unregister() earlier Date: Wed, 20 Dec 2023 12:37:04 +0200 Message-Id: <20231220103713.113386-21-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231220103713.113386-1-sakari.ailus@linux.intel.com> References: <20231220103713.113386-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: <linux-media.vger.kernel.org> List-Subscribe: <mailto:linux-media+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-media+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-LSpam-Score: -4.7 (----) X-LSpam-Report: No, score=-4.7 required=5.0 tests=BAYES_00=-1.9,DKIMWL_WL_HIGH=0.001,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no |
Series |
Media device lifetime management
|
|
Commit Message
Sakari Ailus
Dec. 20, 2023, 10:37 a.m. UTC
v4l2_device_unregister() unregisters V4L2 sub-device nodes among other things. Call it before releasing memory and other resources. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> --- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Sakari, Thank you for the patch. On Wed, Dec 20, 2023 at 12:37:04PM +0200, Sakari Ailus wrote: > v4l2_device_unregister() unregisters V4L2 sub-device nodes among other > things. Call it before releasing memory and other resources. Please expand the commit message, it's not immediately clear why this is needed and what the consequences are. > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> > --- > drivers/media/pci/intel/ipu3/ipu3-cio2.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c > index 5d3b0ffd3d08..da82d09b46ab 100644 > --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c > +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c > @@ -1827,11 +1827,11 @@ static void cio2_pci_remove(struct pci_dev *pci_dev) > struct cio2_device *cio2 = pci_get_drvdata(pci_dev); > > media_device_unregister(&cio2->media_dev); > + v4l2_device_unregister(&cio2->v4l2_dev); > v4l2_async_nf_unregister(&cio2->notifier); > v4l2_async_nf_cleanup(&cio2->notifier); > cio2_queues_exit(cio2); > cio2_fbpt_exit_dummy(cio2); > - v4l2_device_unregister(&cio2->v4l2_dev); > media_device_cleanup(&cio2->media_dev); > mutex_destroy(&cio2->lock); >
Hi Laurent, On Wed, Feb 07, 2024 at 04:24:35PM +0200, Laurent Pinchart wrote: > Hi Sakari, > > Thank you for the patch. > > On Wed, Dec 20, 2023 at 12:37:04PM +0200, Sakari Ailus wrote: > > v4l2_device_unregister() unregisters V4L2 sub-device nodes among other > > things. Call it before releasing memory and other resources. > > Please expand the commit message, it's not immediately clear why this is > needed and what the consequences are. Thanks for the review. There's actually a change in APIs here as the async notifier expects the V4L2 device to remain in place so the notifier can't be cleaned up before unregistering the V4L2 device. Further patches in the set move cleaning up the notifier to the release callback but I think it can well be done here, too. So I think this patch can be dropped.
On Tue, Mar 05, 2024 at 10:21:54AM +0000, Sakari Ailus wrote: > Hi Laurent, > > On Wed, Feb 07, 2024 at 04:24:35PM +0200, Laurent Pinchart wrote: > > Hi Sakari, > > > > Thank you for the patch. > > > > On Wed, Dec 20, 2023 at 12:37:04PM +0200, Sakari Ailus wrote: > > > v4l2_device_unregister() unregisters V4L2 sub-device nodes among other > > > things. Call it before releasing memory and other resources. > > > > Please expand the commit message, it's not immediately clear why this is > > needed and what the consequences are. > > Thanks for the review. > > There's actually a change in APIs here as the async notifier expects the > V4L2 device to remain in place so the notifier can't be cleaned up before > unregistering the V4L2 device. Further patches in the set move cleaning up > the notifier to the release callback but I think it can well be done here, > too. So I think this patch can be dropped. That went a bit too fast. The call should be moved after the notifier cleanup.
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c index 5d3b0ffd3d08..da82d09b46ab 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c @@ -1827,11 +1827,11 @@ static void cio2_pci_remove(struct pci_dev *pci_dev) struct cio2_device *cio2 = pci_get_drvdata(pci_dev); media_device_unregister(&cio2->media_dev); + v4l2_device_unregister(&cio2->v4l2_dev); v4l2_async_nf_unregister(&cio2->notifier); v4l2_async_nf_cleanup(&cio2->notifier); cio2_queues_exit(cio2); cio2_fbpt_exit_dummy(cio2); - v4l2_device_unregister(&cio2->v4l2_dev); media_device_cleanup(&cio2->media_dev); mutex_destroy(&cio2->lock);