From nobody Mon Dec 1 22:35:06 2025 Received: from mail-yx1-f45.google.com (mail-yx1-f45.google.com [74.125.224.45]) (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 5668B30E843 for ; Sat, 29 Nov 2025 19:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764445990; cv=none; b=QkM5f+sygjnNaFp9IVdepTkN3qHTufo9a4KYSsEZcOP9LUaf5bbuglKiSBLQeX9IwBCILKVL10ii9ugJDDBSWRZjhOioDJWbe0nSQlqQUUD0oVfeMuTV7yCTB2z7MNY1jAWAFEHIb6aTZHGLktVOV4Qwq6jKhHcTsCf3pMokhio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764445990; c=relaxed/simple; bh=FdiOAxi8x3qeEv/Dh//XevJQnEeuuiAcs/Vi/TNMfo0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O1ZIlZViouoeCOsg0L9lDPnvVC7JC6rdnGZY1lPMqe1bglJ7GcIiosUpNiBPPyjVqui7Nwrw+4gU80ySmUvaOgAevKS4mrbaGWYdgEn9ikiQHlDR1f27YrgF0aQkEm/Mk/MrEyrGtOUNXww/JC6ukI7PvBKoqJLFKvkjUNbpC9k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gsQkxn5C; arc=none smtp.client-ip=74.125.224.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gsQkxn5C" Received: by mail-yx1-f45.google.com with SMTP id 956f58d0204a3-642f3bab0c8so2300548d50.0 for ; Sat, 29 Nov 2025 11:53:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764445987; x=1765050787; 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=T1J39AX21q7vFvdSQspB28V0qpAzX2/AVdKjbIUMHgo=; b=gsQkxn5CeSWsLIx5Q07eFrabGC3wNQn896BtPFZ1HHdO8o1dXUjUAVs1sPGhnvkr5h dbo++8cvEbMH/V4GE5J7VLHjQxleD58kd3QtDuTr1/b8OVZrTlbs38aypYifTQu4rr27 93wwDQfI1RKh0FFva4xDub6om71OacNVSf+sxZWHPBp/TXk26MvUfqlUZpah18QQ21Ca QQV3+DUAnqlySb3upmvYoLaIcQJ+/BV8EYK3hC9x3K1934z8DgxbOr6jBG4Ox5Cz5Aww AAryjRhhy7F3t35tgETfzPTw2tuv8TNIkrrzxrHg/4aC/gaXGiNPpKrDrux3+IyGNyLn GCqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764445987; x=1765050787; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=T1J39AX21q7vFvdSQspB28V0qpAzX2/AVdKjbIUMHgo=; b=XGalu9KqFj651AeExFS+vD5C7ROONUtpjeTMdfCuevRweSeVLPq91VV6xnnuUcl54H OfeVozhgv3tb2KSI7bm8OWo05aoYBfumwIbOK9m2oba0KIQAOI5G2ggjKyqGV7f61RGh Frel2I+chuZ8DqaqPsXKpnXcz7Aspq5rAcQ5NzwwL5p3o/FEUflcGvJ5LLidwevDoX5q ib7E4MQUTwvltUarqRe10N6P0K9Fl8P4HjT1frXrjXOqN6IN8iDWPJiYSK2qo42lbLDp YxhiBXcAdQCtVIPbvJhUsLO/UqsD1qurgHJvKfzGt0bhcdZje2keooGXKC3rx7ARptl5 UKsQ== X-Forwarded-Encrypted: i=1; AJvYcCULlfkKaeDjVHypHzsp3fISHKmdLjZl15l5teOvsOVYmGiF8TkbRFOTlNI/uotnUQQmmHuGS30Wj/eY4S0=@vger.kernel.org X-Gm-Message-State: AOJu0YwvvSaJOZL+KKGWUEEZdzYy2j7H1NVyk2cDzBkRv31YvVu1gHIy nuCVz79LJnB5xZErzKml1MJTqqA/T4yFvLToFpL7iNKxd4Lw8WzJAi8x X-Gm-Gg: ASbGncs0ZIke9xti30Wha18HORg9fmgZMH5PmDRaec81wsTf30SzlU03KEOGghcFloB epfEm52NopDmQDpz3H5YEDpoKDohu9xhp9P9Gc+aWfPKnztJ/PQfmFicjTBq/LaJ7LNw3+00U9N aTAbT8Tv3eVCtfPBnGyyDeqk3V9tdr1GaK34wJCttdvbMFJinzQZkc52VVqyZ09ocb7t8Fu8APA ABhIjk6Qc0hR0E+JNsodx2ZK8FK6437fUufVSVegNYeGK98dxTFzbSX8Qh4Iit68JfWDyiTsF+l Qr/9bQmuKvTxT2HH5QvHVrwODFLjyNpNUBRqwDK+k3WpMj7IHZJr5Za+t/1FJkubg95PaqpvZLX Gsw5ft4BHSpi1R3hCyTNeSf6iDiHrWPCOZEGV4KguMJsgKgOM5IMStWjrIXH1lJNk8tMfy8TFEO M/Fgc8pug= X-Google-Smtp-Source: AGHT+IGoe6k+HGoU1YAfc/PgjNGtkUsJD9d1pFuoEvQqZEuvaXl0b1nF4MNPaTfl/35pvJr8rQDxmg== X-Received: by 2002:a53:cd8c:0:b0:63e:1943:ce49 with SMTP id 956f58d0204a3-64302abb486mr16805469d50.39.1764445987167; Sat, 29 Nov 2025 11:53:07 -0800 (PST) Received: from localhost ([2601:346:0:79bd:353a:b6ab:d4ee:67b9]) by smtp.gmail.com with ESMTPSA id 00721157ae682-78ad1044f9esm28752057b3.56.2025.11.29.11.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 11:53:06 -0800 (PST) From: "Yury Norov (NVIDIA)" To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Andy Shevchenko , Randy Dunlap , Ingo Molnar , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Petr Pavlu , Daniel Gomez , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Andrew Morton , linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-modules@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: "Yury Norov (NVIDIA)" Subject: [PATCH 2/3] kernel.h: move VERIFY_OCTAL_PERMISSIONS() to sysfs.h Date: Sat, 29 Nov 2025 14:53:01 -0500 Message-ID: <20251129195304.204082-3-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251129195304.204082-1-yury.norov@gmail.com> References: <20251129195304.204082-1-yury.norov@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The macro is related to sysfs, but is defined in kernel.h. Move it to the proper header, and unload the generic kernel.h. Signed-off-by: Yury Norov (NVIDIA) Acked-by: Randy Dunlap Reviewed-by: Andy Shevchenko Suggested-by: Andy Shevchenko Tested-by: Randy Dunlap --- include/linux/kernel.h | 12 ------------ include/linux/moduleparam.h | 2 +- include/linux/sysfs.h | 13 +++++++++++++ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 61d63c57bc2d..5b879bfea948 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -389,16 +389,4 @@ static inline void ftrace_dump(enum ftrace_dump_mode o= ops_dump_mode) { } # define REBUILD_DUE_TO_DYNAMIC_FTRACE #endif =20 -/* 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 >=3D GROUP_READABLE >=3D OTHER_READABLE */ \ - BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) + \ - BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \ - /* USER_WRITABLE >=3D 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 6907aedc4f74..4e390a84a8bc 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 +#include =20 /* * The maximum module name length, including the NUL byte. diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 9a25a2911652..15ee3ef33991 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -798,4 +798,17 @@ static inline void sysfs_put(struct kernfs_node *kn) kernfs_put(kn); } =20 +/* 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 >=3D GROUP_READABLE >=3D OTHER_READABLE */ \ + BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) + \ + BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \ + /* USER_WRITABLE >=3D 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 /* _SYSFS_H_ */ --=20 2.43.0