Commit 93ba139b authored by Yury Norov's avatar Yury Norov

cpumask: use find_first_and_bit()

Now we have an efficient implementation for find_first_and_bit(),
so switch cpumask to use it where appropriate.
Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
Tested-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
parent f68edc92
...@@ -123,6 +123,12 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp) ...@@ -123,6 +123,12 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)
return 0; return 0;
} }
static inline unsigned int cpumask_first_and(const struct cpumask *srcp1,
const struct cpumask *srcp2)
{
return 0;
}
static inline unsigned int cpumask_last(const struct cpumask *srcp) static inline unsigned int cpumask_last(const struct cpumask *srcp)
{ {
return 0; return 0;
...@@ -167,7 +173,7 @@ static inline unsigned int cpumask_local_spread(unsigned int i, int node) ...@@ -167,7 +173,7 @@ static inline unsigned int cpumask_local_spread(unsigned int i, int node)
static inline int cpumask_any_and_distribute(const struct cpumask *src1p, static inline int cpumask_any_and_distribute(const struct cpumask *src1p,
const struct cpumask *src2p) { const struct cpumask *src2p) {
return cpumask_next_and(-1, src1p, src2p); return cpumask_first_and(src1p, src2p);
} }
static inline int cpumask_any_distribute(const struct cpumask *srcp) static inline int cpumask_any_distribute(const struct cpumask *srcp)
...@@ -195,6 +201,19 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp) ...@@ -195,6 +201,19 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)
return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits); return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits);
} }
/**
* cpumask_first_and - return the first cpu from *srcp1 & *srcp2
* @src1p: the first input
* @src2p: the second input
*
* Returns >= nr_cpu_ids if no cpus set in both. See also cpumask_next_and().
*/
static inline
unsigned int cpumask_first_and(const struct cpumask *srcp1, const struct cpumask *srcp2)
{
return find_first_and_bit(cpumask_bits(srcp1), cpumask_bits(srcp2), nr_cpumask_bits);
}
/** /**
* cpumask_last - get the last CPU in a cpumask * cpumask_last - get the last CPU in a cpumask
* @srcp: - the cpumask pointer * @srcp: - the cpumask pointer
...@@ -585,15 +604,6 @@ static inline void cpumask_copy(struct cpumask *dstp, ...@@ -585,15 +604,6 @@ static inline void cpumask_copy(struct cpumask *dstp,
*/ */
#define cpumask_any(srcp) cpumask_first(srcp) #define cpumask_any(srcp) cpumask_first(srcp)
/**
* cpumask_first_and - return the first cpu from *srcp1 & *srcp2
* @src1p: the first input
* @src2p: the second input
*
* Returns >= nr_cpu_ids if no cpus set in both. See also cpumask_next_and().
*/
#define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))
/** /**
* cpumask_any_and - pick a "random" cpu from *mask1 & *mask2 * cpumask_any_and - pick a "random" cpu from *mask1 & *mask2
* @mask1: the first input cpumask * @mask1: the first input cpumask
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment