From patchwork Mon Jan 15 17:13:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 13519863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F03BC3DA79 for ; Mon, 15 Jan 2024 17:14:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8286310E344; Mon, 15 Jan 2024 17:14:29 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 470B510E34F; Mon, 15 Jan 2024 17:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705338867; x=1736874867; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=Iw0VZEJ+HFEd6paKWv5g2Vn0NbAPDmus/BwEoKJu0q0=; b=EZGFLgtaxBSbaP57VpRNJkF7b67XQdjmhvoo98c0RRSFwI8VPMk+wfRK MGFliLQ8/bwQykFzkyouIANLFV8djjHjAZ+qkBYHPs/v3I6nnTUgrIkd+ TYR1AlISN0F5C2i6qTrnkLBUuG+yxoPAn5RIZU9W/k/eB9yg+OQUGu24I SdG83WrXjs+jYGdA045yxFmDdb4szP2ETdmat899NWXlPQzlwoDhQuaJq HggO1M7N+9tjXsa2snT6P3jQj26EAPjgUG4fc4G8J84sknlTDYhU9Rnp6 KUBj05jNV92QK1XlSDp1JD/T/rkuseOUjig653svJreKJWoNhVXcbn+H5 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10954"; a="21139074" X-IronPort-AV: E=Sophos;i="6.04,197,1695711600"; d="scan'208";a="21139074" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2024 09:14:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10954"; a="854063885" X-IronPort-AV: E=Sophos;i="6.04,197,1695711600"; d="scan'208";a="854063885" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga004.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 15 Jan 2024 09:14:26 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 15 Jan 2024 09:14:26 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 15 Jan 2024 09:14:26 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.168) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 15 Jan 2024 09:14:25 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nem4TSHaWaYccEpKhNjHJe8VbVTayE6mTHjGkc2r701o6D4Y/x1TGdP2Q+PXdyue5RG8xSzh74YZR4vSB/MnE97ocHSX/MyCnwrjB4jzV9e7d50ocyjB2DNONF4ROSPqTUHbodGJiQrkAYDBd+Y4a/Yp/p8vzLsX964Qmbz+FK6sbtlQpzRmL+wYmY0ypGd4LIH3jFpNWjTj1sFg6xVIxhxMypt7rcj/gFe7VtTvmVblaYum6Ubl0ezkP4a3k53mIU1X8VVd8jILscqQPW/ETI8wSTsdXOwSb81IIX7AFnL6S8Z6n7gPGawQGeyoq932uwsMmgiPkPABU0JFY5OWXA== 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=MQcC7ohGVAYgzqfN/kkAjJJfljR/41ywz9GsUAACHcA=; b=EPXTd/uwpKqntFMyZeIhmdSvqJUD66yF+JqHLY/tiw1w2Jxjp3vX2JIYkvNlVoHpmmLbIF0V1gDIbINtEpvxvRgCvApYuHAGhG+YOkmNjWFAMwYboj5C48TJsqlBAmQbC48ZdEGjfht1ueUz71joAHJfQFJgukhP3qyAWoGyoZcMIO56axJQuRub9BvIi2U5a0l19Zy/84xh/McbmcYfU4WAEvdXxjo73yG7thEMs03g9RQLXsufBIh5UNjywaFPhYVFvHeK6djxAxkMIonkHJIRF9YQtn0+JJh+6KqOtyk+RfeGz4rgJsjao75Yd2gknntpABSRbjjyGsE+jNoIRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) by CY5PR11MB6391.namprd11.prod.outlook.com (2603:10b6:930:38::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.18; Mon, 15 Jan 2024 17:14:23 +0000 Received: from DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::f105:47dd:6794:6821]) by DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::f105:47dd:6794:6821%4]) with mapi id 15.20.7181.020; Mon, 15 Jan 2024 17:14:20 +0000 From: =?utf-8?q?Micha=C5=82_Winiarski?= To: , , Subject: [PATCH v5 5/5] drm/tests: managed: Add a simple test for drmm_managed_release Date: Mon, 15 Jan 2024 18:13:51 +0100 Message-ID: <20240115171351.504264-6-michal.winiarski@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115171351.504264-1-michal.winiarski@intel.com> References: <20240115171351.504264-1-michal.winiarski@intel.com> X-ClientProxiedBy: FR3P281CA0160.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a2::15) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5373:EE_|CY5PR11MB6391:EE_ X-MS-Office365-Filtering-Correlation-Id: c76bf226-f372-4391-dbd1-08dc15ed69db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fokfRYOHgP09IOIvLSUrxDQSmcgwtm2GAkb3LP1HRLKqv5QcWsbk+MHHfMgv2nHQ/sC7jmi0lOnIhNqUgS/EqQa24pIFyI8Qa/CsaidstMIPsSgtmACS/kjGR5fHGknlpIXU7F8VVqw3M7am3Yfiars/Fn13FuJtrpDuwECUL/49Eyl2YeeUi34SxZRwRnoNqiAD6EbxT9meWtwabl+/EbNG3Yu1Ty3VclNConzfFZGNr1fo+GGzpWkSPfv45f6lYF4rYt7Y5IPauyGcgJdXJ32XyATTNgiyun45J9IZp4rG7AbG6uRbvARS9U9lEO7HVNMvEquhlC70hE48l+c948GnNw4pOvsyGyoGqjV/nmoPP/YzmMY6sXXnAtQuOZJAtbjHHdH9Cuj6ngWcCJ9syz7xFzgqa3cUu/LQYA19ZR/W9gHKYyYrVXFIxvnOREtiDolm22NzIX6YMmkt/ohGEsh1COBvsile56ZoXCBR5Xf1hcQKLtDXgDzr2S0nG6U5L0CGJjYylriWqCAvCJMjG4pTP41vToB8toBfv3y0qj6JZMCpkrlJ9g1pWqVN5q4X X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5373.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(346002)(39860400002)(366004)(376002)(396003)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(66946007)(6506007)(1076003)(6666004)(2616005)(478600001)(82960400001)(66476007)(86362001)(316002)(6486002)(66556008)(26005)(54906003)(5660300002)(8676002)(36756003)(6512007)(41300700001)(7416002)(38100700002)(4326008)(8936002)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?GawMI2XHU0AHHaKhinc6o7M/oEww?= =?utf-8?q?C9A0QJk4XsrjBozkffTouZNOr0NSDj77BB3NCMithf1Y+UgAsCNwGDGfTlMIBRcmc?= =?utf-8?q?WSohfVtLqlX/Q5ApthU+CnsX15IfmjF3UrwPtML7qw7G0T01O8yDmY3ZOqphDwJJG?= =?utf-8?q?V7ABN7j5SPZ6m+xXcbO3cY/ApwNEGELuX73Q1e6AdKRileDSfCXuaIm2p6mGQDxDz?= =?utf-8?q?7cHKTbOWIwj8hmI4zmnSn+Ij/r4CF7/b8EvjGBJHKxwjHERBwHt3wnW+a/5fjPUNZ?= =?utf-8?q?ehRoPkhw9EzAiufJfQSl852hbxYn3FGVr4DvZV+FI5bWj9P06otZwOot5FiN09VmZ?= =?utf-8?q?i3kz+qWWpkoPq92zVjFTzBWbn9BWqg0CHJGKa8tPZo61EuM5BX0WkOz7qmb7K0Zh6?= =?utf-8?q?OHQV0/+Cl4mb2ae5UsR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kR70XNZX9jiLMJyu0qPP8yXV8HAoPF5FRsViy/sGjj61?= =?utf-8?q?SB6D1F5O6uXVRuKbbqhToxluvrfWnYMXUVrtvxBhB/iI6xXK3vnNTCTK3xmruFb2A?= =?utf-8?q?dLBCQ5J2EF+Zt4qozXigDMbgaTLq3LldqVn/sRgt5iGSw4VHR5R98uc+x7VZYr829?= =?utf-8?q?PkZym4MOuJby1t919NkxD88xUBRQklgOZYaQtoRve4xIVjgnfo7KbXtRy+wcaj6Pg?= =?utf-8?q?/rm3hhAm83gTE0IkcGwv8N21SpXN+mvk3Q=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: c76bf226-f372-4391-dbd1-08dc15ed69db X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2024 17:14:20.8118 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: E9HVE2Ut+lwuvj6HXWoLn1/lKyhFINQDmt82N3ZezEgf8HpvVSDCtohPiMorAWw+xItzOoAznV1RBmQPlli8hJXdP4fu4UH1QS8cRZjhfMw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6391 X-OriginatorOrg: intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Micha=C5=82_Winiarski?= , =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , Maxime Ripard , Thomas Zimmermann , Rodrigo Vivi , David Airlie , Michal Wajdeczko Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a simple test that checks whether the action is called when drmm_managed_release is called. Signed-off-by: MichaƂ Winiarski --- drivers/gpu/drm/tests/drm_managed_test.c | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_managed_test.c b/drivers/gpu/drm/tests/drm_managed_test.c index d936c879a4a30..76eb273c9b364 100644 --- a/drivers/gpu/drm/tests/drm_managed_test.c +++ b/drivers/gpu/drm/tests/drm_managed_test.c @@ -25,6 +25,30 @@ static void drm_action(struct drm_device *drm, void *ptr) wake_up_interruptible(&priv->action_wq); } +/* + * The test verifies that the release action is called when + * drmm_release_action is called. + */ +static void drm_test_managed_release_action(struct kunit *test) +{ + struct managed_test_priv *priv = test->priv; + int ret; + + ret = drmm_add_action_or_reset(priv->drm, drm_action, priv); + KUNIT_EXPECT_EQ(test, ret, 0); + + ret = drm_dev_register(priv->drm, 0); + KUNIT_ASSERT_EQ(test, ret, 0); + + drmm_release_action(priv->drm, drm_action, priv); + ret = wait_event_interruptible_timeout(priv->action_wq, priv->action_done, + msecs_to_jiffies(TEST_TIMEOUT_MS)); + KUNIT_EXPECT_GT(test, ret, 0); + + drm_dev_unregister(priv->drm); + drm_kunit_helper_free_device(test, priv->drm->dev); +} + /* * The test verifies that the release action is called automatically when the * device is released. @@ -75,6 +99,7 @@ static int drm_managed_test_init(struct kunit *test) } static struct kunit_case drm_managed_tests[] = { + KUNIT_CASE(drm_test_managed_release_action), KUNIT_CASE(drm_test_managed_run_action), {} };