Subject: Re: [PATCH v2 2/2] drivers/base/node: Fold unregister_node() into unregister_one_node()

From: SeongJae Park <[email-masked]>
Date: Wed, 15 Oct 2025 10:27:58 -0700

On Tue, 14 Oct 2025 21:09:17 +0530 Donet Tom <[email-masked]> wrote:

> The function unregister_node() is only called from unregister_one_node().
> This patch folds unregister_node() into its only caller and renames
> unregister_one_node() to unregister_node().
> 
> This reduces unnecessary indirection and simplifies the code structure.
> No functional changes are introduced.
> 
> Acked-by: David Hildenbrand <[email-masked]>
> Acked-by: Mike Rapoport (Microsoft) <[email-masked]>
> Signed-off-by: Donet Tom <[email-masked]>

Acked-by: SeongJae Park <[email-masked]>

> ---
>  drivers/base/node.c  | 38 +++++++++++++++++---------------------
>  include/linux/node.h |  6 ++----
>  mm/memory_hotplug.c  |  4 ++--
>  3 files changed, 21 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 4bcaa8006cd6..758b777dec1f 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -676,23 +676,6 @@ static void node_device_release(struct device *dev)
>  	kfree(to_node(dev));
>  }
>  
> -/**
> - * unregister_node - unregister a node device
> - * @node: node going away
> - *
> - * Unregisters a node device @node.  All the devices on the node must be
> - * unregistered before calling this function.
> - */
> -void unregister_node(struct node *node)
> -{
> -	hugetlb_unregister_node(node);
> -	compaction_unregister_node(node);
> -	reclaim_unregister_node(node);
> -	node_remove_accesses(node);
> -	node_remove_caches(node);
> -	device_unregister(&node->dev);
> -}
> -
>  struct node *node_devices[MAX_NUMNODES];
>  
>  /*
> @@ -924,13 +907,26 @@ int register_node(int nid)
>  
>  	return error;
>  }
> -
> -void unregister_one_node(int nid)
> +/**
> + * unregister_node - unregister a node device
> + * @nid: nid of the node going away
> + *
> + * Unregisters the node device at node id  @nid.  All the devices on the

Nit.  Why two spaces before "@nid"?

[...]

Thanks,
SJ