From: Ana Bobillo <anabobillo3@gmail.com>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.u-boot-project.org, "Simon Glass" <sjg@chromium.org>,
"Marek Vasut" <marek.vasut+usb@mailbox.org>,
"Bin Meng" <bmeng.cn@gmail.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
"Alexey Charkov" <alchark@flipper.net>,
"Javier Martinez Canillas" <javierm@redhat.com>,
"Marek Behún" <kabel@kernel.org>, "Qu Wenruo" <wqu@suse.com>,
"Matthias Brugger" <mbrugger@suse.com>,
"Peter Robinson" <pbrobinson@gmail.com>,
"Peng Fan" <peng.fan@nxp.com>,
"Jaehoon Chung" <jh80.chung@samsung.com>
Subject: [PATCH v2 01/12] treewide: Use is_power_of_2() from linux/log2.h
Date: Wed, 28 Oct 2026 05:50:55 +0000 [thread overview]
Message-ID: <5a883249-dcd6-4cc0-a1e5-868e2384bf8e@gmail.com> (raw)
In-Reply-To: <01ba3f81-06b7-428b-9224-bd887c35e1c3@gmail.com>
From: Ana Bobillo <anabobillo3@gmail.com>
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 <anabobillo3@gmail.com>
---
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
next prev parent reply other threads:[~2026-10-28 5:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 5:50 [PATCH v2 00/12] block, disk: Check block sizes and partition tables of devices Ana Bobillo
2026-10-28 5:50 ` Ana Bobillo [this message]
2026-10-28 8:56 ` [PATCH v2 01/12] treewide: Use is_power_of_2() from linux/log2.h Simon Glass
2026-10-28 5:51 ` [PATCH v2 02/12] block: Add blk_valid_blksz() to check a block size Ana Bobillo
2026-10-28 8:56 ` Simon Glass
2026-10-28 5:51 ` [PATCH v2 03/12] usb: storage: Fix the capacity faked when READ CAPACITY fails Ana Bobillo
2026-10-28 8:56 ` Simon Glass
2026-10-28 5:51 ` [PATCH v2 04/12] usb: storage: Refuse a block size the block layer cannot use Ana Bobillo
2026-10-28 8:56 ` Simon Glass
2026-10-28 5:51 ` [PATCH v2 05/12] scsi: " Ana Bobillo
2026-10-28 5:51 ` [PATCH v2 06/12] ide: Refuse an ATAPI block size atapi_read() cannot read Ana Bobillo
2026-10-28 8:56 ` Simon Glass
2026-10-28 5:51 ` [PATCH v2 07/12] nvme: Skip a namespace with an unsupported LBA data size Ana Bobillo
2026-10-28 5:51 ` [PATCH v2 08/12] block: Refuse a device with an unsupported block size Ana Bobillo
2026-10-28 8:56 ` Simon Glass
2026-10-28 5:51 ` [PATCH v2 09/12] disk: part_efi: Check the header and entry sizes of a GPT Ana Bobillo
2026-10-28 8:56 ` Simon Glass
2026-10-28 5:51 ` [PATCH v2 10/12] disk: part_dos: Walk the extended partition tables in a bounded loop Ana Bobillo
2026-10-28 8:56 ` Simon Glass
2026-10-28 5:52 ` [PATCH v2 11/12] disk: part_dos: Make room for a three-digit partition number in the UUID Ana Bobillo
2026-10-28 5:52 ` [PATCH v2 12/12] efi_loader: Measure the GPT the partition driver uses Ana Bobillo
2026-10-28 8:57 ` Simon Glass
2026-10-28 9:32 ` Ana Bobillo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a883249-dcd6-4cc0-a1e5-868e2384bf8e@gmail.com \
--to=anabobillo3@gmail.com \
--cc=alchark@flipper.net \
--cc=bmeng.cn@gmail.com \
--cc=ilias.apalodimas@linaro.org \
--cc=javierm@redhat.com \
--cc=jh80.chung@samsung.com \
--cc=kabel@kernel.org \
--cc=marek.vasut+usb@mailbox.org \
--cc=mbrugger@suse.com \
--cc=neil.armstrong@linaro.org \
--cc=pbrobinson@gmail.com \
--cc=peng.fan@nxp.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=wqu@suse.com \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox