mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lennert Buytenhek <buytenh@wantstofly.org>
To: Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org
Subject: [PATCH] genirq: Provide reverse compat handling for irq_chip methods.
Date: Tue, 30 Nov 2010 13:08:13 +0100	[thread overview]
Message-ID: <20101130120813.GR12037@mail.wantstofly.org> (raw)

kernel/irq/chip.c provides compat wrappers for when users of the
new-style (->irq_foo()) irq_chip methods try to call into irq_chips
that provide only old-style (->foo()) methods, but doesn't currently
provide compatibility in the other direction.

As there exist chained irq flow handlers outside kernel/irq/ that have
not been converted over to call the new methods yet, this means that
the irq_chips that they are chained off can't be converted to the new
methods yet.

This patch adds reverse compat wrappers, so that old-style flow
handlers can call into new-style irq_chips, too, and the flow handlers
and irq_chips can be converted to the new API independently.

Signed-off-by: Lennert Buytenhek <buytenh@secretlab.ca>
---
 kernel/irq/chip.c |  142 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 138 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index baa5c4a..9a73b0e 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -298,15 +298,106 @@ static int compat_irq_retrigger(struct irq_data *data)
 	return data->chip->retrigger(data->irq);
 }
 
-static void compat_bus_lock(struct irq_data *data)
+static void compat_irq_bus_lock(struct irq_data *data)
 {
 	data->chip->bus_lock(data->irq);
 }
 
-static void compat_bus_sync_unlock(struct irq_data *data)
+static void compat_irq_bus_sync_unlock(struct irq_data *data)
 {
 	data->chip->bus_sync_unlock(data->irq);
 }
+
+/* And the other way around */
+static void compat_mask(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	data->chip->irq_mask(data);
+}
+
+static void compat_unmask(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	data->chip->irq_unmask(data);
+}
+
+static void compat_ack(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	data->chip->irq_ack(data);
+}
+
+static void compat_mask_ack(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	data->chip->irq_mask_ack(data);
+}
+
+static void compat_eoi(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	data->chip->irq_eoi(data);
+}
+
+static void compat_enable(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	data->chip->irq_enable(data);
+}
+
+static void compat_disable(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	data->chip->irq_disable(data);
+}
+
+static void compat_shutdown(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	data->chip->irq_shutdown(data);
+}
+
+static unsigned int compat_startup(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	return data->chip->irq_startup(data);
+}
+
+static int compat_set_affinity(unsigned int irq, const struct cpumask *dest)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	return data->chip->irq_set_affinity(data, dest, 0);
+}
+
+static int compat_set_type(unsigned int irq, unsigned int type)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	return data->chip->irq_set_type(data, type);
+}
+
+static int compat_set_wake(unsigned int irq, unsigned int on)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	return data->chip->irq_set_wake(data, on);
+}
+
+static int compat_retrigger(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	return data->chip->irq_retrigger(data);
+}
+
+static void compat_bus_lock(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	data->chip->irq_bus_lock(data);
+}
+
+static void compat_bus_sync_unlock(unsigned int irq)
+{
+	struct irq_data *data = irq_get_irq_data(irq);
+	data->chip->irq_bus_sync_unlock(data);
+}
 #endif
 
 /*
@@ -321,12 +412,23 @@ void irq_chip_set_defaults(struct irq_chip *chip)
 	 */
 	if (chip->enable)
 		chip->irq_enable = compat_irq_enable;
+	else if (chip->irq_enable)
+		chip->enable = compat_enable;
+
 	if (chip->disable)
 		chip->irq_disable = compat_irq_disable;
+	else if (chip->irq_disable)
+		chip->disable = compat_disable;
+
 	if (chip->shutdown)
 		chip->irq_shutdown = compat_irq_shutdown;
+	else if (chip->irq_shutdown)
+		chip->shutdown = compat_shutdown;
+
 	if (chip->startup)
 		chip->irq_startup = compat_irq_startup;
+	else if (chip->irq_startup)
+		chip->startup = compat_startup;
 #endif
 	/*
 	 * The real defaults
@@ -355,27 +457,59 @@ void irq_chip_set_defaults(struct irq_chip *chip)
 	 * Now fix up the remaining compat handlers
 	 */
 	if (chip->bus_lock)
-		chip->irq_bus_lock = compat_bus_lock;
+		chip->irq_bus_lock = compat_irq_bus_lock;
+	else if (chip->irq_bus_lock)
+		chip->bus_lock = compat_bus_lock;
+
 	if (chip->bus_sync_unlock)
-		chip->irq_bus_sync_unlock = compat_bus_sync_unlock;
+		chip->irq_bus_sync_unlock = compat_irq_bus_sync_unlock;
+	else if (chip->irq_bus_sync_unlock)
+		chip->bus_sync_unlock = compat_bus_sync_unlock;
+
 	if (chip->mask)
 		chip->irq_mask = compat_irq_mask;
+	else if (chip->irq_mask)
+		chip->mask = compat_mask;
+
 	if (chip->unmask)
 		chip->irq_unmask = compat_irq_unmask;
+	else if (chip->irq_unmask)
+		chip->unmask = compat_unmask;
+
 	if (chip->ack)
 		chip->irq_ack = compat_irq_ack;
+	else if (chip->irq_ack)
+		chip->ack = compat_ack;
+
 	if (chip->mask_ack)
 		chip->irq_mask_ack = compat_irq_mask_ack;
+	else if (chip->irq_mask_ack)
+		chip->mask_ack = compat_mask_ack;
+
 	if (chip->eoi)
 		chip->irq_eoi = compat_irq_eoi;
+	else if (chip->irq_eoi)
+		chip->eoi = compat_eoi;
+
 	if (chip->set_affinity)
 		chip->irq_set_affinity = compat_irq_set_affinity;
+	else if (chip->irq_set_affinity)
+		chip->set_affinity = compat_set_affinity;
+
 	if (chip->set_type)
 		chip->irq_set_type = compat_irq_set_type;
+	else if (chip->irq_set_type)
+		chip->set_type = compat_set_type;
+
 	if (chip->set_wake)
 		chip->irq_set_wake = compat_irq_set_wake;
+	else if (chip->irq_set_wake)
+		chip->set_wake = compat_set_wake;
+
 	if (chip->retrigger)
 		chip->irq_retrigger = compat_irq_retrigger;
+	else if (chip->irq_retrigger)
+		chip->retrigger = compat_retrigger;
 #endif
 }
 
-- 
1.7.1

             reply	other threads:[~2010-11-30 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-30 12:08 Lennert Buytenhek [this message]
2010-12-01  2:46 ` Yong Zhang
2010-12-01 10:28 ` Thomas Gleixner

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=20101130120813.GR12037@mail.wantstofly.org \
    --to=buytenh@wantstofly.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®