[PATCH] genirq: Use AFFINITY and AFFINITY_LIST in write_irq_affinity()

From: Yunfeng Ye
Date: Thu Oct 28 2021 - 08:51:46 EST


The commit 0d3f54257dc3 ("genirq: Introduce effective affinity mask")
introduce AFFINITY and AFFINITY_LIST Enumerated Type, so use it in
write_irq_affinity().

No functional change.

Signed-off-by: Yunfeng Ye <yeyunfeng@xxxxxxxxxx>
---
kernel/irq/proc.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index ee595ec09778..423f65203a69 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -147,10 +147,16 @@ static ssize_t write_irq_affinity(int type, struct file *file,
if (!zalloc_cpumask_var(&new_value, GFP_KERNEL))
return -ENOMEM;

- if (type)
+ switch (type) {
+ case AFFINITY_LIST:
err = cpumask_parselist_user(buffer, count, new_value);
- else
+ break;
+ case AFFINITY:
err = cpumask_parse_user(buffer, count, new_value);
+ break;
+ default:
+ err = -EINVAL;
+ }
if (err)
goto free_cpumask;

@@ -179,13 +185,13 @@ static ssize_t write_irq_affinity(int type, struct file *file,
static ssize_t irq_affinity_proc_write(struct file *file,
const char __user *buffer, size_t count, loff_t *pos)
{
- return write_irq_affinity(0, file, buffer, count, pos);
+ return write_irq_affinity(AFFINITY, file, buffer, count, pos);
}

static ssize_t irq_affinity_list_proc_write(struct file *file,
const char __user *buffer, size_t count, loff_t *pos)
{
- return write_irq_affinity(1, file, buffer, count, pos);
+ return write_irq_affinity(AFFINITY_LIST, file, buffer, count, pos);
}

static int irq_affinity_proc_open(struct inode *inode, struct file *file)
--
2.27.0