[PATCH 04/27] Staging: bcm: Outsourced restoring of endianess for ip adresses
Dan Carpenter
dan.carpenter at oracle.com
Mon May 26 08:25:33 UTC 2014
Style issues. No need to resend, but please read them.
On Fri, May 23, 2014 at 10:23:42PM +0200, Matthias Beyer wrote:
> Signed-off-by: Matthias Beyer <mail at beyermatthias.de>
> ---
> drivers/staging/bcm/CmHost.c | 32 +++++++++++++++++++++++---------
> 1 file changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c
> index 3d8c049..59a3eb9 100644
> --- a/drivers/staging/bcm/CmHost.c
> +++ b/drivers/staging/bcm/CmHost.c
> @@ -14,6 +14,9 @@ enum E_CLASSIFIER_ACTION {
> };
>
> static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UINT16 tid);
> +static void restore_endianess_of_pstClassifierEntry(
> + struct bcm_classifier_rule *pstClassifierEntry,
> + enum bcm_ipaddr_context eIpAddrContext);
Gar... Stop with the forward declarations.
>
> /************************************************************
> * Function - SearchSfid
> @@ -200,15 +203,10 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry,
> }
> if (bIpVersion6) {
> /* Restore EndianNess of Struct */
> - for (i = 0; i < MAX_IP_RANGE_LENGTH * 4; i++) {
> - if (eIpAddrContext == eSrcIpAddress) {
> - pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i]);
> - pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i]);
> - } else if (eIpAddrContext == eDestIpAddress) {
> - pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i]);
> - pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i]);
> - }
> - }
> + restore_endianess_of_pstClassifierEntry(
> + pstClassifierEntry,
> + eIpAddrContext
> + );
Put the close paren on the line before.
> }
> }
> }
> @@ -1919,3 +1917,19 @@ VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter,
> }
> }
> }
> +
> +static void restore_endianess_of_pstClassifierEntry(
> + struct bcm_classifier_rule *pstClassifierEntry,
> + enum bcm_ipaddr_context eIpAddrContext)
> +{
> + int i;
Run your patches through checkpatch.pl. It will complain about a
missing blank line here.
> + for (i = 0; i < MAX_IP_RANGE_LENGTH * 4; i++) {
> + if (eIpAddrContext == eSrcIpAddress) {
> + pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i]);
> + pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i]);
> + } else if (eIpAddrContext == eDestIpAddress) {
> + pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i]);
> + pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i]);
> + }
> + }
> +}
regards,
dan carpenter
More information about the devel
mailing list