Re: [PATCH] rtl8188eu: unused macros read_next_pair removed, ARRAY_SIZE instead of sizeof/sizeof inserted

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

 



On Wed, Oct 07, 2015 at 11:01:00PM +0700, Ivan Safonov wrote:
> Some rtl8188eu driver cleanups:
>   Unused macros read_next_pair removed
>   ARRAY_SIZE instead of sizeof/sizeof inserted
>   Some checkpath fixes

Please split into three different patches, each one doing one logical
change.

> 
> Signed-off-by: Ivan Safonov <insafonov@xxxxxxxxx>
> ---
>  drivers/staging/rtl8188eu/hal/bb_cfg.c | 30 +++++++++++-------------------
>  1 file changed, 11 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c b/drivers/staging/rtl8188eu/hal/bb_cfg.c
> index 9c7e626..5cd8384 100644
> --- a/drivers/staging/rtl8188eu/hal/bb_cfg.c
> +++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c
> @@ -22,14 +22,6 @@
>  
>  #include <phy.h>
>  
> -#define read_next_pair(array, v1, v2, i)		\
> -	 do {						\
> -		i += 2;					\
> -		v1 = array[i];				\
> -		v2 = array[i+1];			\
> -	 } while (0)
> -
> -
>  /* AGC_TAB_1T.TXT */
>  
>  static u32 array_agc_tab_1t_8188e[] = {
> @@ -166,12 +158,12 @@ static u32 array_agc_tab_1t_8188e[] = {
>  static bool set_baseband_agc_config(struct adapter *adapt)
>  {
>  	u32 i;
> -	u32 arraylen = sizeof(array_agc_tab_1t_8188e)/sizeof(u32);
> -	u32 *array = array_agc_tab_1t_8188e;
> +	const u32 arraylen = ARRAY_SIZE(array_agc_tab_1t_8188e);
> +	const u32 * const array = array_agc_tab_1t_8188e;

And constifying these variables may be even the fourth patch...

>  
>  	for (i = 0; i < arraylen; i += 2) {
>  		u32 v1 = array[i];
> -		u32 v2 = array[i+1];
> +		u32 v2 = array[i + 1];
>  
>  		if (v1 < 0xCDCDCDCD) {
>  			phy_set_bb_reg(adapt, v1, bMaskDWord, v2);
> @@ -401,12 +393,12 @@ static void rtl_bb_delay(struct adapter *adapt, u32 addr, u32 data)
>  static bool set_baseband_phy_config(struct adapter *adapt)
>  {
>  	u32 i;
> -	u32 arraylen = sizeof(array_phy_reg_1t_8188e)/sizeof(u32);
> -	u32 *array = array_phy_reg_1t_8188e;
> +	const u32 arraylen = ARRAY_SIZE(array_phy_reg_1t_8188e);
> +	const u32 * const array = array_phy_reg_1t_8188e;
>  
>  	for (i = 0; i < arraylen; i += 2) {
>  		u32 v1 = array[i];
> -		u32 v2 = array[i+1];
> +		u32 v2 = array[i + 1];
>  
>  		if (v1 < 0xCDCDCDCD)
>  			rtl_bb_delay(adapt, v1, v2);
> @@ -582,14 +574,14 @@ static void rtl_addr_delay(struct adapter *adapt,
>  
>  static bool config_bb_with_pgheader(struct adapter *adapt)
>  {
> -	u32 i = 0;
> -	u32 arraylen = sizeof(array_phy_reg_pg_8188e) / sizeof(u32);
> -	u32 *array = array_phy_reg_pg_8188e;
> +	u32 i;
> +	const u32 arraylen = ARRAY_SIZE(array_phy_reg_pg_8188e);
> +	const u32 * const array = array_phy_reg_pg_8188e;
>  
>  	for (i = 0; i < arraylen; i += 3) {
>  		u32 v1 = array[i];
> -		u32 v2 = array[i+1];
> -		u32 v3 = array[i+2];
> +		u32 v2 = array[i + 1];
> +		u32 v3 = array[i + 2];
>  
>  		if (v1 < 0xCDCDCDCD)
>  			rtl_addr_delay(adapt, v1, v2, v3);
> -- 
> 2.4.9

--
Sincerely yours,
Mike.
_______________________________________________
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