mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jake Edge <jake@edge2.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jade Bilkey <herself@thefumon.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] staging: fix bcm/hostmibs.c checkpatch problems
Date: Sun, 23 Mar 2014 10:45:09 -0700	[thread overview]
Message-ID: <1395596709.13968.30.camel@joe-AO722> (raw)
In-Reply-To: <20140322095044.5d4d5ed6@quetzal.lan>

On Sat, 2014-03-22 at 09:50 -0600, Jake Edge wrote:
> Fix 4 checkpatch errors, many warnings in bcm/hostmibs.c

Making code checkpatch clean shouldn't be the primary goal here.

Removing uses of Hungarian-style notation, CamelCase naming, and
long variable names would be more helpful overall.

> diff --git a/drivers/staging/bcm/hostmibs.c b/drivers/staging/bcm/hostmibs.c
[]
> @@ -9,27 +9,32 @@
[]
> -INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter, struct bcm_host_stats_mibs *pstHostMibs)
> +INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
> +		       struct bcm_host_stats_mibs *pstHostMibs)
[]
> -	struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *) &Adapter->stBCMPhsContext;
> +	struct bcm_phs_extension *pDeviceExtension =
> +			(struct bcm_phs_extension *) &Adapter->stBCMPhsContext;

btw: this cast is  unnecessary.
&Adapter->stBCMPhsContext is a (struct bcm_phs_extension *)
 
> -	UINT nClassifierIndex = 0, nPhsTableIndex = 0, nSfIndex = 0, uiIndex = 0;
> +	UINT nClassifierIndex = 0, nPhsTableIndex = 0,
> +						nSfIndex = 0, uiIndex = 0;

Using one initializer per line is generally better.
 
[]

> 	/* Copy the classifier Table */
> -	for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS; nClassifierIndex++) {
> +	for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS;
> +							nClassifierIndex++) {
>  		if (Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE)
> -			memcpy((PVOID) &pstHostMibs->
> +			memcpy((PVOID)&pstHostMibs->
>  			       astClassifierTable[nClassifierIndex],
> -			       (PVOID) &Adapter->
> +			       (PVOID)&Adapter->
>  			       astClassifierTable[nClassifierIndex],
>  			       sizeof(struct bcm_mibs_classifier_rule));

You could remove the (PVOID) casts here.
mem<foo> pointers don't need to be cast to void,
the compiler already does that.

> @@ -82,53 +88,70 @@ INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter, struct bcm_host_stats_m
>  	/* Copy other Host Statistics parameters */
>  	pstHostMibs->stHostInfo.GoodTransmits = Adapter->dev->stats.tx_packets;
>  	pstHostMibs->stHostInfo.GoodReceives = Adapter->dev->stats.rx_packets;
> -	pstHostMibs->stHostInfo.CurrNumFreeDesc = atomic_read(&Adapter->CurrNumFreeTxDesc);
> +	pstHostMibs->stHostInfo.CurrNumFreeDesc =
> +				atomic_read(&Adapter->CurrNumFreeTxDesc);
>  	pstHostMibs->stHostInfo.BEBucketSize = Adapter->BEBucketSize;
>  	pstHostMibs->stHostInfo.rtPSBucketSize = Adapter->rtPSBucketSize;
>  	pstHostMibs->stHostInfo.TimerActive = Adapter->TimerActive;
>  	pstHostMibs->stHostInfo.u32TotalDSD = Adapter->u32TotalDSD;

maybe use a temporary for &pst->stHostInfo and change all
of these to

	host_info-><foo> = Adapter-><bar>;



  reply	other threads:[~2014-03-23 17:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-22 15:50 Jake Edge
2014-03-23 17:45 ` Joe Perches [this message]
2014-03-28 18:49   ` Jake Edge

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=1395596709.13968.30.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=herself@thefumon.com \
    --cc=jake@edge2.net \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®