2019-03-29 23:45:37

by Colin King

[permalink] [raw]
Subject: [PATCH 0/2][V2] scsi: pm8001: clean up code and fix spelling mistakes

From: Colin Ian King <[email protected]>

This is a re-working of an earlier patch; this version splits the
original patch into two parts, one for the code clean up and the
other to fix spelling mistakes.

Colin Ian King (2):
scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is
defined
scsi: pm8001: fix spelling mistake, interupt -> interrupt

drivers/scsi/pm8001/pm8001_hwi.c | 11 ++++++-----
drivers/scsi/pm8001/pm8001_init.c | 4 ++--
drivers/scsi/pm8001/pm8001_sas.h | 2 +-
drivers/scsi/pm8001/pm80xx_hwi.c | 11 ++++++-----
4 files changed, 15 insertions(+), 13 deletions(-)

--
2.20.1



2019-03-29 23:45:24

by Colin King

[permalink] [raw]
Subject: [PATCH 1/2] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined

From: Colin Ian King <[email protected]>

When macro PM8001_USE_MSIX is defined there is redundant dead code
call to pm8001_cr32. Clean this up for the defined PM8001_USE_MSIX and
undefined PM8001_USE_MSIX cases.

Signed-off-by: Colin Ian King <[email protected]>
---
drivers/scsi/pm8001/pm8001_hwi.c | 7 ++++---
drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index e4209091c1da..434498a78946 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -4625,15 +4625,16 @@ static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,

static u32 pm8001_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
{
- u32 value;
#ifdef PM8001_USE_MSIX
return 1;
-#endif
+#else
+ u32 value;
+
value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR);
if (value)
return 1;
return 0;
-
+#endif
}

/**
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 536d2b4384f8..4a176e60307f 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -4619,15 +4619,16 @@ static int pm80xx_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,

static u32 pm80xx_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
{
- u32 value;
#ifdef PM8001_USE_MSIX
return 1;
-#endif
+#else
+ u32 value;
+
value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR);
if (value)
return 1;
return 0;
-
+#endif
}

/**
--
2.20.1


2019-03-29 23:45:31

by Colin King

[permalink] [raw]
Subject: [PATCH 2/2] scsi: pm8001: fix spelling mistake, interupt -> interrupt

From: Colin Ian King <[email protected]>

Rename the functions pm8001_chip_is_our_interupt,
pm80xx_chip_is_our_interupt and function pointer is_our_interrupt
to fix spelling mistakes.

Signed-off-by: Colin Ian King <[email protected]>
---
drivers/scsi/pm8001/pm8001_hwi.c | 4 ++--
drivers/scsi/pm8001/pm8001_init.c | 4 ++--
drivers/scsi/pm8001/pm8001_sas.h | 2 +-
drivers/scsi/pm8001/pm80xx_hwi.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 434498a78946..627075d00918 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -4623,7 +4623,7 @@ static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
return ret;
}

-static u32 pm8001_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
+static u32 pm8001_chip_is_our_interrupt(struct pm8001_hba_info *pm8001_ha)
{
#ifdef PM8001_USE_MSIX
return 1;
@@ -5120,7 +5120,7 @@ const struct pm8001_dispatch pm8001_8001_dispatch = {
.chip_rst = pm8001_hw_chip_rst,
.chip_iounmap = pm8001_chip_iounmap,
.isr = pm8001_chip_isr,
- .is_our_interupt = pm8001_chip_is_our_interupt,
+ .is_our_interrupt = pm8001_chip_is_our_interrupt,
.isr_process_oq = process_oq,
.interrupt_enable = pm8001_chip_interrupt_enable,
.interrupt_disable = pm8001_chip_interrupt_disable,
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index a36060c23b37..3374f553c617 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -201,7 +201,7 @@ static irqreturn_t pm8001_interrupt_handler_msix(int irq, void *opaque)

if (unlikely(!pm8001_ha))
return IRQ_NONE;
- if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha))
+ if (!PM8001_CHIP_DISP->is_our_interrupt(pm8001_ha))
return IRQ_NONE;
#ifdef PM8001_USE_TASKLET
tasklet_schedule(&pm8001_ha->tasklet[irq_vector->irq_id]);
@@ -224,7 +224,7 @@ static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id)
pm8001_ha = sha->lldd_ha;
if (unlikely(!pm8001_ha))
return IRQ_NONE;
- if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha))
+ if (!PM8001_CHIP_DISP->is_our_interrupt(pm8001_ha))
return IRQ_NONE;

#ifdef PM8001_USE_TASKLET
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
index f88b0d33c385..ac6d8e3f22de 100644
--- a/drivers/scsi/pm8001/pm8001_sas.h
+++ b/drivers/scsi/pm8001/pm8001_sas.h
@@ -197,7 +197,7 @@ struct pm8001_dispatch {
int (*chip_ioremap)(struct pm8001_hba_info *pm8001_ha);
void (*chip_iounmap)(struct pm8001_hba_info *pm8001_ha);
irqreturn_t (*isr)(struct pm8001_hba_info *pm8001_ha, u8 vec);
- u32 (*is_our_interupt)(struct pm8001_hba_info *pm8001_ha);
+ u32 (*is_our_interrupt)(struct pm8001_hba_info *pm8001_ha);
int (*isr_process_oq)(struct pm8001_hba_info *pm8001_ha, u8 vec);
void (*interrupt_enable)(struct pm8001_hba_info *pm8001_ha, u8 vec);
void (*interrupt_disable)(struct pm8001_hba_info *pm8001_ha, u8 vec);
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 4a176e60307f..301de40eb708 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -4617,7 +4617,7 @@ static int pm80xx_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
return pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
}

-static u32 pm80xx_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
+static u32 pm80xx_chip_is_our_interrupt(struct pm8001_hba_info *pm8001_ha)
{
#ifdef PM8001_USE_MSIX
return 1;
@@ -4725,7 +4725,7 @@ const struct pm8001_dispatch pm8001_80xx_dispatch = {
.chip_rst = pm80xx_hw_chip_rst,
.chip_iounmap = pm8001_chip_iounmap,
.isr = pm80xx_chip_isr,
- .is_our_interupt = pm80xx_chip_is_our_interupt,
+ .is_our_interrupt = pm80xx_chip_is_our_interrupt,
.isr_process_oq = process_oq,
.interrupt_enable = pm80xx_chip_interrupt_enable,
.interrupt_disable = pm80xx_chip_interrupt_disable,
--
2.20.1


2019-03-30 11:08:53

by walter harms

[permalink] [raw]
Subject: Re: [PATCH 1/2] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined

Am 30.03.2019 00:44, schrieb Colin King:
> From: Colin Ian King <[email protected]>
>
> When macro PM8001_USE_MSIX is defined there is redundant dead code
> call to pm8001_cr32. Clean this up for the defined PM8001_USE_MSIX and
> undefined PM8001_USE_MSIX cases.
>
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> drivers/scsi/pm8001/pm8001_hwi.c | 7 ++++---
> drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++---
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c
> b/drivers/scsi/pm8001/pm8001_hwi.c
> index e4209091c1da..434498a78946 100644
> --- a/drivers/scsi/pm8001/pm8001_hwi.c
> +++ b/drivers/scsi/pm8001/pm8001_hwi.c
> @@ -4625,15 +4625,16 @@ static int pm8001_chip_phy_ctl_req(struct
> pm8001_hba_info *pm8001_ha,
>
> static u32 pm8001_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
> {
> - u32 value;
> #ifdef PM8001_USE_MSIX
> return 1;
> -#endif
> +#else
> + u32 value;
> +
> value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR);
> if (value)
> return 1;
> return 0;
> -
> +#endif
> }
>
> /**
> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c
> b/drivers/scsi/pm8001/pm80xx_hwi.c
> index 536d2b4384f8..4a176e60307f 100644
> --- a/drivers/scsi/pm8001/pm80xx_hwi.c
> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
> @@ -4619,15 +4619,16 @@ static int pm80xx_chip_phy_ctl_req(struct
> pm8001_hba_info *pm8001_ha,
>
> static u32 pm80xx_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
> {
> - u32 value;
> #ifdef PM8001_USE_MSIX
> return 1;
> -#endif
> +#else
> + u32 value;
> +
> value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR);
> if (value)
> return 1;
> return 0;
> -
> +#endif
> }
>
> /**

the ifdef jungle does not make thinks more readable. I am aware that
using neg is also not good but in this special case it seems helpful
to have only one branch, like:

static u32 pm80xx_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
{
#ifndef PM8001_USE_MSIX
u32 value;

value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR);
if (!value)
return 0;
#endif
return 1;

}

just my 2 cents,

re,
wh

2019-03-31 17:45:25

by Jinpu Wang

[permalink] [raw]
Subject: Re: [PATCH 2/2] scsi: pm8001: fix spelling mistake, interupt -> interrupt

On Sat, Mar 30, 2019 at 12:44 AM Colin King <[email protected]> wrote:
>
> From: Colin Ian King <[email protected]>
>
> Rename the functions pm8001_chip_is_our_interupt,
> pm80xx_chip_is_our_interupt and function pointer is_our_interrupt
> to fix spelling mistakes.
>
> Signed-off-by: Colin Ian King <[email protected]>
Thanks, Colin,
Acked-by: Jack Wang <[email protected]>

--
Jack Wang
Linux Kernel Developer

1&1 IONOS Cloud GmbH | Greifswalder Str. 207 | 10405 Berlin | Germany
Phone: +49 30 57700-8042 | Fax: +49 30 57700-8598
E-mail: [email protected] | Web: http://www.ionos.de


Head Office: Berlin, Germany
District Court Berlin Charlottenburg, Registration number: HRB 125506 B
Executive Management: Christoph Steffens, Matthias Steinberg, Achim Weiss

Member of United Internet

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient of this e-mail, you are hereby
notified that saving, distribution or use of the content of this
e-mail in any way is prohibited. If you have received this e-mail in
error, please notify the sender and delete the e-mail.

2019-03-31 17:48:55

by Jinpu Wang

[permalink] [raw]
Subject: Re: [PATCH 1/2] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined

On Sat, Mar 30, 2019 at 12:44 AM Colin King <[email protected]> wrote:
>
> From: Colin Ian King <[email protected]>
>
> When macro PM8001_USE_MSIX is defined there is redundant dead code
> call to pm8001_cr32. Clean this up for the defined PM8001_USE_MSIX and
> undefined PM8001_USE_MSIX cases.
>
> Signed-off-by: Colin Ian King <[email protected]>
Thanks, Colin,
Acked-by: Jack Wang <[email protected]>
> ---
> drivers/scsi/pm8001/pm8001_hwi.c | 7 ++++---
> drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++---
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
> index e4209091c1da..434498a78946 100644
> --- a/drivers/scsi/pm8001/pm8001_hwi.c
> +++ b/drivers/scsi/pm8001/pm8001_hwi.c
> @@ -4625,15 +4625,16 @@ static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
>
> static u32 pm8001_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
> {
> - u32 value;
> #ifdef PM8001_USE_MSIX
> return 1;
> -#endif
> +#else
> + u32 value;
> +
> value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR);
> if (value)
> return 1;
> return 0;
> -
> +#endif
> }
>
> /**
> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
> index 536d2b4384f8..4a176e60307f 100644
> --- a/drivers/scsi/pm8001/pm80xx_hwi.c
> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
> @@ -4619,15 +4619,16 @@ static int pm80xx_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
>
> static u32 pm80xx_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
> {
> - u32 value;
> #ifdef PM8001_USE_MSIX
> return 1;
> -#endif
> +#else
> + u32 value;
> +
> value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR);
> if (value)
> return 1;
> return 0;
> -
> +#endif
> }
>
> /**
> --
> 2.20.1
>


--
Jack Wang
Linux Kernel Developer

1&1 IONOS Cloud GmbH | Greifswalder Str. 207 | 10405 Berlin | Germany
Phone: +49 30 57700-8042 | Fax: +49 30 57700-8598
E-mail: [email protected] | Web: http://www.ionos.de


Head Office: Berlin, Germany
District Court Berlin Charlottenburg, Registration number: HRB 125506 B
Executive Management: Christoph Steffens, Matthias Steinberg, Achim Weiss

Member of United Internet

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient of this e-mail, you are hereby
notified that saving, distribution or use of the content of this
e-mail in any way is prohibited. If you have received this e-mail in
error, please notify the sender and delete the e-mail.

2019-03-31 17:50:19

by Jinpu Wang

[permalink] [raw]
Subject: Re: [PATCH 1/2] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined

On Sat, Mar 30, 2019 at 12:07 PM Walter Harms <[email protected]> wrote:
>
> the ifdef jungle does not make thinks more readable. I am aware that
> using neg is also not good but in this special case it seems helpful
> to have only one branch, like:
>
> static u32 pm80xx_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
> {
> #ifndef PM8001_USE_MSIX
> u32 value;
>
> value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR);
> if (!value)
> return 0;
> #endif
> return 1;
>
> }
>
> just my 2 cents,
>
> re,
> wh

Both version looks good to me, I've acked Colin's version.

Thanks!

--
Jack Wang
Linux Kernel Developer

1&1 IONOS Cloud GmbH | Greifswalder Str. 207 | 10405 Berlin | Germany
Phone: +49 30 57700-8042 | Fax: +49 30 57700-8598
E-mail: [email protected] | Web: http://www.ionos.de


Head Office: Berlin, Germany
District Court Berlin Charlottenburg, Registration number: HRB 125506 B
Executive Management: Christoph Steffens, Matthias Steinberg, Achim Weiss

Member of United Internet

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient of this e-mail, you are hereby
notified that saving, distribution or use of the content of this
e-mail in any way is prohibited. If you have received this e-mail in
error, please notify the sender and delete the e-mail.

2019-04-04 03:16:16

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH 0/2][V2] scsi: pm8001: clean up code and fix spelling mistakes


Colin,

> This is a re-working of an earlier patch; this version splits the
> original patch into two parts, one for the code clean up and the other
> to fix spelling mistakes.

Applied to 5.2/scsi-queue, thanks.

--
Martin K. Petersen Oracle Linux Engineering