From patchwork Fri Jan 5 10:13:24 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: 13511916 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 56F3FC4707B for ; Fri, 5 Jan 2024 10:14:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 73B9A10E5D3; Fri, 5 Jan 2024 10:14:05 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9B9C010E5D3; Fri, 5 Jan 2024 10:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704449644; x=1735985644; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=CV9CQhOlT0/5VGvMDC7Hks2hAE59AabLvH3u/gvoTpY=; b=dlsQpkTuXMyEf3OZSqjGObXqBBTLxJ3Atd/2pyW1ev1R2PtAUEjbR33S M6yQ8FlHNSy9nA4VajBEEbzoQyLYOQ+nj8y8wgWHZV/1cfCyaCb5b+dWO 6ytQauI149n600u5PsJ/LlJB510MrA57H4Zysrzxjz8I2iTbaWhsWpd5L adhmFgrBsTN/TfrkaxGVB2E4BCDGiStJQ9MBwNEL/RfrK3i5RFnNdJNBE 712JtWnZey/Jel/5PoGfZ/xBXNhy58+dWumjEDXB8xoHXM1HGGByvkFT8 xSdEw0daVqgucEFfv3gnLkZ/664/hl7mJ/MWcNnU8BnYVcKjhIcQw65H9 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="483651665" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="483651665" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2024 02:14:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="730435491" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="730435491" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga003.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Jan 2024 02:14:03 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 5 Jan 2024 02:14:03 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Fri, 5 Jan 2024 02:14:03 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 5 Jan 2024 02:13:58 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KlyfoMTLKUMDl1wTc7YAG6WwjhxZ8Uuhgbu8h+Y1ovfemOSatzph2wlPccmphclXTSkgQD2fXW1BCz2HPs3M5bmw261h+ouO3anIa4jkXYAiKS20W9Bu1qDk2oTDY2clN2Rjx7huZzEZaxyI5vaK+bfQHQwei74+XllmLMv387XX+Lb9wEZ4QqAsPrhNawoLkAzYjLixN/c9e5cietKMCpPq02SKL67tq+OnJ4+Su2V5C8mn2347mkgm+vPa/+ZGvN0nmpTzFmfidjoYwKsDamqKagYANYrAvtCdUd7yZSLt8gdccDjN2/x/v9V784loq9THDCt3c56N+HQjr0rZtQ== 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=D3oaXJhkeI+gqFKTkMLFxSpRvgAZzvlkvC4yrcHGNik=; b=MtlqLjCk/uxliHdfqRrdPYjq7fYy9lPeP8wfPn5utSgkv4/Ef6SAPFgC4KD1DDyCxOhLy+jnWHm32A/+21jsJvzuN8XTf6B4CNZSEvhjWQNF6wvHgHp55Z7AD2lTlIXcYEU7mQC3Jf2H7jJXhg/s7/EktE+0qmXHVc950ePD8qVJP6w7RcPI4d8KIPUNm0vYPDxlNgcNSuDBtxjORMNSmWqrZC4lqgcAv3W2fOpI9rVlQ1v7v54yUtRSm9k9V6/I0jD/IhOQJtoh1/9pQUfkztU+owA61TLNSOUgefsgG14U2gAliZbU6trujgBns5OJUBq6aXSeCK0Z6/Ds2eGeqA== 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 PH0PR11MB4823.namprd11.prod.outlook.com (2603:10b6:510:43::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.17; Fri, 5 Jan 2024 10:13:57 +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.7159.015; Fri, 5 Jan 2024 10:13:56 +0000 From: =?utf-8?q?Micha=C5=82_Winiarski?= To: , , Subject: [PATCH v4 6/6] drm/tests: managed: Add a simple test for drmm_managed_release Date: Fri, 5 Jan 2024 11:13:24 +0100 Message-ID: <20240105101324.26811-7-michal.winiarski@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240105101324.26811-1-michal.winiarski@intel.com> References: <20240105101324.26811-1-michal.winiarski@intel.com> X-ClientProxiedBy: VI1PR10CA0092.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::21) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5373:EE_|PH0PR11MB4823:EE_ X-MS-Office365-Filtering-Correlation-Id: 66606960-96ed-4533-711f-08dc0dd706fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZblOjlWvychQRsrbO5HkSPIQwJJeuwp3WSwSmWnSzLRj70jF9DR4ex9A09vCDvGNPaR6oATRQy9Wf8exu4SDVWZrJ8m+M//cZ7nyjiGlb6LHnBsAf8bpc4mlsxjKK0VDMET2B9v5/d/Z00oWoZHZQAzyGL7FoESBwV1RnX4+RfsT2bx0xGKEzOMqo1/4zda5eKDo0IWaIY97nHRNPNZQjTUZWePO1xJyBsgn9KRyP31y3LwrnesZjIOEI5O/PDzZIjGfWFXVk26vtkTZ6AiLLK1NSuV1c7nUH1IGnfhUC8zV/CJvTwa9WQ412zoQ52GQGEBNB1BzkI6BMNURE9HJz1Rc1QXUO+cdvV+sRaMOYLh6GYnWGPCFdfgLThVr1qIrg4D+iYdD6HYyl+1Utf/OJXwHM/u+uBTuGKlNoy3oCY3rqv8ATDqVqgDNxm6SAEPe/8qzQdW0rVYGudWFq8dmKNr86u0Co1IrwSKOUzbNP+73bPsTX/TlNGUMZYm5lAeVpjBc/KR67HXbm6jd8pTLofjRTiEFVSg0mRq7P3Xb789Gj922h3L20YLS6v6jHWqM 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)(366004)(136003)(39860400002)(396003)(376002)(346002)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(2616005)(26005)(1076003)(6666004)(6506007)(6512007)(86362001)(83380400001)(4326008)(8676002)(8936002)(316002)(54906003)(7416002)(36756003)(2906002)(5660300002)(6486002)(478600001)(66946007)(66476007)(66556008)(38100700002)(82960400001)(41300700001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?+Hb6SAYSLpUTa2cGkULVqLD2bfH1?= =?utf-8?q?bPWIAMEqrYAy2SMLeCLzq1G5piQ/I8Yi89zzSWqaSiOWgeC2ey9/OltYgFj35M8Tg?= =?utf-8?q?gwN9inwtyNygJaFG1ZbaV1hPrRjViDl+cj04QCZzymPbs5OiCihvxICGRMbKoBPio?= =?utf-8?q?LYmsNJsadVoMlJbAVL6Y9LMzVya82PEdYXZnu3165S4fyZWDgzAUc/OM2VszSilFB?= =?utf-8?q?m1VYTWksRuPq11IQUmxEC0ITAA95oDHEooRBlu3bP1sR0XCLmP6Qn+anCDXxM0PQR?= =?utf-8?q?S6OQRdMK44MJp7s9GBZ4dP1ySxAjB4XUM7q1fbWaXF6wkX7oa2XAGmSZPBq2FW/jr?= =?utf-8?q?gnFsM+lLC7QkfXAbrAVo8/6Jf2qMGBDD3Eb/BJMc7ecjSbXfyhcU0+AGW4NWhnRU0?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= =?utf-8?q?d678MAZ5G7nxaTV36kHxpOH9cBmOGYbjFbHudz8ytIP+wAtVs6OmRA/UW93efK2pj?= =?utf-8?q?YiKuvjAANObKRkk46lEouqaqeATp6QwYTfQrD3FanX2O98LQGHpWMODdy5Ph4/o4B?= =?utf-8?q?IE99rsz80OeFErGZCymscpNVppyIyEytaLvqyZCbCeu+2QAwW+KB8heb8YFNcktJC?= =?utf-8?q?3wsKdSIENuEOUx7cKMaB+lbFhm2vpT3dN7VD+KvbPwepLCQ6ki0ExFlA2OspllMfy?= =?utf-8?q?bxPzkOSrT2fiUx3DJsHzU7JLV+yFU6pB/g=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 66606960-96ed-4533-711f-08dc0dd706fb X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2024 10:13:56.8875 (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: IfX6EsbBimyYe6l5VmwTT7barni7XdGsxChFBYX5Ck41qUf/BeI5zyMu9w0XCpXTjiQNd8HJ2F/fqS/d9FVoYbc2R2IUF50kwEMBIq2YdNI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4823 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 , Michal Wajdeczko Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a simple test that checks whether the action is indeed called right away and that it is not called on the final drm_dev_put(). Signed-off-by: MichaƂ Winiarski --- drivers/gpu/drm/tests/drm_managed_test.c | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_managed_test.c b/drivers/gpu/drm/tests/drm_managed_test.c index c1fc1f0aac9b2..91863642efc13 100644 --- a/drivers/gpu/drm/tests/drm_managed_test.c +++ b/drivers/gpu/drm/tests/drm_managed_test.c @@ -41,6 +41,33 @@ static void drm_test_managed_run_action(struct kunit *test) KUNIT_EXPECT_TRUE_MSG(test, priv->action_done, "Release action was not called"); } +/* + * The test verifies that the release action is called immediately when + * drmm_release_action is called and that it is not called for a second time + * when the device is released. + */ +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); + KUNIT_EXPECT_TRUE_MSG(test, priv->action_done, "Release action was not called"); + priv->action_done = false; + + drm_dev_unregister(priv->drm); + drm_kunit_helper_free_device(test, priv->drm->dev); + + KUNIT_EXPECT_FALSE_MSG(test, priv->action_done, + "Unexpected release action call during cleanup"); +} + static int drm_managed_test_init(struct kunit *test) { struct managed_test_priv *priv; @@ -67,6 +94,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), {} };