[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Ves+PdNk0KaSLiwd0ozXEZAH_tQLUS4VUm_1Hvk6vBP4w@mail.gmail.com>
Date: Fri, 12 May 2023 12:43:32 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Jiawen Wu <jiawenwu@...stnetic.com>
Cc: netdev@...r.kernel.org, jarkko.nikula@...ux.intel.com,
andriy.shevchenko@...ux.intel.com, mika.westerberg@...ux.intel.com,
jsd@...ihalf.com, Jose.Abreu@...opsys.com, andrew@...n.ch,
hkallweit1@...il.com, linux@...linux.org.uk, linux-i2c@...r.kernel.org,
linux-gpio@...r.kernel.org, mengyuanlou@...-swift.com
Subject: Re: [PATCH net-next v7 6/9] net: txgbe: Support GPIO to SFP socket
On Fri, May 12, 2023 at 11:58 AM Jiawen Wu <jiawenwu@...stnetic.com> 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
Powered by blists - more mailing lists