public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: richard@netpro.work, gregkh@linuxfoundation.org
Cc: linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: wilc1000: Fixes Alignment should match open parenthesis
Date: Sat, 22 Apr 2017 08:00:34 -0700	[thread overview]
Message-ID: <1492873234.30293.38.camel@perches.com> (raw)
In-Reply-To: <20170422062830.30715-1-richard@netpro.work>

On Sat, 2017-04-22 at 07:28 +0100, richard@netpro.work 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.

      reply	other threads:[~2017-04-22 15:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-22  6:28 [PATCH] staging: wilc1000: Fixes Alignment should match open parenthesis richard
2017-04-22 15:00 ` Joe Perches [this message]

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=1492873234.30293.38.camel@perches.com \
    --to=joe@perches.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=richard@netpro.work \
    /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