From patchwork Tue Jan 2 21:07:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184448 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4684523dyb; Tue, 2 Jan 2024 13:09:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEICHz9b4LxY5rkXynNL5q8L262lKf3XBsJVXPA/YZxAw5Tl93xybmHRamciEF58lrq2s6h X-Received: by 2002:a05:600c:3153:b0:40d:70c4:fd6a with SMTP id h19-20020a05600c315300b0040d70c4fd6amr2888167wmo.60.1704229790508; Tue, 02 Jan 2024 13:09:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229790; cv=none; d=google.com; s=arc-20160816; b=gDkvrohdQi/XvrvUb26XmubvwLR1kyy58p7lb/qLDq8z9lzpISjhLd1XOcKtxaqIDk 6XZXRlWENzMRT+zgkCPAqW81IN4VDdc4Ut350ojNy6VjZ5ua+/V9rngFXlqcXKB9RkdU TalA2VjhxqzJPNk+/eGdhtdAi2XrHFcbTgg9EKdp0786+onNPc2Jag5rzpKuOsX1Y1K9 INaTWWVMa/MT9njiBsGz+zKDCphPJVsmUoKj34KTjIqWZlkdHKIFYjzBU0HJ2MfklReW 5xg5L9BuYwtAPovG6VKWqQaabTYZolbqn3r9RtM2jRpWhkqORZRI4MSh6kQ19iouWlBF XHCw== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14825-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 e17-20020a1709062d5100b00a0fe0ed680esi10385603eji.178.2024.01.02.13.09.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:09:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14825-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=Joo2LHIv; spf=pass (google.com: domain of linux-kernel+bounces-14825-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14825-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 205241F23529 for ; Tue, 2 Jan 2024 21:09:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A376117727; Tue, 2 Jan 2024 21:08:49 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014456667414872 X-GMAIL-MSGID: 1787014456667414872 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)