Mark functions and variable static where appropriate

This makes functions and globals static when then can be.  Additionally
this makes add_new_irq() return void since nothing used the returned
struct irq_info*

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
This commit is contained in:
Shawn Bohrer 2014-09-07 21:41:14 -05:00
parent c41f90cb12
commit 8bc00d38e5
3 changed files with 36 additions and 39 deletions

View file

@ -22,7 +22,7 @@ char *classes[] = {
0
};
int map_class_to_level[8] =
static int map_class_to_level[8] =
{ BALANCE_PACKAGE, BALANCE_CACHE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE };
@ -74,7 +74,7 @@ static gint compare_ints(gconstpointer a, gconstpointer b)
return ai->irq - bi->irq;
}
void add_banned_irq(int irq, GList **list)
static void add_banned_irq(int irq, GList **list)
{
struct irq_info find, *new;
GList *entry;
@ -487,6 +487,38 @@ void free_irq_db(void)
rebalance_irq_list = NULL;
}
static void add_new_irq(int irq, struct irq_info *hint)
{
struct irq_info *new;
struct user_irq_policy pol;
new = get_irq_info(irq);
if (new)
return;
get_irq_user_policy("/sys", irq, &pol);
if ((pol.ban == 1) || check_for_irq_ban(NULL, irq)) {
add_banned_irq(irq, &banned_irqs);
new = get_irq_info(irq);
} else
new = add_one_irq_to_db("/sys", irq, &pol);
if (!new) {
log(TO_CONSOLE, LOG_WARNING, "add_new_irq: Failed to add irq %d\n", irq);
return;
}
/*
* Override some of the new irq defaults here
*/
if (hint) {
new->type = hint->type;
new->class = hint->class;
}
new->level = map_class_to_level[new->class];
}
static void add_missing_irq(struct irq_info *info, void *unused __attribute__((unused)))
{
struct irq_info *lookup = get_irq_info(info->irq);
@ -531,39 +563,6 @@ free:
}
struct irq_info *add_new_irq(int irq, struct irq_info *hint)
{
struct irq_info *new;
struct user_irq_policy pol;
new = get_irq_info(irq);
if (new)
return NULL;
get_irq_user_policy("/sys", irq, &pol);
if ((pol.ban == 1) || check_for_irq_ban(NULL, irq)) {
add_banned_irq(irq, &banned_irqs);
new = get_irq_info(irq);
} else
new = add_one_irq_to_db("/sys", irq, &pol);
if (!new) {
log(TO_CONSOLE, LOG_WARNING, "add_new_irq: Failed to add irq %d\n", irq);
return NULL;
}
/*
* Override some of the new irq defaults here
*/
if (hint) {
new->type = hint->type;
new->class = hint->class;
}
new->level = map_class_to_level[new->class];
return new;
}
void for_each_irq(GList *list, void (*cb)(struct irq_info *info, void *data), void *data)
{
GList *entry = g_list_first(list ? list : interrupts_db);

View file

@ -57,7 +57,7 @@ char *banscript = NULL;
char *polscript = NULL;
long HZ;
void sleep_approx(int seconds)
static void sleep_approx(int seconds)
{
struct timespec ts;
struct timeval tv;
@ -209,7 +209,7 @@ static void dump_object_tree(void)
for_each_object(numa_nodes, dump_numa_node_info, NULL);
}
void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused)))
static void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused)))
{
if (info->level == BALANCE_NONE)
return;

View file

@ -110,8 +110,6 @@ extern void add_cl_banned_irq(int irq);
extern void for_each_irq(GList *list, void (*cb)(struct irq_info *info, void *data), void *data);
extern struct irq_info *get_irq_info(int irq);
extern void migrate_irq(GList **from, GList **to, struct irq_info *info);
extern struct irq_info *add_new_irq(int irq, struct irq_info *hint);
extern void force_rebalance_irq(struct irq_info *info, void *data);
#define irq_numa_node(irq) ((irq)->numa_node)