linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: mach-iop32x: iq31244: Replace if-then-else with a switch statement
@ 2013-09-02 15:23 Valentin Ilie
  2013-09-29 15:19 ` Valentin Ilie
  0 siblings, 1 reply; 3+ messages in thread
From: Valentin Ilie @ 2013-09-02 15:23 UTC (permalink / raw)
  To: linux-arm-kernel

Convert a compound if-else blob to a switch statement.

Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
---
 arch/arm/mach-iop32x/iq31244.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c
index f2cd296..3415f11 100644
--- a/arch/arm/mach-iop32x/iq31244.c
+++ b/arch/arm/mach-iop32x/iq31244.c
@@ -101,28 +101,21 @@ void __init iq31244_map_io(void)
 static int __init
 ep80219_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 {
-	int irq;
-
-	if (slot == 0) {
-		/* CFlash */
-		irq = IRQ_IOP32X_XINT1;
-	} else if (slot == 1) {
-		/* 82551 Pro 100 */
-		irq = IRQ_IOP32X_XINT0;
-	} else if (slot == 2) {
-		/* PCI-X Slot */
-		irq = IRQ_IOP32X_XINT3;
-	} else if (slot == 3) {
-		/* SATA */
-		irq = IRQ_IOP32X_XINT2;
-	} else {
+	switch (slot) {
+	case 0: /* CFlash */
+		return IRQ_IOP32X_XINT1;
+	case 1: /* 82551 Pro 100 */
+		return IRQ_IOP32X_XINT0;
+	case 2: /* PCI-X Slot */
+		return IRQ_IOP32X_XINT3;
+	case 3: /* SATA */
+		return IRQ_IOP32X_XINT2;
+	default:
 		printk(KERN_ERR "ep80219_pci_map_irq() called for unknown "
 			"device PCI:%d:%d:%d\n", dev->bus->number,
 			PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
-		irq = -1;
+		return -1;
 	}
-
-	return irq;
 }
 
 static struct hw_pci ep80219_pci __initdata = {
-- 
1.8.1.2

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

* [PATCH] ARM: mach-iop32x: iq31244: Replace if-then-else with a switch statement
  2013-09-02 15:23 [PATCH] ARM: mach-iop32x: iq31244: Replace if-then-else with a switch statement Valentin Ilie
@ 2013-09-29 15:19 ` Valentin Ilie
  2013-10-02 20:23   ` Russell King - ARM Linux
  0 siblings, 1 reply; 3+ messages in thread
From: Valentin Ilie @ 2013-09-29 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

On 2 September 2013 18:23, Valentin Ilie <valentin.ilie@gmail.com> wrote:
> Convert a compound if-else blob to a switch statement.
>
> Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
> ---
>  arch/arm/mach-iop32x/iq31244.c | 29 +++++++++++------------------
>  1 file changed, 11 insertions(+), 18 deletions(-)
>
> diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c
> index f2cd296..3415f11 100644
> --- a/arch/arm/mach-iop32x/iq31244.c
> +++ b/arch/arm/mach-iop32x/iq31244.c
> @@ -101,28 +101,21 @@ void __init iq31244_map_io(void)
>  static int __init
>  ep80219_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
>  {
> -       int irq;
> -
> -       if (slot == 0) {
> -               /* CFlash */
> -               irq = IRQ_IOP32X_XINT1;
> -       } else if (slot == 1) {
> -               /* 82551 Pro 100 */
> -               irq = IRQ_IOP32X_XINT0;
> -       } else if (slot == 2) {
> -               /* PCI-X Slot */
> -               irq = IRQ_IOP32X_XINT3;
> -       } else if (slot == 3) {
> -               /* SATA */
> -               irq = IRQ_IOP32X_XINT2;
> -       } else {
> +       switch (slot) {
> +       case 0: /* CFlash */
> +               return IRQ_IOP32X_XINT1;
> +       case 1: /* 82551 Pro 100 */
> +               return IRQ_IOP32X_XINT0;
> +       case 2: /* PCI-X Slot */
> +               return IRQ_IOP32X_XINT3;
> +       case 3: /* SATA */
> +               return IRQ_IOP32X_XINT2;
> +       default:
>                 printk(KERN_ERR "ep80219_pci_map_irq() called for unknown "
>                         "device PCI:%d:%d:%d\n", dev->bus->number,
>                         PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
> -               irq = -1;
> +               return -1;
>         }
> -
> -       return irq;
>  }
>
>  static struct hw_pci ep80219_pci __initdata = {
> --
> 1.8.1.2
>

Can someone look into this?

-- 
Valentin Ilie

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

* [PATCH] ARM: mach-iop32x: iq31244: Replace if-then-else with a switch statement
  2013-09-29 15:19 ` Valentin Ilie
@ 2013-10-02 20:23   ` Russell King - ARM Linux
  0 siblings, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux @ 2013-10-02 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Sep 29, 2013 at 06:19:28PM +0300, Valentin Ilie wrote:
> On 2 September 2013 18:23, Valentin Ilie <valentin.ilie@gmail.com> wrote:
> > Convert a compound if-else blob to a switch statement.
> >
> > Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
> > ---
> >  arch/arm/mach-iop32x/iq31244.c | 29 +++++++++++------------------
> >  1 file changed, 11 insertions(+), 18 deletions(-)
> >
> > diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c
> > index f2cd296..3415f11 100644
> > --- a/arch/arm/mach-iop32x/iq31244.c
> > +++ b/arch/arm/mach-iop32x/iq31244.c
> > @@ -101,28 +101,21 @@ void __init iq31244_map_io(void)
> >  static int __init
> >  ep80219_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
> >  {
> > -       int irq;
> > -
> > -       if (slot == 0) {
> > -               /* CFlash */
> > -               irq = IRQ_IOP32X_XINT1;
> > -       } else if (slot == 1) {
> > -               /* 82551 Pro 100 */
> > -               irq = IRQ_IOP32X_XINT0;
> > -       } else if (slot == 2) {
> > -               /* PCI-X Slot */
> > -               irq = IRQ_IOP32X_XINT3;
> > -       } else if (slot == 3) {
> > -               /* SATA */
> > -               irq = IRQ_IOP32X_XINT2;
> > -       } else {
> > +       switch (slot) {
> > +       case 0: /* CFlash */
> > +               return IRQ_IOP32X_XINT1;
> > +       case 1: /* 82551 Pro 100 */
> > +               return IRQ_IOP32X_XINT0;
> > +       case 2: /* PCI-X Slot */
> > +               return IRQ_IOP32X_XINT3;
> > +       case 3: /* SATA */
> > +               return IRQ_IOP32X_XINT2;
> > +       default:
> >                 printk(KERN_ERR "ep80219_pci_map_irq() called for unknown "
> >                         "device PCI:%d:%d:%d\n", dev->bus->number,
> >                         PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
> > -               irq = -1;
> > +               return -1;
> >         }
> > -
> > -       return irq;
> >  }
> >
> >  static struct hw_pci ep80219_pci __initdata = {
> > --
> > 1.8.1.2
> >
> 
> Can someone look into this?

The fact that no one has responded suggests that there is no current
maintainer for this.  It's far better to leave the code as-is because
we know that _that_ used to work fine.  Changing it even for cleanups
means that the replacement code has not been exercised on real hardware
and risks regressions.

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

end of thread, other threads:[~2013-10-02 20:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-02 15:23 [PATCH] ARM: mach-iop32x: iq31244: Replace if-then-else with a switch statement Valentin Ilie
2013-09-29 15:19 ` Valentin Ilie
2013-10-02 20:23   ` Russell King - ARM Linux

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).