From patchwork Mon Feb 12 11:54:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 199684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2378674dyd; Mon, 12 Feb 2024 04:00:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX+Mo/khf03MgS7swyAUDlF22Cpn37P1ZknM8dgoIKmPzVxlbli4YBbd1GXjkF/DYfchC6RHuxR3hMT+OJEA+7g1FWjCg== X-Google-Smtp-Source: AGHT+IEwOs9OxSpGnLJ3KtJrsaPiJczYUJzNL3yVwolbSmRt+I2s8kWAwxv6i/IlkGCRqNw2Bpo7 X-Received: by 2002:a17:90b:2d07:b0:297:17fb:4d79 with SMTP id sy7-20020a17090b2d0700b0029717fb4d79mr2834870pjb.2.1707739203660; Mon, 12 Feb 2024 04:00:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707739203; cv=pass; d=google.com; s=arc-20160816; b=j3gF3VEpXdpgPi3A1oXtLSS5IG8jd7gbhEz5XQXfB9aenXpIzD9A2HRHE1MheSVWrh fUizmVqRk19J4ax+KR1ccfC+nVn5AejnuYiMsSnSQtFrqZIsbo3bCZ/H1PaIp9SQw4yW 8/MwdyogRVdTp/6HQ6vn7f/rgXis8WkRElxgzXo/C9gb4jn0K/U6xB9UQkdLwstLt/5s hVwLfNooL/IUElYMpDnBbTVtp1EPEZxBWQrGqDT95Smr6yvYHo01K3eNd+uO/2/VcgIj g7rVw0gYw0Uu1Vy5vqeGwS6S2eH5L2SNO7EPMjRoiXloeD5jL76Cb99v/kBxGn8pb+9i l5SA== ARC-Message-Signature: i=2; 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=3aGSUgEoaSxD8Wnq2siQ6MwOZ/81RxBpHb5g/H05JE8=; fh=NtZGdYAfva3qR//lbMAfxtjo8WUAHyLbSgrynWZw5Hs=; b=lMOAcnSlLrKsQag8gZD3bSWZFrNwAeGf321+F+U88in7wM78MWOxaYWfD5Px3MVHLx HRqJPuXz1IUozfaeH5ttECXf5KHGTSqCYcJx7Vehjo/99gMwxbg2zStGKpYNBb6ti2qC AwJdcmoKS6el4p4u+6jKSoeGK3nVVQx9vYIFPgGwVUvik0/ktsdlPHVBnaCZZBQ0MbnV CdM8kPghbApHC1JupLuVJDLk3/D6dRQdJ2CjTxq2+kP/m+uIxsAB6KIIqplQENAAgw3P QqrXDSW1NrK0XtC0LAdJZRSC8zGbWfb8tCN2pEnliUWs8l+25VvM24I5/PaJhjJAhHUX gKfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b="Etj/MQi/"; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-61476-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61476-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=2; AJvYcCWbgiOJEBKQCaW5/N/Lg4JhEqQl1L5e8O9g2Q9U+ONWLVrj6x/Tjc2P8T0Q/FXNKdGDU6wfHObxwQDEwQ9dhDtqd90U6A== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ot2-20020a17090b3b4200b00296a6ace54csi175516pjb.174.2024.02.12.04.00.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 04:00:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61476-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b="Etj/MQi/"; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-61476-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61476-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 60669284131 for ; Mon, 12 Feb 2024 11:59:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 16A373D387; Mon, 12 Feb 2024 11:55:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="Etj/MQi/" Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 E975B3A8C5 for ; Mon, 12 Feb 2024 11:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707738935; cv=none; b=Gw3jhqmXJ9XwEfgeBbp7kTExPurcvNQmNwCbWPTyleu8uKhqUxfkC88/iTd9Jcsa+MOMTnXTx9Q5XqFdO1uV7Q3JVQ3YuQzG1eaoRY5pm3GO6+zZfB7FRQUkbO5zaTdERsOfvn9D5aHQ2mpIHmdGgdqzy/Vs4AT8mxq+irLDbGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707738935; c=relaxed/simple; bh=ksB6Hw/gRhmpDEm9p0F3Nd/QWj2mSxCXzPil0t2rrzI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uYfJQF9QGcFCvPtrcZxF+NnT79x1/EMY6jHtmRonQGeJkFaDbdcCubsuvFq9RPLdCUt1EN8wmatEnXk1FOn559Kv6ozqhaKPXl1GAJTDmwKnNFYixumdt7LdMs+ctWYi4oVPnw3tlvhaTgNy51ZKyPx+Kr2X1VOyZDNT+sFizcE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=Etj/MQi/; arc=none smtp.client-ip=209.85.208.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2d0f415fd8eso15501841fa.0 for ; Mon, 12 Feb 2024 03:55:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1707738930; x=1708343730; 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=3aGSUgEoaSxD8Wnq2siQ6MwOZ/81RxBpHb5g/H05JE8=; b=Etj/MQi/wmChFiZHALsG0dM55fzFDBy+dVkYq0ES4XRBrbmt35+HwelF+X/7kYKRcy +45IPgIKWxN1ynZNRMB2jPk4MV2/Ln1DbhzG0kpN87VK+ybfAZH4SXC0JADhEZGhsiKp FTth3i09dhMToH89BtXVTDchOxNOezJr4KIAuEfFKSpH3HL3H5cCozQWUdegv60faxEd cN6tYwtVqjNOt0p1N46zws3ZYnN7tbCcr5QyNtTdABo9K8cyoPQd+K4B7vxKKPx3YJUI LOIrRh14l4UdJ1qP7W4JQdzl0icPIc5XxKdE9U5c8YobdaXGiZmbBUGh6a/DPsdCDImf 1X6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707738930; x=1708343730; 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=3aGSUgEoaSxD8Wnq2siQ6MwOZ/81RxBpHb5g/H05JE8=; b=qIQdELKa7FSrqgXjCYSAc8ei8LAkqkmQxiTIaRsIsM4QrIilJXeTBTDtmnCTPGwcIN ioO6AYSQSCDJNgR1w8iDWeS2TLx/X5VIvkoYx5BV+vLvw2UQRdt7ZUsGBhdIwc3yIkYp 2ytyJCQq9iKE0iMBJd644JFU1BRygCq6Xn9Qv8/t3hNhOhHCF8/9NoS0RwMTsdrrwXie uB1ZrDFmQaveE7guh0+R7PFuS1uDygoeJt9+Fvf7goZUlc26iRDY8zzMpH943zRr0Ggv 6/zG+te1CO/3vkkxtvKEnYh5CPJpIxOp7gZ5F2bkNQU37BL5slsw5j0EdB2/DB7Q3dPW 2JsA== X-Gm-Message-State: AOJu0YzUtGiJf7SieX3Sfq7IJ2IQ8w8VLx66hD2OpE7FqqtpBCQi2GHb HARQ+5XELWEIASc2TEqhpiC3mjwdybgrfv4pfwAtzIhFtRhrwtA/tOSLj6/wsDp60X6sUyMx3Z6 E X-Received: by 2002:a2e:7d11:0:b0:2d0:b46a:1a65 with SMTP id y17-20020a2e7d11000000b002d0b46a1a65mr4206115ljc.20.1707738930389; Mon, 12 Feb 2024 03:55:30 -0800 (PST) Received: from raven.blarg.de (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id m1-20020a17090607c100b00a36c3e2e52dsm139203ejc.61.2024.02.12.03.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 03:55:30 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v5 17/35] xarray.h: move declarations to xarray_types.h Date: Mon, 12 Feb 2024 12:54:42 +0100 Message-Id: <20240212115500.2078463-18-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240212115500.2078463-1-max.kellermann@ionos.com> References: <20240212115500.2078463-1-max.kellermann@ionos.com> 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: 1790694343603882758 X-GMAIL-MSGID: 1790694343603882758 By providing declarations in a lean header, we can reduce header dependencies. Signed-off-by: Max Kellermann --- include/drm/gpu_scheduler.h | 2 +- include/linux/blkdev.h | 2 +- include/linux/list_lru.h | 5 ++- include/linux/mlx5/driver.h | 2 +- include/linux/msi.h | 2 +- include/linux/pci.h | 2 +- include/linux/xarray.h | 56 +---------------------------- include/linux/xarray_types.h | 70 ++++++++++++++++++++++++++++++++++++ include/net/net_namespace.h | 2 +- include/net/sch_generic.h | 2 +- include/sound/core.h | 5 ++- 11 files changed, 86 insertions(+), 64 deletions(-) create mode 100644 include/linux/xarray_types.h diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 9a89f72a3bac..f2fb8931cb17 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 7e1fc101a5c3..e67298984913 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -23,7 +23,7 @@ #include #include // for iov_iter_is_aligned() #include -#include +#include struct module; struct request_queue; diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h index 792b67ceb631..5e8cd106dae4 100644 --- a/include/linux/list_lru.h +++ b/include/linux/list_lru.h @@ -11,7 +11,10 @@ #include #include #include -#include + +#ifdef CONFIG_MEMCG_KMEM +#include +#endif struct mem_cgroup; diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index d9b99aca9e72..07956bd2e55b 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/linux/msi.h b/include/linux/msi.h index 04fd2c856287..a3969b00a793 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/linux/pci.h b/include/linux/pci.h index a0fee72c45a4..f2a5638503a3 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -44,7 +44,7 @@ #include #ifdef CONFIG_PCI_DOE -#include +#include #endif #ifndef CONFIG_PCI_IOV diff --git a/include/linux/xarray.h b/include/linux/xarray.h index fd6ada66f6b5..ff1e63ec4865 100644 --- a/include/linux/xarray.h +++ b/include/linux/xarray.h @@ -9,10 +9,10 @@ * See Documentation/core-api/xarray.rst for how to use the XArray. */ +#include #include #include #include -#include #include #include #include // for DIV_ROUND_UP() @@ -225,37 +225,12 @@ static inline int xa_err(void *entry) return 0; } -/** - * struct xa_limit - Represents a range of IDs. - * @min: The lowest ID to allocate (inclusive). - * @max: The maximum ID to allocate (inclusive). - * - * This structure is used either directly or via the XA_LIMIT() macro - * to communicate the range of IDs that are valid for allocation. - * Three common ranges are predefined for you: - * * xa_limit_32b - [0 - UINT_MAX] - * * xa_limit_31b - [0 - INT_MAX] - * * xa_limit_16b - [0 - USHRT_MAX] - */ -struct xa_limit { - u32 max; - u32 min; -}; - #define XA_LIMIT(_min, _max) (struct xa_limit) { .min = _min, .max = _max } #define xa_limit_32b XA_LIMIT(0, UINT_MAX) #define xa_limit_31b XA_LIMIT(0, INT_MAX) #define xa_limit_16b XA_LIMIT(0, USHRT_MAX) -typedef unsigned __bitwise xa_mark_t; -#define XA_MARK_0 ((__force xa_mark_t)0U) -#define XA_MARK_1 ((__force xa_mark_t)1U) -#define XA_MARK_2 ((__force xa_mark_t)2U) -#define XA_PRESENT ((__force xa_mark_t)8U) -#define XA_MARK_MAX XA_MARK_2 -#define XA_FREE_MARK XA_MARK_0 - enum xa_lock_type { XA_LOCK_IRQ = 1, XA_LOCK_BH = 2, @@ -278,35 +253,6 @@ enum xa_lock_type { #define XA_FLAGS_ALLOC (XA_FLAGS_TRACK_FREE | XA_FLAGS_MARK(XA_FREE_MARK)) #define XA_FLAGS_ALLOC1 (XA_FLAGS_TRACK_FREE | XA_FLAGS_ZERO_BUSY) -/** - * struct xarray - The anchor of the XArray. - * @xa_lock: Lock that protects the contents of the XArray. - * - * To use the xarray, define it statically or embed it in your data structure. - * It is a very small data structure, so it does not usually make sense to - * allocate it separately and keep a pointer to it in your data structure. - * - * You may use the xa_lock to protect your own data structures as well. - */ -/* - * If all of the entries in the array are NULL, @xa_head is a NULL pointer. - * If the only non-NULL entry in the array is at index 0, @xa_head is that - * entry. If any other entry in the array is non-NULL, @xa_head points - * to an @xa_node. - */ -struct xarray { - spinlock_t xa_lock; -/* private: The rest of the data structure is not to be used directly. */ - gfp_t xa_flags; - void __rcu * xa_head; -}; - -#define XARRAY_INIT(name, flags) { \ - .xa_lock = __SPIN_LOCK_UNLOCKED(name.xa_lock), \ - .xa_flags = flags, \ - .xa_head = NULL, \ -} - /** * DEFINE_XARRAY_FLAGS() - Define an XArray with custom flags. * @name: A string that names your XArray. diff --git a/include/linux/xarray_types.h b/include/linux/xarray_types.h new file mode 100644 index 000000000000..ff241ce647a9 --- /dev/null +++ b/include/linux/xarray_types.h @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +#ifndef _LINUX_XARRAY_TYPES_H +#define _LINUX_XARRAY_TYPES_H +/* + * eXtensible Arrays + * Copyright (c) 2017 Microsoft Corporation + * Author: Matthew Wilcox + * + * See Documentation/core-api/xarray.rst for how to use the XArray. + */ + +#include +#include +#include + +/** + * struct xa_limit - Represents a range of IDs. + * @min: The lowest ID to allocate (inclusive). + * @max: The maximum ID to allocate (inclusive). + * + * This structure is used either directly or via the XA_LIMIT() macro + * to communicate the range of IDs that are valid for allocation. + * Three common ranges are predefined for you: + * * xa_limit_32b - [0 - UINT_MAX] + * * xa_limit_31b - [0 - INT_MAX] + * * xa_limit_16b - [0 - USHRT_MAX] + */ +struct xa_limit { + u32 max; + u32 min; +}; + +typedef unsigned __bitwise xa_mark_t; +#define XA_MARK_0 ((__force xa_mark_t)0U) +#define XA_MARK_1 ((__force xa_mark_t)1U) +#define XA_MARK_2 ((__force xa_mark_t)2U) +#define XA_PRESENT ((__force xa_mark_t)8U) +#define XA_MARK_MAX XA_MARK_2 +#define XA_FREE_MARK XA_MARK_0 + +/** + * struct xarray - The anchor of the XArray. + * @xa_lock: Lock that protects the contents of the XArray. + * + * To use the xarray, define it statically or embed it in your data structure. + * It is a very small data structure, so it does not usually make sense to + * allocate it separately and keep a pointer to it in your data structure. + * + * You may use the xa_lock to protect your own data structures as well. + */ +/* + * If all of the entries in the array are NULL, @xa_head is a NULL pointer. + * If the only non-NULL entry in the array is at index 0, @xa_head is that + * entry. If any other entry in the array is non-NULL, @xa_head points + * to an @xa_node. + */ +struct xarray { + spinlock_t xa_lock; +/* private: The rest of the data structure is not to be used directly. */ + gfp_t xa_flags; + void __rcu * xa_head; +}; + +#define XARRAY_INIT(name, flags) { \ + .xa_lock = __SPIN_LOCK_UNLOCKED(name.xa_lock), \ + .xa_flags = flags, \ + .xa_head = NULL, \ +} + +#endif /* _LINUX_XARRAY_TYPES_H */ diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 7a92421640be..50826b5e7b85 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -41,7 +41,7 @@ #include #include #include -#include +#include struct user_namespace; struct proc_dir_entry; diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 6ec5064156d9..9845ea172382 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include struct Qdisc_ops; struct qdisc_walker; diff --git a/include/sound/core.h b/include/sound/core.h index f95f6863986f..7dcba88b2fb7 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -14,7 +14,10 @@ #include #include #include -#include + +#ifdef CONFIG_SND_CTL_FAST_LOOKUP +#include +#endif /* number of supported soundcards */ #ifdef CONFIG_SND_DYNAMIC_MINORS