Skip to contentSkip to conversation

genirq: Use AFFINITY and AFFINITY_LIST in write_irq_affinity()

PATCH New Yunfeng Ye 1 participant 1 message Oct 28, 2021 IRQ

lore
Share & tools
lore

Yunfeng Ye

author
#0 lore raw

PATCH 1/1 genirq: Use AFFINITY and AFFINITY_LIST in write_irq_affinity()

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.

---
 kernel/irq/proc.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
kernel/irq/proc.c +10 -4
index ee595ec09778..423f65203a69 100644
@@ -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)
Signature · 1 line
2.27.0