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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 30.03.2019 00:44, schrieb Colin King:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxx>
> ---
>  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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux