From patchwork Thu Sep 8 18:48:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17345 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id AA1D8C327D for ; Thu, 8 Sep 2022 18:49:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 55483620BE; Thu, 8 Sep 2022 20:49:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662963; bh=zgZH8Ud1QBu1xD7M2DCpYNGntybT46spNyErOHPDvlQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=4epVjx4GfijiHhDxvYmxWWcwa+QaCjHmeWJqMbzKXJqxk0aGHE/PEELlLZtdJFXiv 6r6m4ttkrOpq9pl1rC4p4lKT/Ij2VAi0X7RSmO7xgU78zWIOSlJbO+rER1VUqJzwUk hclks68UhSAUatUfHmhC4NlC5VXL6treGlSmqS3D1RLX4Fw6bTepqmiKat1OKAmC8d nPCDlFAKhDTdR24kMp9KMFRlF6Uzhm+qega1GBWuCGnID7BmEL+b9EP57jMjaZLh2H EtI9ffIFZimljOGdhirzns/muT8ww4Xo8llg1uL5p5wNdBeUdK14aQW2kWJQ92ZtQa H/Jr9JlA292iA== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60044.outbound.protection.outlook.com [40.107.6.44]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 37AE66203B for ; Thu, 8 Sep 2022 20:49:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="EzRYpuwm"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KV6/IsxpiCXc1mQvDx/FVhSLCTT2h1OPN3X63cveZ8tmVNC86gMJlGJA7/BnJXqVhRfj5/AKWkO4o92wACLApZ1YSoJrErnxbLHxWWm9U3IsmGkKxeCR4yTc9TthyhBAwrunYl1Z8qo/nLxslyq7YdxO9ZrvrlBdWI0RfuAh41ooUv63iOQE+EeBbV1Gnu0qerVCTN/qrNkUDEROs1KN3bqjXgtdW4wDcb2elJAzKJXD4xCFBSjr8Y8bC045U7/0TtAZplPOcAUSqE4mi5jXDF3TW1qTPGaGqsu1MrcoUIK08cavLi3m2EKjUNli04ywQm721QoMg65J8dYb2q+KoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L5g+ekA+WISt0BkRLuugcQsCZXYoZGWDZs0QaQsUWxQ=; b=L0mPI5DFB/78IEWpJZp4P+F9h2Fgo1J7cYMS83BOrwSC5EgfuU8P0WhB9uQ8AhntEs89eIymfvh6RtOnbeBq0O6obd3hq/io/9naTj3QCY0Rz7XKjq9+7Ps2cHzAAEavyq4zxyeSqhCa5a5LSOs0Dzc6cU09elk0brIzzzZH2ePmOR8AONqm8C1b1UsxAfGoP04lK/gOKOami3iEIGpCaAPkHMSxSwLnfAq1r6DKC4MRRAUs8VdqEBHxsABjc1nXhNcTWhD0eVlZUFM50dOIpGK/L+xi0ATE508DW2f6PjmDJl4xQSeJXp9uA+rfK88+JjckJJ9Z3YU7Dy5JMgDACQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L5g+ekA+WISt0BkRLuugcQsCZXYoZGWDZs0QaQsUWxQ=; b=EzRYpuwmbeUt1KsPxlkReeV7I14TiynlfWrTAlpTWZqs2pyBTMphmErEjlQY5l+v0qdXY4V3ZiTzipRw8+ZFsNCkCW3DkV/yvz1xGvVwJtdv6bHj47Fv2mNrzenGmS9FREAWv78gfoT9I6/MwyT5X1op/TCHEs82LDyc2ZEYPts= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AS8PR04MB8852.eurprd04.prod.outlook.com (2603:10a6:20b:42f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Thu, 8 Sep 2022 18:49:18 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::485:adba:7081:715a]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::485:adba:7081:715a%3]) with mapi id 15.20.5612.019; Thu, 8 Sep 2022 18:49:18 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:39 +0200 Message-Id: <20220908184850.1874303-4-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PR3P250CA0001.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:57::6) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8703:EE_|AS8PR04MB8852:EE_ X-MS-Office365-Filtering-Correlation-Id: e323ea3b-f179-430d-3e58-08da91cad5ae X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0+SQFajJMjHwCcx6HIKkrOzCqa79jEaqe8MZgsbkum4+XGu6m9M+jAC6Vd5QjPtOt6KK6cMnqNWlrMd7GligJ6QqMGjC7WOsYn2Ai+NXI3ysSiuxMIHp8GDIbYCSqVJrU7r8UQXvbF4uPKsQJedc9snvmjoIxNQaPKB/wbk0fEdW5G6BaSodVGX4yTkRqF5Rq3XQeFzAfFzCrkQKGY4IJuNC/GA7SkECxWI3fA48ub9IPgwOUKr4aTj+tBhlaHm80G7uz2NIbln2hy0JiQmiGCvapB7QEEIS/0WsIS/3ImzxQj5RTMfEBRnYZqDlt0TZp1lXeOvRZFRjolpOS47Lyzqn7viWLWs48Zsis4bk/g/xN0V2J0qGyBMjk2SU7zXAJvxQmoVpDpgJKTOvwxFrWZn48nGRe5XIVN1wW5+OxqFXnViVv1kg/G9y7JtOpM21DBgMmv2/Fpvdgz3hyAirOTspa4XOxQhuSkwaqcRgV+l5O+xm1GVvJhSNWkZwsgBMD74tD1XHzdp0iLDbf9jM2DPb7KYarHo3Vzs+8/igHms5hBBW8ALyKnFMKxKl9K4gznAFnIlqhns6For0TnLoywnYwlDEt8Gidcaw/3Rm6AKvusalPpAInYYMwDEvglkCwYrihj6mv4wR1GSICIQ6dzlurS3EOE8csn79/WkqNNtqq9pmliATXhCyN8K+tkIhZEe29GU9jheiZCM+X+lN1Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8703.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(346002)(376002)(396003)(136003)(366004)(38100700002)(66556008)(66476007)(66946007)(8936002)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(83380400001)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HxlB8WC/NgGKbgjYTrCzVF2z5x1z5PiqgJyKiiHOzrLdKDmAwghw8iMCes66n+0+NDlQSagg4IKj0iDrjf0kb3GdQCx0VNZlIv/qpxVcRy6PUZ5zBUAfP5LBj2pyb7UyRPgKUI4EbyqAARyOkit8GN0C40A6o92JKYsXcR8tXDcLzXwZESXSWLTevCvNM2G697M/r5yDpRNfq/0jC8jQ7pHWymRpmjGS8sdRnDj5HPe+STYOdjToQqYbhjvlHR8EQHFobmNKYZiGKjzs4nrNiL570ZrvVX1C8Icfm4yCdioCmFs3FrJ8fcqQAqT9gYP/VEaP3M+t+bwINXQ5tDIVoMlJt6rSocxtIrDyiCVs7kmXTYQwtcK/Pk9q+bRd+776u7acqNR55ZaM8aG21dDts7P4WYziJwOIUhM/Mru5rKVN6On5vF4oEAEeGuumuALdF0l/3g+zvsXpKCGLQLu5ciPJJ8/qb1pGFVrAuKgQUQKISqq8Jywbapx/xG5tv734ICvD3a5ZyY3Lz7pBNoyNlcOnrrMM3L5yOKUwZQnhxP/v5BvbtH7z06Sgdw30or6QEWzomcGe4VBCtCtWqxZRQNu2n8cIu1MLpKg+mDEpPcVLCBZK8ro4OOPXOMuWXW4gXLb5VK9rE1COWAEYjysCmO8jDGfCxnT5AYETOIoNNFRzUICMpVZ+HmiMW6r4GvEIui1o5dG3jqmNaM2PQPH6sb9qgQHBZrvJcQoVHXt4X8fZr2M3usHHQBWHt1DbDbBz0aibU7LEpU7hpeW+e/0KPQzpR8bQJ+MkVpQYXH0oz7/J/vEtklDm9VMg41F+McjxWiX4Zf91CpMw9tqbAMKX+29bX4pXr21bWSb2zO2ml5l2aaqIEQrxM37SnR3D4vWNwUgXBfprbImVlX8epKVHlG4o9FFh+yjb+xbgdfRQUYflMic2OGQnOisNYux+Pb+X39P40LVepItn3yqPvB6ZO/PRBQXtBmnHKca8jo0GucYAEbD7x7AUEOV8kiEojvGcnJ0KBTBdFx2n2nyQPz4nAk8Lm8T5wcCBX64YueqN/yBc0AmZsKYOauBMlyJ4bIGWaiXK85stMRLzn8ONHUclQWf+3XBJAtYOWOm68VnN3KJItHGaY8Olo9+TMMqCBWk/nHDYCU6x+XagHF49Qwf0id6uj7U8kMbY69RnxmQu4pmHXTp3MZuATNUT8Qu89kIsmjEXubdj78T3M+CT0GBWqGOPmjSa34dlks6m5lmal0Kq9sgJzdleg/MZ9EKncIEJUMdL2uU/HJLy0H/CiKdh/9pZhzqF2xlq6c3k10FwoYaza+4u8sQVhiDOYl3iJ+H+jJ/0aZhJgt/cfsxhsquSKtrxS+0JrDjAM1qt2yuRPIKqJVCG8IJVs3arzgcPwkMhQgL/K8DtWlb7FUn0OQuTZeVFdxBDkAu2guDQDTsrTwUlDonRwsQm177sQ5NkQyElYRzbBCzSWpy9CuwG2bktvevZiX8ND/4Hvcl13U5+vsKJyi69qc1mWvRn0W1JncAd/t0Ax4H0X2Wqc0CBVsOJI6F1kfIN2PCx7zD/sMiycgY2lOzpoPr/0Wer3NbKYvHfDmjP1caytzDvE1qTxFsun92Ggk9kAtdbbPmXd44WTdtmPDUzyas8TIxF9RdaiDxlfQhgj4zoVWYYWTBtZNxbVg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e323ea3b-f179-430d-3e58-08da91cad5ae X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 18:49:18.1983 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: v5ff3ZR2QwXqfBf13kmDB9lFtaBm0yB8XAGNwxf3zEf5rfPyN+ULH7prEpJXhOfdBm3MOUOWeJMKbFaQgD6Wqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 03/14] libcamera: v4l2_videodevice: Move FD duplication in V4L2Device::Open 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-Patchwork-Original-From: Xavier Roumegue via libcamera-devel From: Xavier Roumegue Reply-To: Xavier Roumegue Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This ensures that the V4L2Device controls attributes have been enumerated in its open() method in case of file descriptor duplication. Signed-off-by: Xavier Roumegue Reviewed-by: Jacopo Mondi --- src/libcamera/v4l2_videodevice.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 955e1508..d0427fef 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -661,17 +661,9 @@ int V4L2VideoDevice::open(SharedFD handle, enum v4l2_buf_type type) { int ret; - UniqueFD newFd = handle.dup(); - if (!newFd.isValid()) { - ret = -errno; - LOG(V4L2, Error) << "Failed to duplicate file handle: " - << strerror(-ret); - return ret; - } - - ret = V4L2Device::setFd(std::move(newFd)); + ret = V4L2Device::open(handle); if (ret < 0) { - LOG(V4L2, Error) << "Failed to set file handle: " + LOG(V4L2, Error) << "Failed to open file handle: " << strerror(-ret); return ret; }