Re: [PATCH] checkpatch: add IDR to the deprecated list

From: Joe Perches
Date: Sat Nov 01 2025 - 13:44:14 EST


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@xxxxxxxxx>
> Signed-off-by: Carlos López <clopez@xxxxxxx>
> ---
> 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@xxxxxxxxxxx>