Re: [PATCH] staging: wilc1000: Fixes Alignment should match open parenthesis

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

 



On Sat, 2017-04-22 at 07:28 +0100, richard@xxxxxxxxxxx wrote:
> This patch fixes the following checkpatch.pl
> check: CHECK: Alignment should match open parenthesis

Please strive for improved code for human readers and
not just shutting up checkpatch.

> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
[]
> @@ -870,12 +870,12 @@ static int wilc_mac_open(struct net_device *ndev)
>  				if (memcmp(wl->vif[i ^ 1]->bssid,
>  					   wl->vif[i ^ 1]->src_addr, 6))
>  					wilc_set_wfi_drv_handler(vif,
> -							 wilc_get_vif_idx(vif),
> -							 0);
> +					                         wilc_get_vif_idx(vif),
> +					                         0);
>  				else
>  					wilc_set_wfi_drv_handler(vif,
> -							 wilc_get_vif_idx(vif),
> -							 1);
> +					                         wilc_get_vif_idx(vif),
> +					                         1);

Depending on alignment, perhaps a good bit of this code
could use ether_addr_<foo> functions.

				wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
							 ether_addr_equals(wl->vif[i ^ 1]->bssid,
									   wl->vif[i ^ 1]->src_addr));

The code could also be restructured to reduce
indentation by using if / continue;

		if (ndev != wl->vif[i]->ndev)
			continue;

Using a temporary for the repeated use of
wilc_get_vif_idx(vif) would also help code length.

> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
[]
> @@ -1301,16 +1301,16 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
>  
>  	for (i = 0; i < priv->pmkid_list.numpmkid; i++)	{
>  		if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid,
> -				 ETH_ALEN)) {
> +		            ETH_ALEN)) {

		ether_addr_equals()

>  			flag = PMKID_FOUND;
>  			break;
>  		}
>  	}
>  	if (i < WILC_MAX_NUM_PMKIDS) {
>  		memcpy(priv->pmkid_list.pmkidlist[i].bssid, pmksa->bssid,
> -			    ETH_ALEN);
> +		       ETH_ALEN);

		ether_addr_copy()

etc.

_______________________________________________
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