[OPW,kernel] drivers/staging/bcm/Adapter.h : removed typdef from struct _U_IP_ADDRESS
diff mbox

Message ID 20131024233408.GA6955@himangi-Inspiron-N5110gmail.com
State Changes Requested
Headers show

Commit Message

HIMANGI SARAOGI Oct. 24, 2013, 11:34 p.m. UTC
Running checkpatch.pl on the file drivers/staging/bcm/Adapter.h gave an
error as it is a mistake to use typedef for structures
according to CodeingStyle as it reduces readability. The typedef was
removed and all occurrences of the typedef union were replaced with
union U_IP_ADDRESS.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
 drivers/staging/bcm/Adapter.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Lisa Nguyen Oct. 25, 2013, 6:30 a.m. UTC | #1
Hi Himangi,

On Thu, Oct 24, 2013 at 4:34 PM, Himangi Saraogi <himangi774@gmail.com> wrote:
> Running checkpatch.pl on the file drivers/staging/bcm/Adapter.h gave an
> error as it is a mistake to use typedef for structures
> according to CodeingStyle as it reduces readability. The typedef was
> removed and all occurrences of the typedef union were replaced with
> union U_IP_ADDRESS.
>
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> ---
>  drivers/staging/bcm/Adapter.h |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h
> index 1d8bf08..ed83b84 100644
> --- a/drivers/staging/bcm/Adapter.h
> +++ b/drivers/staging/bcm/Adapter.h
> @@ -35,7 +35,7 @@ struct bcm_link_request {
>  #define MAX_PROTOCOL_LENGTH   32
>  #define IPV6_ADDRESS_SIZEINBYTES 0x10

Some things to point out:

> -typedef union _U_IP_ADDRESS {
> +union _U_IP_ADDRESS {
>         struct {
>                 ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH]; /* Source Ip Address Range */
>                 ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH]; /* Source Ip Mask Address Range */
> @@ -52,7 +52,7 @@ typedef union _U_IP_ADDRESS {
>                 UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
>                 UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
>         };
> -} U_IP_ADDRESS;
> +};

It would have been fine to rename the union as U_IP_ADDRESS without
the underscore in front of it.
>
>  struct bcm_hdr_suppression_contextinfo {
>         UCHAR ucaHdrSuppressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */
> @@ -66,10 +66,10 @@ struct bcm_classifier_rule {
>         BOOLEAN         bUsed;
>         USHORT          usVCID_Value;
>         B_UINT8         u8ClassifierRulePriority; /* This field detemines the Classifier Priority */
> -       U_IP_ADDRESS    stSrcIpAddress;
> +       union _U_IP_ADDRESS     stSrcIpAddress;
>         UCHAR           ucIPSourceAddressLength; /* Ip Source Address Length */

> -       U_IP_ADDRESS    stDestIpAddress;
> +       union _U_IP_ADDRESS     stDestIpAddress;
>         UCHAR           ucIPDestinationAddressLength; /* Ip Destination Address Length */
>         UCHAR           ucIPTypeOfServiceLength; /* Type of service Length */
>         UCHAR           ucTosLow; /* Tos Low */

You can just rename those two variables as "union U_IP_ADDRESS
<variable name>". No underscore in front.

Did you also check the source files and compile your changes as well?

Lisa

> --
> 1.7.9.5
>
> --
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Patch
diff mbox

diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h
index 1d8bf08..ed83b84 100644
--- a/drivers/staging/bcm/Adapter.h
+++ b/drivers/staging/bcm/Adapter.h
@@ -35,7 +35,7 @@  struct bcm_link_request {
 #define MAX_PROTOCOL_LENGTH   32
 #define IPV6_ADDRESS_SIZEINBYTES 0x10
 
-typedef union _U_IP_ADDRESS {
+union _U_IP_ADDRESS {
 	struct {
 		ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH]; /* Source Ip Address Range */
 		ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH]; /* Source Ip Mask Address Range */
@@ -52,7 +52,7 @@  typedef union _U_IP_ADDRESS {
 		UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
 		UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
 	};
-} U_IP_ADDRESS;
+};
 
 struct bcm_hdr_suppression_contextinfo {
 	UCHAR ucaHdrSuppressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */
@@ -66,10 +66,10 @@  struct bcm_classifier_rule {
 	BOOLEAN		bUsed;
 	USHORT		usVCID_Value;
 	B_UINT8		u8ClassifierRulePriority; /* This field detemines the Classifier Priority */
-	U_IP_ADDRESS	stSrcIpAddress;
+	union _U_IP_ADDRESS	stSrcIpAddress;
 	UCHAR		ucIPSourceAddressLength; /* Ip Source Address Length */
 
-	U_IP_ADDRESS	stDestIpAddress;
+	union _U_IP_ADDRESS	stDestIpAddress;
 	UCHAR		ucIPDestinationAddressLength; /* Ip Destination Address Length */
 	UCHAR		ucIPTypeOfServiceLength; /* Type of service Length */
 	UCHAR		ucTosLow; /* Tos Low */