lkml.org 
[lkml]   [2018]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] nds32: Power management for nds32
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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2018-10-24 11:47    [W:0.035 / U:13.684 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site