alistair23-linux/drivers/staging/bcm/sort.c
Kevin McKinney 2979460d7a Staging: bcm: Remove typedef for _MINI_ADAPTER and call directly.
This patch removes typedef for _MINI_ADAPTER, changes the
name of the struct from _MINI_ADAPTER to bcm_mini_adapter.
In addition, any calls to the following typedefs
"MINI_ADAPTER, *PMINI_ADAPTER" are changed to call
the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-04 21:09:22 -07:00

53 lines
1.2 KiB
C

#include "headers.h"
#include <linux/sort.h>
/*
* File Name: sort.c
*
* Author: Beceem Communications Pvt. Ltd
*
* Abstract: This file contains the routines sorting the classification rules.
*
* Copyright (c) 2007 Beceem Communications Pvt. Ltd
*/
static int compare_packet_info(void const *a, void const *b)
{
struct bcm_packet_info const *pa = a;
struct bcm_packet_info const *pb = b;
if (!pa->bValid || !pb->bValid)
return 0;
return pa->u8TrafficPriority - pb->u8TrafficPriority;
}
VOID SortPackInfo(struct bcm_mini_adapter *Adapter)
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG,
DBG_LVL_ALL, "<=======");
sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(struct bcm_packet_info),
compare_packet_info, NULL);
}
static int compare_classifiers(void const *a, void const *b)
{
struct bcm_classifier_rule const *pa = a;
struct bcm_classifier_rule const *pb = b;
if (!pa->bUsed || !pb->bUsed)
return 0;
return pa->u8ClassifierRulePriority - pb->u8ClassifierRulePriority;
}
VOID SortClassifiers(struct bcm_mini_adapter *Adapter)
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG,
DBG_LVL_ALL, "<=======");
sort(Adapter->astClassifierTable, MAX_CLASSIFIERS,
sizeof(struct bcm_classifier_rule), compare_classifiers, NULL);
}