From: Ana Bobillo <[email protected]> The btrfs code and the bcm2835_sdhost driver each define their own is_power_of_2(), which clashes with the one in linux/log2.h once a header they include brings that in, as include/blk.h does after the next patch. Drop both and use the common one.
The btrfs copy is the same as the common one. The bcm2835_sdhost copy takes a u64 and also takes 0 as a power of two; its only caller checks the block size of a data transfer, which the MMC core never sets to 0, and the Linux driver it comes from makes the same check with the common is_power_of_2(). Signed-off-by: Ana Bobillo <[email protected]> --- Changes in v2: - New patch, so that blk.h can use is_power_of_2() from linux/log2.h drivers/mmc/bcm2835_sdhost.c | 6 +----- fs/btrfs/compat.h | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/bcm2835_sdhost.c b/drivers/mmc/bcm2835_sdhost.c index 720127468d3..eee7e2d43a2 100644 --- a/drivers/mmc/bcm2835_sdhost.c +++ b/drivers/mmc/bcm2835_sdhost.c @@ -42,6 +42,7 @@ #include <linux/delay.h> #include <linux/io.h> #include <linux/iopoll.h> +#include <linux/log2.h> #include <linux/sizes.h> #include <mach/gpio.h> #include <power/regulator.h> @@ -660,11 +661,6 @@ static void bcm2835_set_clock(struct bcm2835_host *host, unsigned int clock) writel(host->mmc->clock / 2, host->ioaddr + SDTOUT); } -static inline int is_power_of_2(u64 x) -{ - return !(x & (x - 1)); -} - static int bcm2835_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) { diff --git a/fs/btrfs/compat.h b/fs/btrfs/compat.h index 4596b9d1dd3..ffeba740eff 100644 --- a/fs/btrfs/compat.h +++ b/fs/btrfs/compat.h @@ -4,6 +4,7 @@ #define __BTRFS_COMPAT_H__ #include <linux/errno.h> +#include <linux/log2.h> #include <fs_internal.h> #include <u-boot/uuid.h> @@ -74,9 +75,4 @@ static inline void uuid_unparse(const u8 *uuid, char *out) return uuid_bin_to_str((unsigned char *)uuid, out, 0); } -static inline int is_power_of_2(unsigned long n) -{ - return (n != 0 && ((n & (n - 1)) == 0)); -} - #endif
