mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 18:56:24 +00:00
genirq: Simplify the checks for irq_set_percpu_devid_partition()
Since whether desc is NULL or desc->percpu_enabled is true, it returns -EINVAL, check them together, and assign desc->percpu_affinity using a ternary to simplify the code. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240417085356.3785381-1-ruanjinjie@huawei.com
This commit is contained in:
parent
35d77eb7b9
commit
bb58c1baa5
@ -911,10 +911,7 @@ int irq_set_percpu_devid_partition(unsigned int irq,
|
|||||||
{
|
{
|
||||||
struct irq_desc *desc = irq_to_desc(irq);
|
struct irq_desc *desc = irq_to_desc(irq);
|
||||||
|
|
||||||
if (!desc)
|
if (!desc || desc->percpu_enabled)
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (desc->percpu_enabled)
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
desc->percpu_enabled = kzalloc(sizeof(*desc->percpu_enabled), GFP_KERNEL);
|
desc->percpu_enabled = kzalloc(sizeof(*desc->percpu_enabled), GFP_KERNEL);
|
||||||
@ -922,10 +919,7 @@ int irq_set_percpu_devid_partition(unsigned int irq,
|
|||||||
if (!desc->percpu_enabled)
|
if (!desc->percpu_enabled)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (affinity)
|
desc->percpu_affinity = affinity ? : cpu_possible_mask;
|
||||||
desc->percpu_affinity = affinity;
|
|
||||||
else
|
|
||||||
desc->percpu_affinity = cpu_possible_mask;
|
|
||||||
|
|
||||||
irq_set_percpu_devid_flags(irq);
|
irq_set_percpu_devid_flags(irq);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user