From: Felipe Balbi <balbi@ti.com>
To: Kevin Cernekee <cernekee@gmail.com>
Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>,
balbi@ti.com, ralf@linux-mips.org, linux-mips@linux-mips.org,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: bcm63xx UDC driver
Date: Mon, 20 Aug 2012 10:24:27 +0300 [thread overview]
Message-ID: <20120820072425.GG17455@arwen.pp.htv.fi> (raw)
In-Reply-To: <CAJiQ=7CADk_75U5=OQH8vXA=xtj-U=TbBhXzC8JfUGbYEKmxng@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2693 bytes --]
On Sun, Aug 19, 2012 at 01:53:26PM -0700, Kevin Cernekee wrote:
> On Sun, Aug 19, 2012 at 1:17 PM, Sebastian Andrzej Siewior
> <sebastian@breakpoint.cc> wrote:
> > On Sat, Aug 18, 2012 at 10:18:01AM -0700, Kevin Cernekee wrote:
> >
> > This is a quick look :)
>
> Thanks for the review.
>
> >> + for (i = 0; i < NUM_IUDMA; i++)
> >> + if (udc->iudma[i].irq == irq)
> >> + iudma = &udc->iudma[i];
> >> + BUG_ON(!iudma);
> >
> > This is rough. Please don't do this. Bail out in probe or print an error here
> > and return with IRQ_NONE and time will close this irq.
>
> OK, I will change it to warn + return IRQ_NONE, instead of BUG().
>
> That situation shouldn't ever happen anyway. It would mean that our
> ISR is getting called with somebody else's IRQ number, or the iudma
> structs were corrupted.
>
> Probe does bail out if any of the IRQ resources are missing.
>
> >> + for (i = 0; i < NUM_IUDMA + 1; i++) {
> >> + int irq = platform_get_irq(pdev, i);
> >> + if (irq < 0) {
> >> + dev_err(dev, "missing IRQ resource #%d\n", i);
> >> + goto out_uninit;
> >> + }
> >> + if (devm_request_irq(dev, irq,
> >> + i ? &bcm63xx_udc_data_isr : &bcm63xx_udc_ctrl_isr,
> >> + 0, dev_name(dev), udc) < 0) {
> >> + dev_err(dev, "error requesting IRQ #%d\n", irq);
> >> + goto out_uninit;
> >> + }
> >> + if (i > 0)
> >> + udc->iudma[i - 1].irq = irq;
> >> + }
> >
> > According to this code, i in iudma[] can be in 1..5. You could have more than
> > one IRQ. The comment above this for loop is point less. So I think if you can
> > only have _one_ idma irq than you could remove the for loop in
> > bcm63xx_udc_data_isr().
>
> There are 6 IUDMA channels, and each one always has a dedicated
> interrupt line. IRQ resource #0 is the control (vbus/speed/cfg/etc.)
> IRQ, and IRQ resources #1-6 are the IUDMA (IN/OUT data) IRQs. Maybe
> it would be good to add a longer comment to clarify this?
If you actually have separate IRQ lines, you should request_irq() for
each line, which will again render the for loop pointless.
> An earlier iteration of the code had passed in an IRQ range, which
> worked for 6328, but then it was pointed out that the IRQ numbers are
> not contiguous on all platforms. So 7 individual resources are indeed
> necessary.
correct. But nevertheless, you should have a separate request_irq() for
each line, continuous or not continuous.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-08-20 7:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-18 17:18 [PATCH] usb: gadget: bcm63xx UDC driver Kevin Cernekee
2012-08-19 20:17 ` Sebastian Andrzej Siewior
2012-08-19 20:53 ` Kevin Cernekee
2012-08-20 7:24 ` Felipe Balbi [this message]
2012-08-20 19:52 ` Sebastian Andrzej Siewior
2012-08-20 7:40 ` Felipe Balbi
2012-08-21 3:48 ` Kevin Cernekee
2012-08-21 12:04 ` Felipe Balbi
2012-08-21 15:20 ` Kevin Cernekee
2012-08-21 18:08 ` Felipe Balbi
2012-08-21 19:35 ` Kevin Cernekee
2012-08-21 20:34 ` Alan Stern
2012-08-21 20:34 ` Alan Stern
2012-08-21 21:08 ` Kevin Cernekee
2012-08-21 21:34 ` Alan Stern
2012-08-21 21:34 ` Alan Stern
2012-08-21 21:58 ` Kevin Cernekee
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=20120820072425.GG17455@arwen.pp.htv.fi \
--to=balbi@ti.com \
--cc=cernekee@gmail.com \
--cc=linux-mips@linux-mips.org \
--cc=linux-usb@vger.kernel.org \
--cc=ralf@linux-mips.org \
--cc=sebastian@breakpoint.cc \
/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