From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: Marge Yang <Marge.Yang@tw.synaptics.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 20/20] Input: rmi4 - update formatting in F12
Date: Mon, 4 May 2026 21:59:50 -0700 [thread overview]
Message-ID: <20260505045952.1570713-20-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20260505045952.1570713-1-dmitry.torokhov@gmail.com>
Clean up various style and formatting issues in the F12 code.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/rmi4/rmi_f12.c | 120 +++++++++++++++++------------------
1 file changed, 60 insertions(+), 60 deletions(-)
diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c
index bf8c4a0e10de..88c28089de99 100644
--- a/drivers/input/rmi4/rmi_f12.c
+++ b/drivers/input/rmi4/rmi_f12.c
@@ -51,7 +51,6 @@ struct f12_data {
const struct rmi_register_desc_item *data6;
u16 data6_offset;
-
/* F12 Data9 reports relative data */
const struct rmi_register_desc_item *data9;
u16 data9_offset;
@@ -124,8 +123,8 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
return -ENODEV;
}
- ret = rmi_read_block(rmi_dev, fn->fd.control_base_addr + offset, buf,
- item->reg_size);
+ ret = rmi_read_block(rmi_dev, fn->fd.control_base_addr + offset,
+ buf, item->reg_size);
if (ret)
return ret;
@@ -163,7 +162,7 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
if (rmi_get_register_desc_item(&f12->query_reg_desc,
RMI_F12_QUERY_RESOLUTION)) {
offset = rmi_register_desc_calc_reg_offset(&f12->query_reg_desc,
- RMI_F12_QUERY_RESOLUTION);
+ RMI_F12_QUERY_RESOLUTION);
query_dpm_addr = fn->fd.query_base_addr + offset;
ret = rmi_read(fn->rmi_dev, query_dpm_addr, buf);
if (ret) {
@@ -248,18 +247,17 @@ static void rmi_f12_process_objects(struct f12_data *f12, u8 *data1, u32 size)
static irqreturn_t rmi_f12_attention(int irq, void *ctx)
{
- int retval;
struct rmi_function *fn = ctx;
struct rmi_device *rmi_dev = fn->rmi_dev;
struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev);
struct f12_data *f12 = dev_get_drvdata(&fn->dev);
struct rmi_2d_sensor *sensor = &f12->sensor;
u32 valid_bytes = sensor->pkt_size;
+ int retval;
if (drvdata->attn_data.data) {
valid_bytes = min_t(u32, sensor->attn_size, drvdata->attn_data.size);
- memcpy(sensor->data_pkt, drvdata->attn_data.data,
- valid_bytes);
+ memcpy(sensor->data_pkt, drvdata->attn_data.data, valid_bytes);
drvdata->attn_data.data += valid_bytes;
drvdata->attn_data.size -= valid_bytes;
} else {
@@ -273,70 +271,74 @@ static irqreturn_t rmi_f12_attention(int irq, void *ctx)
}
if (f12->data1)
- rmi_f12_process_objects(f12,
- &sensor->data_pkt[f12->data1_offset], valid_bytes);
+ rmi_f12_process_objects(f12, &sensor->data_pkt[f12->data1_offset],
+ valid_bytes);
input_mt_sync_frame(sensor->input);
return IRQ_HANDLED;
}
-static int rmi_f12_write_control_regs(struct rmi_function *fn)
+static int rmi_f12_update_dribble(struct rmi_function *fn, struct f12_data *f12)
{
- int ret;
const struct rmi_register_desc_item *item;
struct rmi_device *rmi_dev = fn->rmi_dev;
- struct f12_data *f12 = dev_get_drvdata(&fn->dev);
- int control_size;
- char buf[3];
- u16 control_offset = 0;
u8 subpacket_offset = 0;
+ u16 control_offset;
+ u32 control_size;
+ int error;
+ u8 buf[3];
- if (f12->has_dribble
- && (f12->sensor.dribble != RMI_REG_STATE_DEFAULT)) {
- item = rmi_get_register_desc_item(&f12->control_reg_desc, 20);
- if (item) {
- control_offset = rmi_register_desc_calc_reg_offset(
- &f12->control_reg_desc, 20);
-
- /*
- * The byte containing the EnableDribble bit will be
- * in either byte 0 or byte 2 of control 20. Depending
- * on the existence of subpacket 0. If control 20 is
- * larger then 3 bytes, just read the first 3.
- */
- control_size = min(item->reg_size, 3U);
-
- ret = rmi_read_block(rmi_dev, fn->fd.control_base_addr
- + control_offset, buf, control_size);
- if (ret)
- return ret;
-
- if (rmi_register_desc_has_subpacket(item, 0))
- subpacket_offset += 1;
-
- switch (f12->sensor.dribble) {
- case RMI_REG_STATE_OFF:
- buf[subpacket_offset] &= ~BIT(2);
- break;
- case RMI_REG_STATE_ON:
- buf[subpacket_offset] |= BIT(2);
- break;
- case RMI_REG_STATE_DEFAULT:
- default:
- break;
- }
+ item = rmi_get_register_desc_item(&f12->control_reg_desc, 20);
+ if (!item)
+ return 0;
- ret = rmi_write_block(rmi_dev,
- fn->fd.control_base_addr + control_offset,
- buf, control_size);
- if (ret)
- return ret;
- }
+ control_offset = rmi_register_desc_calc_reg_offset(&f12->control_reg_desc, 20);
+
+ /*
+ * The byte containing the EnableDribble bit will be
+ * in either byte 0 or byte 2 of control 20. Depending
+ * on the existence of subpacket 0. If control 20 is
+ * larger then 3 bytes, just read the first 3.
+ */
+ control_size = min(item->reg_size, 3U);
+
+ error = rmi_read_block(rmi_dev, fn->fd.control_base_addr + control_offset,
+ buf, control_size);
+ if (error)
+ return error;
+
+ if (rmi_register_desc_has_subpacket(item, 0))
+ subpacket_offset += 1;
+
+ switch (f12->sensor.dribble) {
+ case RMI_REG_STATE_OFF:
+ buf[subpacket_offset] &= ~BIT(2);
+ break;
+ case RMI_REG_STATE_ON:
+ buf[subpacket_offset] |= BIT(2);
+ break;
+ case RMI_REG_STATE_DEFAULT:
+ default:
+ break;
}
+ error = rmi_write_block(rmi_dev, fn->fd.control_base_addr + control_offset,
+ buf, control_size);
+ if (error)
+ return error;
+
return 0;
+}
+static int rmi_f12_write_control_regs(struct rmi_function *fn)
+{
+ struct f12_data *f12 = dev_get_drvdata(&fn->dev);
+
+ if (f12->has_dribble && f12->sensor.dribble != RMI_REG_STATE_DEFAULT)
+ return rmi_f12_update_dribble(fn, f12);
+
+ return 0;
}
static int rmi_f12_config(struct rmi_function *fn)
@@ -362,7 +364,7 @@ static int rmi_f12_config(struct rmi_function *fn)
ret = rmi_f12_write_control_regs(fn);
if (ret)
dev_warn(&fn->dev,
- "Failed to write F12 control registers: %d\n", ret);
+ "Failed to write F12 control registers: %d\n", ret);
return 0;
}
@@ -433,16 +435,14 @@ static int rmi_f12_probe(struct rmi_function *fn)
}
sensor->pkt_size = pkt_size;
- sensor->axis_align =
- f12->sensor_pdata.axis_align;
+ sensor->axis_align = f12->sensor_pdata.axis_align;
sensor->x_mm = f12->sensor_pdata.x_mm;
sensor->y_mm = f12->sensor_pdata.y_mm;
sensor->dribble = f12->sensor_pdata.dribble;
if (sensor->sensor_type == rmi_sensor_default)
- sensor->sensor_type =
- f12->sensor_pdata.sensor_type;
+ sensor->sensor_type = f12->sensor_pdata.sensor_type;
rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: data packet size: %u\n", __func__,
sensor->pkt_size);
--
2.54.0.545.g6539524ca2-goog
prev parent reply other threads:[~2026-05-05 5:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 4:59 [PATCH v2 01/20] Input: rmi4 - fix register descriptor address calculation Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 02/20] Input: rmi4 - refactor register descriptor parsing Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 03/20] Input: rmi4 - fix type overflow in register counts Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 04/20] Input: rmi4 - fix num_subpackets overflow in register descriptor Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 05/20] Input: rmi4 - fix memory leak in rmi_set_attn_data() Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 06/20] Input: rmi4 - iterative IRQ handler Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 07/20] Input: rmi4 - fix bit count in bitmap_copy() Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 08/20] Input: rmi4 - fix limit in rmi_register_desc_has_subpacket() Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 09/20] Input: rmi4 - use local presence map in rmi_read_register_desc() Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 10/20] Input: rmi4 - refactor function allocation and registration Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 11/20] Input: rmi4 - use kzalloc_flex() for struct rmi_function Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 12/20] Input: rmi4 - refactor F12 probe function Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 13/20] Input: rmi4 - change reg_size type to u32 Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 14/20] Input: rmi4 - use unaligned access helpers in F12 Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 15/20] Input: rmi4 - use flexible array member for IRQ masks " Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 16/20] Input: rmi4 - use devm_kmalloc for F12 data packet buffer Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 17/20] Input: rmi4 - use sizeof(*ptr) and idiomatic checks in f12 allocators Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 18/20] Input: rmi4 - simplify size calculations in F12 Dmitry Torokhov
2026-05-05 4:59 ` [PATCH v2 19/20] Input: rmi4 - propagate proper error code in F12 sensor tuning Dmitry Torokhov
2026-05-05 4:59 ` Dmitry Torokhov [this message]
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=20260505045952.1570713-20-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=Marge.Yang@tw.synaptics.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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