linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh: intc: Add IRQ trigger bit field check
@ 2011-10-17  8:59 Magnus Damm
  2011-10-28  6:13 ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2011-10-17  8:59 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

R-Mobile SoCs such as sh73a0 include PINT blocks in INTC
that come with 2-bit IRQ trigger support. Add code to make
sure the bit width is checked so 4-bit only modes like for
instance EDGE_BOTH will fail for PINT.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 drivers/sh/intc/chip.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- 0009/drivers/sh/intc/chip.c
+++ work/drivers/sh/intc/chip.c	2011-10-14 11:52:20.000000000 +0900
@@ -202,11 +202,16 @@ static int intc_set_type(struct irq_data
 	if (!value)
 		return -EINVAL;
 
+	value &= ~SENSE_VALID_FLAG;
+
 	ihp = intc_find_irq(d->sense, d->nr_sense, irq);
 	if (ihp) {
+		/* PINT has 2-bit sense registers, should fail on EDGE_BOTH */
+		if (value >= (1 << _INTC_WIDTH(ihp->handle)))
+			return -EINVAL;
+
 		addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0);
-		intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle,
-						    value & ~SENSE_VALID_FLAG);
+		intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value);
 	}
 
 	return 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sh: intc: Add IRQ trigger bit field check
  2011-10-17  8:59 [PATCH] sh: intc: Add IRQ trigger bit field check Magnus Damm
@ 2011-10-28  6:13 ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2011-10-28  6:13 UTC (permalink / raw)
  To: linux-sh

On Mon, Oct 17, 2011 at 05:59:54PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> R-Mobile SoCs such as sh73a0 include PINT blocks in INTC
> that come with 2-bit IRQ trigger support. Add code to make
> sure the bit width is checked so 4-bit only modes like for
> instance EDGE_BOTH will fail for PINT.
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-28  6:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-17  8:59 [PATCH] sh: intc: Add IRQ trigger bit field check Magnus Damm
2011-10-28  6:13 ` Paul Mundt

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).