Commit 019a5f56 authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Pierre Ossman

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: default avatarNicolas Pitre <nico@cam.org>
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent c783837b
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/log2.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/clk.h> #include <linux/clk.h>
...@@ -391,7 +392,7 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -391,7 +392,7 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
WARN_ON(host->mrq != NULL); 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", printk(KERN_ERR "%s: Unsupported block size (%d bytes)\n",
mmc_hostname(mmc), mrq->data->blksz); mmc_hostname(mmc), mrq->data->blksz);
mrq->cmd->error = -EINVAL; mrq->cmd->error = -EINVAL;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/log2.h>
#include <asm/io.h> #include <asm/io.h>
#define DRIVER_NAME "tifm_sd" #define DRIVER_NAME "tifm_sd"
...@@ -637,7 +638,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -637,7 +638,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
goto err_out; 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", printk(KERN_ERR "%s: Unsupported block size (%d bytes)\n",
sock->dev.bus_id, mrq->data->blksz); sock->dev.bus_id, mrq->data->blksz);
mrq->cmd->error = -EINVAL; mrq->cmd->error = -EINVAL;
......
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