linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* powerpc virq: new routine virq_to_hw
@ 2006-08-25 23:02 Geoff Levand
  2006-08-28  1:22 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Geoff Levand @ 2006-08-25 23:02 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Ben,

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

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>

---
Index: cell--common--4/include/asm-powerpc/irq.h
===================================================================
--- cell--common--4.orig/include/asm-powerpc/irq.h
+++ 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc virq: new routine virq_to_hw
  2006-08-25 23:02 powerpc virq: new routine virq_to_hw Geoff Levand
@ 2006-08-28  1:22 ` Benjamin Herrenschmidt
  2006-08-28  7:16   ` Segher Boessenkool
  2006-08-28 15:03   ` Geoff Levand
  0 siblings, 2 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2006-08-28  1:22 UTC (permalink / raw)
  To: Geoff Levand; +Cc: linuxppc-dev

On Fri, 2006-08-25 at 16:02 -0700, Geoff Levand wrote:
> Ben,
> 
> Please consider this accessor routine which hides the details
> of the map.
> 
> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
> 
> ---
> Index: cell--common--4/include/asm-powerpc/irq.h
> ===================================================================
> --- cell--common--4.orig/include/asm-powerpc/irq.h
> +++ 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;
> +}

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc virq: new routine virq_to_hw
  2006-08-28  1:22 ` Benjamin Herrenschmidt
@ 2006-08-28  7:16   ` Segher Boessenkool
  2006-08-28 15:03   ` Geoff Levand
  1 sibling, 0 replies; 5+ messages in thread
From: Segher Boessenkool @ 2006-08-28  7:16 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc virq: new routine virq_to_hw
  2006-08-28  1:22 ` Benjamin Herrenschmidt
  2006-08-28  7:16   ` Segher Boessenkool
@ 2006-08-28 15:03   ` Geoff Levand
  2006-08-29 22:36     ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 5+ messages in thread
From: Geoff Levand @ 2006-08-28 15:03 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> 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.


Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>

---
Index: cell--common--4/include/asm-powerpc/irq.h
===================================================================
--- cell--common--4.orig/include/asm-powerpc/irq.h
+++ 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc virq: new routine virq_to_hw
  2006-08-28 15:03   ` Geoff Levand
@ 2006-08-29 22:36     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2006-08-29 22:36 UTC (permalink / raw)
  To: Geoff Levand; +Cc: linuxppc-dev

On Mon, 2006-08-28 at 08:03 -0700, Geoff Levand wrote:
> Benjamin Herrenschmidt wrote:
> > 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.
> 
> 
> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
> Index: cell--common--4/include/asm-powerpc/irq.h
> ===================================================================
> --- cell--common--4.orig/include/asm-powerpc/irq.h
> +++ 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-08-29 22:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-25 23:02 powerpc virq: new routine virq_to_hw Geoff Levand
2006-08-28  1:22 ` Benjamin Herrenschmidt
2006-08-28  7:16   ` Segher Boessenkool
2006-08-28 15:03   ` Geoff Levand
2006-08-29 22:36     ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).