From: Walter Harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
Cc: Jack Wang <jinpu.wang@profitbricks.com>,
lindar_liu@usish.com,
"James E . J . Bottomley" <jejb@linux.ibm.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined
Date: Sat, 30 Mar 2019 12:07:51 +0100 (CET) [thread overview]
Message-ID: <822122908.274859.1553944071609@ox-groupware.bfs.de> (raw)
Am 30.03.2019 00:44, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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 <colin.king@canonical.com>
> ---
> 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
next reply other threads:[~2019-03-30 11:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-30 11:07 Walter Harms [this message]
2019-03-31 17:49 ` Jinpu Wang
-- strict thread matches above, loose matches on Subject: below --
2019-03-29 23:44 [PATCH 0/2][V2] scsi: pm8001: clean up code and fix spelling mistakes Colin King
2019-03-29 23:44 ` [PATCH 1/2] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined Colin King
2019-03-31 17:47 ` Jinpu Wang
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=822122908.274859.1553944071609@ox-groupware.bfs.de \
--to=wharms@bfs.de \
--cc=colin.king@canonical.com \
--cc=jejb@linux.ibm.com \
--cc=jinpu.wang@profitbricks.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lindar_liu@usish.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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®