Skip to contentSkip to conversation

powerpc virq: new routine virq_to_hw

PATCH Geoff Levand 3 participants 5 messages Aug 25, 2006 – Aug 29, 2006

lore
Share & tools
lore
#0 lore raw

Ben,

Please consider this accessor routine which hides the details of the map.

---

include/asm-powerpc/irq.h +5 -0
Index: cell--common--4/include/asm-powerpc/irq.h
===================================================================
@@ -136,6 +136,11 @@
 
 extern struct irq_map_entry irq_map[NR_IRQS];
 
+static inline irq_hw_number_t
+virq_to_hw (unsigned int virq)
+{
+	return irq_map[virq].hwirq;
+}
 
 /**
  * irq_alloc_host - Allocate a new irq_host data structure
#1 lore raw
Quoted 13 lines · Geoff Levand

Ben,

Please consider this accessor routine which hides the details of the map.

---
Index: cell--common--4/include/asm-powerpc/irq.h
===================================================================

include/asm-powerpc/irq.h line 143

Quoted 8 lines
include/asm-powerpc/irq.h +5 -0
@@ -136,6 +136,11 @@
 
 extern struct irq_map_entry irq_map[NR_IRQS];
 
+static inline irq_hw_number_t
+virq_to_hw (unsigned int virq)
+{
+	return irq_map[virq].hwirq;
+}

I'd much prefer:

static inline irq_hw_number_t virq_to_hw (unsigned int virq)

{
	return irq_map[virq].hwirq;
}

I've grown to dislike the CR between the return type and the function name (I used to do that too) and it seems that this opinion is shared by Linus (there was an old thread on lkml about it).

Cheers,
Ben.

#2 lore raw
Quoted 10 lines

I'd much prefer:

static inline irq_hw_number_t virq_to_hw (unsigned int virq)

{
	return irq_map[virq].hwirq;
}

I've grown to dislike the CR between the return type and the function name (I used to do that too) and it seems that this opinion is shared by Linus (there was an old thread on lkml about it).

And while we're at it: no space before parenthesis in a function declaration/definition.

Segher

#3 lore raw
In reply to Benjamin Herrenschmidt
Quoted 6 lines · Benjamin Herrenschmidt

I'd much prefer:

static inline irq_hw_number_t virq_to_hw (unsigned int virq)

{
	return irq_map[virq].hwirq;
}

Here is an updated version.

-Geoff

This adds an accessor routine virq_to_hw() to the virq routines which hides the implementation details of the virq to hwirq map.

---

include/asm-powerpc/irq.h +4 -0
Index: cell--common--4/include/asm-powerpc/irq.h
===================================================================
@@ -136,6 +136,10 @@
 
 extern struct irq_map_entry irq_map[NR_IRQS];
 
+static inline irq_hw_number_t virq_to_hw(unsigned int virq)
+{
+	return irq_map[virq].hwirq;
+}
 
 /**
  * irq_alloc_host - Allocate a new irq_host data structure
#4 lore raw
Quoted 13 lines · Geoff Levand
Quoted 6 lines · Benjamin Herrenschmidt

I'd much prefer:

static inline irq_hw_number_t virq_to_hw (unsigned int virq)

{
	return irq_map[virq].hwirq;
}

Here is an updated version.

-Geoff

Quoted 6 lines

This adds an accessor routine virq_to_hw() to the virq routines which hides the implementation details of the virq to hwirq map.

Quoted 16 lines

---
Index: cell--common--4/include/asm-powerpc/irq.h
===================================================================

include/asm-powerpc/irq.h +4 -0
@@ -136,6 +136,10 @@
 
 extern struct irq_map_entry irq_map[NR_IRQS];
 
+static inline irq_hw_number_t virq_to_hw(unsigned int virq)
+{
+	return irq_map[virq].hwirq;
+}
 
 /**
  * irq_alloc_host - Allocate a new irq_host data structure