From patchwork Thu Jun 11 17:16:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 4024 Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C2B3461027 for ; Thu, 11 Jun 2020 19:16:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="gSwJ5D0U"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: content-transfer-encoding; s=s1; bh=AOsWfebRFA6ErG2RAs6ttl4LB0gt5ThztqU8dHnZVRk=; b=gSwJ5D0Uoh/cygkrqlucIgdDsjVzK12aVAozrqCBo4s0Dqjro0eP4PgW8MPd5oJdihp1 C40GuaBdA4QFKqYRSdBr0Q2E7TviT1r19gvTGC+dWa3grr2Eg5lSn147hy2Wk2zd3Y2eA7 tql0gGedS6luUU7+sI2SNFTRUx3HXM8NY= Received: by filterdrecv-p3iad2-784dbb6bd8-pfkxc with SMTP id filterdrecv-p3iad2-784dbb6bd8-pfkxc-19-5EE266D2-19 2020-06-11 17:16:02.265012104 +0000 UTC m=+680947.585168719 Received: from mail.uajain.com (unknown) by ismtpd0002p1hnd1.sendgrid.net (SG) with ESMTP id JkbzlI51T2uT2U_ULET41w Thu, 11 Jun 2020 17:16:01.887 +0000 (UTC) From: Umang Jain Date: Thu, 11 Jun 2020 17:16:02 +0000 (UTC) Message-Id: <20200611171528.9381-2-email@uajain.com> In-Reply-To: <20200611171528.9381-1-email@uajain.com> References: <20200611171528.9381-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcGsFXrTC3nkaVUz7y/MXE3XUcgQ86CGdnwAGSBYcas7hRdz37+jERDWJQITOSZgEsMGL5UDkVbNyzlEQe1Z++UJRuaht3LAS/e8h9ZMxTTVJtxofhExRCGxZnNAiJVfnQ6xSKMwE7IJKjufmj1APjKi5pcLOSKU6VwbQEZ66FxttuKaO8BK0zhcoMTElJtENRdqX2msWGW5Uy0UXhoOQ5lA== To: laurent.pinchart@ideasonboard.com, libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH v4 1/6] libcamera: CameraManager: Drop the vector of created PipelineHandlers X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jun 2020 17:16:04 -0000 This placeholder for the pipeline-handlers created by CameraManager, was responsible to hold a reference to pipeline-handlers which were not getting dropped anywhere in the code-path. Instead of introducing a fix of decrementing the reference, it is decided to eliminate this vector entirely from the CameraManager. This is due to the fact that the vector does not seem to have much use in CameraManager and thus reducing futile book-keeping. Since the vector is eliminated, there are no unchecked reference of the pipeline-handlers. This fixes the initial issue of dangling driver directories (for e.g. for UVC camera - in /sys/bus/usb/drivers/uvcvideo) on 'unbind' → 'bind' operation while the CameraManager is running. The directories were still kept around even after 'unbind' because of the pipeline-handler's unchecked reference holding onto them. Signed-off-by: Umang Jain --- src/libcamera/camera_manager.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index 576856a..b8128df 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -63,7 +63,6 @@ private: bool initialized_; int status_; - std::vector> pipes_; std::unique_ptr enumerator_; IPAManager ipaManager_; @@ -144,7 +143,6 @@ int CameraManager::Private::init() LOG(Camera, Debug) << "Pipeline handler \"" << factory->name() << "\" matched"; - pipes_.push_back(std::move(pipe)); } } @@ -162,7 +160,6 @@ void CameraManager::Private::cleanup() * they all get destroyed before the device enumerator deletes the * media devices. */ - pipes_.clear(); cameras_.clear(); enumerator_.reset(nullptr);