Skip to content

Commit

Permalink
kernel/padata.c: hide unused functions
Browse files Browse the repository at this point in the history
A recent cleanup removed some exported functions that were not used
anywhere, which in turn exposed the fact that some other functions in
the same file are only used in some configurations.

We now get a warning about them when CONFIG_HOTPLUG_CPU is disabled:

  kernel/padata.c:670:12: error: '__padata_remove_cpu' defined but not used [-Werror=unused-function]
   static int __padata_remove_cpu(struct padata_instance *pinst, int cpu)
              ^~~~~~~~~~~~~~~~~~~
  kernel/padata.c:650:12: error: '__padata_add_cpu' defined but not used [-Werror=unused-function]
   static int __padata_add_cpu(struct padata_instance *pinst, int cpu)

This rearranges the code so the __padata_remove_cpu/__padata_add_cpu
functions are within the #ifdef that protects the code that calls them.

[[email protected]: coding-style fixes]
Fixes: 4ba6d78 ("kernel/padata.c: removed unused code")
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Steffen Klassert <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
arndb authored and torvalds committed May 20, 2016
1 parent 815613d commit 19d795b
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions kernel/padata.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,43 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
}
EXPORT_SYMBOL(padata_set_cpumask);

/**
* padata_start - start the parallel processing
*
* @pinst: padata instance to start
*/
int padata_start(struct padata_instance *pinst)
{
int err = 0;

mutex_lock(&pinst->lock);

if (pinst->flags & PADATA_INVALID)
err = -EINVAL;

__padata_start(pinst);

mutex_unlock(&pinst->lock);

return err;
}
EXPORT_SYMBOL(padata_start);

/**
* padata_stop - stop the parallel processing
*
* @pinst: padata instance to stop
*/
void padata_stop(struct padata_instance *pinst)
{
mutex_lock(&pinst->lock);
__padata_stop(pinst);
mutex_unlock(&pinst->lock);
}
EXPORT_SYMBOL(padata_stop);

#ifdef CONFIG_HOTPLUG_CPU

static int __padata_add_cpu(struct padata_instance *pinst, int cpu)
{
struct parallel_data *pd;
Expand Down Expand Up @@ -726,43 +763,6 @@ int padata_remove_cpu(struct padata_instance *pinst, int cpu, int mask)
}
EXPORT_SYMBOL(padata_remove_cpu);

/**
* padata_start - start the parallel processing
*
* @pinst: padata instance to start
*/
int padata_start(struct padata_instance *pinst)
{
int err = 0;

mutex_lock(&pinst->lock);

if (pinst->flags & PADATA_INVALID)
err =-EINVAL;

__padata_start(pinst);

mutex_unlock(&pinst->lock);

return err;
}
EXPORT_SYMBOL(padata_start);

/**
* padata_stop - stop the parallel processing
*
* @pinst: padata instance to stop
*/
void padata_stop(struct padata_instance *pinst)
{
mutex_lock(&pinst->lock);
__padata_stop(pinst);
mutex_unlock(&pinst->lock);
}
EXPORT_SYMBOL(padata_stop);

#ifdef CONFIG_HOTPLUG_CPU

static inline int pinst_has_cpu(struct padata_instance *pinst, int cpu)
{
return cpumask_test_cpu(cpu, pinst->cpumask.pcpu) ||
Expand Down

0 comments on commit 19d795b

Please sign in to comment.