Re: [PATCH 1/1] staging: fix bcm/hostmibs.c checkpatch problems

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

 



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>;


_______________________________________________
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