Re: [PATCH 9/9] drivers: staging: rtl8187se: refactor wmm_param_update

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

 



On Sat, Mar 01, 2014 at 10:22:53PM -0700, Axel Rasmussen wrote:
> The function rtl8180_wmm_param_update contained two blocks of code which
> were nearly identical. This patch combines those two blocks into a
> single function, to reduce code duplication, and do fix some
> checkpatch.pl warnings about excessively long lines due to the large
> number of indents that were needed for the original blocks of code.
> 
> Signed-off-by: Axel Rasmussen <axel.rasmussen1@xxxxxxxxx>
> ---
>  drivers/staging/rtl8187se/r8180_core.c | 119 ++++++++++++++-------------------
>  1 file changed, 49 insertions(+), 70 deletions(-)
> 
> diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
> index b6fdb6f..fc5d4d9 100644
> --- a/drivers/staging/rtl8187se/r8180_core.c
> +++ b/drivers/staging/rtl8187se/r8180_core.c
> @@ -2114,16 +2114,49 @@ static void rtl8180_hw_sleep(struct net_device *dev, u32 th, u32 tl)
>  	spin_unlock_irqrestore(&priv->ps_lock, flags);
>  }
>  
> +static void rtl8180_wmm_single_param_update(struct net_device *dev,
> +	u8 mode, AC_CODING eACI, PAC_PARAM param)
> +{
> +	u8 u1bAIFS;
> +	u32 u4bAcParam;
> +
> +	/* Retrieve parameters to update. */
> +	/* Mode G/A: slotTimeTimer = 9; Mode B: 20 */
> +	u1bAIFS = param->f.AciAifsn.f.AIFSN * ((mode & IEEE_G) == IEEE_G ?
> +		9 : 20) + aSifsTime;
> +	u4bAcParam = (((u32)param->f.TXOPLimit << AC_PARAM_TXOP_LIMIT_OFFSET) |
> +		((u32)param->f.Ecw.f.ECWmax << AC_PARAM_ECW_MAX_OFFSET) |
> +		((u32)param->f.Ecw.f.ECWmin << AC_PARAM_ECW_MIN_OFFSET) |
> +		((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET));
> +
> +	switch (eACI) {
> +	case AC1_BK:
> +		write_nic_dword(dev, AC_BK_PARAM, u4bAcParam);
> +		break;
> +	case AC0_BE:
> +		write_nic_dword(dev, AC_BE_PARAM, u4bAcParam);
> +		break;
> +	case AC2_VI:
> +		write_nic_dword(dev, AC_VI_PARAM, u4bAcParam);
> +		break;
> +	case AC3_VO:
> +		write_nic_dword(dev, AC_VO_PARAM, u4bAcParam);
> +		break;
> +	default:
> +		pr_warn("SetHwReg8185(): invalid ACI: %d!\n", eACI);
> +	break;

Missing tab here.  Anyway, just swap all the break statements for
returns.

regards,
dan carpenter

> +	}
> +}
> +

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux