All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Larsson <andreas@gaisler.com>
To: Peter Korsgaard <jacmet@sunsite.dk>
Cc: linux-i2c@vger.kernel.org, Jean Delvare <khali@linux-fr.org>,
	Ben Dooks <ben-linux@fluff.org>,
	Wolfram Sang <w.sang@pengutronix.de>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	linux-kernel@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org, software@gaisler.com
Subject: Re: [PATCH 1/2] i2c: i2c-ocores: Add irq support for sparc
Date: Wed, 24 Oct 2012 11:05:04 +0200	[thread overview]
Message-ID: <5087AF40.7090105@gaisler.com> (raw)
In-Reply-To: <87wqyhlzfv.fsf@macbook.be.48ers.dk>

On 10/23/2012 10:13 PM, Peter Korsgaard wrote:
>>>>>> "Andreas" == Andreas Larsson <andreas@gaisler.com> writes:
>
>   Andreas> There are no platform resources of type IORESOURCE_IRQ on
>   Andreas> sparc, so the irq number is acquired in a different manner for
>   Andreas> sparc. The general case uses platform_get_irq, that internally
>   Andreas> still uses platform_get_resource.
>
> I have no idea why sparc is being odd in this regard, but assuming this
> is how it's done, I'm fine with this change.
>
> A quick grep doesn't find any other drivers doing this though:
>
> git grep -l archdata.irqs drivers | xargs grep platform_get_irq
>
> Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

Other drivers that work both on sparc and on other platforms usually use 
irq_of_parse_and_map on a corresponding device_node. For non-sparc 
architectures irq_of_parse_and_map sets up mappings that needs to be 
teared down on module exit. Sparc however has its own version of 
irq_of_parse_and_map that just returns the irq number using archdata.irq[].

I am trying to get through a patch platform_get_irq to work for sparc as 
well. If that eventually goes through, the CONFIG_SPARC stuff can then 
be removed cleanly from this driver withouth having to mess with 
irq_of_parse_and_map and tearing mappings down.

Another solution is to use irq_of_parse_and_map for the of-case if no 
irq was found using platform_get_irq. But that would make for more 
rearrangements and add the need for irq_dispose_mapping to be added on 
module exit as well (even though the disposing would do nothing for sparc).

Cheers,
Andreas Larsson


WARNING: multiple messages have this Message-ID (diff)
From: Andreas Larsson <andreas-FkzTOoA/JUlBDgjK7y7TUQ@public.gmane.org>
To: Peter Korsgaard <jacmet-OfajU3CKLf1/SzgSGea1oA@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	Grant Likely
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	software-FkzTOoA/JUlBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCH 1/2] i2c: i2c-ocores: Add irq support for sparc
Date: Wed, 24 Oct 2012 11:05:04 +0200	[thread overview]
Message-ID: <5087AF40.7090105@gaisler.com> (raw)
In-Reply-To: <87wqyhlzfv.fsf-uXGAPMMVk8amE9MCos8gUmSdvHPH+/yF@public.gmane.org>

On 10/23/2012 10:13 PM, Peter Korsgaard wrote:
>>>>>> "Andreas" == Andreas Larsson <andreas-FkzTOoA/JUlBDgjK7y7TUQ@public.gmane.org> writes:
>
>   Andreas> There are no platform resources of type IORESOURCE_IRQ on
>   Andreas> sparc, so the irq number is acquired in a different manner for
>   Andreas> sparc. The general case uses platform_get_irq, that internally
>   Andreas> still uses platform_get_resource.
>
> I have no idea why sparc is being odd in this regard, but assuming this
> is how it's done, I'm fine with this change.
>
> A quick grep doesn't find any other drivers doing this though:
>
> git grep -l archdata.irqs drivers | xargs grep platform_get_irq
>
> Acked-by: Peter Korsgaard <jacmet-OfajU3CKLf1/SzgSGea1oA@public.gmane.org>

Other drivers that work both on sparc and on other platforms usually use 
irq_of_parse_and_map on a corresponding device_node. For non-sparc 
architectures irq_of_parse_and_map sets up mappings that needs to be 
teared down on module exit. Sparc however has its own version of 
irq_of_parse_and_map that just returns the irq number using archdata.irq[].

I am trying to get through a patch platform_get_irq to work for sparc as 
well. If that eventually goes through, the CONFIG_SPARC stuff can then 
be removed cleanly from this driver withouth having to mess with 
irq_of_parse_and_map and tearing mappings down.

Another solution is to use irq_of_parse_and_map for the of-case if no 
irq was found using platform_get_irq. But that would make for more 
rearrangements and add the need for irq_dispose_mapping to be added on 
module exit as well (even though the disposing would do nothing for sparc).

Cheers,
Andreas Larsson

  reply	other threads:[~2012-10-24  9:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-23 15:03 [PATCH 0/2] i2c: i2c-ocores: Add support for sparc, custom set and get functions, and the GRLIB port of the controller Andreas Larsson
2012-10-23 15:03 ` Andreas Larsson
2012-10-23 15:03 ` [PATCH 1/2] i2c: i2c-ocores: Add irq support for sparc Andreas Larsson
2012-10-23 15:03   ` Andreas Larsson
2012-10-23 20:13   ` Peter Korsgaard
2012-10-23 20:13     ` Peter Korsgaard
2012-10-24  9:05     ` Andreas Larsson [this message]
2012-10-24  9:05       ` Andreas Larsson
2012-10-23 15:03 ` [PATCH 2/2] i2c: i2c-ocores: Add support for the GRLIB port of the controller and custom getreg and setreg functions Andreas Larsson
2012-10-23 15:03   ` Andreas Larsson
2012-10-23 20:24   ` Peter Korsgaard
2012-10-24  9:05     ` Andreas Larsson
2012-10-24 11:48       ` Peter Korsgaard
2012-10-24 11:48         ` Peter Korsgaard

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=5087AF40.7090105@gaisler.com \
    --to=andreas@gaisler.com \
    --cc=ben-linux@fluff.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jacmet@sunsite.dk \
    --cc=khali@linux-fr.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=software@gaisler.com \
    --cc=w.sang@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.