From: Nicolas Pitre Date: Thu, 11 Oct 2007 05:06:03 +0000 (-0400) Subject: mmc: don't use weight32() X-Git-Tag: v2.6.24-rc1~1464^2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=019a5f56ec195aceadada18aaaad0f67294bdaef;p=linux-2.6-omap-h63xx.git mmc: don't use weight32() Using weight32() to determine if a value is a power of 2 is a rather heavi weight solution. The classic idiom is (x & (x - 1)) == 0, but the kernel already provide a is_power_of_2 function for it. Signed-off-by: Nicolas Pitre Signed-off-by: Pierre Ossman --- diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 4a72772f4fe..d0eb0a2abf4 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -391,7 +392,7 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) WARN_ON(host->mrq != NULL); - if (mrq->data && (hweight32(mrq->data->blksz) > 1)) { + if (mrq->data && !is_power_of_2(mrq->data->blksz)) { printk(KERN_ERR "%s: Unsupported block size (%d bytes)\n", mmc_hostname(mmc), mrq->data->blksz); mrq->cmd->error = -EINVAL; diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index 951392d2ce3..9b904795eb7 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #define DRIVER_NAME "tifm_sd" @@ -637,7 +638,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) goto err_out; } - if (mrq->data && (hweight32(mrq->data->blksz) > 1)) { + if (mrq->data && !is_power_of_2(mrq->data->blksz)) { printk(KERN_ERR "%s: Unsupported block size (%d bytes)\n", sock->dev.bus_id, mrq->data->blksz); mrq->cmd->error = -EINVAL;