* [PATCH 00/10] treewide: switch to __nonnull_args() macro
@ 2026-10-28 8:19 Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 01/10] docs: xforms_lists: support __nonnull_args() Dmitry Ilvokhin
` (10 more replies)
0 siblings, 11 replies; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
Commit 22302af28d3f ("cleanup: Annotate guard constructors with
nonnull") added the __nonnull_args() macro to wrap the raw compiler
attribute, keeping the attribute's quirks in one place rather than
open-coded at every call site.
This series replaces the remaining open-coded __attribute__((nonnull))
users with __nonnull_args() to standardize nonnull attribute usage
across the tree.
Each patch can be applied separately by the respective maintainers. The
only dependency is kernel-doc: the string and lib/list_sort patches need
patch 1 ("docs: xforms_lists: support __nonnull_args()") in the same
release, otherwise strends() and list_sort() drop out of the generated
documentation.
Latest Sparse release could not properly parse __nonnull_args() without
arguments. Fix was proposed [1] and merged, but until updated version of
Sparse will reach wide masses it might trip on __nonnull_args() without
arguments.
There are few more instances of __attribute__((nonnull)) usages left in
the tools subdirectory, they are perf related copied files and can
(should?) be updated separately after this patchset lands.
Build-tested allmodconfig with GCC 11.5.0 and clang 22.1.8.
[1]: https://lore.kernel.org/all/20261019175633.415493-19-bvanassche@acm.org/
Dmitry Ilvokhin (10):
docs: xforms_lists: support __nonnull_args()
string: Switch to __nonnull_args() macro
lib/list_sort: Switch to __nonnull_args() macro
xarray: switch to __nonnull_args() macro
drm/i915: switch to __nonnull_args() macro
drm/amdgpu: switch to __nonnull_args() macro
drm/gem: Switch to __nonnull_args() macro
leds: pwm: Switch to __nonnull_args() macro
soc: aspeed: lpc-snoop: Switch to __nonnull_args() macro
checkpatch: suggest nonnull attribute conversion
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 ++--
drivers/gpu/drm/i915/i915_request.h | 4 ++--
drivers/leds/leds-pwm.c | 2 +-
drivers/soc/aspeed/aspeed-lpc-snoop.c | 4 ++--
include/drm/drm_gem.h | 2 +-
include/linux/list_sort.h | 4 ++--
include/linux/string.h | 2 +-
include/linux/xarray.h | 4 ++--
lib/list_sort.c | 6 +++---
scripts/checkpatch.pl | 3 +++
tools/include/linux/compiler.h | 4 ++++
tools/lib/python/kdoc/xforms_lists.py | 1 +
13 files changed, 25 insertions(+), 17 deletions(-)
base-commit: 6b4b543fa18757297ac756a6fe6e64f506b7844a
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 01/10] docs: xforms_lists: support __nonnull_args()
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
@ 2026-10-28 8:19 ` Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 02/10] string: Switch to __nonnull_args() macro Dmitry Ilvokhin
` (9 subsequent siblings)
10 siblings, 0 replies; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
Avoid kernel-doc warnings by supporting __nonnull_args()
as a function transform.
This is a preparatory change for the treewide migration from
__attribute__((nonnull)) to __nonnull_args() macro.
Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
---
tools/lib/python/kdoc/xforms_lists.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/lib/python/kdoc/xforms_lists.py b/tools/lib/python/kdoc/xforms_lists.py
index 320f977c5bac..a8c47ede8637 100644
--- a/tools/lib/python/kdoc/xforms_lists.py
+++ b/tools/lib/python/kdoc/xforms_lists.py
@@ -108,6 +108,7 @@ class CTransforms:
(CMatch("__attribute__"), ""),
(CMatch("STATIC_IFN_KUNIT"), ""),
(CMatch("INLINE_IFN_KUNIT"), ""),
+ (CMatch("__nonnull_args"), ""),
#
# HACK: this is similar to process_export() hack. It is meant to
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 02/10] string: Switch to __nonnull_args() macro
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 01/10] docs: xforms_lists: support __nonnull_args() Dmitry Ilvokhin
@ 2026-10-28 8:19 ` Dmitry Ilvokhin
2026-10-28 9:48 ` Andy Shevchenko
2026-10-28 8:19 ` [PATCH 03/10] lib/list_sort: " Dmitry Ilvokhin
` (8 subsequent siblings)
10 siblings, 1 reply; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
Commit 22302af28d3f ("cleanup: Annotate guard constructors with
nonnull") added the macro __nonnull_args() to wrap raw compiler
attribute.
Replace __attribute__((nonnull)) with __nonnull_args() to
standardize nonnull attribute usage across the tree and keep the
attribute's quirks in one place rather than open-coded at every call
site.
Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
---
include/linux/string.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/string.h b/include/linux/string.h
index 6cb5cdd01158..1f1cb73514e1 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -587,7 +587,7 @@ static inline bool strstarts(const char *str, const char *prefix)
* Returns:
* True if @str ends with @suffix. False in all other cases.
*/
-static inline bool __attribute__((nonnull(1, 2)))
+static inline bool __nonnull_args(1, 2)
strends(const char *str, const char *suffix)
{
unsigned int str_len = strlen(str), suffix_len = strlen(suffix);
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 03/10] lib/list_sort: Switch to __nonnull_args() macro
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 01/10] docs: xforms_lists: support __nonnull_args() Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 02/10] string: Switch to __nonnull_args() macro Dmitry Ilvokhin
@ 2026-10-28 8:19 ` Dmitry Ilvokhin
2026-10-28 9:47 ` Andy Shevchenko
2026-10-28 8:19 ` [PATCH 04/10] xarray: switch " Dmitry Ilvokhin
` (7 subsequent siblings)
10 siblings, 1 reply; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
Commit 22302af28d3f ("cleanup: Annotate guard constructors with
nonnull") added the macro __nonnull_args() to wrap raw compiler
attribute.
Replace __attribute__((nonnull)) with __nonnull_args() to
standardize nonnull attribute usage across the tree and keep the
attribute's quirks in one place rather than open-coded at every call
site.
Add spaces after the commas in the __nonnull_args() argument list to
follow the usual coding style (according to checkpatch).
Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
---
include/linux/list_sort.h | 4 ++--
lib/list_sort.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/linux/list_sort.h b/include/linux/list_sort.h
index 453105f74e05..48a91ef0d751 100644
--- a/include/linux/list_sort.h
+++ b/include/linux/list_sort.h
@@ -6,9 +6,9 @@
struct list_head;
-typedef int __attribute__((nonnull(2,3))) (*list_cmp_func_t)(void *,
+typedef int __nonnull_args(2, 3) (*list_cmp_func_t)(void *,
const struct list_head *, const struct list_head *);
-__attribute__((nonnull(2,3)))
+__nonnull_args(2, 3)
void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp);
#endif
diff --git a/lib/list_sort.c b/lib/list_sort.c
index ff99203f208f..da34c46cf5d8 100644
--- a/lib/list_sort.c
+++ b/lib/list_sort.c
@@ -9,7 +9,7 @@
* to chaining of merge() calls: null-terminated, no reserved or
* sentinel head node, "prev" links not maintained.
*/
-__attribute__((nonnull(2,3,4)))
+__nonnull_args(2, 3, 4)
static struct list_head *merge(void *priv, list_cmp_func_t cmp,
struct list_head *a, struct list_head *b)
{
@@ -45,7 +45,7 @@ static struct list_head *merge(void *priv, list_cmp_func_t cmp,
* prev-link restoration pass, or maintaining the prev links
* throughout.
*/
-__attribute__((nonnull(2,3,4,5)))
+__nonnull_args(2, 3, 4, 5)
static void merge_final(void *priv, list_cmp_func_t cmp, struct list_head *head,
struct list_head *a, struct list_head *b)
{
@@ -175,7 +175,7 @@ static void merge_final(void *priv, list_cmp_func_t cmp, struct list_head *head,
* of size 2^k varies from 2^(k-1) (cases 3 and 5 when x == 0) to
* 2^(k+1) - 1 (second merge of case 5 when x == 2^(k-1) - 1).
*/
-__attribute__((nonnull(2,3)))
+__nonnull_args(2, 3)
void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp)
{
struct list_head *list = head->next, *pending = NULL;
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 04/10] xarray: switch to __nonnull_args() macro
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
` (2 preceding siblings ...)
2026-10-28 8:19 ` [PATCH 03/10] lib/list_sort: " Dmitry Ilvokhin
@ 2026-10-28 8:19 ` Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 05/10] drm/i915: " Dmitry Ilvokhin
` (6 subsequent siblings)
10 siblings, 0 replies; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
Commit 22302af28d3f ("cleanup: Annotate guard constructors with
nonnull") added the macro __nonnull_args() to wrap raw compiler
attribute.
Replace __attribute__((nonnull)) with __nonnull_args() to standardize
nonnull attribute usage across the tree and keep the attribute's quirks
in one place rather than open-coded at every call site.
tools/testing/shared/linux/xarray.h directly includes the kernel's
include/linux/xarray.h, which now uses __nonnull_args(). The macro is
not defined under tools/, breaking test builds.
Define __nonnull_args() in tools/include/linux/compiler.h.
Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
---
include/linux/xarray.h | 4 ++--
tools/include/linux/compiler.h | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/linux/xarray.h b/include/linux/xarray.h
index be850174e802..cf7f8802da5b 100644
--- a/include/linux/xarray.h
+++ b/include/linux/xarray.h
@@ -361,9 +361,9 @@ bool xa_get_mark(struct xarray *, unsigned long index, xa_mark_t);
void xa_set_mark(struct xarray *, unsigned long index, xa_mark_t);
void xa_clear_mark(struct xarray *, unsigned long index, xa_mark_t);
void *xa_find(struct xarray *xa, unsigned long *index,
- unsigned long max, xa_mark_t) __attribute__((nonnull(2)));
+ unsigned long max, xa_mark_t) __nonnull_args(2);
void *xa_find_after(struct xarray *xa, unsigned long *index,
- unsigned long max, xa_mark_t) __attribute__((nonnull(2)));
+ unsigned long max, xa_mark_t) __nonnull_args(2);
unsigned int xa_extract(struct xarray *, void **dst, unsigned long start,
unsigned long max, unsigned int n, xa_mark_t);
void xa_destroy(struct xarray *);
diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h
index 03ecf9086643..fad2c6131a80 100644
--- a/tools/include/linux/compiler.h
+++ b/tools/include/linux/compiler.h
@@ -68,6 +68,10 @@
#define __naked __attribute__((__naked__))
#endif
+#ifndef __nonnull_args
+#define __nonnull_args(x...) __attribute__((__nonnull__(x)))
+#endif
+
/* Are two types/vars the same type (ignoring qualifiers)? */
#ifndef __same_type
# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 05/10] drm/i915: switch to __nonnull_args() macro
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
` (3 preceding siblings ...)
2026-10-28 8:19 ` [PATCH 04/10] xarray: switch " Dmitry Ilvokhin
@ 2026-10-28 8:19 ` Dmitry Ilvokhin
2026-10-28 9:49 ` Andy Shevchenko
` (2 more replies)
2026-10-28 8:19 ` [PATCH 06/10] drm/amdgpu: " Dmitry Ilvokhin
` (5 subsequent siblings)
10 siblings, 3 replies; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
Commit 22302af28d3f ("cleanup: Annotate guard constructors with
nonnull") added the macro __nonnull_args() to wrap raw compiler
attribute.
Replace __attribute__((nonnull)) with __nonnull_args() to standardize
nonnull attribute usage across the tree and keep the attribute's quirks
in one place rather than open-coded at every call site.
Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
---
drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 ++--
drivers/gpu/drm/i915/i915_request.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h
index a2f4b6758a65..648d0b4139cf 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
@@ -127,7 +127,7 @@ __deprecated
struct drm_gem_object *
drm_gem_object_lookup(struct drm_file *file, u32 handle);
-__attribute__((nonnull))
+__nonnull_args()
static inline struct drm_i915_gem_object *
i915_gem_object_get(struct drm_i915_gem_object *obj)
{
@@ -135,7 +135,7 @@ i915_gem_object_get(struct drm_i915_gem_object *obj)
return obj;
}
-__attribute__((nonnull))
+__nonnull_args()
static inline void
i915_gem_object_put(struct drm_i915_gem_object *obj)
{
diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h
index b09135301f39..f559203c332d 100644
--- a/drivers/gpu/drm/i915/i915_request.h
+++ b/drivers/gpu/drm/i915/i915_request.h
@@ -437,12 +437,12 @@ void i915_request_cancel(struct i915_request *rq, int error);
long i915_request_wait_timeout(struct i915_request *rq,
unsigned int flags,
long timeout)
- __attribute__((nonnull(1)));
+ __nonnull_args(1);
long i915_request_wait(struct i915_request *rq,
unsigned int flags,
long timeout)
- __attribute__((nonnull(1)));
+ __nonnull_args(1);
#define I915_WAIT_INTERRUPTIBLE BIT(0)
#define I915_WAIT_PRIORITY BIT(1) /* small priority bump for the request */
#define I915_WAIT_ALL BIT(2) /* used by i915_gem_object_wait() */
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 06/10] drm/amdgpu: switch to __nonnull_args() macro
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
` (4 preceding siblings ...)
2026-10-28 8:19 ` [PATCH 05/10] drm/i915: " Dmitry Ilvokhin
@ 2026-10-28 8:19 ` Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 07/10] drm/gem: Switch " Dmitry Ilvokhin
` (4 subsequent siblings)
10 siblings, 0 replies; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
Commit 22302af28d3f ("cleanup: Annotate guard constructors with
nonnull") added the macro __nonnull_args() to wrap raw compiler
attribute.
Replace __attribute__((nonnull)) with __nonnull_args() to standardize
nonnull attribute usage across the tree and keep the attribute's quirks
in one place rather than open-coded at every call site.
Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 8f0720a77520..c238564b4a31 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -307,7 +307,7 @@ static int amdgpu_ttm_map_buffer(struct amdgpu_ttm_buffer_entity *entity,
* move and different for a BO to BO copy.
*
*/
-__attribute__((nonnull))
+__nonnull_args()
static int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
struct amdgpu_ttm_buffer_entity *entity,
const struct amdgpu_copy_mem *src,
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 07/10] drm/gem: Switch to __nonnull_args() macro
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
` (5 preceding siblings ...)
2026-10-28 8:19 ` [PATCH 06/10] drm/amdgpu: " Dmitry Ilvokhin
@ 2026-10-28 8:19 ` Dmitry Ilvokhin
2026-10-28 11:44 ` Andi Shyti
2026-10-28 8:19 ` [PATCH 08/10] leds: pwm: " Dmitry Ilvokhin
` (3 subsequent siblings)
10 siblings, 1 reply; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
Commit 22302af28d3f ("cleanup: Annotate guard constructors with
nonnull") added the macro __nonnull_args() to wrap raw compiler
attribute.
Replace __attribute__((nonnull)) with __nonnull_args() to standardize
nonnull attribute usage across the tree and keep the attribute's quirks
in one place rather than open-coded at every call site.
Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
---
include/drm/drm_gem.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index ed329408acbe..56dd15921c7a 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -566,7 +566,7 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj)
kref_get(&obj->refcount);
}
-__attribute__((nonnull))
+__nonnull_args()
static inline void
__drm_gem_object_put(struct drm_gem_object *obj)
{
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 08/10] leds: pwm: Switch to __nonnull_args() macro
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
` (6 preceding siblings ...)
2026-10-28 8:19 ` [PATCH 07/10] drm/gem: Switch " Dmitry Ilvokhin
@ 2026-10-28 8:19 ` Dmitry Ilvokhin
2026-10-28 9:49 ` Andy Shevchenko
2026-10-28 8:19 ` [PATCH 09/10] soc: aspeed: lpc-snoop: " Dmitry Ilvokhin
` (2 subsequent siblings)
10 siblings, 1 reply; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
Commit 22302af28d3f ("cleanup: Annotate guard constructors with
nonnull") added the macro __nonnull_args() to wrap raw compiler
attribute.
Replace __attribute__((nonnull)) with __nonnull_args() to standardize
nonnull attribute usage across the tree and keep the attribute's quirks
in one place rather than open-coded at every call site.
Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
---
drivers/leds/leds-pwm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 6c1f2f50ff85..0363d370828b 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -80,7 +80,7 @@ static int led_pwm_default_brightness_get(struct fwnode_handle *fwnode,
return default_brightness;
}
-__attribute__((nonnull))
+__nonnull_args()
static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
struct led_pwm *led, struct fwnode_handle *fwnode)
{
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 09/10] soc: aspeed: lpc-snoop: Switch to __nonnull_args() macro
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
` (7 preceding siblings ...)
2026-10-28 8:19 ` [PATCH 08/10] leds: pwm: " Dmitry Ilvokhin
@ 2026-10-28 8:19 ` Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 10/10] checkpatch: suggest nonnull attribute conversion Dmitry Ilvokhin
2026-10-28 20:44 ` [PATCH 00/10] treewide: switch to __nonnull_args() macro Randy Dunlap
10 siblings, 0 replies; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
Commit 22302af28d3f ("cleanup: Annotate guard constructors with
nonnull") added the macro __nonnull_args() to wrap raw compiler
attribute.
Replace __attribute__((nonnull)) with __nonnull_args() to standardize
nonnull attribute usage across the tree and keep the attribute's quirks
in one place rather than open-coded at every call site.
Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
---
drivers/soc/aspeed/aspeed-lpc-snoop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c
index b09dca34099f..ee84a06a035e 100644
--- a/drivers/soc/aspeed/aspeed-lpc-snoop.c
+++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c
@@ -226,7 +226,7 @@ static int aspeed_lpc_snoop_config_irq(struct aspeed_lpc_snoop *lpc_snoop,
return 0;
}
-__attribute__((nonnull))
+__nonnull_args()
static int aspeed_lpc_enable_snoop(struct device *dev,
struct aspeed_lpc_snoop *lpc_snoop,
struct aspeed_lpc_snoop_channel *channel,
@@ -279,7 +279,7 @@ static int aspeed_lpc_enable_snoop(struct device *dev,
return rc;
}
-__attribute__((nonnull))
+__nonnull_args()
static void aspeed_lpc_disable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
struct aspeed_lpc_snoop_channel *channel)
{
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 10/10] checkpatch: suggest nonnull attribute conversion
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
` (8 preceding siblings ...)
2026-10-28 8:19 ` [PATCH 09/10] soc: aspeed: lpc-snoop: " Dmitry Ilvokhin
@ 2026-10-28 8:19 ` Dmitry Ilvokhin
2026-10-28 16:11 ` Joe Perches
2026-10-28 20:44 ` [PATCH 00/10] treewide: switch to __nonnull_args() macro Randy Dunlap
10 siblings, 1 reply; 20+ messages in thread
From: Dmitry Ilvokhin @ 2026-10-28 8:19 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
The kernel provides the __nonnull_args() macro as the preferred form for
marking pointer arguments as non-NULL. Add a check suggesting the macro
over the raw __attribute__((nonnull)) spelling, consistent with the
existing attribute conversion suggestions.
Examples:
WARNING: Prefer __nonnull_args(1, 2) over __attribute__((nonnull(1, 2)))
#11: FILE: drivers/soc/aspeed/aspeed-lpc-snoop.c:230:
+__attribute__((nonnull(1, 2)))
WARNING: Prefer __nonnull_args() over __attribute__((nonnull))
#11: FILE: drivers/soc/aspeed/aspeed-lpc-snoop.c:283:
+__attribute__((nonnull))
Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
---
scripts/checkpatch.pl | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c9840f5219c2..e696fcd02337 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6856,6 +6856,7 @@ sub process {
"no_caller_saved_registers" => "__no_caller_saved_registers",
"noclone" => "__noclone",
"noinline" => "noinline",
+ "nonnull" => "__nonnull_args",
"nonstring" => "__nonstring",
"noreturn" => "__noreturn",
"packed" => "__packed",
@@ -6876,6 +6877,8 @@ sub process {
if ($curr_attr eq "format" && $params) {
$params =~ /^\s*\(\s*(\w+)\s*,\s*(.*)/;
$new = "__$1\($2";
+ } elsif ($curr_attr eq "nonnull" && $params eq "") {
+ $new = "$new()";
} else {
$new = "$new$params";
}
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 03/10] lib/list_sort: Switch to __nonnull_args() macro
2026-10-28 8:19 ` [PATCH 03/10] lib/list_sort: " Dmitry Ilvokhin
@ 2026-10-28 9:47 ` Andy Shevchenko
0 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2026-10-28 9:47 UTC (permalink / raw)
To: Dmitry Ilvokhin
Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap, amd-gfx, dri-devel, linux-kernel, intel-gfx,
linux-leds, linux-arm-kernel, linux-aspeed, linux-hardening,
linux-fsdevel, linux-mm, linux-doc, Miguel Ojeda
On Wed, Oct 28, 2026 at 10:20 AM Dmitry Ilvokhin <d@ilvokhin.com> wrote:
>
> Commit 22302af28d3f ("cleanup: Annotate guard constructors with
> nonnull") added the macro __nonnull_args() to wrap raw compiler
> attribute.
>
> Replace __attribute__((nonnull)) with __nonnull_args() to
> standardize nonnull attribute usage across the tree and keep the
> attribute's quirks in one place rather than open-coded at every call
> site.
>
> Add spaces after the commas in the __nonnull_args() argument list to
> follow the usual coding style (according to checkpatch).
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 02/10] string: Switch to __nonnull_args() macro
2026-10-28 8:19 ` [PATCH 02/10] string: Switch to __nonnull_args() macro Dmitry Ilvokhin
@ 2026-10-28 9:48 ` Andy Shevchenko
0 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2026-10-28 9:48 UTC (permalink / raw)
To: Dmitry Ilvokhin
Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap, amd-gfx, dri-devel, linux-kernel, intel-gfx,
linux-leds, linux-arm-kernel, linux-aspeed, linux-hardening,
linux-fsdevel, linux-mm, linux-doc, Miguel Ojeda
On Wed, Oct 28, 2026 at 10:20 AM Dmitry Ilvokhin <d@ilvokhin.com> wrote:
>
> Commit 22302af28d3f ("cleanup: Annotate guard constructors with
> nonnull") added the macro __nonnull_args() to wrap raw compiler
> attribute.
>
> Replace __attribute__((nonnull)) with __nonnull_args() to
> standardize nonnull attribute usage across the tree and keep the
> attribute's quirks in one place rather than open-coded at every call
> site.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 08/10] leds: pwm: Switch to __nonnull_args() macro
2026-10-28 8:19 ` [PATCH 08/10] leds: pwm: " Dmitry Ilvokhin
@ 2026-10-28 9:49 ` Andy Shevchenko
0 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2026-10-28 9:49 UTC (permalink / raw)
To: Dmitry Ilvokhin
Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap, amd-gfx, dri-devel, linux-kernel, intel-gfx,
linux-leds, linux-arm-kernel, linux-aspeed, linux-hardening,
linux-fsdevel, linux-mm, linux-doc, Miguel Ojeda
On Wed, Oct 28, 2026 at 10:20 AM Dmitry Ilvokhin <d@ilvokhin.com> wrote:
>
> Commit 22302af28d3f ("cleanup: Annotate guard constructors with
> nonnull") added the macro __nonnull_args() to wrap raw compiler
> attribute.
>
> Replace __attribute__((nonnull)) with __nonnull_args() to standardize
> nonnull attribute usage across the tree and keep the attribute's quirks
> in one place rather than open-coded at every call site.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 05/10] drm/i915: switch to __nonnull_args() macro
2026-10-28 8:19 ` [PATCH 05/10] drm/i915: " Dmitry Ilvokhin
@ 2026-10-28 9:49 ` Andy Shevchenko
2026-10-28 11:33 ` Jani Nikula
2026-10-28 11:44 ` Andi Shyti
2 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2026-10-28 9:49 UTC (permalink / raw)
To: Dmitry Ilvokhin
Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap, amd-gfx, dri-devel, linux-kernel, intel-gfx,
linux-leds, linux-arm-kernel, linux-aspeed, linux-hardening,
linux-fsdevel, linux-mm, linux-doc, Miguel Ojeda
On Wed, Oct 28, 2026 at 10:20 AM Dmitry Ilvokhin <d@ilvokhin.com> wrote:
>
> Commit 22302af28d3f ("cleanup: Annotate guard constructors with
> nonnull") added the macro __nonnull_args() to wrap raw compiler
> attribute.
>
> Replace __attribute__((nonnull)) with __nonnull_args() to standardize
> nonnull attribute usage across the tree and keep the attribute's quirks
> in one place rather than open-coded at every call site.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 05/10] drm/i915: switch to __nonnull_args() macro
2026-10-28 8:19 ` [PATCH 05/10] drm/i915: " Dmitry Ilvokhin
2026-10-28 9:49 ` Andy Shevchenko
@ 2026-10-28 11:33 ` Jani Nikula
2026-10-28 11:44 ` Andi Shyti
2 siblings, 0 replies; 20+ messages in thread
From: Jani Nikula @ 2026-10-28 11:33 UTC (permalink / raw)
To: Dmitry Ilvokhin, Alex Deucher, Christian König,
David Airlie, Simona Vetter, Joonas Lahtinen, Rodrigo Vivi,
Tvrtko Ursulin, Lee Jones, Pavel Machek, Joel Stanley,
Andrew Jeffery, Ryan Chen, Billy Tsai, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, Kees Cook, Andy Shevchenko,
Matthew Wilcox, Andrew Morton, Andy Whitcroft, Joe Perches,
Jonathan Corbet, Shuah Khan, Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda, Dmitry Ilvokhin
On Wed, 28 Oct 2026, Dmitry Ilvokhin <d@ilvokhin.com> wrote:
> Commit 22302af28d3f ("cleanup: Annotate guard constructors with
> nonnull") added the macro __nonnull_args() to wrap raw compiler
> attribute.
>
> Replace __attribute__((nonnull)) with __nonnull_args() to standardize
> nonnull attribute usage across the tree and keep the attribute's quirks
> in one place rather than open-coded at every call site.
>
> Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 ++--
> drivers/gpu/drm/i915/i915_request.h | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h
> index a2f4b6758a65..648d0b4139cf 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
> @@ -127,7 +127,7 @@ __deprecated
> struct drm_gem_object *
> drm_gem_object_lookup(struct drm_file *file, u32 handle);
>
> -__attribute__((nonnull))
> +__nonnull_args()
> static inline struct drm_i915_gem_object *
> i915_gem_object_get(struct drm_i915_gem_object *obj)
> {
> @@ -135,7 +135,7 @@ i915_gem_object_get(struct drm_i915_gem_object *obj)
> return obj;
> }
>
> -__attribute__((nonnull))
> +__nonnull_args()
> static inline void
> i915_gem_object_put(struct drm_i915_gem_object *obj)
> {
> diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h
> index b09135301f39..f559203c332d 100644
> --- a/drivers/gpu/drm/i915/i915_request.h
> +++ b/drivers/gpu/drm/i915/i915_request.h
> @@ -437,12 +437,12 @@ void i915_request_cancel(struct i915_request *rq, int error);
> long i915_request_wait_timeout(struct i915_request *rq,
> unsigned int flags,
> long timeout)
> - __attribute__((nonnull(1)));
> + __nonnull_args(1);
>
> long i915_request_wait(struct i915_request *rq,
> unsigned int flags,
> long timeout)
> - __attribute__((nonnull(1)));
> + __nonnull_args(1);
> #define I915_WAIT_INTERRUPTIBLE BIT(0)
> #define I915_WAIT_PRIORITY BIT(1) /* small priority bump for the request */
> #define I915_WAIT_ALL BIT(2) /* used by i915_gem_object_wait() */
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 05/10] drm/i915: switch to __nonnull_args() macro
2026-10-28 8:19 ` [PATCH 05/10] drm/i915: " Dmitry Ilvokhin
2026-10-28 9:49 ` Andy Shevchenko
2026-10-28 11:33 ` Jani Nikula
@ 2026-10-28 11:44 ` Andi Shyti
2 siblings, 0 replies; 20+ messages in thread
From: Andi Shyti @ 2026-10-28 11:44 UTC (permalink / raw)
To: Dmitry Ilvokhin
Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap, amd-gfx, dri-devel, linux-kernel, intel-gfx,
linux-leds, linux-arm-kernel, linux-aspeed, linux-hardening,
linux-fsdevel, linux-mm, linux-doc, Miguel Ojeda
Hi Dmitry,
On Wed, Oct 28, 2026 at 08:19:44AM +0000, Dmitry Ilvokhin wrote:
> Commit 22302af28d3f ("cleanup: Annotate guard constructors with
> nonnull") added the macro __nonnull_args() to wrap raw compiler
> attribute.
>
> Replace __attribute__((nonnull)) with __nonnull_args() to standardize
> nonnull attribute usage across the tree and keep the attribute's quirks
> in one place rather than open-coded at every call site.
>
> Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Thanks,
Andi
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 07/10] drm/gem: Switch to __nonnull_args() macro
2026-10-28 8:19 ` [PATCH 07/10] drm/gem: Switch " Dmitry Ilvokhin
@ 2026-10-28 11:44 ` Andi Shyti
0 siblings, 0 replies; 20+ messages in thread
From: Andi Shyti @ 2026-10-28 11:44 UTC (permalink / raw)
To: Dmitry Ilvokhin
Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
Lee Jones, Pavel Machek, Joel Stanley, Andrew Jeffery, Ryan Chen,
Billy Tsai, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Kees Cook, Andy Shevchenko, Matthew Wilcox, Andrew Morton,
Andy Whitcroft, Joe Perches, Jonathan Corbet, Shuah Khan,
Randy Dunlap, amd-gfx, dri-devel, linux-kernel, intel-gfx,
linux-leds, linux-arm-kernel, linux-aspeed, linux-hardening,
linux-fsdevel, linux-mm, linux-doc, Miguel Ojeda
Hi Dmitry,
On Wed, Oct 28, 2026 at 08:19:46AM +0000, Dmitry Ilvokhin wrote:
> Commit 22302af28d3f ("cleanup: Annotate guard constructors with
> nonnull") added the macro __nonnull_args() to wrap raw compiler
> attribute.
>
> Replace __attribute__((nonnull)) with __nonnull_args() to standardize
> nonnull attribute usage across the tree and keep the attribute's quirks
> in one place rather than open-coded at every call site.
>
> Suggested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Thanks,
Andi
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 10/10] checkpatch: suggest nonnull attribute conversion
2026-10-28 8:19 ` [PATCH 10/10] checkpatch: suggest nonnull attribute conversion Dmitry Ilvokhin
@ 2026-10-28 16:11 ` Joe Perches
0 siblings, 0 replies; 20+ messages in thread
From: Joe Perches @ 2026-10-28 16:11 UTC (permalink / raw)
To: Dmitry Ilvokhin, Alex Deucher, Christian König,
David Airlie, Simona Vetter, Jani Nikula, Joonas Lahtinen,
Rodrigo Vivi, Tvrtko Ursulin, Lee Jones, Pavel Machek,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Kees Cook,
Andy Shevchenko, Matthew Wilcox, Andrew Morton, Andy Whitcroft,
Jonathan Corbet, Shuah Khan, Randy Dunlap
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda
On Wed, 2026-10-28 at 08:19 +0000, Dmitry Ilvokhin wrote:
> The kernel provides the __nonnull_args() macro as the preferred form for
> marking pointer arguments as non-NULL. Add a check suggesting the macro
> over the raw __attribute__((nonnull)) spelling, consistent with the
> existing attribute conversion suggestions.
>
> Examples:
>
> WARNING: Prefer __nonnull_args(1, 2) over __attribute__((nonnull(1, 2)))
> #11: FILE: drivers/soc/aspeed/aspeed-lpc-snoop.c:230:
> +__attribute__((nonnull(1, 2)))
>
> WARNING: Prefer __nonnull_args() over __attribute__((nonnull))
> #11: FILE: drivers/soc/aspeed/aspeed-lpc-snoop.c:283:
> +__attribute__((nonnull))
>
> Signed-off-by: Dmitry Ilvokhin <[d@ilvokhin.com](mailto:d@ilvokhin.com)>
Seems sensible, thanks.
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -6856,6 +6856,7 @@ sub process {
> "no_caller_saved_registers" => "__no_caller_saved_registers",
> "noclone" => "__noclone",
> "noinline" => "noinline",
> + "nonnull" => "__nonnull_args",
> "nonstring" => "__nonstring",
> "noreturn" => "__noreturn",
> "packed" => "__packed",
> @@ -6876,6 +6877,8 @@ sub process {
> if ($curr_attr eq "format" && $params) {
> $params =~ /^\s*\(\s*(\w+)\s*,\s*(.*)/;
> $new = "__$1\($2";
> + } elsif ($curr_attr eq "nonnull" && $params eq "") {
> + $new = "$new()";
> } else {
> $new = "$new$params";
> }
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 00/10] treewide: switch to __nonnull_args() macro
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
` (9 preceding siblings ...)
2026-10-28 8:19 ` [PATCH 10/10] checkpatch: suggest nonnull attribute conversion Dmitry Ilvokhin
@ 2026-10-28 20:44 ` Randy Dunlap
10 siblings, 0 replies; 20+ messages in thread
From: Randy Dunlap @ 2026-10-28 20:44 UTC (permalink / raw)
To: Dmitry Ilvokhin, Alex Deucher, Christian König,
David Airlie, Simona Vetter, Jani Nikula, Joonas Lahtinen,
Rodrigo Vivi, Tvrtko Ursulin, Lee Jones, Pavel Machek,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Kees Cook,
Andy Shevchenko, Matthew Wilcox, Andrew Morton, Andy Whitcroft,
Joe Perches, Jonathan Corbet, Shuah Khan
Cc: amd-gfx, dri-devel, linux-kernel, intel-gfx, linux-leds,
linux-arm-kernel, linux-aspeed, linux-hardening, linux-fsdevel,
linux-mm, linux-doc, Miguel Ojeda
On 10/28/26 1:19 AM, Dmitry Ilvokhin wrote:
> Commit 22302af28d3f ("cleanup: Annotate guard constructors with
> nonnull") added the __nonnull_args() macro to wrap the raw compiler
> attribute, keeping the attribute's quirks in one place rather than
> open-coded at every call site.
>
> This series replaces the remaining open-coded __attribute__((nonnull))
> users with __nonnull_args() to standardize nonnull attribute usage
> across the tree.
>
> Each patch can be applied separately by the respective maintainers. The
> only dependency is kernel-doc: the string and lib/list_sort patches need
> patch 1 ("docs: xforms_lists: support __nonnull_args()") in the same
> release, otherwise strends() and list_sort() drop out of the generated
> documentation.
>
> Latest Sparse release could not properly parse __nonnull_args() without
> arguments. Fix was proposed [1] and merged, but until updated version of
> Sparse will reach wide masses it might trip on __nonnull_args() without
> arguments.
>
> There are few more instances of __attribute__((nonnull)) usages left in
> the tools subdirectory, they are perf related copied files and can
> (should?) be updated separately after this patchset lands.
>
> Build-tested allmodconfig with GCC 11.5.0 and clang 22.1.8.
What ARCH(es)?
Did you mean to use such an "old" version of GCC?
thanks.
>
> [1]: https://lore.kernel.org/all/20261019175633.415493-19-bvanassche@acm.org/
>
> Dmitry Ilvokhin (10):
> docs: xforms_lists: support __nonnull_args()
> string: Switch to __nonnull_args() macro
> lib/list_sort: Switch to __nonnull_args() macro
> xarray: switch to __nonnull_args() macro
> drm/i915: switch to __nonnull_args() macro
> drm/amdgpu: switch to __nonnull_args() macro
> drm/gem: Switch to __nonnull_args() macro
> leds: pwm: Switch to __nonnull_args() macro
> soc: aspeed: lpc-snoop: Switch to __nonnull_args() macro
> checkpatch: suggest nonnull attribute conversion
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
> drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 ++--
> drivers/gpu/drm/i915/i915_request.h | 4 ++--
> drivers/leds/leds-pwm.c | 2 +-
> drivers/soc/aspeed/aspeed-lpc-snoop.c | 4 ++--
> include/drm/drm_gem.h | 2 +-
> include/linux/list_sort.h | 4 ++--
> include/linux/string.h | 2 +-
> include/linux/xarray.h | 4 ++--
> lib/list_sort.c | 6 +++---
> scripts/checkpatch.pl | 3 +++
> tools/include/linux/compiler.h | 4 ++++
> tools/lib/python/kdoc/xforms_lists.py | 1 +
> 13 files changed, 25 insertions(+), 17 deletions(-)
>
>
> base-commit: 6b4b543fa18757297ac756a6fe6e64f506b7844a
--
~Randy
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2026-10-28 20:45 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 8:19 [PATCH 00/10] treewide: switch to __nonnull_args() macro Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 01/10] docs: xforms_lists: support __nonnull_args() Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 02/10] string: Switch to __nonnull_args() macro Dmitry Ilvokhin
2026-10-28 9:48 ` Andy Shevchenko
2026-10-28 8:19 ` [PATCH 03/10] lib/list_sort: " Dmitry Ilvokhin
2026-10-28 9:47 ` Andy Shevchenko
2026-10-28 8:19 ` [PATCH 04/10] xarray: switch " Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 05/10] drm/i915: " Dmitry Ilvokhin
2026-10-28 9:49 ` Andy Shevchenko
2026-10-28 11:33 ` Jani Nikula
2026-10-28 11:44 ` Andi Shyti
2026-10-28 8:19 ` [PATCH 06/10] drm/amdgpu: " Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 07/10] drm/gem: Switch " Dmitry Ilvokhin
2026-10-28 11:44 ` Andi Shyti
2026-10-28 8:19 ` [PATCH 08/10] leds: pwm: " Dmitry Ilvokhin
2026-10-28 9:49 ` Andy Shevchenko
2026-10-28 8:19 ` [PATCH 09/10] soc: aspeed: lpc-snoop: " Dmitry Ilvokhin
2026-10-28 8:19 ` [PATCH 10/10] checkpatch: suggest nonnull attribute conversion Dmitry Ilvokhin
2026-10-28 16:11 ` Joe Perches
2026-10-28 20:44 ` [PATCH 00/10] treewide: switch to __nonnull_args() macro Randy Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®