All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Philippe Gerum <rpm@xenomai.org>
Cc: xenomai@xenomai.org
Subject: [PATCH v2 4/6] ipipe: Let ipipe_enable_irq return an error code
Date: Thu, 11 Jul 2019 21:56:15 +0200	[thread overview]
Message-ID: <9ab38b7eb54ba7c27d4191da667f39737e25c9e9.1562874977.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1562874977.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1562874977.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

It's time to let ipipe_enable_irq return a proper error as it will gain
another function that may fail. Drop the WARN_ON_ONCE in favor of that.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/linux/ipipe.h |  2 +-
 kernel/irq/chip.c     | 12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
index b8a80eeade4f..f7c07a207093 100644
--- a/include/linux/ipipe.h
+++ b/include/linux/ipipe.h
@@ -475,7 +475,7 @@ static inline struct ipipe_threadinfo *ipipe_current_threadinfo(void)
 
 #define ipipe_task_threadinfo(p) (&task_thread_info(p)->ipipe_data)
 
-void ipipe_enable_irq(unsigned int irq);
+int ipipe_enable_irq(unsigned int irq);
 
 static inline void ipipe_disable_irq(unsigned int irq)
 {
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 6c279e065879..65d345b727be 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -1082,7 +1082,7 @@ __fixup_irq_handler(struct irq_desc *desc, irq_flow_handler_t handle, int is_cha
 	return handle;
 }
 
-void ipipe_enable_irq(unsigned int irq)
+int ipipe_enable_irq(unsigned int irq)
 {
 	struct irq_desc *desc;
 	struct irq_chip *chip;
@@ -1090,7 +1090,7 @@ void ipipe_enable_irq(unsigned int irq)
 
 	desc = irq_to_desc(irq);
 	if (desc == NULL)
-		return;
+		return -EINVAL;
 
 	chip = irq_desc_get_chip(desc);
 
@@ -1105,16 +1105,18 @@ void ipipe_enable_irq(unsigned int irq)
 		}
 		raw_spin_unlock_irqrestore(&desc->lock, flags);
 
-		return;
+		return 0;
 	}
 
-	if (WARN_ON_ONCE(chip->irq_enable == NULL && chip->irq_unmask == NULL))
-		return;
+	if (chip->irq_enable == NULL && chip->irq_unmask == NULL)
+		return -ENOSYS;
 
 	if (chip->irq_enable)
 		chip->irq_enable(&desc->irq_data);
 	else
 		chip->irq_unmask(&desc->irq_data);
+
+	return 0;
 }
 EXPORT_SYMBOL_GPL(ipipe_enable_irq);
 
-- 
2.16.4



  parent reply	other threads:[~2019-07-11 19:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 19:56 [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 1/6] ipipe: Restore trace_hardirqs_on_virt_caller Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 2/6] ipipe: lockdep: Remove duplicate context checks Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 3/6] ipipe: Add missing include for ipipe_root_only Jan Kiszka
2019-07-11 19:56 ` Jan Kiszka [this message]
2019-07-11 19:56 ` [PATCH v2 5/6] ipipe: Activate IRQ in ipipe_enable_irq Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 6/6] ipipe: Let ipipe_set_irq_affinity return an error Jan Kiszka
2019-07-23 16:39 ` [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Philippe Gerum

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=9ab38b7eb54ba7c27d4191da667f39737e25c9e9.1562874977.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.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.