Re: [PATCH 1/1] nds32: Power management for nds32

From: Pavel Machek
Date: Wed Oct 24 2018 - 05:46:19 EST


Hi!

> > Can we get rid of "is_bit_1" array here, and use normal bit operations
> > on another variable here?
> >
> Do you mean like this:
>
> static int nointc_set_wake(struct irq_data *data, unsigned int on) {
> unsigned long int_mask = __nds32__mfsr(NDS32_SR_INT_MASK);
> static unsigned long irq_orig_bit = 0;
> u32 bit = 1 << data->hwirq;
>
> if (on) {
> if (int_mask & bit)
> __assign_bit(data->hwirq, &irq_orig_bit, true);
> else
> __assign_bit(data->hwirq, &irq_orig_bit, false);
>
> __assign_bit(data->hwirq, &int_mask, true);
> __assign_bit(data->hwirq, &wake_mask, true);
>
> } else {
> if (!(irq_orig_bit & bit))
> __assign_bit(data->hwirq, &int_mask, false);
>
> __assign_bit(data->hwirq, &wake_mask, false);
> __assign_bit(data->hwirq, &irq_orig_bit, false);
> }
>
> __nds32__mtsr_dsb(int_mask, NDS32_SR_INT_MASK);
>
> return 0;

Yes, that is better. You don't need = 0 on static variable
afaict. (And may want to put it out of a function so it stands out).

You can add my Acked-by on resulting patch.

Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature