Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6779023rdb; Tue, 2 Jan 2024 13:09:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrT9nw8pbo6UYXsY6Ydmrm6qDRBBzodea+GTEO0M3K050A9JhCNWA7pqpHMjHrmO6JBdTz X-Received: by 2002:a05:6214:f09:b0:67a:c268:22e1 with SMTP id gw9-20020a0562140f0900b0067ac26822e1mr32529588qvb.27.1704229747877; Tue, 02 Jan 2024 13:09:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229747; cv=none; d=google.com; s=arc-20160816; b=u/MqUn4cvlrDG7IOPxWU/D5RVVJS8mj5rmMpNqaDpj5H0H8OqkGltA41TeQl0db5sX NsszEKszJE+MoFK8sIvfZVY0MuzMdnUT2kUp8rencB8FXUccrfqOmxC6w2McOtOrZS3+ STNPSWegZ1HhkwAG3OPet1O38ahIRmqIbY7T+KfZzbpoIaikirRK0VIqjPNxKKyen8Py wSJAMc/jE8+jJAH0JC2qBojCjVv//H4xyefhPGf3HM2WGuUo4YanBrAiB6YQ713DWlTo 4IyoFcPQbn9HR/3QhmtpSSQQ3xduUmWY1FTRHTtV2R4gjyuU2ujh3iXtTM6fVg/fXGtn sekg== 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=AULYiml6H3I+b2G8tlhMxcx/1ZvVdi4KizI4u111pxQ=; fh=8Mqhbukr6LRjig1GXBDFEaCoN2oEXwmEEUR2oC9Y8v8=; b=gMKmXOKzb7st++LiaaTyYruJDHCa2+8vSBN3UR8Fh26ynePe/iNJEVhMEiNNgJG/IJ T/4nkPaqPC7ZvoyLWUMviv5Lyj524zzjS6xbZXUPIJ4B6N6BLMJD0OO5MrvW+f50sEyN rp+k5ugibsolMyxDQg81tEfj+xGWyAfvy+EdX6JceIw4/K4WE5r4mNo0wDD1kTUX/IlA st+oV5tNkuVmpGd/hC2S4DUjPo5D/FDh7ZrcbUXwBLEpqBVnB7y+t92b5Xvjj/I5Ptl+ qcLG9m8OfFoO/9l/8cLq9aT3ylk462Ju/yOGXextG/zc+SZj/ELa3FdN3t2AqXmM8dDS UrUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Joo2LHIv; spf=pass (google.com: domain of linux-kernel+bounces-14825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r29-20020a0cb29d000000b0067fbdf79815si21827177qve.47.2024.01.02.13.09.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:09:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Joo2LHIv; spf=pass (google.com: domain of linux-kernel+bounces-14825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14825-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 99C731C226CC for ; Tue, 2 Jan 2024 21:09:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C20EE168D0; Tue, 2 Jan 2024 21:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Joo2LHIv" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (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 59FBF1643A for ; Tue, 2 Jan 2024 21:08:45 +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-f53.google.com with SMTP id ca18e2360f4ac-7baa8da5692so421987239f.0 for ; Tue, 02 Jan 2024 13:08:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229724; x=1704834524; 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=AULYiml6H3I+b2G8tlhMxcx/1ZvVdi4KizI4u111pxQ=; b=Joo2LHIvGCuK3aFERRxNSEtajHNauRc0yJaLHBjfMAMzRY8w7hVez0nRhsg3zc2dlN 5Up3Ht5heS20vtfDdGVUfDzWfCgfhs8QzZkJe6f9GOz2RddQH99u8O+exxZW46folbED T4xTPIQDzWuehQ0jdIS/SkAHnIMxQeG/QB46Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229724; x=1704834524; 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=AULYiml6H3I+b2G8tlhMxcx/1ZvVdi4KizI4u111pxQ=; b=hPV0JlNixzp9tr7jsaCqkErLnKWM2GBwIs4JbgdaT/4RFsIU+y6S2vYTC4qssRr78W Y+eVM6QQIGjYwdssLn04Ad+Onejxd3zGwc6HQehBRmvcQ1OJp/JLI5WhRqk/xshoinPW ErJ8jBMTp2Y3eJtDORIvH/WOYG8333FnBkCIYy7HgvZ/VHn7KRPBWTwFeS8nhfS2Wgxr k4SqxW4EKcfWOYNHpOIyvccuQ7h5j6ru5b5Ntw3IgHB0i2QcLsWLmNn6SiFV2nzi33Fp 2eWgTGnHKw+xNqcKhIqFkvlJ58zcPgGGvjtvSNKJhKsNFI+80iWPadHZVLd+/R7lJ7if N5dA== X-Gm-Message-State: AOJu0YzcB+yrMpt6hkZsX9ikkRzTG/BkixGnWUNe5GZH8nlQJbVS9x01 9NWxpaY+rqnVqNIZuqRDavC9W7J1IOszs4CyVQ+SXIOe7weM X-Received: by 2002:a5e:a70b:0:b0:7b7:3d:6452 with SMTP id b11-20020a5ea70b000000b007b7003d6452mr18789276iod.5.1704229724386; Tue, 02 Jan 2024 13:08:44 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:44 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Andy Shevchenko , AKASHI Takahiro , Andrew Morton , Baoquan He , Greg Kroah-Hartman Subject: [PATCH v4 01/24] resource: Add DEFINE_RES_*_NAMED_FLAGS macro Date: Tue, 2 Jan 2024 14:07:25 -0700 Message-ID: <20240102140734.v4.1.I59b56ebd2f303784031c27bbb1529cf6ef71ba16@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Andy Shevchenko Signed-off-by: Mark Hasemeyer --- Changes in v4: -Update Andy's email to @linux.intel.com -Add Reviewed-by tag 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) -- 2.43.0.472.g3155946c3a-goog