From patchwork Tue Oct 15 22:07:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13837317 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010020.outbound.protection.outlook.com [52.101.69.20]) (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 4792D1B0F3C for ; Tue, 15 Oct 2024 22:08:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.20 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729030087; cv=fail; b=LJxESeEnQ+FcqBaqE3vc10wKRiqlKVz1/HrE9oS7Tsvs8RjfzaQOwTd91Ra3tuElWbibtiS1sDIErgk5FNc48ZQCDLN2ueFxMgoxH1xlmyCLndRek5bgw+vMah5SRXkHxTvgwqT7hlgaha7gIa8k9KcQEJ/uUhKZkIWlgc09dVE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729030087; c=relaxed/simple; bh=dpRuTumZhFUVbKPOdmtAMQ5zSKVcrdkbzwxxi6fJUz8=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=g10h62Rgq6HB2j1rcBMY26Rf3ZYe7F9VQOEsGky8rg9KZ9RX1oRG8boBjiCG2IIfeEc9u+uqrxPilBbn93UPKBJAcGMtUIyzz+lSn2jM5ITzmjxrehapmxKjwovdUfzkeHrO/cf7sMfUHjEkrmCh8QaEE+znVxNd+Fa+BqxIjnk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=XM2y38Qp; arc=fail smtp.client-ip=52.101.69.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="XM2y38Qp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ohBqd6KkVhftuO4VqhKCJENTeM4OPsaX/TSbDOIq4NHj5ufQV7ls84wbuDhB4jCbLjMNTuveU5lRJcR9MBYSpSqQj2q9xrNZzJkIbhclxph8gl6x41//Qx1DB73nAndplYNQR9OSE+jF644oftwDdx2DiEB8vwndBpN/GxSXQyG8wiiChN1NhlmFH21/5A92yhRhO7/mnzqmRq28K48gThjMd6bx7AYhleGNaHFC2xVwg8MHY+SwtenTSF8J0A0s+kO4xKBPNnMKzkiIt5vA2hEYlmmuYCSSxZ2eedxzp/Acytkt972YlKceeiWbhhnuFXtnJLMbS7LP1wVUiJn3Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=swW1eyLF2wHdo0B2Hb3YfQpGGihq8nZ9DTnuN6C2Omg=; b=o/AlepONR9l6KxO8iKKKCVDpC3+HMcZSFw/eRxOFiaJIV+Fr7hosyzH9FTGDHW/AWeT22bsL44Sm8Eq04unSTJhFsPmlFrkAMTvEfq+Wdgzb2/31hL06NvinTgJuPs4h2Pjbpd3Wii1RpDtDzeIdC8Se60Gs0jtjmcJYlYJzoOpp4KW9/xGgIYQoos4WECXaXxGhJ/JM7+JugDo69NUle98L7KzzDfGQD0AN0Wz8xJShgnoN2qOycFW3xOxQFBrUv5LzL/B6q1zhWSeK4o4vVKfjB+Qk9PIBOaghTC1Qt3goDiAN9ehn5WZHIViYScaJ7Su+HGYkspey+WcUWM4vEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=swW1eyLF2wHdo0B2Hb3YfQpGGihq8nZ9DTnuN6C2Omg=; b=XM2y38Qp8zevU7ORrcX11DucfhVs5Yp3PaFwyEV7Gh6RAJHmp7mw3umEAPiU4ltBJ7+ppoO47fi4O27IssCKYQudc8HOZKZmk9/JBqgVhvjTsKWZy2ON8uhkalGLuhk/8/ZFyxx9ejOmRv6JT0IezktEDN9tt9vFP6gl31HxgdqmbZnoUbRgjxeFeUxIMPSxQ5CIRqomVSzySDsZMN9iLzX0kmtRcnseS8AKwagMB6BPVIaP60AJvlBc9o/BvlkjzXxshV+VyKRoLguf/AkbCwZ0nQNzJOyZ+wEzZbIIOPh0hCOohtUxNf/BGJl0VDIiER3zwRO5X15nFB50gRTfrw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DBBPR04MB7788.eurprd04.prod.outlook.com (2603:10a6:10:1e4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 22:08:01 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8069.016; Tue, 15 Oct 2024 22:08:01 +0000 From: Frank Li Date: Tue, 15 Oct 2024 18:07:14 -0400 Subject: [PATCH v3 1/6] genirq/msi: Add cleanup guard define for msi_lock_descs()/msi_unlock_descs() Message-Id: <20241015-ep-msi-v3-1-cedc89a16c1a@nxp.com> References: <20241015-ep-msi-v3-0-cedc89a16c1a@nxp.com> In-Reply-To: <20241015-ep-msi-v3-0-cedc89a16c1a@nxp.com> To: Manivannan Sadhasivam , =?utf-8?q?Krzy?= =?utf-8?q?sztof_Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Arnd Bergmann , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, imx@lists.linux.dev, Niklas Cassel , dlemoal@kernel.org, maz@kernel.org, tglx@linutronix.de, jdmason@kudzu.us, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729030073; l=791; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=dpRuTumZhFUVbKPOdmtAMQ5zSKVcrdkbzwxxi6fJUz8=; b=5WhOgWPZ4IGIHmznpYsjRFzEk+lVGdt0p3vms3BedG0LqO+CX5RpnQWxJ6ypDWH8zAPX4BuyQ ZOwIThBonCUATNAwpQ8x8Lse5nQaq11Z7nx6ERwk3vmVGnYDa2vZ8e8 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0059.namprd13.prod.outlook.com (2603:10b6:a03:2c2::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7788:EE_ X-MS-Office365-Filtering-Correlation-Id: aa8c6dab-3e34-412b-bd6c-08dced65d5c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-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1OX+XVpxQPq4YgNJ0Pve63k7NYjB4YIe9FqtzxDeI2ptPPaI?= =?utf-8?q?G6rfvacMqlJiaBk7hlAQABjfEqni6u1WXSdxOsDyV7HJl1/2g3UtOkI3LXPXd8Vk8?= =?utf-8?q?CDSm4HShZYZZWLjj+ZgK9Jk89Bp3j3LpMEg2vdsNaw06xF+PFZH3SUVVF28E1uoAu?= =?utf-8?q?+KrvivxhoL2IA9YOYUKUIsADHWj+LYNBidk+lPdbYYYq5FPnfWHrNuEsVtwht9vJn?= =?utf-8?q?oHhr7HphWNwPKA+KPk1F4LmH4WM/jIYUTcs8GYDxVxcX4DGBvKXQePty6+sk3u6BA?= =?utf-8?q?qX9VV7n2To0rQBgkbGXOhhXVp/zmqnc8jkqz6JiwWvLx2CfE7JXJ5oytjmRwYtf4M?= =?utf-8?q?dvenenC5gNZk8MSXmPumBAWaQuQThfT7jn1fF2jqQ8WcBbRmuZVRbJ17AME07AIwQ?= =?utf-8?q?hkYKDXedHG3z9sqb5rscAdZi6I8msMjki9kZhUgI4pLcu8+EV5ZmTglm2a+NcMoOr?= =?utf-8?q?kUWQrpnt8Bejih+hmaP6NH1xrViPKGSPO1w=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?yqV0nWloKE6ZIItP5M4tRooWQSDt?= =?utf-8?q?xmlOhINEZJ6eJy8o8KnXMQQ1RwCEXessDpvKbg3dB4qFM624iSEgVUO5dVsN8CIY9?= =?utf-8?q?oCHXzjc6mvna95BNjedm5iv7BoNhIvlvoOUJF4SkULM6aIFENA0pITPDjJWYvhWAf?= =?utf-8?q?nhiG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BuaOK/UZel7EqMy94dkkyzKj/C4lFm/VSeq03DcsN1IR2fxI8gVY+y?= =?utf-8?q?Oklzr4MF627vDQeDCFaVRwX/EEFunUyH2GhXYyqyeEMGxVtLU0x7rC1HevZwvVv/V?= =?utf-8?q?P3I5ck2TpQm/iyH45JrH/AQXNXduwanU+vpkRXmz5rdURYnCbVrbYXMFVFqG5OTjE?= =?utf-8?q?rvdZxM5DbvJfb9DxJ6Ihgz8BnvtlRhmaOMgqC7pu6PZ8te77YtulkXYfOJlhBAmwM?= =?utf-8?q?lOIK6mV2HB2jcDF+s9CCF71r8F+aUyl8SOAPSa9Qd8SmpJ+UL2t4LoN22ViUfvTqe?= =?utf-8?q?K++9dWKK0tDZrtOzBXQY36qtH53bb8CcmcxVUCONXyqAwLWmGsRGK/aX9sVxPk7o2?= =?utf-8?q?WcrCqyNZCRH2X2GXy7HzpUAj0hF2DL2ySDetTgIGRR7IKVql2DpIb5SfKNOEakn4m?= =?utf-8?q?+AJpNE7iOpJyj2LqK/Ne4S+VJpI5zs4TWyTjG0WHk/YbCnnK8FCdjOP4=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa8c6dab-3e34-412b-bd6c-08dced65d5c9 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 22:08:01.4871 (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: q/42s0zFaX077BEkWmrLTbTPnk1OTKQ5RgpI7lcd+j1yblzq8jCCRrJvt/XBA0IxHOgEUQ2SGDurKjuo0bVijA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7788 Add a cleanup DEFINE_GUARD macro for msi_lock_descs() and msi_unlock_descs() to simplify lock and unlock operations in error path. Signed-off-by: Frank Li --- include/linux/msi.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/msi.h b/include/linux/msi.h index b10093c4d00ea..0b6cb7f303887 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -228,6 +228,8 @@ int msi_setup_device_data(struct device *dev); void msi_lock_descs(struct device *dev); void msi_unlock_descs(struct device *dev); +DEFINE_GUARD(msi_descs, struct device *, msi_lock_descs(_T), msi_unlock_descs(_T)) + struct msi_desc *msi_domain_first_desc(struct device *dev, unsigned int domid, enum msi_desc_filter filter);