[PATCH 10/10] Input: synaptics-rmi4 - use __le16 for FIFO offset in F54

From: Dmitry Torokhov

Date: Fri Jun 26 2026 - 01:21:06 EST


Instead of manually splitting the 16-bit offset into a 2-byte array,
use __le16 and cpu_to_le16() to serialize the FIFO offset in
rmi_f54_work(). This is cleaner and more portable.

Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/input/rmi4/rmi_f54.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c
index 5d045ece3c2f..3eeb189be18b 100644
--- a/drivers/input/rmi4/rmi_f54.c
+++ b/drivers/input/rmi4/rmi_f54.c
@@ -15,6 +15,7 @@
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-vmalloc.h>
+#include <asm/byteorder.h>
#include "rmi_driver.h"

#define F54_NAME "rmi4_f54"
@@ -552,7 +553,6 @@ static void rmi_f54_work(struct work_struct *work)
{
struct f54_data *f54 = container_of(work, struct f54_data, work.work);
struct rmi_function *fn = f54->fn;
- u8 fifo[2];
size_t report_size;
u8 command;
int error;
@@ -597,12 +597,11 @@ static void rmi_f54_work(struct work_struct *work)

for (size_t i = 0; i < report_size; i += F54_REPORT_DATA_SIZE) {
size_t size = min_t(size_t, F54_REPORT_DATA_SIZE, report_size - i);
+ __le16 fifo = cpu_to_le16(i);

- fifo[0] = i & 0xff;
- fifo[1] = i >> 8;
error = rmi_write_block(fn->rmi_dev,
fn->fd.data_base_addr + F54_FIFO_OFFSET,
- fifo, sizeof(fifo));
+ &fifo, sizeof(fifo));
if (error) {
dev_err(&fn->dev, "Failed to set fifo start offset\n");
goto out;
--
2.55.0.rc0.799.gd6f94ed593-goog