All of lore.kernel.org
 help / color / mirror / Atom feed
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 1/3] gpio: pca953x: make the register access by GPIO bank
Date: Tue, 08 Jan 2013 10:00:11 +0100	[thread overview]
Message-ID: <50EBE01B.80704@free-electrons.com> (raw)
In-Reply-To: <50EBDFAD.2090903@free-electrons.com>

Hi Gregory,

On 08/01/2013 09:58, Gregory CLEMENT wrote:
> On 01/08/2013 09:32 AM, Maxime Ripard wrote:
>> On 07/01/2013 23:51, Gregory CLEMENT wrote:
>>>  static irqreturn_t pca953x_irq_handler(int irq, void *devid)
>>>  {
>>>  	struct pca953x_chip *chip = devid;
>>> -	u32 pending;
>>> -	u32 level;
>>> +	u8 pending[MAX_BANK];
>>> +	u8 level;
>>> +	int i;
>>>  
>>> -	pending = pca953x_irq_pending(chip);
>>> -
>>> -	if (!pending)
>>> +	if (!pca953x_irq_pending(chip, pending))
>>>  		return IRQ_HANDLED;
>>>  
>>> -	do {
>>> -		level = __ffs(pending);
>>> -		handle_nested_irq(irq_find_mapping(chip->domain, level));
>>> -
>>> -		pending &= ~(1 << level);
>>> -	} while (pending);
>>> +	for (i = 0; i < NBANK(chip); i++) {
>>> +		do {
>>> +			level = __ffs(pending[i]);
>>> +			handle_nested_irq(irq_find_mapping(chip->domain,
>>> +							level + (BANK_SZ * i)));
>>> +			pending[i] &= ~(1 << level);
>>> +		} while (pending[i]);
>>> +	}
>>>  
>>>  	return IRQ_HANDLED;
>>>  }
>>
>> This triggers the following warning when an interrupt is raised:
>>
>> [   30.773500] ------------[ cut here ]------------
>> [   30.778843] WARNING: at /home/tmp/linux/kernel/irq/irqdomain.c:137 irq_domain_legacy_revmap+0x2c/0x48()
>> [   30.788375] Modules linked in:
>> [   30.791531] [<c0014100>] (unwind_backtrace+0x0/0xf0) from [<c001c878>] (warn_slowpath_common+0x4c/0x64)
>> [   30.801125] [<c001c878>] (warn_slowpath_common+0x4c/0x64) from [<c001c8ac>] (warn_slowpath_null+0x1c/0x24)
>> [   30.810968] [<c001c8ac>] (warn_slowpath_null+0x1c/0x24) from [<c006b5e0>] (irq_domain_legacy_revmap+0x2c/0x48)
>> [   30.821187] [<c006b5e0>] (irq_domain_legacy_revmap+0x2c/0x48) from [<c01c3734>] (pca953x_irq_handler+0x16c/0x1ac)
>> [   30.831656] [<c01c3734>] (pca953x_irq_handler+0x16c/0x1ac) from [<c0068688>] (irq_thread+0xd0/0x124)
>> [   30.841000] [<c0068688>] (irq_thread+0xd0/0x124) from [<c003c238>] (kthread+0xa4/0xb0)
>> [   30.849125] [<c003c238>] (kthread+0xa4/0xb0) from [<c000ed48>] (ret_from_fork+0x14/0x2c)
>> [   30.857375] ---[ end trace 09584b7a73100a49 ]---
>>
> 
> Humm it seems that this warning is caused by attempting to use an out of range hwirq.
> I need to investigate it more in details.
> 
> Expect the IRQ part, is this version is working for your gpio expander?

Yes, it works fine if you leave the interruptions aside.

Maxime

-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Andreas Schallenberg <Andreas.Schallenberg@3alitytechnica.com>,
	Roland Stigge <stigge@antcom.de>,
	Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 1/3] gpio: pca953x: make the register access by GPIO bank
Date: Tue, 08 Jan 2013 10:00:11 +0100	[thread overview]
Message-ID: <50EBE01B.80704@free-electrons.com> (raw)
In-Reply-To: <50EBDFAD.2090903@free-electrons.com>

Hi Gregory,

On 08/01/2013 09:58, Gregory CLEMENT wrote:
> On 01/08/2013 09:32 AM, Maxime Ripard wrote:
>> On 07/01/2013 23:51, Gregory CLEMENT wrote:
>>>  static irqreturn_t pca953x_irq_handler(int irq, void *devid)
>>>  {
>>>  	struct pca953x_chip *chip = devid;
>>> -	u32 pending;
>>> -	u32 level;
>>> +	u8 pending[MAX_BANK];
>>> +	u8 level;
>>> +	int i;
>>>  
>>> -	pending = pca953x_irq_pending(chip);
>>> -
>>> -	if (!pending)
>>> +	if (!pca953x_irq_pending(chip, pending))
>>>  		return IRQ_HANDLED;
>>>  
>>> -	do {
>>> -		level = __ffs(pending);
>>> -		handle_nested_irq(irq_find_mapping(chip->domain, level));
>>> -
>>> -		pending &= ~(1 << level);
>>> -	} while (pending);
>>> +	for (i = 0; i < NBANK(chip); i++) {
>>> +		do {
>>> +			level = __ffs(pending[i]);
>>> +			handle_nested_irq(irq_find_mapping(chip->domain,
>>> +							level + (BANK_SZ * i)));
>>> +			pending[i] &= ~(1 << level);
>>> +		} while (pending[i]);
>>> +	}
>>>  
>>>  	return IRQ_HANDLED;
>>>  }
>>
>> This triggers the following warning when an interrupt is raised:
>>
>> [   30.773500] ------------[ cut here ]------------
>> [   30.778843] WARNING: at /home/tmp/linux/kernel/irq/irqdomain.c:137 irq_domain_legacy_revmap+0x2c/0x48()
>> [   30.788375] Modules linked in:
>> [   30.791531] [<c0014100>] (unwind_backtrace+0x0/0xf0) from [<c001c878>] (warn_slowpath_common+0x4c/0x64)
>> [   30.801125] [<c001c878>] (warn_slowpath_common+0x4c/0x64) from [<c001c8ac>] (warn_slowpath_null+0x1c/0x24)
>> [   30.810968] [<c001c8ac>] (warn_slowpath_null+0x1c/0x24) from [<c006b5e0>] (irq_domain_legacy_revmap+0x2c/0x48)
>> [   30.821187] [<c006b5e0>] (irq_domain_legacy_revmap+0x2c/0x48) from [<c01c3734>] (pca953x_irq_handler+0x16c/0x1ac)
>> [   30.831656] [<c01c3734>] (pca953x_irq_handler+0x16c/0x1ac) from [<c0068688>] (irq_thread+0xd0/0x124)
>> [   30.841000] [<c0068688>] (irq_thread+0xd0/0x124) from [<c003c238>] (kthread+0xa4/0xb0)
>> [   30.849125] [<c003c238>] (kthread+0xa4/0xb0) from [<c000ed48>] (ret_from_fork+0x14/0x2c)
>> [   30.857375] ---[ end trace 09584b7a73100a49 ]---
>>
> 
> Humm it seems that this warning is caused by attempting to use an out of range hwirq.
> I need to investigate it more in details.
> 
> Expect the IRQ part, is this version is working for your gpio expander?

Yes, it works fine if you leave the interruptions aside.

Maxime

-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2013-01-08  9:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07 22:51 [PATCH V2 0/3] Add support for gpio expander pca9505 used on Mirabox Gregory CLEMENT
2013-01-07 22:51 ` Gregory CLEMENT
2013-01-07 22:51 ` [PATCH V2 1/3] gpio: pca953x: make the register access by GPIO bank Gregory CLEMENT
2013-01-07 22:51   ` Gregory CLEMENT
2013-01-08  8:32   ` Maxime Ripard
2013-01-08  8:32     ` Maxime Ripard
2013-01-08  8:58     ` Gregory CLEMENT
2013-01-08  8:58       ` Gregory CLEMENT
2013-01-08  9:00       ` Maxime Ripard [this message]
2013-01-08  9:00         ` Maxime Ripard
2013-01-21 23:30       ` Gregory CLEMENT
2013-01-21 23:30         ` Gregory CLEMENT
2013-01-07 22:51 ` [PATCH V2 2/3] gpio: pca953x: add support for pca9505 Gregory CLEMENT
2013-01-07 22:51   ` Gregory CLEMENT
2013-01-07 22:51 ` [PATCH V2 3/3] arm: mvebu: enable gpio expander over i2c on Mirabox platform Gregory CLEMENT
2013-01-07 22:51   ` Gregory CLEMENT

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=50EBE01B.80704@free-electrons.com \
    --to=maxime.ripard@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.