From: Felipe Balbi <felipe.balbi@nokia.com>
To: "ext Pandita, Vikram" <vikram.pandita@ti.com>
Cc: "Menon, Nishanth" <nm@ti.com>,
"Balbi Felipe (Nokia-D/Helsinki)" <felipe.balbi@nokia.com>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH 1/2] Serial: Define IRQ flags for 8250 driver
Date: Fri, 12 Jun 2009 22:01:39 +0300 [thread overview]
Message-ID: <20090612190139.GC28101@nokia.com> (raw)
In-Reply-To: <FCCFB4CDC6E5564B9182F639FC35608702F53464BE@dbde02.ent.ti.com>
On Fri, Jun 12, 2009 at 04:50:09PM +0200, ext Pandita, Vikram wrote:
>
>
> >-----Original Message-----
> >From: Menon, Nishanth
> >Sent: Friday, June 12, 2009 9:46 AM
> >To: felipe.balbi@nokia.com
> >Cc: Pandita, Vikram; linux-omap@vger.kernel.org
> >Subject: RE: [PATCH 1/2] Serial: Define IRQ flags for 8250 driver
> >
> >> -----Original Message-----
> >> From: Felipe Balbi [mailto:felipe.balbi@nokia.com]
> >> Sent: Friday, June 12, 2009 1:38 AM
> >> To: Menon, Nishanth
> >> Cc: Pandita, Vikram; linux-omap@vger.kernel.org
> >> Subject: Re: [PATCH 1/2] Serial: Define IRQ flags for 8250 driver
> >>
> >> On Fri, Jun 12, 2009 at 03:46:37AM +0200, ext Menon, Nishanth wrote:
> >> >
> >> > > -----Original Message-----
> >> > > From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> >> > > owner@vger.kernel.org] On Behalf Of Pandita, Vikram
> >> > > Sent: Thursday, June 11, 2009 7:50 PM
> >> > > To: linux-omap@vger.kernel.org
> >> > > Cc: Pandita, Vikram
> >> > > Subject: [PATCH 1/2] Serial: Define IRQ flags for 8250 driver
> >> > >
> >> > >
> >> > > + /* Get IRQ Trigger Flag */
> >> > > + if (up->port.flags & UPF_IRQ_TRIG_RISING)
> >> > > + irq_flags |= IRQF_TRIGGER_RISING;
> >> > > + else if (up->port.flags & UPF_IRQ_TRIG_FALLING)
> >> > > + irq_flags |= IRQF_TRIGGER_FALLING;
> >> > > + else if (up->port.flags & UPF_IRQ_TRIG_HIGH)
> >> > > + irq_flags |= IRQF_TRIGGER_HIGH;
> >> > > + else if (up->port.flags & UPF_IRQ_TRIG_LOW)
> >> > > + irq_flags |= IRQF_TRIGGER_LOW;
> >> > > +
> >> > Blame it on my dislike for nested if elseif, but...
> >> > irq_flags |=
> >> > (up->port.flags & UPF_IRQ_TRIG_RISING)? IRQF_TRIGGER_RISING :
> >> > (up->port.flags & UPF_IRQ_TRIG_FALLING)? IRQF_TRIGGER_FALLING :
> >> > (up->port.flags & IRQF_TRIGGER_HIGH)? IRQF_TRIGGER_HIGH :
> >> > (up->port.flags & UPF_IRQ_TRIG_LOW)? IRQF_TRIGGER_LOW : 0;
> >> >
> >> > Makes sense?
> >>
> >> switch (up->port.flags & UPF_IRQ_FLAGS_MASK) {
> >> case UPF_IRQ_TRIG_RISING:
> >> irq_flags |= IRQF_TRIGGER_RISING;
> >> break;
> >> case UPF_IRQ_TRIG_FALLING:
> >> irq_flags |= IRQF_TRIGGER_FALLING;
> >> break;
> >> case UPF_IRQ_TRIG_HIGH:
> >> irq_flags |= IRQF_TRIGGER_HIGH;
> >> break;
> >> case UPF_IRQ_TRIG_LOW:
> >> irq_flags |= IRQF_TRIGGER_LOW;
> >> break;
> >> default:
> >> printk(KERN_ERR "Unsupported flag\n");
> >> return -EINVAL;
> >> }
> >>
> >Better :) infact, if the port.flags = UPF_IRQ_TRIG_LOW | UPF_IRQ_TRIG_HIGH it might be better to
> >return -EINVAL, which Felipe's change does :).
>
> Needs more investigation as to how current boards using 8250 driver do not pass any flag (maybe just SHARED flag) and they still work. Maybe some default taken by request_irq()
>
> In short NO_ need to return failure as no flag is a valid use case.
remove the default part:
switch (up->port.flags & UPF_IRQ_FLAGS_MASK) {
case UPF_IRQ_TRIG_RISING:
irq_flags |= IRQF_TRIGGER_RISING;
break;
case UPF_IRQ_TRIG_FALLING:
irq_flags |= IRQF_TRIGGER_FALLING;
break;
case UPF_IRQ_TRIG_HIGH:
irq_flags |= IRQF_TRIGGER_HIGH;
break;
case UPF_IRQ_TRIG_LOW:
irq_flags |= IRQF_TRIGGER_LOW;
break;
default:
break;
}
--
balbi
next prev parent reply other threads:[~2009-06-12 19:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-12 0:49 [PATCH 1/2] Serial: Define IRQ flags for 8250 driver Vikram Pandita
2009-06-12 1:46 ` Menon, Nishanth
2009-06-12 6:37 ` Felipe Balbi
2009-06-12 14:45 ` Menon, Nishanth
2009-06-12 14:50 ` Pandita, Vikram
2009-06-12 14:54 ` Menon, Nishanth
2009-06-12 19:01 ` Felipe Balbi [this message]
2009-06-12 19:11 ` Pandita, Vikram
2009-06-12 23:13 ` Felipe Contreras
-- strict thread matches above, loose matches on Subject: below --
2009-06-12 0:53 Vikram Pandita
2009-06-12 16:26 ` Marc Zyngier
2009-06-12 16:47 ` Kevin Hilman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090612190139.GC28101@nokia.com \
--to=felipe.balbi@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=vikram.pandita@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox