From: Gabriel Shahrouzi <gshahrouzi@gmail.com>
To: Coly Li <colyli@kernel.org>, Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org,
kernelmentees@lists.linuxfoundation.org, gshahrouzi@gmail.com
Subject: [PATCH 2/2] bcache: Fix warnings for incorrect type in assignments
Date: Mon, 7 Apr 2025 23:33:22 -0400 [thread overview]
Message-ID: <20250408033322.401680-3-gshahrouzi@gmail.com> (raw)
In-Reply-To: <20250408033322.401680-1-gshahrouzi@gmail.com>
Remove unnecessary cpu_to_le16() and cpu_to_le32() conversions when
assigning values (priorities, timestamps) to native integer type
members. Prevent incorrect byte ordering for big-endian systems.
Signed-off-by: Gabriel Shahrouzi <gshahrouzi@gmail.com>
---
drivers/md/bcache/super.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index e42f1400cea9d..c4c5ca17fb600 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -648,7 +648,7 @@ int bch_prio_write(struct cache *ca, bool wait)
for (b = ca->buckets + i * prios_per_bucket(ca);
b < ca->buckets + ca->sb.nbuckets && d < end;
b++, d++) {
- d->prio = cpu_to_le16(b->prio);
+ d->prio = b->prio;
d->gen = b->gen;
}
@@ -721,7 +721,7 @@ static int prio_read(struct cache *ca, uint64_t bucket)
d = p->data;
}
- b->prio = le16_to_cpu(d->prio);
+ b->prio = d->prio;
b->gen = b->last_gc = d->gen;
}
@@ -832,7 +832,7 @@ static void bcache_device_detach(struct bcache_device *d)
SET_UUID_FLASH_ONLY(u, 0);
memcpy(u->uuid, invalid_uuid, 16);
- u->invalidated = cpu_to_le32((u32)ktime_get_real_seconds());
+ u->invalidated = (u32)ktime_get_real_seconds();
bch_uuid_write(d->c);
}
@@ -1188,7 +1188,7 @@ void bch_cached_dev_detach(struct cached_dev *dc)
int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
uint8_t *set_uuid)
{
- uint32_t rtime = cpu_to_le32((u32)ktime_get_real_seconds());
+ uint32_t rtime = (u32)ktime_get_real_seconds();
struct uuid_entry *u;
struct cached_dev *exist_dc, *t;
int ret = 0;
@@ -1230,7 +1230,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
(BDEV_STATE(&dc->sb) == BDEV_STATE_STALE ||
BDEV_STATE(&dc->sb) == BDEV_STATE_NONE)) {
memcpy(u->uuid, invalid_uuid, 16);
- u->invalidated = cpu_to_le32((u32)ktime_get_real_seconds());
+ u->invalidated = (u32)ktime_get_real_seconds();
u = NULL;
}
@@ -1591,7 +1591,7 @@ int bch_flash_dev_create(struct cache_set *c, uint64_t size)
get_random_bytes(u->uuid, 16);
memset(u->label, 0, 32);
- u->first_reg = u->last_reg = cpu_to_le32((u32)ktime_get_real_seconds());
+ u->first_reg = u->last_reg = (u32)ktime_get_real_seconds();
SET_UUID_FLASH_ONLY(u, 1);
u->sectors = size >> 9;
--
2.43.0
next prev parent reply other threads:[~2025-04-08 3:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 3:33 [PATCH 0/2] bcache: Fix symbol visibility and type assignment Gabriel Shahrouzi
2025-04-08 3:33 ` [PATCH 1/2] bcache: Fix undeclared symbol warning for bcache_is_reboot Gabriel Shahrouzi
2025-04-08 4:55 ` Coly Li
2025-04-08 5:42 ` Gabriel Shahrouzi
2025-04-08 3:33 ` Gabriel Shahrouzi [this message]
2025-04-08 4:58 ` [PATCH 2/2] bcache: Fix warnings for incorrect type in assignments Coly Li
2025-04-08 7:15 ` Gabriel Shahrouzi
2025-04-08 10:39 ` Coly Li
2025-04-08 13:27 ` Gabriel Shahrouzi
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=20250408033322.401680-3-gshahrouzi@gmail.com \
--to=gshahrouzi@gmail.com \
--cc=colyli@kernel.org \
--cc=kent.overstreet@linux.dev \
--cc=kernelmentees@lists.linuxfoundation.org \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
/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;
as well as URLs for NNTP newsgroup(s).