Re: [PATCH net-next v7 6/9] net: txgbe: Support GPIO to SFP socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 12, 2023 at 11:58 AM Jiawen Wu <jiawenwu@xxxxxxxxxxxxxx> wrote:

...

> > > +   switch (type) {
> > > +   case IRQ_TYPE_EDGE_BOTH:
> > > +           level |= BIT(hwirq);
> > > +           break;
> > > +   case IRQ_TYPE_EDGE_RISING:
> > > +           level |= BIT(hwirq);
> > > +           polarity |= BIT(hwirq);
> > > +           break;
> > > +   case IRQ_TYPE_EDGE_FALLING:
> > > +           level |= BIT(hwirq);
> >
> > > +           polarity &= ~BIT(hwirq);
> >
> > This...
> >
> > > +           break;
> > > +   case IRQ_TYPE_LEVEL_HIGH:
> > > +           level &= ~BIT(hwirq);
> >
> > ...and this can be done outside of the switch-case. Then you simply set certain
> > bits where it's needed.
> >
> > > +           polarity |= BIT(hwirq);
> > > +           break;
> > > +   case IRQ_TYPE_LEVEL_LOW:
> > > +           level &= ~BIT(hwirq);
> > > +           polarity &= ~BIT(hwirq);
> > > +           break;
> >
> > default?
>
> Do you mean that treat IRQ_TYPE_LEVEL_LOW as default case, clear level and
> polarity firstly, then set the bits in other needed case?

level &= ...
polarity &= ...

switch () {
case X:
  level |= ...
  break;
case Y:
  polarity |= ...
  break;
case Z:
  ...
  break;
default:
  ...handle error...
}


-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux