public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: add IDR to the deprecated list
@ 2025-10-31 11:19 Carlos López
  2025-10-31 18:53 ` dan.j.williams
  2025-11-01 17:43 ` Joe Perches
  0 siblings, 2 replies; 3+ messages in thread
From: Carlos López @ 2025-10-31 11:19 UTC (permalink / raw)
  To: linux-kernel
  Cc: willy, Carlos López, Dan Williams, Andy Whitcroft,
	Joe Perches, Dwaipayan Ray, Lukas Bulwahn

As of commit 85656ec193e9, the IDR interface is marked as deprecated
in the documentation, but no checks are made in that regard for new
code. Add the existing IDR initialization APIs to the deprecated list
in checkpatch, so that if new code is introduced using these APIs, a
warning is emitted.

Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Carlos López <clopez@suse.de>
---
 scripts/checkpatch.pl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 92669904eecc..bc72fa66c0ef 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -860,6 +860,10 @@ our %deprecated_apis = (
 	"kunmap"				=> "kunmap_local",
 	"kmap_atomic"				=> "kmap_local_page",
 	"kunmap_atomic"				=> "kunmap_local",
+	#These should be enough to drive away new IDR users
+	"DEFINE_IDR"				=> "DEFINE_XARRAY",
+	"idr_init"				=> "xa_init",
+	"idr_init_base"				=> "xa_init_flags"
 );
 
 #Create a search pattern for all these strings to speed up a loop below
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch: add IDR to the deprecated list
  2025-10-31 11:19 [PATCH] checkpatch: add IDR to the deprecated list Carlos López
@ 2025-10-31 18:53 ` dan.j.williams
  2025-11-01 17:43 ` Joe Perches
  1 sibling, 0 replies; 3+ messages in thread
From: dan.j.williams @ 2025-10-31 18:53 UTC (permalink / raw)
  To: Carlos López, linux-kernel
  Cc: willy, Carlos López, Dan Williams, Andy Whitcroft,
	Joe Perches, Dwaipayan Ray, Lukas Bulwahn

Carlos López wrote:
> As of commit 85656ec193e9, the IDR interface is marked as deprecated
> in the documentation, but no checks are made in that regard for new
> code. Add the existing IDR initialization APIs to the deprecated list
> in checkpatch, so that if new code is introduced using these APIs, a
> warning is emitted.
> 
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Carlos López <clopez@suse.de>
> ---
>  scripts/checkpatch.pl | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 92669904eecc..bc72fa66c0ef 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -860,6 +860,10 @@ our %deprecated_apis = (
>  	"kunmap"				=> "kunmap_local",
>  	"kmap_atomic"				=> "kmap_local_page",
>  	"kunmap_atomic"				=> "kunmap_local",
> +	#These should be enough to drive away new IDR users
> +	"DEFINE_IDR"				=> "DEFINE_XARRAY",
> +	"idr_init"				=> "xa_init",
> +	"idr_init_base"				=> "xa_init_flags"
>  );

Thanks! Works for me:

WARNING: Deprecated use of 'DEFINE_IDR', prefer 'DEFINE_XARRAY' instead
#111: FILE: drivers/virt/coco/tsm-core.c:15:
+static DEFINE_IDR(tsm_idr);

Acked-by: Dan Williams <dan.j.williams@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch: add IDR to the deprecated list
  2025-10-31 11:19 [PATCH] checkpatch: add IDR to the deprecated list Carlos López
  2025-10-31 18:53 ` dan.j.williams
@ 2025-11-01 17:43 ` Joe Perches
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2025-11-01 17:43 UTC (permalink / raw)
  To: Carlos López, linux-kernel, Andrew Morton
  Cc: willy, Dan Williams, Andy Whitcroft, Dwaipayan Ray, Lukas Bulwahn

On Fri, 2025-10-31 at 12:19 +0100, Carlos López wrote:
> As of commit 85656ec193e9, the IDR interface is marked as deprecated
> in the documentation, but no checks are made in that regard for new
> code. Add the existing IDR initialization APIs to the deprecated list
> in checkpatch, so that if new code is introduced using these APIs, a
> warning is emitted.
> 
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Carlos López <clopez@suse.de>
> ---
>  scripts/checkpatch.pl | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 92669904eecc..bc72fa66c0ef 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -860,6 +860,10 @@ our %deprecated_apis = (
>  	"kunmap"				=> "kunmap_local",
>  	"kmap_atomic"				=> "kmap_local_page",
>  	"kunmap_atomic"				=> "kunmap_local",
> +	#These should be enough to drive away new IDR users
> +	"DEFINE_IDR"				=> "DEFINE_XARRAY",
> +	"idr_init"				=> "xa_init",
> +	"idr_init_base"				=> "xa_init_flags"
>  );
>  
>  #Create a search pattern for all these strings to speed up a loop below

Acked-by: Joe Perches <joe@perches.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-01 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 11:19 [PATCH] checkpatch: add IDR to the deprecated list Carlos López
2025-10-31 18:53 ` dan.j.williams
2025-11-01 17:43 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox