<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>[PATCH 1/3] regmap: fix some error messages to take account of irq_reg_stride</title>
        <description> From: Stephen Warren &amp;lt;swarren@nvidia.com&amp;gt;

A number of places in the code were printing error messages that included
the address of a register, but were not calculating the register address
in the same way as the access to the register. Use a temporary to solve
this.

Signed-off-by: Stephen Warren &amp;lt;swarren@nvidia.com&amp;gt;
---
Note: This patch series will be a dependency for some MFD patches that I
will send shortly.

 drivers/base/regmap/regmap-irq.c |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index a897346..c7e5b18 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -59,6 +59,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
 	struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data);
 	struct regmap *map = d-&amp;gt;map;
 	int i, ret;
+	u32 reg;
 
 	/*
 	 * If there's been a change in the mask write it back to the
@@ -66,13 +67,13 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
 	 * suppress pointless writes.
 	 */
 	for (i = 0; i &amp;lt; d-&amp;gt;chip-&amp;gt;num_regs; i++) {
-		ret = regmap_update_bits(d-&amp;gt;map, d-&amp;gt;chip-&amp;gt;mask_base +
-						(i * map-&amp;gt;reg_stride *
-						d-&amp;gt;irq_reg_stride),
+		reg = d-&amp;gt;chip-&amp;gt;mask_base +
+			(i * map-&amp;gt;reg_stride * d-&amp;gt;irq_reg_stride);
+		ret = regmap_update_bits(d-&amp;gt;map, reg,
 					 d-&amp;gt;mask_buf_def, d-&amp;gt;mask_buf);
 		if (ret != 0)
 			dev_err(d-&amp;gt;map-&amp;gt;dev, &amp;quot;Failed to sync masks in %x\n&amp;quot;,
-				d-&amp;gt;chip-&amp;gt;mask_base + (i * map-&amp;gt;reg_stride));
+				reg);
 	}
 
 	/* If we've changed our wakeup count propagate it to the parent */
@@ -144,6 +145,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
 	struct regmap *map = data-&amp;gt;map;
 	int ret, i;
 	bool handled = false;
+	u32 reg;
 
 	/*
 	 * Ignore masked IRQs and ack if we need to; we ack early so
@@ -166,14 +168,12 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
 		data-&amp;gt;status_buf &amp;amp;= ~data-&amp;gt;mask_buf;
 
 		if (data-&amp;gt;status_buf &amp;amp;&amp;amp; chip-&amp;gt;ack_base) {
-			ret = regmap_write(map, chip-&amp;gt;ack_base +
-						(i * map-&amp;gt;reg_stride *
-						data-&amp;gt;irq_reg_stride),
-					   data-&amp;gt;status_buf);
+			reg = chip-&amp;gt;ack_base +
+				(i * map-&amp;gt;reg_stride * data-&amp;gt;irq_reg_stride);
+			ret = regmap_write(map, reg, data-&amp;gt;status_buf);
 			if (ret != 0)
 				dev_err(map-&amp;gt;dev, &amp;quot;Failed to ack 0x%x: %d\n&amp;quot;,
-					chip-&amp;gt;ack_base + (i * map-&amp;gt;reg_stride),
-					ret);
+					reg, ret);
 		}
 	}
 
@@ -238,6 +238,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
 	struct regmap_irq_chip_data *d;
 	int i;
 	int ret = -ENOMEM;
+	u32 reg;
 
 	for (i = 0; i &amp;lt; chip-&amp;gt;num_irqs; i++) {
 		if (chip-&amp;gt;irqs.reg_offset % map-&amp;gt;reg_stride)
@@ -303,12 +304,12 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
 	/* Mask all the interrupts by default */
 	for (i = 0; i &amp;lt; chip-&amp;gt;num_regs; i++) {
 		d-&amp;gt;mask_buf = d-&amp;gt;mask_buf_def;
-		ret = regmap_write(map, chip-&amp;gt;mask_base + (i * map-&amp;gt;reg_stride
-				   * d-&amp;gt;irq_reg_stride),
-				   d-&amp;gt;mask_buf);
+		reg = chip-&amp;gt;mask_base +
+			(i * map-&amp;gt;reg_stride * d-&amp;gt;irq_reg_stride);
+		ret = regmap_write(map, reg, d-&amp;gt;mask_buf);
 		if (ret != 0) {
 			dev_err(map-&amp;gt;dev, &amp;quot;Failed to set masks in 0x%x: %d\n&amp;quot;,
-				chip-&amp;gt;mask_base + (i * map-&amp;gt;reg_stride), ret);
+				reg, ret);
 			goto err_alloc;
 		}
 	}
-- 
1.7.0.4

--
To unsubscribe from this list: send the line &amp;quot;unsubscribe linux-kernel&amp;quot; in
the body of a message to &amp;#109;&amp;#97;&amp;#106;&amp;#111;&amp;#114;&amp;#100;&amp;#111;&amp;#109;&amp;#111;&amp;#64;&amp;#118;&amp;#103;&amp;#101;&amp;#114;&amp;#46;&amp;#107;&amp;#101;&amp;#114;&amp;#110;&amp;#101;&amp;#108;&amp;#46;&amp;#111;&amp;#114;&amp;#103;
More majordomo info at  [vger.kernel.org]
Please read the FAQ at  [www.tux.org]</description>
        <link>http://choon.net/forum/read.php?21,1219636,1219636#msg-1219636</link>
        <lastBuildDate>Thu, 23 May 2013 00:39:03 +0800</lastBuildDate>
        <generator>Phorum 5.2.19</generator>
        <item>
            <guid>http://choon.net/forum/read.php?21,1219636,1233984#msg-1233984</guid>
            <title>Re: [PATCH 1/3] regmap: fix some error messages to take account of irq_reg_stride</title>
            <link>http://choon.net/forum/read.php?21,1219636,1233984#msg-1233984</link>
            <description><![CDATA[ On Fri, Jul 27, 2012 at 01:01:54PM -0600, Stephen Warren wrote:<br />
&gt; From: Stephen Warren &lt;swarren@nvidia.com&gt;<br />
&gt; <br />
&gt; A number of places in the code were printing error messages that included<br />
&gt; the address of a register, but were not calculating the register address<br />
&gt; in the same way as the access to the register. Use a temporary to solve<br />
&gt; this.<br />
<br />
Applied, thanks.<br />
--<br />
To unsubscribe from this list: send the line &quot;unsubscribe linux-kernel&quot; in<br />
the body of a message to <a href="mailto:&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;">&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;</a><br />
More majordomo info at  [<a href="http://vger.kernel.org/majordomo-info.html"  rel="nofollow">vger.kernel.org</a>]<br />
Please read the FAQ at  [<a href="http://www.tux.org/lkml/"  rel="nofollow">www.tux.org</a>]]]></description>
            <dc:creator>Mark Brown</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Wed, 01 Aug 2012 21:57:16 +0800</pubDate>
        </item>
        <item>
            <guid>http://choon.net/forum/read.php?21,1219636,1233661#msg-1233661</guid>
            <title>Re: [PATCH 3/3] regmap: enhance regmap-irq to handle 1 IRQ feeding n chips</title>
            <link>http://choon.net/forum/read.php?21,1219636,1233661#msg-1233661</link>
            <description><![CDATA[ On Tue, Jul 31, 2012 at 05:18:36PM -0600, Stephen Warren wrote:<br />
<br />
&gt; I don't think it's appropriate to put this support into the IRQ core.<br />
&gt; The main issue is that all the handlers for any shared wired-or<br />
&gt; interrupt line have to be registered before the IRQ is enabled, to avoid<br />
&gt; some initially active interrupt continually firing before the IRQ is<br />
&gt; enabled. Co-ordinating this when the wired-or line is on a board outside<br />
&gt; a device driver rather than internal to a chip and one device driver is<br />
&gt; a bit more than the IRQ core should probably be doing, hence I imagine<br />
&gt; why it doesn't support it.<br />
<br />
No, that's not the issue at all - none of the above is at all different<br />
to any other shared interrupt and obviously we support shared IRQs quite<br />
happily (we wouldn't run on a good chunk of PCs if we didn't).  Shared<br />
interrupts do require the hardware design not be insane but generally<br />
hardware engineers do manage to get that right.<br />
<br />
We don't support this for threaded IRQs due to thorny synchronisation<br />
issues in fast paths.<br />
<br />
&gt; Co-ordinating this setup where all the sources of the wired-or are in<br />
&gt; one chip seems to belong to the chip driver, which is where my patch did<br />
&gt; this.<br />
<br />
Well, no.  It did this by having a piece of framework code add a round<br />
robin irq_chip (essentially a shared threaded IRQ) layered on top of the<br />
existing regmap-irq code which had nothing to do with the rest of that<br />
code.  There's nothing at all about that framework code which is at all<br />
specific to regmap-irq, it just calls a series of sub IRQs every time<br />
the primary IRQ goes off.<br />
<br />
This isn't the chip driver that's doing things, it's the regmap-irq<br />
code.  With the current round robin implementation there's no reason for<br />
regmap to implement it, other things can quite happily do the same thing.<br />
Having a regmap helper which used a generic facility would be reasonable<br />
but the actual demux is a generic thing.<br />
<br />
[Suggestion to not bounce back into the IRQ core]<br />
<br />
&gt; but it seems a little hokey to short-circuit the IRQ core; it would<br />
&gt; prevent execution of any statistics gathering or stuck interrupt<br />
&gt; handling that handle_nested_irq() might do for example.<br />
<br />
This seems like a better approach if doing things entirely in regmap.  I<br />
can't see any impact on any of the IRQ core features here, we're always<br />
going to call each of the sub IRQs exactly once for each call to the IRQ<br />
handler and the stuck IRQ code is still going to identify the same set<br />
of real IRQs as stuck.<br />
<br />
&gt; Now, if we made each child regmap_irq not be its own IRQ domain or<br />
&gt; irq_chip, but simply had one top-level domain/chip that aggregated them,<br />
&gt; that argument would be moot. However, that top-level domain/chip would<br />
&gt; become rather complex and just end up doing a bunch of demultiplexing<br />
&gt; code that's not needed if we do it like in my patch...<br />
<br />
That demultiplexing seems excessively complex, yes.<br />
--<br />
To unsubscribe from this list: send the line &quot;unsubscribe linux-kernel&quot; in<br />
the body of a message to <a href="mailto:&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;">&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;</a><br />
More majordomo info at  [<a href="http://vger.kernel.org/majordomo-info.html"  rel="nofollow">vger.kernel.org</a>]<br />
Please read the FAQ at  [<a href="http://www.tux.org/lkml/"  rel="nofollow">www.tux.org</a>]]]></description>
            <dc:creator>Mark Brown</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Wed, 01 Aug 2012 19:42:31 +0800</pubDate>
        </item>
        <item>
            <guid>http://choon.net/forum/read.php?21,1219636,1219637#msg-1219637</guid>
            <title>[PATCH 3/3] regmap: enhance regmap-irq to handle 1 IRQ feeding n chips</title>
            <link>http://choon.net/forum/read.php?21,1219636,1219637#msg-1219637</link>
            <description><![CDATA[ From: Stephen Warren &lt;swarren@nvidia.com&gt;<br />
<br />
Some devices contain a single interrupt output, and multiple separate<br />
interrupt controllers that all trigger that interrupt output, yet provide<br />
no top-level interrupt controller/registers to allow determination of<br />
which child interrupt controller caused the interrupt.<br />
<br />
In this case, a regmap irq_chip can be created for each of the individual<br />
&quot;child&quot; interrupt controllers, alongside some infra-structure to hook the<br />
interrupt and distribute it to each &quot;child&quot;. This patch introduces<br />
regmap_add_irq_chips() which sets up such infra-structure, and creates<br />
a number of child regmap irq_chips.<br />
<br />
Signed-off-by: Stephen Warren &lt;swarren@nvidia.com&gt;<br />
---<br />
 drivers/base/regmap/regmap-irq.c |  187 ++++++++++++++++++++++++++++++++++++++<br />
 include/linux/regmap.h           |    9 ++<br />
 2 files changed, 196 insertions(+), 0 deletions(-)<br />
<br />
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c<br />
index 6bb4364..9d7894c 100644<br />
--- a/drivers/base/regmap/regmap-irq.c<br />
+++ b/drivers/base/regmap/regmap-irq.c<br />
@@ -2,6 +2,7 @@<br />
  * regmap based irq_chip<br />
  *<br />
  * Copyright 2011 Wolfson Microelectronics plc<br />
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.<br />
  *<br />
  * Author: Mark Brown &lt;broonie@opensource.wolfsonmicro.com&gt;<br />
  *<br />
@@ -16,6 +17,7 @@<br />
 #include &lt;linux/irq.h&gt;<br />
 #include &lt;linux/interrupt.h&gt;<br />
 #include &lt;linux/irqdomain.h&gt;<br />
+#include &lt;linux/pm_runtime.h&gt;<br />
 #include &lt;linux/slab.h&gt;<br />
 <br />
 #include &quot;internal.h&quot;<br />
@@ -40,6 +42,14 @@ struct regmap_irq_chip_data {<br />
 	unsigned int irq_reg_stride;<br />
 };<br />
 <br />
+struct regmap_irq_chips_data {<br />
+	struct device *dev;<br />
+	int irq;<br />
+	int nchips;<br />
+	struct irq_domain *irqdom;<br />
+	struct regmap_irq_chip_data **datas;<br />
+};<br />
+<br />
 static inline const<br />
 struct regmap_irq *irq_to_regmap_irq(struct regmap_irq_chip_data *data,<br />
 				     int irq)<br />
@@ -463,3 +473,180 @@ int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq)<br />
 	return irq_create_mapping(data-&gt;domain, irq);<br />
 }<br />
 EXPORT_SYMBOL_GPL(regmap_irq_get_virq);<br />
+<br />
+static void regmaps_irq_enable(struct irq_data *data)<br />
+{<br />
+}<br />
+<br />
+static void regmaps_irq_disable(struct irq_data *data)<br />
+{<br />
+}<br />
+<br />
+static struct irq_chip regmaps_irq_chip = {<br />
+	.name		= &quot;regmaps&quot;,<br />
+	.irq_disable	= regmaps_irq_disable,<br />
+	.irq_enable	= regmaps_irq_enable,<br />
+};<br />
+<br />
+static int regmaps_irq_map(struct irq_domain *h, unsigned int virq,<br />
+			   irq_hw_number_t hw)<br />
+{<br />
+	struct regmap_irq_chips_data *data = h-&gt;host_data;<br />
+<br />
+	irq_set_chip_data(virq, data);<br />
+	irq_set_chip_and_handler(virq, &amp;regmaps_irq_chip, handle_edge_irq);<br />
+	irq_set_nested_thread(virq, 1);<br />
+<br />
+	/* ARM needs us to explicitly flag the IRQ as valid<br />
+	 * and will set them noprobe when we do so. */<br />
+#ifdef CONFIG_ARM<br />
+	set_irq_flags(virq, IRQF_VALID);<br />
+#else<br />
+	irq_set_noprobe(virq);<br />
+#endif<br />
+<br />
+	return 0;<br />
+}<br />
+<br />
+static struct irq_domain_ops regmaps_domain_ops = {<br />
+	.map	= regmaps_irq_map,<br />
+};<br />
+<br />
+static irqreturn_t regmaps_irq_thread(int irq, void *data)<br />
+{<br />
+	struct regmap_irq_chips_data *d = data;<br />
+	int ret, i;<br />
+<br />
+	ret = pm_runtime_get_sync(d-&gt;dev);<br />
+	if (ret &lt; 0) {<br />
+		dev_err(d-&gt;dev, &quot;Failed to resume device: %d\n&quot;, ret);<br />
+		return IRQ_NONE;<br />
+	}<br />
+<br />
+	for (i = 0; i &lt; d-&gt;nchips; i++)<br />
+		handle_nested_irq(irq_find_mapping(d-&gt;irqdom, i));<br />
+<br />
+	pm_runtime_mark_last_busy(d-&gt;dev);<br />
+	pm_runtime_put_autosuspend(d-&gt;dev);<br />
+<br />
+	return IRQ_HANDLED;<br />
+}<br />
+<br />
+/**<br />
+ * regmap_add_irq_chips(): Call regmap_add_irq_chip for n chips on one IRQ<br />
+ *<br />
+ * @irq:       Primary IRQ for the device<br />
+ * @irq_flags: The IRQF_ flags to use for the primary interrupt.<br />
+ * @nchips:    The number of IRQ chips attached to the interrupt.<br />
+ * @maps:      The regmap for each IRQ chip.<br />
+ * @irq_bases  The base Linux IRQ number for each chip, or NULL.<br />
+ * @chips:     Configuration for each interrupt controller.<br />
+ * @data:      Runtime data structure set of controllers, allocated on success<br />
+ *<br />
+ * Some devices contain a single interrupt output, and multiple separate<br />
+ * interrupt controllers that all trigger that interrupt output, yet provide<br />
+ * no top-level interrupt controller to allow determination of which child<br />
+ * interrupt controller caused the interrupt. regmap_add_irq_chips() creates<br />
+ * the required N regmap irq_chips, and handles demultiplexing this virtual<br />
+ * top-level interrupt.<br />
+ *<br />
+ * Returns 0 on success or an errno on failure.<br />
+ *<br />
+ * In order for this to be efficient the chip really should use a<br />
+ * register cache.  The chip driver is responsible for restoring the<br />
+ * register values used by the IRQ controller over suspend and resume.<br />
+ */<br />
+int regmap_add_irq_chips(int irq, int irq_flags, int nchips,<br />
+			 struct regmap **maps, int *irq_bases,<br />
+			 const struct regmap_irq_chip **chips,<br />
+			 struct regmap_irq_chips_data **data)<br />
+{<br />
+	int ret = -ENOMEM;<br />
+	struct regmap_irq_chips_data *d;<br />
+	int i;<br />
+<br />
+	d = kzalloc(sizeof(*d), GFP_KERNEL);<br />
+	if (!d)<br />
+		return -ENOMEM;<br />
+<br />
+	d-&gt;dev = maps[0]-&gt;dev;<br />
+	d-&gt;irq = irq;<br />
+	d-&gt;nchips = nchips;<br />
+<br />
+	d-&gt;datas = kzalloc(nchips * sizeof(*(d-&gt;datas)), GFP_KERNEL);<br />
+	if (!d-&gt;datas)<br />
+		goto err_alloc;<br />
+<br />
+	d-&gt;irqdom = irq_domain_add_linear(NULL, nchips, &amp;regmaps_domain_ops, d);<br />
+	if (!d-&gt;irqdom) {<br />
+		ret = -EINVAL;<br />
+		goto err_alloc;<br />
+	}<br />
+<br />
+	for (i = 0; i &lt; nchips; i++) {<br />
+		ret = regmap_add_irq_chip(maps<i>,<br />
+					  irq_create_mapping(d-&gt;irqdom, i),<br />
+					  IRQF_ONESHOT,<br />
+					  irq_bases ? irq_bases<i> : 0,<br />
+					  chips<i>, &amp;d-&gt;datas<i>);<br />
+		if (ret != 0) {<br />
+			dev_err(maps<i>-&gt;dev,<br />
+				&quot;Failed to add chip %d IRQs: %d\n&quot;, i, ret);<br />
+			goto err_chips;<br />
+		}<br />
+	}<br />
+<br />
+	ret = request_threaded_irq(irq, NULL, regmaps_irq_thread,<br />
+				   irq_flags, dev_name(d-&gt;dev), d);<br />
+	if (ret != 0) {<br />
+		dev_err(d-&gt;dev, &quot;Failed to request IRQ %d: %d\n&quot;, irq, ret);<br />
+		goto err_chips;<br />
+	}<br />
+<br />
+	*data = d;<br />
+<br />
+	return 0;<br />
+<br />
+err_chips:<br />
+	for (i--; i &gt;= 0; i--)<br />
+		regmap_del_irq_chip(irq_create_mapping(d-&gt;irqdom, i),<br />
+				    d-&gt;datas<i>);<br />
+	/* We should unmap the domain but... */<br />
+err_alloc:<br />
+	kfree(d-&gt;datas);<br />
+	kfree(d);<br />
+	return ret;<br />
+}<br />
+EXPORT_SYMBOL_GPL(regmap_add_irq_chips);<br />
+<br />
+/**<br />
+ * regmap_del_irq_chips(): Undo regmap_add_irq_chips()<br />
+ *<br />
+ * @irq:    Primary IRQ for the device<br />
+ * @d:      regmap_irq_chips_data allocated by regmap_add_irq_chips()<br />
+ */<br />
+void regmap_del_irq_chips(struct regmap_irq_chips_data *d)<br />
+{<br />
+	int i;<br />
+<br />
+	free_irq(d-&gt;irq, d);<br />
+<br />
+	for (i = d-&gt;nchips - 1; i &gt;= 0; i--)<br />
+		regmap_del_irq_chip(irq_create_mapping(d-&gt;irqdom, i),<br />
+				    d-&gt;datas<i>);<br />
+<br />
+	/* We should unmap the domain but... */<br />
+<br />
+	kfree(d-&gt;datas);<br />
+	kfree(d);<br />
+}<br />
+EXPORT_SYMBOL_GPL(regmap_del_irq_chips);<br />
+<br />
+struct regmap_irq_chip_data *regmap_irq_chips_get_chip(<br />
+				struct regmap_irq_chips_data *d, int chip)<br />
+{<br />
+	if (chip &gt;= d-&gt;nchips)<br />
+		return NULL;<br />
+	return d-&gt;datas[chip];<br />
+}<br />
+EXPORT_SYMBOL(regmap_irq_chips_get_chip);<br />
diff --git a/include/linux/regmap.h b/include/linux/regmap.h<br />
index 7f7e00d..b5d9699 100644<br />
--- a/include/linux/regmap.h<br />
+++ b/include/linux/regmap.h<br />
@@ -307,6 +307,7 @@ struct regmap_irq_chip {<br />
 };<br />
 <br />
 struct regmap_irq_chip_data;<br />
+struct regmap_irq_chips_data;<br />
 <br />
 int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,<br />
 			int irq_base, const struct regmap_irq_chip *chip,<br />
@@ -315,6 +316,14 @@ void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);<br />
 int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);<br />
 int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);<br />
 <br />
+int regmap_add_irq_chips(int irq, int irq_flags, int nchips,<br />
+			 struct regmap **maps, int *irq_bases,<br />
+			 const struct regmap_irq_chip **chips,<br />
+			 struct regmap_irq_chips_data **data);<br />
+void regmap_del_irq_chips(struct regmap_irq_chips_data *d);<br />
+struct regmap_irq_chip_data *regmap_irq_chips_get_chip(<br />
+				struct regmap_irq_chips_data *d, int chip);<br />
+<br />
 #else<br />
 <br />
 /*<br />
-- <br />
1.7.0.4<br />
<br />
--<br />
To unsubscribe from this list: send the line &quot;unsubscribe linux-kernel&quot; in<br />
the body of a message to <a href="mailto:&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;">&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;</a><br />
More majordomo info at  [<a href="http://vger.kernel.org/majordomo-info.html"  rel="nofollow">vger.kernel.org</a>]<br />
Please read the FAQ at  [<a href="http://www.tux.org/lkml/"  rel="nofollow">www.tux.org</a>]</i></i></i></i></i></i></i>]]></description>
            <dc:creator>Stephen Warren</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Sat, 28 Jul 2012 03:03:19 +0800</pubDate>
        </item>
        <item>
            <guid>http://choon.net/forum/read.php?21,1219636,1219636#msg-1219636</guid>
            <title>[PATCH 1/3] regmap: fix some error messages to take account of irq_reg_stride</title>
            <link>http://choon.net/forum/read.php?21,1219636,1219636#msg-1219636</link>
            <description><![CDATA[ From: Stephen Warren &lt;swarren@nvidia.com&gt;<br />
<br />
A number of places in the code were printing error messages that included<br />
the address of a register, but were not calculating the register address<br />
in the same way as the access to the register. Use a temporary to solve<br />
this.<br />
<br />
Signed-off-by: Stephen Warren &lt;swarren@nvidia.com&gt;<br />
---<br />
Note: This patch series will be a dependency for some MFD patches that I<br />
will send shortly.<br />
<br />
 drivers/base/regmap/regmap-irq.c |   29 +++++++++++++++--------------<br />
 1 files changed, 15 insertions(+), 14 deletions(-)<br />
<br />
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c<br />
index a897346..c7e5b18 100644<br />
--- a/drivers/base/regmap/regmap-irq.c<br />
+++ b/drivers/base/regmap/regmap-irq.c<br />
@@ -59,6 +59,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data)<br />
 	struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data);<br />
 	struct regmap *map = d-&gt;map;<br />
 	int i, ret;<br />
+	u32 reg;<br />
 <br />
 	/*<br />
 	 * If there's been a change in the mask write it back to the<br />
@@ -66,13 +67,13 @@ static void regmap_irq_sync_unlock(struct irq_data *data)<br />
 	 * suppress pointless writes.<br />
 	 */<br />
 	for (i = 0; i &lt; d-&gt;chip-&gt;num_regs; i++) {<br />
-		ret = regmap_update_bits(d-&gt;map, d-&gt;chip-&gt;mask_base +<br />
-						(i * map-&gt;reg_stride *<br />
-						d-&gt;irq_reg_stride),<br />
+		reg = d-&gt;chip-&gt;mask_base +<br />
+			(i * map-&gt;reg_stride * d-&gt;irq_reg_stride);<br />
+		ret = regmap_update_bits(d-&gt;map, reg,<br />
 					 d-&gt;mask_buf_def<i>, d-&gt;mask_buf<i>);<br />
 		if (ret != 0)<br />
 			dev_err(d-&gt;map-&gt;dev, &quot;Failed to sync masks in %x\n&quot;,<br />
-				d-&gt;chip-&gt;mask_base + (i * map-&gt;reg_stride));<br />
+				reg);<br />
 	}<br />
 <br />
 	/* If we've changed our wakeup count propagate it to the parent */<br />
@@ -144,6 +145,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)<br />
 	struct regmap *map = data-&gt;map;<br />
 	int ret, i;<br />
 	bool handled = false;<br />
+	u32 reg;<br />
 <br />
 	/*<br />
 	 * Ignore masked IRQs and ack if we need to; we ack early so<br />
@@ -166,14 +168,12 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)<br />
 		data-&gt;status_buf<i> &amp;= ~data-&gt;mask_buf<i>;<br />
 <br />
 		if (data-&gt;status_buf<i> &amp;&amp; chip-&gt;ack_base) {<br />
-			ret = regmap_write(map, chip-&gt;ack_base +<br />
-						(i * map-&gt;reg_stride *<br />
-						data-&gt;irq_reg_stride),<br />
-					   data-&gt;status_buf<i>);<br />
+			reg = chip-&gt;ack_base +<br />
+				(i * map-&gt;reg_stride * data-&gt;irq_reg_stride);<br />
+			ret = regmap_write(map, reg, data-&gt;status_buf<i>);<br />
 			if (ret != 0)<br />
 				dev_err(map-&gt;dev, &quot;Failed to ack 0x%x: %d\n&quot;,<br />
-					chip-&gt;ack_base + (i * map-&gt;reg_stride),<br />
-					ret);<br />
+					reg, ret);<br />
 		}<br />
 	}<br />
 <br />
@@ -238,6 +238,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,<br />
 	struct regmap_irq_chip_data *d;<br />
 	int i;<br />
 	int ret = -ENOMEM;<br />
+	u32 reg;<br />
 <br />
 	for (i = 0; i &lt; chip-&gt;num_irqs; i++) {<br />
 		if (chip-&gt;irqs<i>.reg_offset % map-&gt;reg_stride)<br />
@@ -303,12 +304,12 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,<br />
 	/* Mask all the interrupts by default */<br />
 	for (i = 0; i &lt; chip-&gt;num_regs; i++) {<br />
 		d-&gt;mask_buf<i> = d-&gt;mask_buf_def<i>;<br />
-		ret = regmap_write(map, chip-&gt;mask_base + (i * map-&gt;reg_stride<br />
-				   * d-&gt;irq_reg_stride),<br />
-				   d-&gt;mask_buf<i>);<br />
+		reg = chip-&gt;mask_base +<br />
+			(i * map-&gt;reg_stride * d-&gt;irq_reg_stride);<br />
+		ret = regmap_write(map, reg, d-&gt;mask_buf<i>);<br />
 		if (ret != 0) {<br />
 			dev_err(map-&gt;dev, &quot;Failed to set masks in 0x%x: %d\n&quot;,<br />
-				chip-&gt;mask_base + (i * map-&gt;reg_stride), ret);<br />
+				reg, ret);<br />
 			goto err_alloc;<br />
 		}<br />
 	}<br />
-- <br />
1.7.0.4<br />
<br />
--<br />
To unsubscribe from this list: send the line &quot;unsubscribe linux-kernel&quot; in<br />
the body of a message to <a href="mailto:&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;">&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;</a><br />
More majordomo info at  [<a href="http://vger.kernel.org/majordomo-info.html"  rel="nofollow">vger.kernel.org</a>]<br />
Please read the FAQ at  [<a href="http://www.tux.org/lkml/"  rel="nofollow">www.tux.org</a>]</i></i></i></i></i></i></i></i></i></i></i></i>]]></description>
            <dc:creator>Stephen Warren</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Sat, 28 Jul 2012 03:03:13 +0800</pubDate>
        </item>
    </channel>
</rss>
