linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: akpm@linux-foundation.org, mm-commits@vger.kernel.org,
	daniel@caiaq.de, dbrownell@users.sourceforge.net,
	s.hauer@pengutronix.de, spi-devel-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: + spi-imx-correct-check-for-platform_get_irq-failing.patch added to -mm tree
Date: Wed, 9 Dec 2009 18:55:53 +0100	[thread overview]
Message-ID: <20091209175553.GA25451@pengutronix.de> (raw)
In-Reply-To: <20091209153241.GB1389@pengutronix.de>

On Wed, Dec 09, 2009 at 04:32:41PM +0100, Uwe Kleine-König wrote:
> On Wed, Dec 09, 2009 at 08:08:19AM -0700, Grant Likely wrote:
> > (resend because I forgot to cc the mailing list)
> > 
> > 2009/12/9 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> > > Hello Grant,
> > >
> > > On Tue, Dec 08, 2009 at 05:38:57PM -0700, Grant Likely wrote:
> > >> > diff -puN drivers/spi/spi_imx.c~spi-imx-correct-check-for-platform_get_irq-failing drivers/spi/spi_imx.c
> > >> > --- a/drivers/spi/spi_imx.c~spi-imx-correct-check-for-platform_get_irq-failing
> > >> > +++ a/drivers/spi/spi_imx.c
> > >> > @@ -554,7 +554,7 @@ static int __init spi_imx_probe(struct p
> > >> >        }
> > >> >
> > >> >        spi_imx->irq = platform_get_irq(pdev, 0);
> > >> > -       if (!spi_imx->irq) {
> > >> > +       if (spi_imx->irq < 0) {
> > >>
> > >> This changes the old behaviour.  Is that what you intended?  '<= 0' perhaps?
> > > Yes, the old check was wrong.  What if the irq to use is 0?  I thought
> > > the commit log to be understandable.  platform_get_irq returns -ENXIO on
> > > error and an irq number on success.  So 0 has to be interpreted as valid
> > > irq, not an error.
> > 
> > 0 is not a valid IRQ
> Hmm, on my x86 I have:
> 
> 	$ grep '\<0:' /proc/interrupts 
> 	   0:      24330   IO-APIC-edge      timer
> 
> arm/davinci starts at 0, too.  As does arm/ns9xxx.  arm/pxa seems to
> start at 1.  realview starts at 1, too.  So four out of five make are
> wrong?  Seems like a big area for cleanup.
I've read a bit and I think the best for a driver writer (i.e. the role
I have when changing drivers/spi/spi_imx.c) is to accept what
platform_get_irq returns to me.  If the platform specified 

	struct resource mydevicesresources[] = {
		...
		{
			.start = 0,
			.end = 0,
			.flags = IORESOURCE_IRQ,
		},
		...
	};

then the best thing to do is to take irq0, isn't it.  So as
platform_get_irq is implemented as

	int platform_get_irq(struct platform_device *dev, unsigned int num)
	{
	        struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);

        	return r ? r->start : -ENXIO;
	}

testing for <0 seems right to me.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

  parent reply	other threads:[~2009-12-09 17:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200912082330.nB8NU4IO016215@imap1.linux-foundation.org>
     [not found] ` <fa686aa40912081638m734e97c3r2c3f412898d293b@mail.gmail.com>
     [not found]   ` <20091209074533.GB8136@pengutronix.de>
     [not found]     ` <20091209074533.GB8136-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-12-09 15:08       ` + spi-imx-correct-check-for-platform_get_irq-failing.patch added to -mm tree Grant Likely
     [not found]         ` <fa686aa40912090708g45879802l6cea7b401b1434e3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-09 15:32           ` Uwe Kleine-König
     [not found]             ` <20091209153241.GB1389-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-12-09 17:23               ` Grant Likely
2009-12-09 17:55             ` Uwe Kleine-König [this message]
2009-12-09 18:00               ` Grant Likely

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=20091209175553.GA25451@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=daniel@caiaq.de \
    --cc=dbrownell@users.sourceforge.net \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).