Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1938367rdb; Sun, 11 Feb 2024 04:37:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVcTUAzZ9OEXJPVeqlvmkVf+0CG34ltIG3UHvZydZdW0IGccxVtp8jUkkDIY3I8kMBssqYf44BzLZ34ZGmlmEGg4c+cAWjrVQeekTX0CQ== X-Google-Smtp-Source: AGHT+IGFJPXEtTQMq0PAI34+SvkXE9B2iJRHdNb+YFBMAyUKbM44xkBt7BbsCsxQOzewQY7xu4PH X-Received: by 2002:a05:6358:704:b0:17a:e127:57ef with SMTP id e4-20020a056358070400b0017ae12757efmr593930rwj.29.1707655060702; Sun, 11 Feb 2024 04:37:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707655060; cv=pass; d=google.com; s=arc-20160816; b=tSt7Nx/+gcNdtfVadeHnvA3JNMobYSh71Lad8oSApmkWemfw3WsBFZyOUUR3R4UzIq 8Xl+4Hg8Tf6SPyhNlSJkr/Sq6dNCmoszTHzErDEkrVbPa070E3whsDPyU/cO865ZcSI5 JaOuzubTNTN1UcAtJ+QiyXWZ+5mOXPom33etYt1mXwjOw1k955By9R8QP2/ixamIEZCn Bz4HHNCvF8GGj84JSkP9bJd+FZPNLC4dBkjSvbm7SjiCx5eS+kMGPNd8ovUP80cEHOS/ xivJe8giCSN7sJuM8QXo/z2IYgJ/eUl1VUBd49RU6NQw0ii18/N/o9Tb/MrZ3hBPtCqP K5+A== 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=fKk+aGvc2YUoK3OFau8iqg4ZDHFtN8sLbkkpKq6ClNw=; fh=KSug6YaSYmzkilUI85TlaEhmltulEZ3gsS0gGhO2INA=; b=pmkXDPJgiUYSBfNlJa0z3q2ftjcoiHgwRIwezB7d625JXQ0RoEEvknY+ePItMX7xQr 3MS0pZaUex+YLb2zGhzJ+lJwSV9ID90deOGLhYNUGPIs8qaMA+lt5ecgbMp7ORBAIZ6o nmms+nemI81jKao9yMHg1pQnmRM4fMhOHR79uMB6AOclTRaXfz4uXwyNBdIFFtC0Lq7U +B6YFFSR6SXM8CRUohTXLoJxseI1I6G01Z2Xi4M8o/zfPO1o5WgD5a+aM0E4FQPBhU/h dlHEOt/2tFEH16uSaX3mySmnFbvzVFdtQlRMSCtGZ9D7AkH1yXOEkEThnPlPvlCAT0q8 0Sjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=iUo95rqh; 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-60761-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60761-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=2; AJvYcCV5+8dbEZSm6N3DNFrIUlQ12a4IHjOTldp+8TLhfAXtlorXPVNFSgNeN/FABE2BGsjMfkeNT1F7yfTspqREqqtHPVBkc7zvP6e5SIKoIw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id qb10-20020a17090b280a00b00297160ba34csi2759310pjb.104.2024.02.11.04.37.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 04:37:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60761-linux.lists.archive=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=iUo95rqh; 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-60761-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60761-linux.lists.archive=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 575AE281D69 for ; Sun, 11 Feb 2024 12:37:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2BF760B8F; Sun, 11 Feb 2024 12:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="iUo95rqh" Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 92DEA60273 for ; Sun, 11 Feb 2024 12:30:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707654651; cv=none; b=UXK+RHTBhgtusANmIjL22NUW1P2bPhAIONkvqDffWwEXVXVUZNWG+veVeaLpQeA7rBZUhiKeIJn+RSyiw6wRohm4hPkIXw+BpXRBNmfr8LoMCU1IdJKM72XyhFPwjNWBvKJvgCGcfWSmtbgxROAHOMeImv+tBY4jJ6EW5+hDJAo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707654651; c=relaxed/simple; bh=5WoLQ+20FuNzDTgx6dlWdeAOXVkYHDqU6RsL5tdTmfc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Zl5Gk0u8edhNJyAkvBd7ZGYzog7CXFHBlheEesy3VwmyblofQ0uJYc3NMck8iDQAHf/aSXNnQ2qkkDq3Q/Dt4MK/9bTtx2lJcAmtuieZP502q3pIS/wDeggMVSNbx1AQsvUy5RzP3ewDmvw3IBH6zPaDWPqVUilH8jK3lbWdF2k= 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=iUo95rqh; arc=none smtp.client-ip=209.85.208.54 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-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-556c3f0d6c5so3114520a12.2 for ; Sun, 11 Feb 2024 04:30:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1707654646; x=1708259446; 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=fKk+aGvc2YUoK3OFau8iqg4ZDHFtN8sLbkkpKq6ClNw=; b=iUo95rqhmDIs3bDNuL+jP2SWYPBOky/7fbQ9BS37psz11e9Q5aLbpEscjpYqvcukPl VVfN8ljTyzkh39OfRixwfF58c8x4D7ju1WGDzX3J/8mOOFX8ZgYY6ZTeAoLYr0GvCgzU irGVfrHGLWWB0vjD2VGFyQPSI2bNtIwQ1Apw3/QVBXuUwUAlZoHvkc5zZnAuMSKBjsc2 bjWbZxEiT3RNDmG9m9SBD+UIeZ7ebvYO7lSlV/OPKdHtMz9bi9+lx+eF77CkvmDOs87+ mtef6cOCPrDE0H8i6WYHOhRqpUrITW74xGg3uDnK4G9fwXEA85+DTW9+8b+IF3bAOB9A 0FBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707654646; x=1708259446; 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=fKk+aGvc2YUoK3OFau8iqg4ZDHFtN8sLbkkpKq6ClNw=; b=wtzNJvsZttBjQtjJC3vVBFT/WjGQj/3JbP7/tPlJiYdJQUMiF29gtVatyty6epl0b6 9+nVWVAtqYrXqGrQbzFZAKIbyB3ZUJKRZUw0KtdWtbhWHcHHynsBoTIKXAwTGwI1SWOg pH9xfaJI4R9vR72xwqieW4SCeCcwUZv6CcO7HFWBQ5vXCB9mRkNPWr/1KNOfxWwBnoah RtwqrcGSNJuW6Om1qUdeoJG9AUbSGd7FQJP7eSW5JZDJ7VopjgaN9FB/++HT2chNzA+V 64jcf0/6348OjnWPo0kcXzo9vOsdxlx5VJtlnPEv7o5UiXXNHyuIsp6xFup7H96ajLSU bAzQ== X-Gm-Message-State: AOJu0YzH3baLX428kqQZC7pxqnKF0m12181Ahrt8cpcHl3g4gTTs7fH+ 3Qy6ecvAIPJx4SMkOeo/9TVtD5PtVDXI0zluBYWvhOf5649EB/E8m0hDJnLOm84XkDad9aZRBin D X-Received: by 2002:a05:6402:1295:b0:55f:f2ae:20ed with SMTP id w21-20020a056402129500b0055ff2ae20edmr2455830edv.16.1707654646588; Sun, 11 Feb 2024 04:30:46 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id fj18-20020a0564022b9200b0056187ca4120sm1024611edb.10.2024.02.11.04.30.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 04:30:45 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v3 32/35] linux/kernel.h: move VERIFY_OCTAL_PERMISSIONS() to octal_permissions.h Date: Sun, 11 Feb 2024 13:29:57 +0100 Message-Id: <20240211123000.3359365-33-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240211123000.3359365-1-max.kellermann@ionos.com> References: <20240211123000.3359365-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 Content-Transfer-Encoding: 8bit Reducing dependencies on the header linux/kernel.h. Signed-off-by: Max Kellermann --- arch/arc/kernel/perf_event.c | 1 + drivers/edac/thunderx_edac.c | 1 + drivers/hwmon/occ/common.c | 1 + drivers/media/platform/amphion/vpu_dbg.c | 1 + drivers/soc/aspeed/aspeed-uart-routing.c | 1 + fs/xfs/xfs_error.c | 1 + include/linux/kernel.h | 13 ------------- include/linux/moduleparam.h | 2 +- include/linux/octal_permissions.h | 20 ++++++++++++++++++++ include/linux/sysfs.h | 2 +- 10 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 include/linux/octal_permissions.h diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c index 9d43a9988812..dbc24c9351d1 100644 --- a/arch/arc/kernel/perf_event.c +++ b/arch/arc/kernel/perf_event.c @@ -9,6 +9,7 @@ #include #include // for upper_32_bits(), lower_32_bits() #include +#include #include #include #include diff --git a/drivers/edac/thunderx_edac.c b/drivers/edac/thunderx_edac.c index e99ce19e6574..c610d99dceda 100644 --- a/drivers/edac/thunderx_edac.c +++ b/drivers/edac/thunderx_edac.c @@ -21,6 +21,7 @@ #include #include #include +#include #include diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c index f7b89b880339..1a4f1a90c2c5 100644 --- a/drivers/hwmon/occ/common.c +++ b/drivers/hwmon/occ/common.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c index bed0ed4fb8a0..ef5658b492cf 100644 --- a/drivers/media/platform/amphion/vpu_dbg.c +++ b/drivers/media/platform/amphion/vpu_dbg.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/soc/aspeed/aspeed-uart-routing.c b/drivers/soc/aspeed/aspeed-uart-routing.c index a2195f062e01..6b091df7775a 100644 --- a/drivers/soc/aspeed/aspeed-uart-routing.c +++ b/drivers/soc/aspeed/aspeed-uart-routing.c @@ -5,6 +5,7 @@ */ #include #include +#include #include #include #include diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c index 8d558f0f1b3b..a225860d272a 100644 --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c @@ -14,6 +14,7 @@ #include "xfs_error.h" #include "xfs_sysfs.h" #include "xfs_inode.h" +#include #include #include #include diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 5d088ce30045..ac332f4deed9 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -308,16 +307,4 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD #endif -/* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */ -#define VERIFY_OCTAL_PERMISSIONS(perms) \ - (BUILD_BUG_ON_ZERO((perms) < 0) + \ - BUILD_BUG_ON_ZERO((perms) > 0777) + \ - /* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */ \ - BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) + \ - BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \ - /* USER_WRITABLE >= GROUP_WRITABLE */ \ - BUILD_BUG_ON_ZERO((((perms) >> 6) & 2) < (((perms) >> 3) & 2)) + \ - /* OTHER_WRITABLE? Generally considered a bad idea. */ \ - BUILD_BUG_ON_ZERO((perms) & 2) + \ - (perms)) #endif diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index a285e74ec028..860b0ea1f3b3 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -4,7 +4,7 @@ /* (C) Copyright 2001, 2002 Rusty Russell IBM Corporation */ #include #include -#include // for VERIFY_OCTAL_PERMISSIONS() +#include /* You can override this manually, but generally this should match the module name. */ diff --git a/include/linux/octal_permissions.h b/include/linux/octal_permissions.h new file mode 100644 index 000000000000..57d4d6a5b66d --- /dev/null +++ b/include/linux/octal_permissions.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_OCTAL_PERMISSIONS_H +#define _LINUX_OCTAL_PERMISSIONS_H + +#include + +/* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */ +#define VERIFY_OCTAL_PERMISSIONS(perms) \ + (BUILD_BUG_ON_ZERO((perms) < 0) + \ + BUILD_BUG_ON_ZERO((perms) > 0777) + \ + /* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */ \ + BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) + \ + BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \ + /* USER_WRITABLE >= GROUP_WRITABLE */ \ + BUILD_BUG_ON_ZERO((((perms) >> 6) & 2) < (((perms) >> 3) & 2)) + \ + /* OTHER_WRITABLE? Generally considered a bad idea. */ \ + BUILD_BUG_ON_ZERO((perms) & 2) + \ + (perms)) + +#endif diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 0500b023b5cc..a4b752b24329 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -15,10 +15,10 @@ #include #include -#include // for VERIFY_OCTAL_PERMISSIONS() #include #include #include +#include struct kobject; struct module; -- 2.39.2