lkml.org 
[lkml]   [2023]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH 4/5] genirq: Use the common function irq_expand_nr_irqs()
    Date
    On Sun, Jan 29 2023 at 18:57, Shanker Donthineni wrote:

    > Subject: genirq: Use the common function ...

    genirq: Unify irq_expand_nr_irqs()

    irq_expand_nr_irqs() is implemented as a stub function for !SPARSEIRQ
    builds. That's not necessary as the SPARSEIRQ version returns -ENOMEM
    correctly even for the !SPARSEIRQ case as the ....


    But this common function is non-obvious for the !SPARSEIRQ case. It at
    least needs a comment

    > +static int irq_expand_nr_irqs(unsigned int nr)
    > +{
    > + if (nr > MAX_SPARSE_IRQS)
    > + return -ENOMEM;
    > + nr_irqs = nr;
    > + return 0;
    > +}

    or preferrably something like this:

    if (!IS_ENABLED(CONFIG_SPARSEIRQ) || nr > MAX_SPARSE_IRQS)
    return -ENOMEM;

    which makes it entirely clear and also allows the compiler to optimize
    is down to a 'return -ENOMEM'.

    Thanks,

    tglx

    \
     
     \ /
      Last update: 2023-03-27 00:03    [W:5.954 / U:0.040 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site