Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp659085rdb; Mon, 15 Jan 2024 09:15:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFszOq7u8PYCo+fQkq2VfOy4XHqvN2SILjKLNaDw0hJ22KelLfRqxM2L3alWg0jX/RbFGKK X-Received: by 2002:ad4:5ca3:0:b0:67f:6bd0:493b with SMTP id q3-20020ad45ca3000000b0067f6bd0493bmr7570045qvh.43.1705338921501; Mon, 15 Jan 2024 09:15:21 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s6-20020a0cb306000000b00680f7361521si7973989qve.264.2024.01.15.09.15.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 09:15:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EZGFLgta; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-26305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3693C1C213DA for ; Mon, 15 Jan 2024 17:15:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A64CB18E14; Mon, 15 Jan 2024 17:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EZGFLgta" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 4A3CA18E11 for ; Mon, 15 Jan 2024 17:14:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com 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="21139075" X-IronPort-AV: E=Sophos;i="6.04,197,1695711600"; d="scan'208";a="21139075" 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=20Winiarski?= To: , , CC: Rodrigo Vivi , Michal Wajdeczko , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Javier Martinez Canillas , =?UTF-8?q?Ma=C3=ADra=20Canal?= , =?UTF-8?q?Micha=C5=82=20Winiarski?= 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> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR3P281CA0160.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a2::15) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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?B?R2F3TUkyWEhVMEFISGFLaGluYzZvN00vb0V3d0M5QTBRSms0WHNyakJvemtm?= =?utf-8?B?ZlRvdVpOT3IwTlNEajc3QkIzTkNNaXRoZjFZK1VnQXNDTndHREdmVGxNSUJS?= =?utf-8?B?Y21jV1NvaGZWdExxbFgvUTVBcHRoVStDbnNYMTVJZm1qRjNVcndQdE1MN3F3?= =?utf-8?B?N0cwVDAxTzh5RG1ZM1pPcXBoRHdKSkdWN0FCTjdqNVNQWjZtK3hYY2JPM2NZ?= =?utf-8?B?L0Fwd05FR0VMdVg3M1ExZTZBZEtSaWxlRFNmQ1h1YUltMnA2bUdRRHhEejdj?= =?utf-8?B?SEtUYk9XSXdqOGhtSTR6bW5TbitJai9yNENGNy9iOEV2akdCSkhLeHdqSEVS?= =?utf-8?B?QndIdDN3blcrYS81ZmpQVU5aZWhSb1BraHc5RXpBaXVmSmZRU2w4NTJoYnhZ?= =?utf-8?B?bjNGR1ZyNER2WlYrRkk1YldqOVAwNm90WndPb3Q1RmlO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ossTenant-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 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), {} }; -- 2.43.0