All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski <brgl@bgdev.pl>
Subject: [PATCH 3/3] irq/irq_sim: return the base of the irq range from irq_sim_init()
Date: Sun,  4 Mar 2018 13:10:18 +0100	[thread overview]
Message-ID: <20180304121018.640-4-brgl@bgdev.pl> (raw)
In-Reply-To: <20180304121018.640-1-brgl@bgdev.pl>

Returning the base of the allocated interrupt range from irq_sim_init()
and devm_irq_sim_init() will allow users to handle the logic of
associating irq numbers with any other driver-specific resources
without having to use irq_sim_irqnum().

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
 kernel/irq/irq_sim.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index 05f0d7c1698a..85690859a2a8 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -50,7 +50,8 @@ static void irq_sim_handle_irq(struct irq_work *work)
  * @sim:        The interrupt simulator object to initialize.
  * @num_irqs:   Number of interrupts to allocate
  *
- * Returns 0 on success and a negative error number on failure.
+ * On success: return the base of the allocated interrupt range.
+ * On failure: a negative errno.
  */
 int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs)
 {
@@ -79,7 +80,7 @@ int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs)
 	init_irq_work(&sim->work_ctx.work, irq_sim_handle_irq);
 	sim->irq_count = num_irqs;
 
-	return 0;
+	return sim->irq_base;
 }
 EXPORT_SYMBOL_GPL(irq_sim_init);
 
@@ -111,7 +112,8 @@ static void devm_irq_sim_release(struct device *dev, void *res)
  * @sim:        The interrupt simulator object to initialize.
  * @num_irqs:   Number of interrupts to allocate
  *
- * Returns 0 on success and a negative error number on failure.
+ * On success: return the base of the allocated interrupt range.
+ * On failure: a negative errno.
  */
 int devm_irq_sim_init(struct device *dev, struct irq_sim *sim,
 		      unsigned int num_irqs)
@@ -132,7 +134,7 @@ int devm_irq_sim_init(struct device *dev, struct irq_sim *sim,
 	dr->sim = sim;
 	devres_add(dev, dr);
 
-	return 0;
+	return rv;
 }
 EXPORT_SYMBOL_GPL(devm_irq_sim_init);
 
-- 
2.16.1

  parent reply	other threads:[~2018-03-04 12:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-04 12:10 [PATCH 0/3] irq_sim updates for v4.17 Bartosz Golaszewski
2018-03-04 12:10 ` [PATCH 1/3] irq/irq_sim: explicitly pull in slab.h Bartosz Golaszewski
2018-03-09 10:48   ` [tip:irq/core] genirq/irq_sim: Explicitly include slab.h tip-bot for Bartosz Golaszewski
2018-03-04 12:10 ` [PATCH 2/3] irq/irq_sim: modify the return value check for irq_sim_init() Bartosz Golaszewski
2018-03-09 10:49   ` [tip:irq/core] genirq/irq_sim: Check the return value of irq_sim_init() for error codes tip-bot for Bartosz Golaszewski
2018-03-04 12:10 ` Bartosz Golaszewski [this message]
2018-03-09 10:49   ` [tip:irq/core] genirq/irq_sim: Return the base of the irq range from irq_sim_init() tip-bot for Bartosz Golaszewski

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=20180304121018.640-4-brgl@bgdev.pl \
    --to=brgl@bgdev.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=tglx@linutronix.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.