From patchwork Tue Dec 26 19:21:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 183338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp1055392dyb; Tue, 26 Dec 2023 11:22:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxfvnCNGA2x09j5sZB9KhEzd4jnwqy6hUPs+0rIlqZivdw4fwMy1l7pID1u8PbQUxLxr+8 X-Received: by 2002:a05:600c:34c9:b0:40d:598f:351f with SMTP id d9-20020a05600c34c900b0040d598f351fmr868626wmq.170.1703618561739; Tue, 26 Dec 2023 11:22:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703618561; cv=none; d=google.com; s=arc-20160816; b=IJEtXjm+F1hTOkJEZ9xgeFJrgUwsf2zHBrPBUF9dyT25zdH9ZLGs9YGmkB+y25I2Ba XYMWCGWpWbSQPPDEeuPXV0R3UrH1gp92t9InnEIl4GHUlbUPJPkAvHRRG5hSF1fUzOFm 8xvLuxBnlsDLfegArpbuGE6sv2ZaCC28K3JRrllJWDJbEZP/1l5klkjWnFtdq3UcMZkl NcZ18eR8AxxZIuLeuaNNDUbh/TiN+xOShgDyimv6Z8h+OfXPV88A/azQV7mS4EClfQhp +5twPcCbPHf++6HvUupIFcHPTHZWxqsGJTc0n9jroSjqR95AiCkt8PjAk9fRu4B759Nh kJpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DpqenrRUC6bjM3FBUQeM6IW1qxia9n9naxBupjAv3uo=; fh=CKXAP7lj3/kcpK7Rx/NWRaeEems1i8mzpvubS8KRGP4=; b=TyKLmtTJ5nsYPtrQc0rcxSzYqbLNfCARvn94Y68HogYP9OEnhXEm/B0p14ef6glTt6 9IfFpclk1yWmfs9EuIU9sSdKnL9rBEfygn9tfO+o/OXXBDhkH422rMCsXGExT8KCqffh 5wSmQXAIycnPqI8Km9Psk7EGJchDR/Osxkk9+teWRxaXeeCiM9SnUvkI8eBRXhBbOyyO TORaXqeTmMf8bh3eKOQdxOHn0Xvdz+DhbUEq1R0pCBxhebHHE20jAO3gZSnphKgFvm0D 09s4pyOzQpbcWpEBP+BOtlF8EpT9yLOocrEKn1UYa9VSxPeCq1BD7TlkomlhlZC5Ds+T u68Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lg6zEGOV; spf=pass (google.com: domain of linux-kernel+bounces-11629-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11629-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a4-20020a170906684400b00a1d07581a7esi5123677ejs.97.2023.12.26.11.22.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 11:22:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11629-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lg6zEGOV; spf=pass (google.com: domain of linux-kernel+bounces-11629-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11629-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 596611F21AD7 for ; Tue, 26 Dec 2023 19:22:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F333B568A; Tue, 26 Dec 2023 19:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="lg6zEGOV" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1593E4432 for ; Tue, 26 Dec 2023 19:22:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7b7fdde8b26so206711539f.1 for ; Tue, 26 Dec 2023 11:22:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1703618522; x=1704223322; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DpqenrRUC6bjM3FBUQeM6IW1qxia9n9naxBupjAv3uo=; b=lg6zEGOVJELIYZP8LcIUqeyWpjIYPc2ZgojXQgmoqL5txatFJtk/ELRg86mTlcJrAY 22xSDZciqMVfDmYi+JudnojpMsLhfQskc4E4qDHnRBbNHsZ4FfnMyt6NwqiXgRy3kMLF EoZ9/WMDZhexTgoIQzLvp6bxk7lmt0XCwdFcw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703618522; x=1704223322; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DpqenrRUC6bjM3FBUQeM6IW1qxia9n9naxBupjAv3uo=; b=Y453cvDYWseHD/Gn9rnbChnuQU0aANrqXjBV93FCi5MQI14Fv2hJ9IAZnpcHtMPJN0 csVhGgfZCIi8nw6T8V6Ze8NivllfE/kweJqLRNgXowdjmakntPsZcaUZjOtqJycDWAeJ w/+eSyQHVuqsQDYK5tzEYmbutKPnZ9ze3Y208qbzn367WVf//f0Vk1cH1wmOoKV2irQl f/NYQdkoemAyJV4EDFDH91JSidaITEhooudzVTiuKHMZdGH6e7IkI/1UUvTnrfAA1QKn j0hla64T7mvIC+KWNGQWoOmWYv6zhOlpeJ6a+T3tw6FRZyi6ALlDUlf9uQidtboCaSw0 3h3w== X-Gm-Message-State: AOJu0Ywy36OLB2GKT44PNOjnfDFjisFKx8iLVESvr9qsIyjJOt7FCQvz rJR7bBtDTfVC8jmayilnkKuFPavf4YdNoC09TolwOtQ7hc5e X-Received: by 2002:a6b:ef14:0:b0:7bb:818:9eeb with SMTP id k20-20020a6bef14000000b007bb08189eebmr401147ioh.37.1703618522186; Tue, 26 Dec 2023 11:22:02 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id gw3-20020a0566381ee300b0046b692e719esm3207609jab.150.2023.12.26.11.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 11:22:01 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: AngeloGioacchino Del Regno , Krzysztof Kozlowski , Rob Herring , Konrad Dybcio , Sudeep Holla , Andy Shevchenko , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , AKASHI Takahiro , Andrew Morton , Andy Shevchenko , Baoquan He , Greg Kroah-Hartman Subject: [PATCH v3 01/24] resource: Add DEFINE_RES_*_NAMED_FLAGS macro Date: Tue, 26 Dec 2023 12:21:05 -0700 Message-ID: <20231226122113.v3.1.I59b56ebd2f303784031c27bbb1529cf6ef71ba16@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20231226192149.1830592-1-markhas@chromium.org> References: <20231226192149.1830592-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786373537060183408 X-GMAIL-MSGID: 1786373537060183408 In some cases, it would be nice to instantiate a struct resource with custom flags. For example, creating an IRQ resource with a flag that marks the interrupt as wake capable. Add a set of macros to provide custom flag arguments. Suggested-by: Andy Shevchenko Signed-off-by: Mark Hasemeyer Reviewed-by: Andy Shevchenko --- Changes in v3: -New patch include/linux/ioport.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/include/linux/ioport.h b/include/linux/ioport.h index db7fe25f33700..a44e73ca058a8 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -163,28 +163,38 @@ enum { .desc = IORES_DESC_NONE, \ } +#define DEFINE_RES_IO_NAMED_FLAGS(_start, _size, _name, _flags) \ + DEFINE_RES_NAMED((_start), (_size), (_name), (_flags) | IORESOURCE_IO) #define DEFINE_RES_IO_NAMED(_start, _size, _name) \ - DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO) + DEFINE_RES_IO_NAMED_FLAGS((_start), (_size), (_name), 0) #define DEFINE_RES_IO(_start, _size) \ DEFINE_RES_IO_NAMED((_start), (_size), NULL) +#define DEFINE_RES_MEM_NAMED_FLAGS(_start, _size, _name, _flags) \ + DEFINE_RES_NAMED((_start), (_size), (_name), (_flags) | IORESOURCE_MEM) #define DEFINE_RES_MEM_NAMED(_start, _size, _name) \ - DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_MEM) + DEFINE_RES_MEM_NAMED_FLAGS((_start), (_size), (_name), 0) #define DEFINE_RES_MEM(_start, _size) \ DEFINE_RES_MEM_NAMED((_start), (_size), NULL) +#define DEFINE_RES_REG_NAMED_FLAGS(_start, _size, _name, _flags) \ + DEFINE_RES_NAMED((_start), (_size), (_name), (_flags) | IORESOURCE_REG) #define DEFINE_RES_REG_NAMED(_start, _size, _name) \ - DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_REG) + DEFINE_RES_REG_NAMED_FLAGS((_start), (_size), (_name), 0) #define DEFINE_RES_REG(_start, _size) \ DEFINE_RES_REG_NAMED((_start), (_size), NULL) +#define DEFINE_RES_IRQ_NAMED_FLAGS(_irq, _name, _flags) \ + DEFINE_RES_NAMED((_irq), 1, (_name), (_flags) | IORESOURCE_IRQ) #define DEFINE_RES_IRQ_NAMED(_irq, _name) \ - DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ) + DEFINE_RES_IRQ_NAMED_FLAGS((_irq), (_name), 0) #define DEFINE_RES_IRQ(_irq) \ DEFINE_RES_IRQ_NAMED((_irq), NULL) +#define DEFINE_RES_DMA_NAMED_FLAGS(_dma, _name, _flags) \ + DEFINE_RES_NAMED((_dma), 1, (_name), (_flags) | IORESOURCE_DMA) #define DEFINE_RES_DMA_NAMED(_dma, _name) \ - DEFINE_RES_NAMED((_dma), 1, (_name), IORESOURCE_DMA) + DEFINE_RES_DMA_NAMED_FLAGS((_dma), (_name), 0) #define DEFINE_RES_DMA(_dma) \ DEFINE_RES_DMA_NAMED((_dma), NULL)