[V4,1/6] genirq/affinity: Remove the 'firstvec' parameter from irq_build_affinity_masks

Message ID 20221227022905.352674-2-ming.lei@redhat.com
State New
Headers
Series genirq/affinity: Abstract APIs from managed irq affinity spread |

Commit Message

Ming Lei Dec. 27, 2022, 2:29 a.m. UTC
  The 'firstvec' parameter is always same with the parameter of
'startvec', so use 'startvec' directly inside irq_build_affinity_masks().

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 kernel/irq/affinity.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
  

Comments

John Garry Jan. 11, 2023, 9:23 a.m. UTC | #1
On 27/12/2022 02:29, Ming Lei wrote:
> The 'firstvec' parameter is always same with the parameter of
> 'startvec', so use 'startvec' directly inside irq_build_affinity_masks().
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>

I also note that local variable firstvec == startvec always in 
irq_build_affinity_masks(), so may not need to introduce firstvec 
variable at all. However that code seems to be removed later, so FWIW:

Reviewed-by: John Garry <john.g.garry@oracle.com>

> ---
>   kernel/irq/affinity.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
> index d9a5c1d65a79..3361e36ebaa1 100644
> --- a/kernel/irq/affinity.c
> +++ b/kernel/irq/affinity.c
> @@ -337,10 +337,10 @@ static int __irq_build_affinity_masks(unsigned int startvec,
>    *	2) spread other possible CPUs on these vectors
>    */
>   static int irq_build_affinity_masks(unsigned int startvec, unsigned int numvecs,
> -				    unsigned int firstvec,
>   				    struct irq_affinity_desc *masks)
>   {
>   	unsigned int curvec = startvec, nr_present = 0, nr_others = 0;
> +	unsigned int firstvec = startvec;
>   	cpumask_var_t *node_to_cpumask;
>   	cpumask_var_t nmsk, npresmsk;
>   	int ret = -ENOMEM;
> @@ -463,8 +463,7 @@ irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
>   		unsigned int this_vecs = affd->set_size[i];
>   		int ret;
>   
> -		ret = irq_build_affinity_masks(curvec, this_vecs,
> -					       curvec, masks);
> +		ret = irq_build_affinity_masks(curvec, this_vecs, masks);
>   		if (ret) {
>   			kfree(masks);
>   			return NULL;
  

Patch

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index d9a5c1d65a79..3361e36ebaa1 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -337,10 +337,10 @@  static int __irq_build_affinity_masks(unsigned int startvec,
  *	2) spread other possible CPUs on these vectors
  */
 static int irq_build_affinity_masks(unsigned int startvec, unsigned int numvecs,
-				    unsigned int firstvec,
 				    struct irq_affinity_desc *masks)
 {
 	unsigned int curvec = startvec, nr_present = 0, nr_others = 0;
+	unsigned int firstvec = startvec;
 	cpumask_var_t *node_to_cpumask;
 	cpumask_var_t nmsk, npresmsk;
 	int ret = -ENOMEM;
@@ -463,8 +463,7 @@  irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
 		unsigned int this_vecs = affd->set_size[i];
 		int ret;
 
-		ret = irq_build_affinity_masks(curvec, this_vecs,
-					       curvec, masks);
+		ret = irq_build_affinity_masks(curvec, this_vecs, masks);
 		if (ret) {
 			kfree(masks);
 			return NULL;