* [PATCH 1/3] input/touchscreen: imagis: Clarify the usage of protocol_b
From: Raymond Hackley @ 2024-06-12 3:21 UTC (permalink / raw)
To: linux-kernel
Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Stephan Gerhold, Nikita Travkin, linux-input,
devicetree, ~postmarketos/upstreaming
In-Reply-To: <20240612032036.33103-1-raymondhackley@protonmail.com>
protocol_b is a property, which tells Imagis panel to use a different
format for coordinates.
IST30XXC series is known for using protocol B, while the other series
aren't. Note this could be confusing, unlike the model name implies.
Adjust the usage of protocol_b to avoid confusion.
Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com>
---
drivers/input/touchscreen/imagis.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c
index 074dd6c342ec..886bcfc8497a 100644
--- a/drivers/input/touchscreen/imagis.c
+++ b/drivers/input/touchscreen/imagis.c
@@ -120,12 +120,12 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id)
for (i = 0; i < finger_count; i++) {
if (ts->tdata->protocol_b)
- error = imagis_i2c_read_reg(ts,
- ts->tdata->touch_coord_cmd, &finger_status);
- else
error = imagis_i2c_read_reg(ts,
ts->tdata->touch_coord_cmd + (i * 4),
&finger_status);
+ else
+ error = imagis_i2c_read_reg(ts,
+ ts->tdata->touch_coord_cmd, &finger_status);
if (error) {
dev_err(&ts->client->dev,
"failed to read coordinates for finger %d: %d\n",
@@ -394,6 +394,7 @@ static const struct imagis_properties imagis_3032c_data = {
.whoami_cmd = IST3038C_REG_CHIPID,
.whoami_val = IST3032C_WHOAMI,
.touch_keys_supported = true,
+ .protocol_b = true,
};
static const struct imagis_properties imagis_3038b_data = {
@@ -401,7 +402,6 @@ static const struct imagis_properties imagis_3038b_data = {
.touch_coord_cmd = IST3038B_REG_STATUS,
.whoami_cmd = IST3038B_REG_CHIPID,
.whoami_val = IST3038B_WHOAMI,
- .protocol_b = true,
};
static const struct imagis_properties imagis_3038c_data = {
@@ -409,6 +409,7 @@ static const struct imagis_properties imagis_3038c_data = {
.touch_coord_cmd = IST3038C_REG_TOUCH_COORD,
.whoami_cmd = IST3038C_REG_CHIPID,
.whoami_val = IST3038C_WHOAMI,
+ .protocol_b = true,
};
#ifdef CONFIG_OF
--
2.39.2
^ permalink raw reply related
* [PATCH 0/3] Add support for Imagis IST3038 and clarify the usage of protocol_b
From: Raymond Hackley @ 2024-06-12 3:20 UTC (permalink / raw)
To: linux-kernel
Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Stephan Gerhold, Nikita Travkin, linux-input,
devicetree, ~postmarketos/upstreaming
Imagis IST3038 is another variant of Imagis IST3038 IC, which has
a different register interface from IST3038C (possibly firmware defined).
Unlike IST3038C/IST3032C, IST3038 has different registers for commands,
which means IST3038 doesn't use protocol B.
Similar to IST3032C and maybe the other variants, IST3038 has touch keys
support, which provides KEY_APPSELECT and KEY_BACK.
Add support for IST3038 with touch keys.
protocol_b is a property, which tells Imagis panel to use a different
format for coordinates.
IST30XXC series is known for using protocol B, while the other series
aren't. Note this could be confusing, unlike the model name implies.
Adjust the usage of protocol_b to avoid confusion.
^ permalink raw reply
* Re: [PATCH v4 3/3] dt-bindings: cros-ec-keyboard: Add keyboard matrix v3.0
From: Dmitry Torokhov @ 2024-06-11 18:11 UTC (permalink / raw)
To: Daisuke Nojiri
Cc: Benson Leung, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Reka Norman, Hans Verkuil,
Pavan Holla, Gwendal Grignou, Lukasz Majczak, Ching-Kang Yen,
Stephen Boyd, Prashant Malani, chrome-platform, linux-kernel,
linux-input, devicetree
In-Reply-To: <2fdd4a2cb8526e60ba7143ec868e835f8ba8f55b.1717779167.git.dnojiri@chromium.org>
On Fri, Jun 07, 2024 at 10:02:58AM -0700, Daisuke Nojiri wrote:
> Add support for keyboard matrix version 3.0, which reduces keyboard
> ghosting.
Could you add to the patch description an example of how this should be used?
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v4 1/3] platform/chrome: Add struct ec_response_get_next_event_v3
From: Dmitry Torokhov @ 2024-06-11 18:11 UTC (permalink / raw)
To: Daisuke Nojiri
Cc: Benson Leung, Tzung-Bi Shih, Guenter Roeck, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Reka Norman, Hans Verkuil,
Pavan Holla, Gwendal Grignou, Lukasz Majczak, Ching-Kang Yen,
Stephen Boyd, Prashant Malani, chrome-platform, linux-kernel,
linux-input, devicetree
In-Reply-To: <979b1fdaa5b3d3165e53f5429470c42581394d14.1717779167.git.dnojiri@chromium.org>
Hi Daisuke,
On Fri, Jun 07, 2024 at 10:02:56AM -0700, Daisuke Nojiri wrote:
> Add struct ec_response_get_next_event_v3 to upgrade
> EC_CMD_GET_NEXT_EVENT to version 3.
>
> Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
> ---
> .../linux/platform_data/cros_ec_commands.h | 34 +++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h
> index 070e49c5381e..fff191a8d413 100644
> --- a/include/linux/platform_data/cros_ec_commands.h
> +++ b/include/linux/platform_data/cros_ec_commands.h
> @@ -3527,6 +3527,34 @@ union __ec_align_offset1 ec_response_get_next_data_v1 {
> };
> BUILD_ASSERT(sizeof(union ec_response_get_next_data_v1) == 16);
>
> +union __ec_align_offset1 ec_response_get_next_data_v3 {
> + uint8_t key_matrix[18];
> +
> + /* Unaligned */
> + uint32_t host_event;
> + uint64_t host_event64;
> +
> + struct __ec_todo_unpacked {
> + /* For aligning the fifo_info */
> + uint8_t reserved[3];
> + struct ec_response_motion_sense_fifo_info info;
> + } sensor_fifo;
> +
> + uint32_t buttons;
> +
> + uint32_t switches;
> +
> + uint32_t fp_events;
> +
> + uint32_t sysrq;
> +
> + /* CEC events from enum mkbp_cec_event */
> + uint32_t cec_events;
> +
> + uint8_t cec_message[16];
> +};
> +BUILD_ASSERT(sizeof(union ec_response_get_next_data_v3) == 18);
> +
> struct ec_response_get_next_event {
> uint8_t event_type;
> /* Followed by event data if any */
> @@ -3539,6 +3567,12 @@ struct ec_response_get_next_event_v1 {
> union ec_response_get_next_data_v1 data;
> } __ec_align1;
>
> +struct ec_response_get_next_event_v3 {
> + uint8_t event_type;
> + /* Followed by event data if any */
> + union ec_response_get_next_data_v3 data;
> +} __ec_align1;
> +
It is not really obvious that ec_response_get_next_event and
ec_response_get_next_event_v3 are layout compatible. I would simply
extend the union and add key_matrix_v3 field instead of defining
a brand new union.
And I would drop ec_response_get_next_event_v1 and added missing fields
to the original union as well...
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH HID v3 15/16] HID: bpf: rework hid_bpf_ops_btf_struct_access
From: Benjamin Tissoires @ 2024-06-11 16:57 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Shuah Khan, Jiri Kosina, Jonathan Corbet, Alexei Starovoitov,
open list:KERNEL SELFTEST FRAMEWORK, LKML, bpf,
open list:HID CORE LAYER, open list:DOCUMENTATION
In-Reply-To: <CAADnVQLCyEZMyThCH6QNopBbWbNcpR+h2AaLhT0apEO7pOWrRQ@mail.gmail.com>
On Jun 10 2024, Alexei Starovoitov wrote:
> On Sat, Jun 8, 2024 at 2:01 AM Benjamin Tissoires <bentiss@kernel.org> wrote:
> >
> > The idea is to provide a list of stucts and their editable fields.
> >
> > Currently no functional changes are introduced here, we will add some
> > more writeable fields in the next patch.
> >
> > Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> >
> > ---
> >
> > changes in v3:
> > - rewrote WRITE_RANGE macro to not deal with offset from the caller side
> >
> > new in v2
> > ---
> > drivers/hid/bpf/hid_bpf_struct_ops.c | 91 +++++++++++++++++++++++++++---------
> > 1 file changed, 69 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/hid/bpf/hid_bpf_struct_ops.c b/drivers/hid/bpf/hid_bpf_struct_ops.c
> > index 056d05d96962..b14eccb121e0 100644
> > --- a/drivers/hid/bpf/hid_bpf_struct_ops.c
> > +++ b/drivers/hid/bpf/hid_bpf_struct_ops.c
> > @@ -16,6 +16,7 @@
> > #include <linux/hid_bpf.h>
> > #include <linux/init.h>
> > #include <linux/module.h>
> > +#include <linux/stddef.h>
> > #include <linux/workqueue.h>
> > #include "hid_bpf_dispatch.h"
> >
> > @@ -52,40 +53,86 @@ static int hid_bpf_ops_check_member(const struct btf_type *t,
> > return 0;
> > }
> >
> > +struct hid_bpf_offset_write_range {
> > + const char *struct_name;
> > + u32 struct_length;
> > + u32 start;
> > + u32 end;
> > +};
> > +
> > static int hid_bpf_ops_btf_struct_access(struct bpf_verifier_log *log,
> > const struct bpf_reg_state *reg,
> > int off, int size)
> > {
> > - const struct btf_type *state;
> > - const struct btf_type *t;
> > - s32 type_id;
> > +#define WRITE_RANGE(_name, _field, _is_string) \
> > + { \
> > + .struct_name = #_name, \
> > + .struct_length = sizeof(struct _name), \
> > + .start = offsetof(struct _name, _field), \
> > + .end = offsetofend(struct _name, _field) - !!(_is_string),
>
> so it works because char name[128]; had last byte as zero
> before prog writes into it (in addition to potentially having
> earlier 0 bytes), so the string is guaranteed
> to be null-terminated regardless of what prog writes into it.
> Right?
Yeah, struct hid_device is created through hid_allocate_device(), which
does a kzalloc. Then all operations are supposedly safe in the current
transport layers, so the last byte should always be \0.
>
> Overall:
> Acked-by: Alexei Starovoitov <ast@kernel.org>
Thanks a lot.
I might send a v4 or not depending if I get other reviews, but I'll make
sure to take your nitpick in 3/16 into account (cast kdata/udate in the
beginning of the function to make the lines shorter and less verbose).
Cheers,
Benjamin
^ permalink raw reply
* Re: [PATCH] Input: adc-joystick - move axes data into the main structure
From: Dan Carpenter @ 2024-06-11 10:46 UTC (permalink / raw)
To: oe-kbuild, Dmitry Torokhov, linux-input
Cc: lkp, oe-kbuild-all, Artur Rojek, Chris Morgan, linux-kernel
In-Reply-To: <ZmYlfKDm5sgB44EU@google.com>
Hi Dmitry,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Dmitry-Torokhov/Input-adc-joystick-move-axes-data-into-the-main-structure/20240610-060124
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link: https://lore.kernel.org/r/ZmYlfKDm5sgB44EU%40google.com
patch subject: [PATCH] Input: adc-joystick - move axes data into the main structure
config: x86_64-randconfig-161-20240611 (https://download.01.org/0day-ci/archive/20240611/202406111750.AXBfJUS3-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202406111750.AXBfJUS3-lkp@intel.com/
smatch warnings:
drivers/input/joystick/adc-joystick.c:166 adc_joystick_set_axes() error: uninitialized symbol 'axes'.
drivers/input/joystick/adc-joystick.c:241 adc_joystick_probe() error: uninitialized symbol 'joy'.
drivers/input/joystick/adc-joystick.c:241 adc_joystick_probe() warn: passing zero to 'PTR_ERR'
vim +/axes +166 drivers/input/joystick/adc-joystick.c
2c2b364fddd551 Artur Rojek 2020-09-28 131
2c2b364fddd551 Artur Rojek 2020-09-28 132 static int adc_joystick_set_axes(struct device *dev, struct adc_joystick *joy)
2c2b364fddd551 Artur Rojek 2020-09-28 133 {
2c2b364fddd551 Artur Rojek 2020-09-28 134 struct adc_joystick_axis *axes;
2c2b364fddd551 Artur Rojek 2020-09-28 135 struct fwnode_handle *child;
815b74328f141f Dmitry Torokhov 2024-06-09 136 s32 range[2], fuzz, flat;
815b74328f141f Dmitry Torokhov 2024-06-09 137 unsigned int num_axes;
815b74328f141f Dmitry Torokhov 2024-06-09 138 int error, i;
2c2b364fddd551 Artur Rojek 2020-09-28 139
2c2b364fddd551 Artur Rojek 2020-09-28 140 num_axes = device_get_child_node_count(dev);
2c2b364fddd551 Artur Rojek 2020-09-28 141 if (!num_axes) {
2c2b364fddd551 Artur Rojek 2020-09-28 142 dev_err(dev, "Unable to find child nodes\n");
2c2b364fddd551 Artur Rojek 2020-09-28 143 return -EINVAL;
2c2b364fddd551 Artur Rojek 2020-09-28 144 }
2c2b364fddd551 Artur Rojek 2020-09-28 145
2c2b364fddd551 Artur Rojek 2020-09-28 146 if (num_axes != joy->num_chans) {
2c2b364fddd551 Artur Rojek 2020-09-28 147 dev_err(dev, "Got %d child nodes for %d channels\n",
2c2b364fddd551 Artur Rojek 2020-09-28 148 num_axes, joy->num_chans);
2c2b364fddd551 Artur Rojek 2020-09-28 149 return -EINVAL;
2c2b364fddd551 Artur Rojek 2020-09-28 150 }
2c2b364fddd551 Artur Rojek 2020-09-28 151
2c2b364fddd551 Artur Rojek 2020-09-28 152 device_for_each_child_node(dev, child) {
2c2b364fddd551 Artur Rojek 2020-09-28 153 error = fwnode_property_read_u32(child, "reg", &i);
2c2b364fddd551 Artur Rojek 2020-09-28 154 if (error) {
2c2b364fddd551 Artur Rojek 2020-09-28 155 dev_err(dev, "reg invalid or missing\n");
2c2b364fddd551 Artur Rojek 2020-09-28 156 goto err_fwnode_put;
2c2b364fddd551 Artur Rojek 2020-09-28 157 }
2c2b364fddd551 Artur Rojek 2020-09-28 158
2c2b364fddd551 Artur Rojek 2020-09-28 159 if (i >= num_axes) {
2c2b364fddd551 Artur Rojek 2020-09-28 160 error = -EINVAL;
2c2b364fddd551 Artur Rojek 2020-09-28 161 dev_err(dev, "No matching axis for reg %d\n", i);
2c2b364fddd551 Artur Rojek 2020-09-28 162 goto err_fwnode_put;
2c2b364fddd551 Artur Rojek 2020-09-28 163 }
2c2b364fddd551 Artur Rojek 2020-09-28 164
2c2b364fddd551 Artur Rojek 2020-09-28 165 error = fwnode_property_read_u32(child, "linux,code",
2c2b364fddd551 Artur Rojek 2020-09-28 @166 &axes[i].code);
axes is unitialized.
2c2b364fddd551 Artur Rojek 2020-09-28 167 if (error) {
2c2b364fddd551 Artur Rojek 2020-09-28 168 dev_err(dev, "linux,code invalid or missing\n");
2c2b364fddd551 Artur Rojek 2020-09-28 169 goto err_fwnode_put;
2c2b364fddd551 Artur Rojek 2020-09-28 170 }
2c2b364fddd551 Artur Rojek 2020-09-28 171
2c2b364fddd551 Artur Rojek 2020-09-28 172 error = fwnode_property_read_u32_array(child, "abs-range",
815b74328f141f Dmitry Torokhov 2024-06-09 173 range, 2);
2c2b364fddd551 Artur Rojek 2020-09-28 174 if (error) {
2c2b364fddd551 Artur Rojek 2020-09-28 175 dev_err(dev, "abs-range invalid or missing\n");
2c2b364fddd551 Artur Rojek 2020-09-28 176 goto err_fwnode_put;
2c2b364fddd551 Artur Rojek 2020-09-28 177 }
2c2b364fddd551 Artur Rojek 2020-09-28 178
815b74328f141f Dmitry Torokhov 2024-06-09 179 if (range[0] > range[1]) {
6560cfcfb46511 Chris Morgan 2024-01-19 180 dev_dbg(dev, "abs-axis %d inverted\n", i);
6560cfcfb46511 Chris Morgan 2024-01-19 181 axes[i].inverted = true;
815b74328f141f Dmitry Torokhov 2024-06-09 182 swap(range[0], range[1]);
6560cfcfb46511 Chris Morgan 2024-01-19 183 }
6560cfcfb46511 Chris Morgan 2024-01-19 184
815b74328f141f Dmitry Torokhov 2024-06-09 185 fwnode_property_read_u32(child, "abs-fuzz", &fuzz);
815b74328f141f Dmitry Torokhov 2024-06-09 186 fwnode_property_read_u32(child, "abs-flat", &flat);
2c2b364fddd551 Artur Rojek 2020-09-28 187
2c2b364fddd551 Artur Rojek 2020-09-28 188 input_set_abs_params(joy->input, axes[i].code,
815b74328f141f Dmitry Torokhov 2024-06-09 189 range[0], range[1], fuzz, flat);
2c2b364fddd551 Artur Rojek 2020-09-28 190 }
2c2b364fddd551 Artur Rojek 2020-09-28 191
2c2b364fddd551 Artur Rojek 2020-09-28 192 return 0;
2c2b364fddd551 Artur Rojek 2020-09-28 193
2c2b364fddd551 Artur Rojek 2020-09-28 194 err_fwnode_put:
2c2b364fddd551 Artur Rojek 2020-09-28 195 fwnode_handle_put(child);
2c2b364fddd551 Artur Rojek 2020-09-28 196 return error;
2c2b364fddd551 Artur Rojek 2020-09-28 197 }
2c2b364fddd551 Artur Rojek 2020-09-28 198
815b74328f141f Dmitry Torokhov 2024-06-09 199
815b74328f141f Dmitry Torokhov 2024-06-09 200 /*
815b74328f141f Dmitry Torokhov 2024-06-09 201 * Count how many channels we got. NULL terminated.
815b74328f141f Dmitry Torokhov 2024-06-09 202 * Do not check the storage size if using polling.
815b74328f141f Dmitry Torokhov 2024-06-09 203 */
815b74328f141f Dmitry Torokhov 2024-06-09 204 static int adc_joystick_count_channels(struct device *dev,
815b74328f141f Dmitry Torokhov 2024-06-09 205 const struct iio_channel *chans,
815b74328f141f Dmitry Torokhov 2024-06-09 206 bool polled,
815b74328f141f Dmitry Torokhov 2024-06-09 207 unsigned int *num_chans)
815b74328f141f Dmitry Torokhov 2024-06-09 208 {
815b74328f141f Dmitry Torokhov 2024-06-09 209 int bits;
815b74328f141f Dmitry Torokhov 2024-06-09 210 int i;
815b74328f141f Dmitry Torokhov 2024-06-09 211
815b74328f141f Dmitry Torokhov 2024-06-09 212 for (i = 0; chans[i].indio_dev; i++) {
815b74328f141f Dmitry Torokhov 2024-06-09 213 if (polled)
815b74328f141f Dmitry Torokhov 2024-06-09 214 continue;
815b74328f141f Dmitry Torokhov 2024-06-09 215 bits = chans[i].channel->scan_type.storagebits;
815b74328f141f Dmitry Torokhov 2024-06-09 216 if (!bits || bits > 16) {
815b74328f141f Dmitry Torokhov 2024-06-09 217 dev_err(dev, "Unsupported channel storage size\n");
815b74328f141f Dmitry Torokhov 2024-06-09 218 return -EINVAL;
815b74328f141f Dmitry Torokhov 2024-06-09 219 }
815b74328f141f Dmitry Torokhov 2024-06-09 220 if (bits != chans[0].channel->scan_type.storagebits) {
815b74328f141f Dmitry Torokhov 2024-06-09 221 dev_err(dev, "Channels must have equal storage size\n");
815b74328f141f Dmitry Torokhov 2024-06-09 222 return -EINVAL;
815b74328f141f Dmitry Torokhov 2024-06-09 223 }
815b74328f141f Dmitry Torokhov 2024-06-09 224 }
815b74328f141f Dmitry Torokhov 2024-06-09 225
815b74328f141f Dmitry Torokhov 2024-06-09 226 return i;
815b74328f141f Dmitry Torokhov 2024-06-09 227 }
815b74328f141f Dmitry Torokhov 2024-06-09 228
2c2b364fddd551 Artur Rojek 2020-09-28 229 static int adc_joystick_probe(struct platform_device *pdev)
2c2b364fddd551 Artur Rojek 2020-09-28 230 {
2c2b364fddd551 Artur Rojek 2020-09-28 231 struct device *dev = &pdev->dev;
815b74328f141f Dmitry Torokhov 2024-06-09 232 struct iio_channel *chans;
2c2b364fddd551 Artur Rojek 2020-09-28 233 struct adc_joystick *joy;
2c2b364fddd551 Artur Rojek 2020-09-28 234 struct input_dev *input;
815b74328f141f Dmitry Torokhov 2024-06-09 235 unsigned int poll_interval = 0;
815b74328f141f Dmitry Torokhov 2024-06-09 236 unsigned int num_chans;
2c2b364fddd551 Artur Rojek 2020-09-28 237 int error;
2c2b364fddd551 Artur Rojek 2020-09-28 238
815b74328f141f Dmitry Torokhov 2024-06-09 239 chans = devm_iio_channel_get_all(dev);
815b74328f141f Dmitry Torokhov 2024-06-09 240 if (IS_ERR(chans)) {
2c2b364fddd551 Artur Rojek 2020-09-28 @241 error = PTR_ERR(joy->chans);
s/joy->chans/chans/
2c2b364fddd551 Artur Rojek 2020-09-28 242 if (error != -EPROBE_DEFER)
2c2b364fddd551 Artur Rojek 2020-09-28 243 dev_err(dev, "Unable to get IIO channels");
2c2b364fddd551 Artur Rojek 2020-09-28 244 return error;
2c2b364fddd551 Artur Rojek 2020-09-28 245 }
2c2b364fddd551 Artur Rojek 2020-09-28 246
24c06e000e8fa2 Chris Morgan 2022-08-16 247 error = device_property_read_u32(dev, "poll-interval", &poll_interval);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH v2 3/4] Input: adxl34x - switch to using managed resources
From: Nuno Sá @ 2024-06-11 9:11 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input, Nuno Sa; +Cc: Michael Hennerich, linux-kernel
In-Reply-To: <20240610164301.1048482-3-dmitry.torokhov@gmail.com>
On Mon, 2024-06-10 at 09:42 -0700, Dmitry Torokhov wrote:
> Switch the driver to use managed resources to simplify error handling.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
^ permalink raw reply
* Re: [PATCH v2 2/4] Input: adxl34x - use input_set_capability()
From: Nuno Sá @ 2024-06-11 9:09 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input, Nuno Sa; +Cc: Michael Hennerich, linux-kernel
In-Reply-To: <20240610164301.1048482-2-dmitry.torokhov@gmail.com>
On Mon, 2024-06-10 at 09:42 -0700, Dmitry Torokhov wrote:
> Switch to using input_set_capability() instead of using __set_bit() to
> make clear what exactly kinds of events (EV_KEY, EV_REL) are being
> declared.
>
> Also drop redundant calls setting EV_ABS and ABS_X|Y|Z bits as that is
> taken care by input_set_abs_params().
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
>
> v2: new patch, split out from devm conversion at Nino's request
>
> drivers/input/misc/adxl34x.c | 32 +++++++++++++-------------------
> 1 file changed, 13 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
> index fbe5a56c19d1..830acf29c32b 100644
> --- a/drivers/input/misc/adxl34x.c
> +++ b/drivers/input/misc/adxl34x.c
> @@ -769,18 +769,12 @@ struct adxl34x *adxl34x_probe(struct device *dev, int
> irq,
>
> input_set_drvdata(input_dev, ac);
>
> - __set_bit(ac->pdata.ev_type, input_dev->evbit);
> -
> if (ac->pdata.ev_type == EV_REL) {
> - __set_bit(REL_X, input_dev->relbit);
> - __set_bit(REL_Y, input_dev->relbit);
> - __set_bit(REL_Z, input_dev->relbit);
> + input_set_capability(input_dev, EV_REL, REL_X);
> + input_set_capability(input_dev, EV_REL, REL_Y);
> + input_set_capability(input_dev, EV_REL, REL_Z);
> } else {
> /* EV_ABS */
> - __set_bit(ABS_X, input_dev->absbit);
> - __set_bit(ABS_Y, input_dev->absbit);
> - __set_bit(ABS_Z, input_dev->absbit);
> -
> if (pdata->data_range & FULL_RES)
> range = ADXL_FULLRES_MAX_VAL; /* Signed 13-bit */
> else
> @@ -791,18 +785,18 @@ struct adxl34x *adxl34x_probe(struct device *dev, int
> irq,
> input_set_abs_params(input_dev, ABS_Z, -range, range, 3, 3);
> }
>
> - __set_bit(EV_KEY, input_dev->evbit);
> - __set_bit(pdata->ev_code_tap[ADXL_X_AXIS], input_dev->keybit);
> - __set_bit(pdata->ev_code_tap[ADXL_Y_AXIS], input_dev->keybit);
> - __set_bit(pdata->ev_code_tap[ADXL_Z_AXIS], input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY, pdata-
> >ev_code_tap[ADXL_X_AXIS]);
> + input_set_capability(input_dev, EV_KEY, pdata-
> >ev_code_tap[ADXL_Y_AXIS]);
> + input_set_capability(input_dev, EV_KEY, pdata-
> >ev_code_tap[ADXL_Z_AXIS]);
>
> if (pdata->ev_code_ff) {
> ac->int_mask = FREE_FALL;
> - __set_bit(pdata->ev_code_ff, input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY, pdata->ev_code_ff);
> }
>
> if (pdata->ev_code_act_inactivity)
> - __set_bit(pdata->ev_code_act_inactivity, input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY,
> + pdata->ev_code_act_inactivity);
>
> ac->int_mask |= ACTIVITY | INACTIVITY;
>
> @@ -874,13 +868,13 @@ struct adxl34x *adxl34x_probe(struct device *dev, int
> irq,
>
> if (pdata->orientation_enable & ADXL_EN_ORIENTATION_3D)
> for (i = 0; i < ARRAY_SIZE(pdata-
> >ev_codes_orient_3d); i++)
> - __set_bit(pdata->ev_codes_orient_3d[i],
> - input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY,
> + pdata-
> >ev_codes_orient_3d[i]);
>
> if (pdata->orientation_enable & ADXL_EN_ORIENTATION_2D)
> for (i = 0; i < ARRAY_SIZE(pdata-
> >ev_codes_orient_2d); i++)
> - __set_bit(pdata->ev_codes_orient_2d[i],
> - input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY,
> + pdata-
> >ev_codes_orient_2d[i]);
> } else {
> ac->pdata.orientation_enable = 0;
> }
^ permalink raw reply
* RE: [PATCH v2 1/4] Input: adxl34x - use device core to create driver-specific device attributes
From: Hennerich, Michael @ 2024-06-11 8:45 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input@vger.kernel.org, Sa, Nuno
Cc: linux-kernel@vger.kernel.org
In-Reply-To: <20240610164301.1048482-1-dmitry.torokhov@gmail.com>
> -----Original Message-----
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Sent: Monday, June 10, 2024 6:43 PM
> To: linux-input@vger.kernel.org; Sa, Nuno <Nuno.Sa@analog.com>
> Cc: Hennerich, Michael <Michael.Hennerich@analog.com>; linux-
> kernel@vger.kernel.org
> Subject: [PATCH v2 1/4] Input: adxl34x - use device core to create driver-
> specific device attributes
>
>
> Instead of creating driver-specific device attributes with
> sysfs_create_group() have device core do this by setting up dev_groups
> pointer in the driver structure.
>
> Reviewed-by: Nuno Sa <nuno.sa@analog.com>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> ---
>
> v2: added Nono's ACK
>
> drivers/input/misc/adxl34x-i2c.c | 1 + drivers/input/misc/adxl34x-spi.c | 1
> +
> drivers/input/misc/adxl34x.c | 15 +++++++--------
> drivers/input/misc/adxl34x.h | 1 +
> 4 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-
> i2c.c
> index d4014e367c77..7531c7b2d657 100644
> --- a/drivers/input/misc/adxl34x-i2c.c
> +++ b/drivers/input/misc/adxl34x-i2c.c
> @@ -132,6 +132,7 @@ MODULE_DEVICE_TABLE(of, adxl34x_of_id); static
> struct i2c_driver adxl34x_driver = {
> .driver = {
> .name = "adxl34x",
> + .dev_groups = adxl34x_groups,
> .pm = pm_sleep_ptr(&adxl34x_pm),
> .of_match_table = adxl34x_of_id,
> },
> diff --git a/drivers/input/misc/adxl34x-spi.c b/drivers/input/misc/adxl34x-
> spi.c
> index f1094a8ccdd5..2befcc4df0be 100644
> --- a/drivers/input/misc/adxl34x-spi.c
> +++ b/drivers/input/misc/adxl34x-spi.c
> @@ -97,6 +97,7 @@ static void adxl34x_spi_remove(struct spi_device *spi)
> static struct spi_driver adxl34x_driver = {
> .driver = {
> .name = "adxl34x",
> + .dev_groups = adxl34x_groups,
> .pm = pm_sleep_ptr(&adxl34x_pm),
> },
> .probe = adxl34x_spi_probe,
> diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c index
> a3f45e0ee0c7..fbe5a56c19d1 100644
> --- a/drivers/input/misc/adxl34x.c
> +++ b/drivers/input/misc/adxl34x.c
> @@ -664,6 +664,12 @@ static const struct attribute_group
> adxl34x_attr_group = {
> .attrs = adxl34x_attributes,
> };
>
> +const struct attribute_group *adxl34x_groups[] = {
> + &adxl34x_attr_group,
> + NULL
> +};
> +EXPORT_SYMBOL_GPL(adxl34x_groups);
> +
> static int adxl34x_input_open(struct input_dev *input) {
> struct adxl34x *ac = input_get_drvdata(input); @@ -823,13 +829,9
> @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
> goto err_free_mem;
> }
>
> - err = sysfs_create_group(&dev->kobj, &adxl34x_attr_group);
> - if (err)
> - goto err_free_irq;
> -
> err = input_register_device(input_dev);
> if (err)
> - goto err_remove_attr;
> + goto err_free_irq;
>
> AC_WRITE(ac, OFSX, pdata->x_axis_offset);
> ac->hwcal.x = pdata->x_axis_offset;
> @@ -889,8 +891,6 @@ struct adxl34x *adxl34x_probe(struct device *dev, int
> irq,
>
> return ac;
>
> - err_remove_attr:
> - sysfs_remove_group(&dev->kobj, &adxl34x_attr_group);
> err_free_irq:
> free_irq(ac->irq, ac);
> err_free_mem:
> @@ -903,7 +903,6 @@ EXPORT_SYMBOL_GPL(adxl34x_probe);
>
> void adxl34x_remove(struct adxl34x *ac) {
> - sysfs_remove_group(&ac->dev->kobj, &adxl34x_attr_group);
> free_irq(ac->irq, ac);
> input_unregister_device(ac->input);
> dev_dbg(ac->dev, "unregistered accelerometer\n"); diff --git
> a/drivers/input/misc/adxl34x.h b/drivers/input/misc/adxl34x.h index
> f9272a2e7a96..67e0ddc5c3eb 100644
> --- a/drivers/input/misc/adxl34x.h
> +++ b/drivers/input/misc/adxl34x.h
> @@ -26,5 +26,6 @@ struct adxl34x *adxl34x_probe(struct device *dev, int
> irq, void adxl34x_remove(struct adxl34x *ac);
>
> extern const struct dev_pm_ops adxl34x_pm;
> +extern const struct attribute_group *adxl34x_groups[];
>
> #endif
> --
> 2.45.2.505.gda0bf45e8d-goog
^ permalink raw reply
* [dtor-input:next] BUILD SUCCESS e17fb91cd4cde13001dc75ad99a378ab28dd44df
From: kernel test robot @ 2024-06-10 22:22 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
branch HEAD: e17fb91cd4cde13001dc75ad99a378ab28dd44df Input: add missing MODULE_DESCRIPTION() macros
elapsed time: 1449m
configs tested: 190
configs skipped: 3
The following configs have been built successfully.
More configs may be tested in the coming days.
tested configs:
alpha allnoconfig gcc
alpha allyesconfig gcc
alpha defconfig gcc
arc allmodconfig gcc
arc allnoconfig gcc
arc allyesconfig gcc
arc defconfig gcc
arc randconfig-001-20240610 gcc
arc randconfig-002-20240610 gcc
arm allmodconfig gcc
arm allnoconfig clang
arm defconfig clang
arm hisi_defconfig gcc
arm ixp4xx_defconfig gcc
arm keystone_defconfig gcc
arm moxart_defconfig gcc
arm mvebu_v5_defconfig gcc
arm pxa168_defconfig clang
arm randconfig-001-20240610 gcc
arm randconfig-002-20240610 gcc
arm randconfig-003-20240610 clang
arm randconfig-004-20240610 gcc
arm sama5_defconfig gcc
arm64 allnoconfig gcc
arm64 defconfig gcc
arm64 randconfig-001-20240610 gcc
arm64 randconfig-002-20240610 gcc
arm64 randconfig-003-20240610 gcc
arm64 randconfig-004-20240610 gcc
csky allnoconfig gcc
csky defconfig gcc
csky randconfig-001-20240610 gcc
csky randconfig-002-20240610 gcc
hexagon allmodconfig clang
hexagon allnoconfig clang
hexagon allyesconfig clang
hexagon defconfig clang
hexagon randconfig-001-20240610 clang
hexagon randconfig-002-20240610 clang
i386 allmodconfig gcc
i386 allnoconfig gcc
i386 allyesconfig gcc
i386 buildonly-randconfig-001-20240610 clang
i386 buildonly-randconfig-002-20240610 gcc
i386 buildonly-randconfig-003-20240610 gcc
i386 buildonly-randconfig-004-20240610 clang
i386 buildonly-randconfig-005-20240610 gcc
i386 buildonly-randconfig-006-20240610 clang
i386 defconfig clang
i386 randconfig-001-20240610 gcc
i386 randconfig-002-20240610 gcc
i386 randconfig-003-20240610 gcc
i386 randconfig-004-20240610 gcc
i386 randconfig-005-20240610 clang
i386 randconfig-006-20240610 gcc
i386 randconfig-011-20240610 clang
i386 randconfig-012-20240610 clang
i386 randconfig-013-20240610 clang
i386 randconfig-014-20240610 clang
i386 randconfig-015-20240610 clang
i386 randconfig-016-20240610 clang
loongarch allmodconfig gcc
loongarch allnoconfig gcc
loongarch defconfig gcc
loongarch randconfig-001-20240610 gcc
loongarch randconfig-002-20240610 gcc
m68k allmodconfig gcc
m68k allnoconfig gcc
m68k allyesconfig gcc
m68k atari_defconfig gcc
m68k bvme6000_defconfig gcc
m68k defconfig gcc
microblaze allmodconfig gcc
microblaze allnoconfig gcc
microblaze allyesconfig gcc
microblaze defconfig gcc
mips allnoconfig gcc
mips allyesconfig gcc
mips decstation_r4k_defconfig gcc
mips gpr_defconfig clang
mips pic32mzda_defconfig gcc
nios2 allmodconfig gcc
nios2 allnoconfig gcc
nios2 allyesconfig gcc
nios2 defconfig gcc
nios2 randconfig-001-20240610 gcc
nios2 randconfig-002-20240610 gcc
openrisc allnoconfig gcc
openrisc allyesconfig gcc
openrisc defconfig gcc
parisc allmodconfig gcc
parisc allnoconfig gcc
parisc allyesconfig gcc
parisc defconfig gcc
parisc randconfig-001-20240610 gcc
parisc randconfig-002-20240610 gcc
parisc64 defconfig gcc
powerpc allmodconfig gcc
powerpc allnoconfig gcc
powerpc allyesconfig clang
powerpc ebony_defconfig clang
powerpc ep8248e_defconfig gcc
powerpc kilauea_defconfig clang
powerpc klondike_defconfig gcc
powerpc ksi8560_defconfig gcc
powerpc mpc834x_itx_defconfig clang
powerpc mpc834x_itxgp_defconfig clang
powerpc mpc866_ads_defconfig clang
powerpc randconfig-001-20240610 clang
powerpc randconfig-002-20240610 clang
powerpc randconfig-003-20240610 clang
powerpc redwood_defconfig clang
powerpc walnut_defconfig gcc
powerpc64 randconfig-001-20240610 clang
powerpc64 randconfig-002-20240610 clang
powerpc64 randconfig-003-20240610 gcc
riscv allmodconfig clang
riscv allnoconfig gcc
riscv allyesconfig clang
riscv defconfig clang
riscv randconfig-001-20240610 gcc
riscv randconfig-002-20240610 gcc
s390 alldefconfig gcc
s390 allmodconfig clang
s390 allnoconfig clang
s390 allyesconfig gcc
s390 defconfig clang
s390 randconfig-001-20240610 gcc
s390 randconfig-002-20240610 gcc
sh allmodconfig gcc
sh allnoconfig gcc
sh allyesconfig gcc
sh apsh4a3a_defconfig gcc
sh defconfig gcc
sh landisk_defconfig gcc
sh randconfig-001-20240610 gcc
sh randconfig-002-20240610 gcc
sh se7619_defconfig gcc
sh se7750_defconfig gcc
sh sh2007_defconfig gcc
sh sh7724_generic_defconfig gcc
sh sh7763rdp_defconfig gcc
sparc allmodconfig gcc
sparc allnoconfig gcc
sparc defconfig gcc
sparc64 allmodconfig gcc
sparc64 allyesconfig gcc
sparc64 defconfig gcc
sparc64 randconfig-001-20240610 gcc
sparc64 randconfig-002-20240610 gcc
um allmodconfig clang
um allnoconfig clang
um allyesconfig gcc
um defconfig clang
um i386_defconfig gcc
um randconfig-001-20240610 gcc
um randconfig-002-20240610 clang
um x86_64_defconfig clang
x86_64 allnoconfig clang
x86_64 allyesconfig clang
x86_64 buildonly-randconfig-001-20240610 gcc
x86_64 buildonly-randconfig-002-20240610 clang
x86_64 buildonly-randconfig-003-20240610 gcc
x86_64 buildonly-randconfig-004-20240610 gcc
x86_64 buildonly-randconfig-005-20240610 gcc
x86_64 buildonly-randconfig-006-20240610 gcc
x86_64 defconfig gcc
x86_64 randconfig-001-20240610 gcc
x86_64 randconfig-002-20240610 gcc
x86_64 randconfig-003-20240610 clang
x86_64 randconfig-004-20240610 gcc
x86_64 randconfig-005-20240610 gcc
x86_64 randconfig-006-20240610 clang
x86_64 randconfig-011-20240610 clang
x86_64 randconfig-012-20240610 gcc
x86_64 randconfig-013-20240610 gcc
x86_64 randconfig-014-20240610 gcc
x86_64 randconfig-015-20240610 clang
x86_64 randconfig-016-20240610 clang
x86_64 randconfig-071-20240610 gcc
x86_64 randconfig-072-20240610 clang
x86_64 randconfig-073-20240610 clang
x86_64 randconfig-074-20240610 gcc
x86_64 randconfig-075-20240610 clang
x86_64 randconfig-076-20240610 clang
x86_64 rhel-8.3-rust clang
xtensa allnoconfig gcc
xtensa iss_defconfig gcc
xtensa randconfig-001-20240610 gcc
xtensa randconfig-002-20240610 gcc
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* reporting: psmouse.synaptics_intertouch=1 for "PNP: DLL060d PNP0f13"
From: Markus Rathgeb @ 2024-06-10 20:50 UTC (permalink / raw)
To: linux-input
Hi,
my kernel log tells me I could try to set psmouse.synaptics_intertouch
to 1 and report it.
kernel: psmouse serio1: synaptics: Your touchpad (PNP: DLL060d
PNP0f13) says it can support a different bus. If i2c-hid and hid-rmi
are not used, you might want to try setting
psmouse.synaptics_intertouch to 1 and report this to
linux-input@vger.kernel.org.
As i2c-hid and hid-rmi modules are not used I added
"psmouse.synaptics_intertouch=1" to the kernel command line and reboot
the system.
After that the message does not appear anymore.
AFAIK my touchpad works before and after that change without any
problems. At least I did not realize any.
Without enabling intertouch the kernel message looks like:
May 01 18:44:01 m3800.localdomain kernel: psmouse serio1: synaptics:
queried max coordinates: x [..5660], y [..4646]
May 01 18:44:01 m3800.localdomain kernel: psmouse serio1: synaptics:
queried min coordinates: x [1386..], y [1252..]
May 01 18:44:01 m3800.localdomain kernel: psmouse serio1: synaptics:
Your touchpad (PNP: DLL060d PNP0f13) says it can support a different
bus. If i2c-hid and hid-rmi are not used, you might want to try
setting psmouse.synaptics_intertouch to 1 and report this to
linux-input@vger.kernel.org.
May 01 18:44:01 m3800.localdomain kernel: psmouse serio1: synaptics:
Touchpad model: 1, fw: 8.1, id: 0x1e2b1, caps:
0xd00123/0x840300/0x126800/0x0, board id: 2733, fw id: 1515627
and another one
May 18 21:27:26 m3800.localdomain kernel: psmouse serio1: synaptics:
queried max coordinates: x [..5660], y [..4646]
May 18 21:27:26 m3800.localdomain kernel: psmouse serio1: synaptics:
queried min coordinates: x [1386..], y [1252..]
May 18 21:27:26 m3800.localdomain kernel: psmouse serio1: synaptics:
Your touchpad (PNP: DLL060d PNP0f13) says it can support a different
bus. If i2c-hid and hid-rmi are not used, you might want to try
setting psmouse.synaptics_intertouch to 1 and report this to
linux-input@vger.kernel.org.
May 18 21:27:26 m3800.localdomain kernel: psmouse serio1: synaptics:
Touchpad model: 1, fw: 8.1, id: 0x1e2b1, caps:
0xd00123/0x840300/0x126800/0x0, board id: 2733, fw id: 1515627
After adding the kernel parameter it looks like
Jun 10 22:18:57 m3800.localdomain kernel: psmouse serio1: synaptics:
queried max coordinates: x [..5660], y [..4646]
Jun 10 22:18:57 m3800.localdomain kernel: psmouse serio1: synaptics:
queried min coordinates: x [1386..], y [1252..]
Jun 10 22:18:57 m3800.localdomain kernel: psmouse serio1: synaptics:
Trying to set up SMBus access
Jun 10 22:18:57 m3800.localdomain kernel: psmouse serio1: synaptics:
SMbus companion is not ready yet
Jun 10 22:18:57 m3800.localdomain kernel: psmouse serio1: synaptics:
Touchpad model: 1, fw: 8.1, id: 0x1e2b1, caps:
0xd00123/0x840300/0x126800/0x0, board id: 2733, fw id: 1515627
Jun 10 22:19:03 m3800.localdomain kernel: psmouse serio1: synaptics:
queried max coordinates: x [..5660], y [..4646]
Jun 10 22:19:03 m3800.localdomain kernel: psmouse serio1: synaptics:
queried min coordinates: x [1386..], y [1252..]
Jun 10 22:19:03 m3800.localdomain kernel: psmouse serio1: synaptics:
Trying to set up SMBus access
So, the SMBus part is new.
Hopefully the report is helpful for you.
Best regards,
Markus
^ permalink raw reply
* Re: [PATCH HID v3 15/16] HID: bpf: rework hid_bpf_ops_btf_struct_access
From: Alexei Starovoitov @ 2024-06-10 18:39 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Shuah Khan, Jiri Kosina, Jonathan Corbet, Alexei Starovoitov,
open list:KERNEL SELFTEST FRAMEWORK, LKML, bpf,
open list:HID CORE LAYER, open list:DOCUMENTATION
In-Reply-To: <20240608-hid_bpf_struct_ops-v3-15-6ac6ade58329@kernel.org>
On Sat, Jun 8, 2024 at 2:01 AM Benjamin Tissoires <bentiss@kernel.org> wrote:
>
> The idea is to provide a list of stucts and their editable fields.
>
> Currently no functional changes are introduced here, we will add some
> more writeable fields in the next patch.
>
> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
>
> ---
>
> changes in v3:
> - rewrote WRITE_RANGE macro to not deal with offset from the caller side
>
> new in v2
> ---
> drivers/hid/bpf/hid_bpf_struct_ops.c | 91 +++++++++++++++++++++++++++---------
> 1 file changed, 69 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/hid/bpf/hid_bpf_struct_ops.c b/drivers/hid/bpf/hid_bpf_struct_ops.c
> index 056d05d96962..b14eccb121e0 100644
> --- a/drivers/hid/bpf/hid_bpf_struct_ops.c
> +++ b/drivers/hid/bpf/hid_bpf_struct_ops.c
> @@ -16,6 +16,7 @@
> #include <linux/hid_bpf.h>
> #include <linux/init.h>
> #include <linux/module.h>
> +#include <linux/stddef.h>
> #include <linux/workqueue.h>
> #include "hid_bpf_dispatch.h"
>
> @@ -52,40 +53,86 @@ static int hid_bpf_ops_check_member(const struct btf_type *t,
> return 0;
> }
>
> +struct hid_bpf_offset_write_range {
> + const char *struct_name;
> + u32 struct_length;
> + u32 start;
> + u32 end;
> +};
> +
> static int hid_bpf_ops_btf_struct_access(struct bpf_verifier_log *log,
> const struct bpf_reg_state *reg,
> int off, int size)
> {
> - const struct btf_type *state;
> - const struct btf_type *t;
> - s32 type_id;
> +#define WRITE_RANGE(_name, _field, _is_string) \
> + { \
> + .struct_name = #_name, \
> + .struct_length = sizeof(struct _name), \
> + .start = offsetof(struct _name, _field), \
> + .end = offsetofend(struct _name, _field) - !!(_is_string),
so it works because char name[128]; had last byte as zero
before prog writes into it (in addition to potentially having
earlier 0 bytes), so the string is guaranteed
to be null-terminated regardless of what prog writes into it.
Right?
Overall:
Acked-by: Alexei Starovoitov <ast@kernel.org>
^ permalink raw reply
* Re: [PATCH HID v3 03/16] HID: bpf: implement HID-BPF through bpf_struct_ops
From: Alexei Starovoitov @ 2024-06-10 18:34 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Shuah Khan, Jiri Kosina, Jonathan Corbet, Alexei Starovoitov,
open list:KERNEL SELFTEST FRAMEWORK, LKML, bpf,
open list:HID CORE LAYER, open list:DOCUMENTATION
In-Reply-To: <20240608-hid_bpf_struct_ops-v3-3-6ac6ade58329@kernel.org>
On Sat, Jun 8, 2024 at 2:01 AM Benjamin Tissoires <bentiss@kernel.org> wrote:
>
> +
> +static int hid_bpf_ops_init_member(const struct btf_type *t,
> + const struct btf_member *member,
> + void *kdata, const void *udata)
> +{
> + u32 moff = __btf_member_bit_offset(t, member) / 8;
> + u32 flags;
> +
> + switch (moff) {
> + case offsetof(struct hid_bpf_ops, hid_id):
> + /* For hid_id and flags fields, this function has to copy it
> + * and return 1 to indicate that the data has been handled by
> + * the struct_ops type, or the verifier will reject the map if
> + * the value of those fields is not zero.
> + */
> + ((struct hid_bpf_ops *)kdata)->hid_id = ((struct hid_bpf_ops *)udata)->hid_id;
> + return 1;
> + case offsetof(struct hid_bpf_ops, flags):
> + flags = ((struct hid_bpf_ops *)udata)->flags;
> + if (flags & ~BPF_F_BEFORE)
> + return -EINVAL;
> + ((struct hid_bpf_ops *)kdata)->flags = flags;
minor nit: I'd cast kdata/udate in the beginning of
the function to make the lines shorter and less verbose.
Similar to how bpf_tcp_ca_init_member() does it.
Acked-by: Alexei Starovoitov <ast@kernel.org>
^ permalink raw reply
* Re: [PATCH] HID: uclogic: avoid linking common code into multiple modules
From: Arnd Bergmann @ 2024-06-10 18:25 UTC (permalink / raw)
To: José Expósito
Cc: Arnd Bergmann, Jiri Kosina, Benjamin Tissoires, Rahul Rameshbabu,
Fabio Baltieri, Ivan Gorinov, Johannes Roith, linux-input,
linux-kernel
In-Reply-To: <Zmcwlt6Kfpt09tKi@fedora>
On Mon, Jun 10, 2024, at 18:57, José Expósito wrote:
> On Mon, Jun 10, 2024 at 08:24:51AM +0200, Arnd Bergmann wrote:
>> On Sat, Jun 8, 2024, at 20:28, José Expósito wrote:
>
> Turns out that, since the last time I checked the KUnit docs,
> we have "EXPORT_SYMBOL_IF_KUNIT" available now.
>
> I think we can use it and your final patch, without the MODULE_*
> changes, could look like:
Looks good to me, can you send that with
Reported-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
?
Feel free to take my original changelog text if that helps
Arnd
> diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
> index ce71b53ea6c5..e40f1ddebbb7 100644
> --- a/drivers/hid/Makefile
> +++ b/drivers/hid/Makefile
> @@ -154,10 +154,8 @@ obj-$(CONFIG_HID_WINWING) += hid-winwing.o
> obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o
> obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR) += hid-sensor-custom.o
>
> -hid-uclogic-test-objs := hid-uclogic-rdesc.o \
> - hid-uclogic-params.o \
> - hid-uclogic-rdesc-test.o
> -obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic-test.o
> +hid-uclogic-test-objs := hid-uclogic-rdesc-test.o
> +obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic.o hid-uclogic-test.o
>
> obj-$(CONFIG_USB_HID) += usbhid/
> obj-$(CONFIG_USB_MOUSE) += usbhid/
> diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c
> index b6dfdf6356a6..6c7a90417569 100644
> --- a/drivers/hid/hid-uclogic-rdesc.c
> +++ b/drivers/hid/hid-uclogic-rdesc.c
> @@ -17,6 +17,7 @@
> #include "hid-uclogic-rdesc.h"
> #include <linux/slab.h>
> #include <asm/unaligned.h>
> +#include <kunit/visibility.h>
>
> /* Fixed WP4030U report descriptor */
> __u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
> @@ -1242,3 +1243,4 @@ __u8 *uclogic_rdesc_template_apply(const __u8
> *template_ptr,
>
> return rdesc_ptr;
> }
> +EXPORT_SYMBOL_IF_KUNIT(uclogic_rdesc_template_apply);
>
> I hope that helps,
> Jose
^ permalink raw reply
* Re: [PATCH] HID: uclogic: avoid linking common code into multiple modules
From: José Expósito @ 2024-06-10 16:57 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Jiri Kosina, Benjamin Tissoires, Rahul Rameshbabu,
Fabio Baltieri, Ivan Gorinov, Johannes Roith, linux-input,
linux-kernel
In-Reply-To: <54c19328-35e2-4506-aa3a-a0b08813d873@app.fastmail.com>
On Mon, Jun 10, 2024 at 08:24:51AM +0200, Arnd Bergmann wrote:
> On Sat, Jun 8, 2024, at 20:28, José Expósito wrote:
> > On Wed, May 29, 2024 at 11:48:05AM +0200, Arnd Bergmann wrote:
>
> >> @@ -154,10 +152,8 @@ obj-$(CONFIG_HID_WINWING) += hid-winwing.o
> >> obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o
> >> obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR) += hid-sensor-custom.o
> >>
> >> -hid-uclogic-test-objs := hid-uclogic-rdesc.o \
> >> - hid-uclogic-params.o \
> >> - hid-uclogic-rdesc-test.o
> >> -obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic-test.o
> >> +hid-uclogic-test-objs := hid-uclogic-rdesc-test.o
> >> +obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic-test.o hid-uclogic-params.o hid-uclogic-params.o
> >>
> >> obj-$(CONFIG_USB_HID) += usbhid/
> >> obj-$(CONFIG_USB_MOUSE) += usbhid/
> >
> > I tested your patch with:
> >
> > hid-uclogic-objs := hid-uclogic-core.o \
> > hid-uclogic-rdesc.o \
> > hid-uclogic-params.o
> > obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o
> > [...]
> > hid-uclogic-test-objs := hid-uclogic-rdesc-test.o
> > obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic.o hid-uclogic-test.o
> >
> > And I think it is a bit more clear and it looks like it does the trick
> > removing the warning.
>
> Right, that seems fine.
>
> > Also, with that change only "EXPORT_SYMBOL_GPL(uclogic_rdesc_template_apply);"
> > is required. The other EXPORT_SYMBOL_GPL can be removed.
> >
> > However, I'm not sure about what are the best practices using EXPORT_SYMBOL_GPL
> > and if it should be used for each function/data in the .h file. Maybe that's
> > why you added them.
>
> No, having only the single export is better here, you should
> have as few of them as possible. I did picked the more complicated
> approach as I wasn't sure if loading the entire driver from the
> test module caused any problems. Let's use your simpler patch
> then.
>
> Arnd
Turns out that, since the last time I checked the KUnit docs,
we have "EXPORT_SYMBOL_IF_KUNIT" available now.
I think we can use it and your final patch, without the MODULE_*
changes, could look like:
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index ce71b53ea6c5..e40f1ddebbb7 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -154,10 +154,8 @@ obj-$(CONFIG_HID_WINWING) += hid-winwing.o
obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o
obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR) += hid-sensor-custom.o
-hid-uclogic-test-objs := hid-uclogic-rdesc.o \
- hid-uclogic-params.o \
- hid-uclogic-rdesc-test.o
-obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic-test.o
+hid-uclogic-test-objs := hid-uclogic-rdesc-test.o
+obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic.o hid-uclogic-test.o
obj-$(CONFIG_USB_HID) += usbhid/
obj-$(CONFIG_USB_MOUSE) += usbhid/
diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c
index b6dfdf6356a6..6c7a90417569 100644
--- a/drivers/hid/hid-uclogic-rdesc.c
+++ b/drivers/hid/hid-uclogic-rdesc.c
@@ -17,6 +17,7 @@
#include "hid-uclogic-rdesc.h"
#include <linux/slab.h>
#include <asm/unaligned.h>
+#include <kunit/visibility.h>
/* Fixed WP4030U report descriptor */
__u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
@@ -1242,3 +1243,4 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
return rdesc_ptr;
}
+EXPORT_SYMBOL_IF_KUNIT(uclogic_rdesc_template_apply);
I hope that helps,
Jose
^ permalink raw reply related
* [PATCH v2 4/4] Input: adxl34x- switch to using "guard" notation
From: Dmitry Torokhov @ 2024-06-10 16:43 UTC (permalink / raw)
To: linux-input, Nuno Sa; +Cc: Michael Hennerich, linux-kernel
In-Reply-To: <20240610164301.1048482-1-dmitry.torokhov@gmail.com>
Switch to using guard(mutex)() notation to acquire and automatically
release mutexes.
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
v2: added Nono's ACK
drivers/input/misc/adxl34x.c | 61 ++++++++++++------------------------
1 file changed, 20 insertions(+), 41 deletions(-)
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index c6c34005f5d2..7cafbf8d5f1a 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -241,7 +241,8 @@ static void adxl34x_get_triple(struct adxl34x *ac, struct axis_triple *axis)
ac->bops->read_block(ac->dev, DATAX0, DATAZ1 - DATAX0 + 1, buf);
- mutex_lock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
+
ac->saved.x = (s16) le16_to_cpu(buf[0]);
axis->x = ac->saved.x;
@@ -250,7 +251,6 @@ static void adxl34x_get_triple(struct adxl34x *ac, struct axis_triple *axis)
ac->saved.z = (s16) le16_to_cpu(buf[2]);
axis->z = ac->saved.z;
- mutex_unlock(&ac->mutex);
}
static void adxl34x_service_ev_fifo(struct adxl34x *ac)
@@ -416,15 +416,13 @@ static int adxl34x_suspend(struct device *dev)
{
struct adxl34x *ac = dev_get_drvdata(dev);
- mutex_lock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
if (!ac->suspended && !ac->disabled && ac->opened)
__adxl34x_disable(ac);
ac->suspended = true;
- mutex_unlock(&ac->mutex);
-
return 0;
}
@@ -432,15 +430,13 @@ static int adxl34x_resume(struct device *dev)
{
struct adxl34x *ac = dev_get_drvdata(dev);
- mutex_lock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
if (ac->suspended && !ac->disabled && ac->opened)
__adxl34x_enable(ac);
ac->suspended = false;
- mutex_unlock(&ac->mutex);
-
return 0;
}
@@ -464,7 +460,7 @@ static ssize_t adxl34x_disable_store(struct device *dev,
if (error)
return error;
- mutex_lock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
if (!ac->suspended && ac->opened) {
if (val) {
@@ -478,8 +474,6 @@ static ssize_t adxl34x_disable_store(struct device *dev,
ac->disabled = !!val;
- mutex_unlock(&ac->mutex);
-
return count;
}
@@ -489,16 +483,13 @@ static ssize_t adxl34x_calibrate_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct adxl34x *ac = dev_get_drvdata(dev);
- ssize_t count;
- mutex_lock(&ac->mutex);
- count = sprintf(buf, "%d,%d,%d\n",
- ac->hwcal.x * 4 + ac->swcal.x,
- ac->hwcal.y * 4 + ac->swcal.y,
- ac->hwcal.z * 4 + ac->swcal.z);
- mutex_unlock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
- return count;
+ return sprintf(buf, "%d,%d,%d\n",
+ ac->hwcal.x * 4 + ac->swcal.x,
+ ac->hwcal.y * 4 + ac->swcal.y,
+ ac->hwcal.z * 4 + ac->swcal.z);
}
static ssize_t adxl34x_calibrate_store(struct device *dev,
@@ -512,7 +503,8 @@ static ssize_t adxl34x_calibrate_store(struct device *dev,
* We use HW calibration and handle the remaining bits in SW. (4mg/LSB)
*/
- mutex_lock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
+
ac->hwcal.x -= (ac->saved.x / 4);
ac->swcal.x = ac->saved.x % 4;
@@ -525,7 +517,6 @@ static ssize_t adxl34x_calibrate_store(struct device *dev,
AC_WRITE(ac, OFSX, (s8) ac->hwcal.x);
AC_WRITE(ac, OFSY, (s8) ac->hwcal.y);
AC_WRITE(ac, OFSZ, (s8) ac->hwcal.z);
- mutex_unlock(&ac->mutex);
return count;
}
@@ -553,15 +544,13 @@ static ssize_t adxl34x_rate_store(struct device *dev,
if (error)
return error;
- mutex_lock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
ac->pdata.data_rate = RATE(val);
AC_WRITE(ac, BW_RATE,
ac->pdata.data_rate |
(ac->pdata.low_power_mode ? LOW_POWER : 0));
- mutex_unlock(&ac->mutex);
-
return count;
}
@@ -588,7 +577,7 @@ static ssize_t adxl34x_autosleep_store(struct device *dev,
if (error)
return error;
- mutex_lock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
if (val)
ac->pdata.power_mode |= (PCTL_AUTO_SLEEP | PCTL_LINK);
@@ -598,8 +587,6 @@ static ssize_t adxl34x_autosleep_store(struct device *dev,
if (!ac->disabled && !ac->suspended && ac->opened)
AC_WRITE(ac, POWER_CTL, ac->pdata.power_mode | PCTL_MEASURE);
- mutex_unlock(&ac->mutex);
-
return count;
}
@@ -610,14 +597,11 @@ static ssize_t adxl34x_position_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct adxl34x *ac = dev_get_drvdata(dev);
- ssize_t count;
- mutex_lock(&ac->mutex);
- count = sprintf(buf, "(%d, %d, %d)\n",
- ac->saved.x, ac->saved.y, ac->saved.z);
- mutex_unlock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
- return count;
+ return sprintf(buf, "(%d, %d, %d)\n",
+ ac->saved.x, ac->saved.y, ac->saved.z);
}
static DEVICE_ATTR(position, S_IRUGO, adxl34x_position_show, NULL);
@@ -638,9 +622,8 @@ static ssize_t adxl34x_write_store(struct device *dev,
if (error)
return error;
- mutex_lock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
AC_WRITE(ac, val >> 8, val & 0xFF);
- mutex_unlock(&ac->mutex);
return count;
}
@@ -674,15 +657,13 @@ static int adxl34x_input_open(struct input_dev *input)
{
struct adxl34x *ac = input_get_drvdata(input);
- mutex_lock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
if (!ac->suspended && !ac->disabled)
__adxl34x_enable(ac);
ac->opened = true;
- mutex_unlock(&ac->mutex);
-
return 0;
}
@@ -690,14 +671,12 @@ static void adxl34x_input_close(struct input_dev *input)
{
struct adxl34x *ac = input_get_drvdata(input);
- mutex_lock(&ac->mutex);
+ guard(mutex)(&ac->mutex);
if (!ac->suspended && !ac->disabled)
__adxl34x_disable(ac);
ac->opened = false;
-
- mutex_unlock(&ac->mutex);
}
struct adxl34x *adxl34x_probe(struct device *dev, int irq,
--
2.45.2.505.gda0bf45e8d-goog
^ permalink raw reply related
* [PATCH v2 3/4] Input: adxl34x - switch to using managed resources
From: Dmitry Torokhov @ 2024-06-10 16:42 UTC (permalink / raw)
To: linux-input, Nuno Sa; +Cc: Michael Hennerich, linux-kernel
In-Reply-To: <20240610164301.1048482-1-dmitry.torokhov@gmail.com>
Switch the driver to use managed resources to simplify error handling.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
v2: conversion to using input_set_capability() moved to a separate patch
drivers/input/misc/adxl34x-i2c.c | 8 -----
drivers/input/misc/adxl34x-spi.c | 8 -----
drivers/input/misc/adxl34x.c | 53 ++++++++++----------------------
drivers/input/misc/adxl34x.h | 1 -
4 files changed, 17 insertions(+), 53 deletions(-)
diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-i2c.c
index 7531c7b2d657..c05d898898e8 100644
--- a/drivers/input/misc/adxl34x-i2c.c
+++ b/drivers/input/misc/adxl34x-i2c.c
@@ -98,13 +98,6 @@ static int adxl34x_i2c_probe(struct i2c_client *client)
return 0;
}
-static void adxl34x_i2c_remove(struct i2c_client *client)
-{
- struct adxl34x *ac = i2c_get_clientdata(client);
-
- adxl34x_remove(ac);
-}
-
static const struct i2c_device_id adxl34x_id[] = {
{ "adxl34x" },
{ }
@@ -137,7 +130,6 @@ static struct i2c_driver adxl34x_driver = {
.of_match_table = adxl34x_of_id,
},
.probe = adxl34x_i2c_probe,
- .remove = adxl34x_i2c_remove,
.id_table = adxl34x_id,
};
diff --git a/drivers/input/misc/adxl34x-spi.c b/drivers/input/misc/adxl34x-spi.c
index 2befcc4df0be..fd716d861832 100644
--- a/drivers/input/misc/adxl34x-spi.c
+++ b/drivers/input/misc/adxl34x-spi.c
@@ -87,13 +87,6 @@ static int adxl34x_spi_probe(struct spi_device *spi)
return 0;
}
-static void adxl34x_spi_remove(struct spi_device *spi)
-{
- struct adxl34x *ac = spi_get_drvdata(spi);
-
- adxl34x_remove(ac);
-}
-
static struct spi_driver adxl34x_driver = {
.driver = {
.name = "adxl34x",
@@ -101,7 +94,6 @@ static struct spi_driver adxl34x_driver = {
.pm = pm_sleep_ptr(&adxl34x_pm),
},
.probe = adxl34x_spi_probe,
- .remove = adxl34x_spi_remove,
};
module_spi_driver(adxl34x_driver);
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index 830acf29c32b..c6c34005f5d2 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -707,21 +707,21 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
struct adxl34x *ac;
struct input_dev *input_dev;
const struct adxl34x_platform_data *pdata;
- int err, range, i;
+ int error, range, i;
int revid;
if (!irq) {
dev_err(dev, "no IRQ?\n");
- err = -ENODEV;
- goto err_out;
+ return ERR_PTR(-ENODEV);
}
- ac = kzalloc(sizeof(*ac), GFP_KERNEL);
- input_dev = input_allocate_device();
- if (!ac || !input_dev) {
- err = -ENOMEM;
- goto err_free_mem;
- }
+ ac = devm_kzalloc(dev, sizeof(*ac), GFP_KERNEL);
+ if (!ac)
+ return ERR_PTR(-ENOMEM);
+
+ input_dev = devm_input_allocate_device(dev);
+ if (!input_dev)
+ return ERR_PTR(-ENOMEM);
ac->fifo_delay = fifo_delay_default;
@@ -754,14 +754,12 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
break;
default:
dev_err(dev, "Failed to probe %s\n", input_dev->name);
- err = -ENODEV;
- goto err_free_mem;
+ return ERR_PTR(-ENODEV);
}
snprintf(ac->phys, sizeof(ac->phys), "%s/input0", dev_name(dev));
input_dev->phys = ac->phys;
- input_dev->dev.parent = dev;
input_dev->id.product = ac->model;
input_dev->id.bustype = bops->bustype;
input_dev->open = adxl34x_input_open;
@@ -816,16 +814,16 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
AC_WRITE(ac, POWER_CTL, 0);
- err = request_threaded_irq(ac->irq, NULL, adxl34x_irq,
- IRQF_ONESHOT, dev_name(dev), ac);
- if (err) {
+ error = devm_request_threaded_irq(dev, ac->irq, NULL, adxl34x_irq,
+ IRQF_ONESHOT, dev_name(dev), ac);
+ if (error) {
dev_err(dev, "irq %d busy?\n", ac->irq);
- goto err_free_mem;
+ return ERR_PTR(error);
}
- err = input_register_device(input_dev);
- if (err)
- goto err_free_irq;
+ error = input_register_device(input_dev);
+ if (error)
+ return ERR_PTR(error);
AC_WRITE(ac, OFSX, pdata->x_axis_offset);
ac->hwcal.x = pdata->x_axis_offset;
@@ -884,26 +882,9 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
ac->pdata.power_mode &= (PCTL_AUTO_SLEEP | PCTL_LINK);
return ac;
-
- err_free_irq:
- free_irq(ac->irq, ac);
- err_free_mem:
- input_free_device(input_dev);
- kfree(ac);
- err_out:
- return ERR_PTR(err);
}
EXPORT_SYMBOL_GPL(adxl34x_probe);
-void adxl34x_remove(struct adxl34x *ac)
-{
- free_irq(ac->irq, ac);
- input_unregister_device(ac->input);
- dev_dbg(ac->dev, "unregistered accelerometer\n");
- kfree(ac);
-}
-EXPORT_SYMBOL_GPL(adxl34x_remove);
-
EXPORT_GPL_SIMPLE_DEV_PM_OPS(adxl34x_pm, adxl34x_suspend, adxl34x_resume);
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
diff --git a/drivers/input/misc/adxl34x.h b/drivers/input/misc/adxl34x.h
index 67e0ddc5c3eb..718e90c2046d 100644
--- a/drivers/input/misc/adxl34x.h
+++ b/drivers/input/misc/adxl34x.h
@@ -23,7 +23,6 @@ struct adxl34x_bus_ops {
struct adxl34x *adxl34x_probe(struct device *dev, int irq,
bool fifo_delay_default,
const struct adxl34x_bus_ops *bops);
-void adxl34x_remove(struct adxl34x *ac);
extern const struct dev_pm_ops adxl34x_pm;
extern const struct attribute_group *adxl34x_groups[];
--
2.45.2.505.gda0bf45e8d-goog
^ permalink raw reply related
* [PATCH v2 2/4] Input: adxl34x - use input_set_capability()
From: Dmitry Torokhov @ 2024-06-10 16:42 UTC (permalink / raw)
To: linux-input, Nuno Sa; +Cc: Michael Hennerich, linux-kernel
In-Reply-To: <20240610164301.1048482-1-dmitry.torokhov@gmail.com>
Switch to using input_set_capability() instead of using __set_bit() to
make clear what exactly kinds of events (EV_KEY, EV_REL) are being
declared.
Also drop redundant calls setting EV_ABS and ABS_X|Y|Z bits as that is
taken care by input_set_abs_params().
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
v2: new patch, split out from devm conversion at Nino's request
drivers/input/misc/adxl34x.c | 32 +++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index fbe5a56c19d1..830acf29c32b 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -769,18 +769,12 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
input_set_drvdata(input_dev, ac);
- __set_bit(ac->pdata.ev_type, input_dev->evbit);
-
if (ac->pdata.ev_type == EV_REL) {
- __set_bit(REL_X, input_dev->relbit);
- __set_bit(REL_Y, input_dev->relbit);
- __set_bit(REL_Z, input_dev->relbit);
+ input_set_capability(input_dev, EV_REL, REL_X);
+ input_set_capability(input_dev, EV_REL, REL_Y);
+ input_set_capability(input_dev, EV_REL, REL_Z);
} else {
/* EV_ABS */
- __set_bit(ABS_X, input_dev->absbit);
- __set_bit(ABS_Y, input_dev->absbit);
- __set_bit(ABS_Z, input_dev->absbit);
-
if (pdata->data_range & FULL_RES)
range = ADXL_FULLRES_MAX_VAL; /* Signed 13-bit */
else
@@ -791,18 +785,18 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
input_set_abs_params(input_dev, ABS_Z, -range, range, 3, 3);
}
- __set_bit(EV_KEY, input_dev->evbit);
- __set_bit(pdata->ev_code_tap[ADXL_X_AXIS], input_dev->keybit);
- __set_bit(pdata->ev_code_tap[ADXL_Y_AXIS], input_dev->keybit);
- __set_bit(pdata->ev_code_tap[ADXL_Z_AXIS], input_dev->keybit);
+ input_set_capability(input_dev, EV_KEY, pdata->ev_code_tap[ADXL_X_AXIS]);
+ input_set_capability(input_dev, EV_KEY, pdata->ev_code_tap[ADXL_Y_AXIS]);
+ input_set_capability(input_dev, EV_KEY, pdata->ev_code_tap[ADXL_Z_AXIS]);
if (pdata->ev_code_ff) {
ac->int_mask = FREE_FALL;
- __set_bit(pdata->ev_code_ff, input_dev->keybit);
+ input_set_capability(input_dev, EV_KEY, pdata->ev_code_ff);
}
if (pdata->ev_code_act_inactivity)
- __set_bit(pdata->ev_code_act_inactivity, input_dev->keybit);
+ input_set_capability(input_dev, EV_KEY,
+ pdata->ev_code_act_inactivity);
ac->int_mask |= ACTIVITY | INACTIVITY;
@@ -874,13 +868,13 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
if (pdata->orientation_enable & ADXL_EN_ORIENTATION_3D)
for (i = 0; i < ARRAY_SIZE(pdata->ev_codes_orient_3d); i++)
- __set_bit(pdata->ev_codes_orient_3d[i],
- input_dev->keybit);
+ input_set_capability(input_dev, EV_KEY,
+ pdata->ev_codes_orient_3d[i]);
if (pdata->orientation_enable & ADXL_EN_ORIENTATION_2D)
for (i = 0; i < ARRAY_SIZE(pdata->ev_codes_orient_2d); i++)
- __set_bit(pdata->ev_codes_orient_2d[i],
- input_dev->keybit);
+ input_set_capability(input_dev, EV_KEY,
+ pdata->ev_codes_orient_2d[i]);
} else {
ac->pdata.orientation_enable = 0;
}
--
2.45.2.505.gda0bf45e8d-goog
^ permalink raw reply related
* [PATCH v2 1/4] Input: adxl34x - use device core to create driver-specific device attributes
From: Dmitry Torokhov @ 2024-06-10 16:42 UTC (permalink / raw)
To: linux-input, Nuno Sa; +Cc: Michael Hennerich, linux-kernel
Instead of creating driver-specific device attributes with
sysfs_create_group() have device core do this by setting up dev_groups
pointer in the driver structure.
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
v2: added Nono's ACK
drivers/input/misc/adxl34x-i2c.c | 1 +
drivers/input/misc/adxl34x-spi.c | 1 +
drivers/input/misc/adxl34x.c | 15 +++++++--------
drivers/input/misc/adxl34x.h | 1 +
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-i2c.c
index d4014e367c77..7531c7b2d657 100644
--- a/drivers/input/misc/adxl34x-i2c.c
+++ b/drivers/input/misc/adxl34x-i2c.c
@@ -132,6 +132,7 @@ MODULE_DEVICE_TABLE(of, adxl34x_of_id);
static struct i2c_driver adxl34x_driver = {
.driver = {
.name = "adxl34x",
+ .dev_groups = adxl34x_groups,
.pm = pm_sleep_ptr(&adxl34x_pm),
.of_match_table = adxl34x_of_id,
},
diff --git a/drivers/input/misc/adxl34x-spi.c b/drivers/input/misc/adxl34x-spi.c
index f1094a8ccdd5..2befcc4df0be 100644
--- a/drivers/input/misc/adxl34x-spi.c
+++ b/drivers/input/misc/adxl34x-spi.c
@@ -97,6 +97,7 @@ static void adxl34x_spi_remove(struct spi_device *spi)
static struct spi_driver adxl34x_driver = {
.driver = {
.name = "adxl34x",
+ .dev_groups = adxl34x_groups,
.pm = pm_sleep_ptr(&adxl34x_pm),
},
.probe = adxl34x_spi_probe,
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index a3f45e0ee0c7..fbe5a56c19d1 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -664,6 +664,12 @@ static const struct attribute_group adxl34x_attr_group = {
.attrs = adxl34x_attributes,
};
+const struct attribute_group *adxl34x_groups[] = {
+ &adxl34x_attr_group,
+ NULL
+};
+EXPORT_SYMBOL_GPL(adxl34x_groups);
+
static int adxl34x_input_open(struct input_dev *input)
{
struct adxl34x *ac = input_get_drvdata(input);
@@ -823,13 +829,9 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
goto err_free_mem;
}
- err = sysfs_create_group(&dev->kobj, &adxl34x_attr_group);
- if (err)
- goto err_free_irq;
-
err = input_register_device(input_dev);
if (err)
- goto err_remove_attr;
+ goto err_free_irq;
AC_WRITE(ac, OFSX, pdata->x_axis_offset);
ac->hwcal.x = pdata->x_axis_offset;
@@ -889,8 +891,6 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
return ac;
- err_remove_attr:
- sysfs_remove_group(&dev->kobj, &adxl34x_attr_group);
err_free_irq:
free_irq(ac->irq, ac);
err_free_mem:
@@ -903,7 +903,6 @@ EXPORT_SYMBOL_GPL(adxl34x_probe);
void adxl34x_remove(struct adxl34x *ac)
{
- sysfs_remove_group(&ac->dev->kobj, &adxl34x_attr_group);
free_irq(ac->irq, ac);
input_unregister_device(ac->input);
dev_dbg(ac->dev, "unregistered accelerometer\n");
diff --git a/drivers/input/misc/adxl34x.h b/drivers/input/misc/adxl34x.h
index f9272a2e7a96..67e0ddc5c3eb 100644
--- a/drivers/input/misc/adxl34x.h
+++ b/drivers/input/misc/adxl34x.h
@@ -26,5 +26,6 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
void adxl34x_remove(struct adxl34x *ac);
extern const struct dev_pm_ops adxl34x_pm;
+extern const struct attribute_group *adxl34x_groups[];
#endif
--
2.45.2.505.gda0bf45e8d-goog
^ permalink raw reply related
* Re: [PATCH v11 1/5] firmware: cs_dsp: Add write sequence interface
From: Charles Keepax @ 2024-06-10 15:11 UTC (permalink / raw)
To: James Ogletree
Cc: dmitry.torokhov, robh+dt, krzysztof.kozlowski+dt, conor+dt, lee,
broonie, jeff, patches, linux-sound, linux-input, devicetree
In-Reply-To: <20240605135249.361082-2-jogletre@opensource.cirrus.com>
On Wed, Jun 05, 2024 at 01:52:45PM +0000, James Ogletree wrote:
> A write sequence is a sequence of register addresses
> and values executed by some Cirrus DSPs following
> certain power state transitions.
>
> Add support for Cirrus drivers to update or add to a
> write sequence present in firmware.
>
> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> Signed-off-by: James Ogletree <jogletre@opensource.cirrus.com>
> ---
I would suggest we just apply this patch, it is unlikely to
change from review comments on the rest of the series and could
well be useful to other parts in the meantime. It would also
mean less traffic each time this series is sent up.
Thanks,
Charles
^ permalink raw reply
* Re: [PATCH 3/3] Input: ili210x - use guard notation when disabling and reenabling IRQ
From: Markus Elfring @ 2024-06-10 14:11 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: LKML, John Keeping, Marek Vasut
In-Reply-To: <20240609234757.610273-3-dmitry.torokhov@gmail.com>
> This makes the code more compact and error handling more robust.
Please improve the change description with an imperative wording.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc2#n94
Regards,
Markus
^ permalink raw reply
* Re: [PATCH 1/3] Input: ili210x - use kvmalloc() to allocate buffer for firmware update
From: Markus Elfring @ 2024-06-10 14:00 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: LKML, John Keeping, Marek Vasut
In-Reply-To: <20240609234757.610273-1-dmitry.torokhov@gmail.com>
> Allocating a contiguous buffer of 64K may fail is memory is sufficiently
…
if?
I find that cover letters can be helpful for presented patch series.
Regards,
Markus
^ permalink raw reply
* Re: [PATCH] HID: lenovo: fix Fn-Lock on Lenovo TrackPoint Keyboard II in USB mode
From: ValdikSS @ 2024-06-10 9:31 UTC (permalink / raw)
To: iam; +Cc: bentiss, jikos, linux-input, rodrigoaguileraparraga
In-Reply-To: <20240520000527.203644-1-iam@valdikss.org.ru>
[-- Attachment #1.1: Type: text/plain, Size: 90 bytes --]
Kindly asking to review the patch, it's small but fixes the real and
annoying issue.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply
* Re: [PATCH v3] HID: hid-goodix: Add Goodix HID-over-SPI driver
From: Dan Carpenter @ 2024-06-10 9:39 UTC (permalink / raw)
To: oe-kbuild, Charles Wang, dmitry.torokhov, jikos, bentiss
Cc: lkp, oe-kbuild-all, hbarnor, dianders, linux-input, linux-kernel,
Charles Wang
In-Reply-To: <20240607133709.3518-1-charles.goodix@gmail.com>
Hi Charles,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Charles-Wang/HID-hid-goodix-Add-Goodix-HID-over-SPI-driver/20240607-214042
base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
patch link: https://lore.kernel.org/r/20240607133709.3518-1-charles.goodix%40gmail.com
patch subject: [PATCH v3] HID: hid-goodix: Add Goodix HID-over-SPI driver
config: sparc64-randconfig-r071-20240609 (https://download.01.org/0day-ci/archive/20240610/202406101633.1RJnij1Y-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 13.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202406101633.1RJnij1Y-lkp@intel.com/
smatch warnings:
drivers/hid/hid-goodix-spi.c:217 goodix_hid_parse() error: uninitialized symbol 'rdesc'.
vim +/rdesc +217 drivers/hid/hid-goodix-spi.c
bb11c3a1740813 Charles Wang 2024-06-07 214 static int goodix_hid_parse(struct hid_device *hid)
bb11c3a1740813 Charles Wang 2024-06-07 215 {
bb11c3a1740813 Charles Wang 2024-06-07 216 struct goodix_ts_data *ts = hid->driver_data;
bb11c3a1740813 Charles Wang 2024-06-07 @217 u8 *rdesc __free(kfree);
bb11c3a1740813 Charles Wang 2024-06-07 218 u16 rsize;
bb11c3a1740813 Charles Wang 2024-06-07 219 int error;
bb11c3a1740813 Charles Wang 2024-06-07 220
bb11c3a1740813 Charles Wang 2024-06-07 221 rsize = le16_to_cpu(ts->hid_desc.report_desc_lenght);
bb11c3a1740813 Charles Wang 2024-06-07 222 if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {
bb11c3a1740813 Charles Wang 2024-06-07 223 dev_err(ts->dev, "invalid report desc size %d", rsize);
bb11c3a1740813 Charles Wang 2024-06-07 224 return -EINVAL;
^^^^^^^^^^^^^^^
rdesc isn't initialized here. It should be declared as:
u8 *rdesc __free(kfree) = NULL;
bb11c3a1740813 Charles Wang 2024-06-07 225 }
bb11c3a1740813 Charles Wang 2024-06-07 226
bb11c3a1740813 Charles Wang 2024-06-07 227 rdesc = kzalloc(rsize, GFP_KERNEL);
Or it could be declared here instead.
u8 *rdesc __free(kfree) = kzalloc(rsize, GFP_KERNEL);
bb11c3a1740813 Charles Wang 2024-06-07 228 if (!rdesc)
bb11c3a1740813 Charles Wang 2024-06-07 229 return -ENOMEM;
bb11c3a1740813 Charles Wang 2024-06-07 230
bb11c3a1740813 Charles Wang 2024-06-07 231 error = goodix_spi_read(ts, GOODIX_HID_REPORT_DESC_ADDR, rdesc, rsize);
bb11c3a1740813 Charles Wang 2024-06-07 232 if (error) {
bb11c3a1740813 Charles Wang 2024-06-07 233 dev_err(ts->dev, "failed get report desc, %d", error);
bb11c3a1740813 Charles Wang 2024-06-07 234 return error;
bb11c3a1740813 Charles Wang 2024-06-07 235 }
bb11c3a1740813 Charles Wang 2024-06-07 236
bb11c3a1740813 Charles Wang 2024-06-07 237 error = hid_parse_report(hid, rdesc, rsize);
bb11c3a1740813 Charles Wang 2024-06-07 238 if (error)
bb11c3a1740813 Charles Wang 2024-06-07 239 dev_err(ts->dev, "failed parse report, %d", error);
bb11c3a1740813 Charles Wang 2024-06-07 240
bb11c3a1740813 Charles Wang 2024-06-07 241 return error;
bb11c3a1740813 Charles Wang 2024-06-07 242 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH 3/3] Input: adxl34x- switch to using "guard" notation
From: Nuno Sá @ 2024-06-10 9:26 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: Michael Hennerich, linux-kernel
In-Reply-To: <20240609234122.603796-3-dmitry.torokhov@gmail.com>
On Sun, 2024-06-09 at 16:41 -0700, Dmitry Torokhov wrote:
> Switch to using guard(mutex)() notation to acquire and automatically
> release mutexes.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox