From patchwork Wed Oct 18 23:16:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 155223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp52464vqb; Wed, 18 Oct 2023 16:18:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHL+ZWbzG72J3depKDjsCXiU/xgXV3GEKgVCx1v2A0CdVJVv53ptSQt9Y9uyzB7HqhuMhyO X-Received: by 2002:a92:c262:0:b0:345:d58d:9ae5 with SMTP id h2-20020a92c262000000b00345d58d9ae5mr1027218ild.7.1697671135323; Wed, 18 Oct 2023 16:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697671135; cv=none; d=google.com; s=arc-20160816; b=AdMqFNKkRQCQcMMoTSzHmOMbxa/RQpsnNGyhBLws8Jf3tiUgnzlH5mri3fkNuQVR56 a2FPBADbjM6dE2vjSU2C/mqq6cADvnmuI61Bxuafpyc40UYjQiCwle5SS3LzAA+/ND+8 fIubdwlm1WyNiJuJBkyUX8zy9yXK/JDRGDh6CU8Ats7e1DU/xLnuvTnNb3lBH/33dfsa 99c/t59ZXWpt7/QIQFABvCni/iYIV/RxEuAaPT9g5DRf+DNd1pZxfVoeUbNLQ9xg7ozs yVHRLGujDHiQGXO0lqvWoBD5OcI5aBQuL+nRssXlzD2f2v6QPN8q3EWf9ZU6cELEPRGA Qlsg== 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=RJqx2Fdek1ADUTSkCgc/0U9q1VMMD6RGrs5RMITxMR4=; fh=HOH1WI2PiuzzmjdAooQK1QfpsEURBB+MokyJBswy9GQ=; b=vUOBNN7bNQlm6BCGck3ccwEDjWwRIvgomUALHu51haM2OHpp7FQGMFk49wMmsXvQ1w rm3D1U8/2FIK64s6YGT+xVHpZpdGxsbYdKLGxPeR/6JLT86SrR/iFVBCXQGFPmEYiK8n PreUGcIT5zQ+YZt73qOV2ymWD8Vk22LmfBHh5w7ZTxl9C8miSEX07imIW3mKh9zwWAky rw6yXahI6fpTWld9ljOegt+80w9WmN8F/JE4cJIRCrdc6Sb86OHW33L5DlqfrbG6+CKv TjnNkYwMAW0ht8lhZW4QpAm6Vqhtk39XGXa7yhcf5bfV7y3StWuwLaH8ms4QAetQd6I8 J3iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XO5yM3Yt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id k69-20020a636f48000000b005859c221c6dsi3069517pgc.221.2023.10.18.16.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 16:18:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XO5yM3Yt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id E3A9E8115470; Wed, 18 Oct 2023 16:18:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232122AbjJRXRI (ORCPT + 24 others); Wed, 18 Oct 2023 19:17:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232042AbjJRXQa (ORCPT ); Wed, 18 Oct 2023 19:16:30 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C77D113; Wed, 18 Oct 2023 16:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697670989; x=1729206989; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=GIPMSMLcNSd70raoeZwCxjNvumcHnXvuwgkKfWU6OdQ=; b=XO5yM3YtmIUNCneEOiNYb6ZijDJOhQJp68s2OJwXBKvd0l9+O18bPLUS xWvwOVMDrRvY11TO0DwNe+d0XaRAQ964W/q1/heZzBYoNXFzm/NFpkBBP 83RXhPlrTpXQ4ePmmeP5XkJo0m+IAmIXXFZcDRGaoIHKP+xYnlDDO4vce yOZrx17B25sShSdY589HOvET5zf2pIM7y7jWH6WtcFPvfPAZ5ah6O0qM4 td/HN1uG26xciwZ5ct/axiXkiamOnOB7XJnFKcgoq4K8GOOJviafpZfsF B6OLpCxxDFx3ZG+U+QwMczsMYLbBp8bDQPRqCgDEgQeBlZ4TCjwGAdk8/ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="452605961" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="452605961" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 16:16:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="756782183" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="756782183" Received: from linux.intel.com ([10.54.29.200]) by orsmga002.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 16:16:25 -0700 Received: from debox1-desk4.lan (unknown [10.209.71.91]) by linux.intel.com (Postfix) with ESMTP id C5BFA580DD0; Wed, 18 Oct 2023 16:16:25 -0700 (PDT) From: "David E. Box" To: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, dave.hansen@linux.intel.com, arnd@arndb.de, peterz@infradead.org, aleksander.lobakin@intel.com, ilpo.jarvinen@linux.intel.com, rajvi.jingar@linux.intel.com Subject: [PATCH V4 10/17] linux/io.h: iounmap/ioport_unmap cleanup.h support Date: Wed, 18 Oct 2023 16:16:17 -0700 Message-Id: <20231018231624.1044633-11-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018231624.1044633-1-david.e.box@linux.intel.com> References: <20231018231624.1044633-1-david.e.box@linux.intel.com> MIME-Version: 1.0 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 18 Oct 2023 16:18:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780137208528891252 X-GMAIL-MSGID: 1780137208528891252 Add auto-release cleanups for ioumap and ioport_unmap. Suggested-by: Ilpo Järvinen Signed-off-by: David E. Box --- V4 - New patch include/linux/io.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/io.h b/include/linux/io.h index 7304f2a69960..1488832c4ad2 100644 --- a/include/linux/io.h +++ b/include/linux/io.h @@ -6,6 +6,7 @@ #ifndef _LINUX_IO_H #define _LINUX_IO_H +#include #include #include #include @@ -20,6 +21,9 @@ __visible void __iowrite32_copy(void __iomem *to, const void *from, size_t count void __ioread32_copy(void *to, const void __iomem *from, size_t count); void __iowrite64_copy(void __iomem *to, const void *from, size_t count); +DEFINE_FREE(iounmap, void __iomem *, iounmap(_T)); +DEFINE_FREE(ioport_unmap, void __iomem *, ioport_unmap(_T)); + #ifdef CONFIG_MMU int ioremap_page_range(unsigned long addr, unsigned long end, phys_addr_t phys_addr, pgprot_t prot);