Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp93938rdh; Wed, 22 Nov 2023 20:05:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIP3Uigx4j56p+ct7N6H8Z9oezxZ/YAbOgTZQyausZiSsxjZvQodxdB/KLOuQuU+q10asY X-Received: by 2002:a05:6a20:6a0a:b0:18a:b5c3:55da with SMTP id p10-20020a056a206a0a00b0018ab5c355damr2162152pzk.10.1700712334530; Wed, 22 Nov 2023 20:05:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700712334; cv=none; d=google.com; s=arc-20160816; b=JyOmixPdmLZMXdnPVroHZ/hb5K3ARVWEVLDl7+k6Evgi52W9d9TKxVocvSxlGUOxl2 6FPBzIZjXNs2Dxtygjw/a6dElLCN/IH7Xy5sZPVym182Wmc9M86CyDWNK/0C9jNuyYTc up/F0wqi7iU5aLa1rNaeSwkfWSJdRPy2cgxVaHmXXTuac2xQvnOclWsIKgwu6lKrOPoq jVbznA9u7mIKERQjVpR+bT9m3HmtUtbCNuiFlzbAh62tEo9MWlBr0vkaWi+FvWXAleBE IvKuLRL7NH2c8BWzGIAZJw5HhGQmiz62LKItfkFOFhpJOMQ7djmCT5sWaiTQhTxB6Md/ wCfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5ESILGEUPpbzOxOBRSBkGP73mDWWwhQ1lBx+97QIyNw=; fh=aBF56gt1ZIoBM/Km9IExMMgXxUSat1xZCoUaU7LtMu4=; b=QUbJdwu5soqGbXGRSjWMLkbra9urvlmX797re/KGc8d2ktjNNHXWaDRmZzuNzwXczG BeD2984w7u2YEKVCt6ayr8m/72NMb2OziI4NRPzjtYuKS9TAR3qn4yVtf5cnneodSyVE 3cVa2kwDOnBxVyejyGMKHfHN3dXfmaaB86DmI8BQhfe0BIVhwOYodHqKVtwDtMY5uLMX 3rXysOdsV11/csEuC9nI59y1B3jMTeoIgb9EOvlk/nHm6/0b9FPwnGEosQJcuGF98eOC C/xpMvk3nQcHewcD/NidmAMSch41Sn3P7ppum/JFbBbvwLLClb60bu2qWcRYBTZNWXew sqmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=asa4+sDC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id y7-20020a634b07000000b00578ea9a0b93si493395pga.890.2023.11.22.20.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 20:05:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=asa4+sDC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DFF2683B2E2E; Wed, 22 Nov 2023 20:05:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344751AbjKWEE5 (ORCPT + 99 others); Wed, 22 Nov 2023 23:04:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233071AbjKWEDx (ORCPT ); Wed, 22 Nov 2023 23:03:53 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13B11D48; Wed, 22 Nov 2023 20:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700712240; x=1732248240; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=5ZZAKxI4gVSEhTRWxoAY8gcBKY1IXr9jOeKv5If/tc8=; b=asa4+sDCer8oL6EvCBvQ2oOOHS+KlIJMRg7xnBL+AE7Gf5TDURuGAmf2 Q+Zd09rPaDWaCrezuNGCylWFIwk17toqzXXRFSxJidfgS7v95ml7xwlcy KD1qQlXOEEg2IOtBrtdnHpcEsE5163bI5kIWKJ504E1CJB3JJHnPFYBlq 8LACWQzy+UQkp4N5kFLMEFzQ62aFbCXoGBSzZxRG92VOgd1MRYpMZciFd vPFAun+QljxVduibEeLvorfWZ1ovuCQwt2sT/Ju9PgcZq1pj+NKjjdIOO F7H71yPpXSqAqMzvmjXY3uFg6sWaYAI4ZKfnoa+uJ8qf1DDu8HR1/+Nyu A==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="5334663" X-IronPort-AV: E=Sophos;i="6.04,220,1695711600"; d="scan'208";a="5334663" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 20:03:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="837671154" X-IronPort-AV: E=Sophos;i="6.04,220,1695711600"; d="scan'208";a="837671154" Received: from linux.intel.com ([10.54.29.200]) by fmsmga004.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 20:03:57 -0800 Received: from debox1-desk4.lan (snpatel1-mobl.amr.corp.intel.com [10.209.89.91]) by linux.intel.com (Postfix) with ESMTP id C57AF580CA6; Wed, 22 Nov 2023 20:03:56 -0800 (PST) From: "David E. Box" To: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, ilpo.jarvinen@linux.intel.com, rajvi.jingar@linux.intel.com, dave.hansen@linux.intel.com, peterz@infradead.org Subject: [PATCH V5 12/20] asm-generic/io.h: iounmap/ioport_unmap cleanup.h support Date: Wed, 22 Nov 2023 20:03:47 -0800 Message-Id: <20231123040355.82139-13-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231123040355.82139-1-david.e.box@linux.intel.com> References: <20231123040355.82139-1-david.e.box@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 22 Nov 2023 20:05:27 -0800 (PST) Add auto-release cleanups for iounmap() and ioport_unmap(). Signed-off-by: David E. Box Suggested-by: Ilpo Järvinen --- V2 - Move from linux/io.h to asm-generic/io.h. Adds iounmap cleanup if iounmap() is defined. Adds ioport_unmap cleanup if CONFIG_IOPORT_MAP is defined. include/asm-generic/io.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index bac63e874c7b..9ef0332490b1 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -8,6 +8,7 @@ #define __ASM_GENERIC_IO_H #include /* I/O is all done through memory accesses */ +#include #include /* for memset() and memcpy() */ #include #include @@ -1065,6 +1066,10 @@ static inline void __iomem *ioremap(phys_addr_t addr, size_t size) #endif #endif /* !CONFIG_MMU || CONFIG_GENERIC_IOREMAP */ +#ifdef iounmap +DEFINE_FREE(iounmap, void __iomem *, iounmap(_T)); +#endif + #ifndef ioremap_wc #define ioremap_wc ioremap #endif @@ -1127,6 +1132,7 @@ static inline void ioport_unmap(void __iomem *p) extern void __iomem *ioport_map(unsigned long port, unsigned int nr); extern void ioport_unmap(void __iomem *p); #endif /* CONFIG_GENERIC_IOMAP */ +DEFINE_FREE(ioport_unmap, void __iomem *, ioport_unmap(_T)); #endif /* CONFIG_HAS_IOPORT_MAP */ #ifndef CONFIG_GENERIC_IOMAP -- 2.34.1