Re: [PATCH 2/2 v4] input: add SparkFun Qwiic Joystick driver
From: Oleh Kravchenko <hidden>
Date: 2021-06-15 07:50:05
Also in:
linux-devicetree
Hello Dmitry, Thank you for your code-review
15 черв. 2021 р. о 07:57 Dmitry Torokhov [off-list ref] пише: Hi Oleh,quoted
+struct qwiic_data { + __be16 x; + __be16 y; + u8 thumb; +} __packed;The members of this structure are naturally aligned, so there is no need to declare it as __packed.
Sorry, I forgot to fix this nitpick :-/
quoted
+ +static void qwiic_poll(struct input_dev *input) +{ + struct qwiic_jsk *priv; + struct qwiic_data data; + int err; + + priv = input_get_drvdata(input); + + err = i2c_smbus_read_i2c_block_data(priv->client, QWIIC_JSK_REG_DATA, + sizeof(data), (u8 *)&data); + if (err != sizeof(data)) + return; + + input_report_abs(input, ABS_X, be16_to_cpu(data.x) >> 6); + input_report_abs(input, ABS_Y, be16_to_cpu(data.y) >> 6); + input_report_key(input, BTN_THUMBL, !data.thumb); + input_sync(input); +} + +static int qwiic_probe(struct i2c_client *client, + const struct i2c_device_id *id)The probe() does not use the i2c_device_id parameter, so I will switch it to probe_new() to avoid the temptation of using it in the future.
Sounds awesome!
Please let me know if you disagree, otherwise I will go and apply (no need to resubmit).
I agree, please merge.