lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1707qnp0-7s29-nssr-q868-q36o33571o5q@xreary.bet>
Date: Wed, 26 Nov 2025 17:16:50 +0100 (CET)
From: Jiri Kosina <jikos@...nel.org>
To: LI Qingwu <Qing-wu.Li@...ca-geosystems.com.cn>
cc: bentiss@...nel.org, dianders@...omium.org, treapking@...omium.org, 
    alex.vinarskis@...il.com, dan.carpenter@...aro.org, superm1@...nel.org, 
    guanwentao@...ontech.com, kl@...wtf, linux-input@...r.kernel.org, 
    linux-kernel@...r.kernel.org, liqind@....com
Subject: Re: [PATCH V3 1/1] HID: i2c-hid: Add API to wait for device reset
 completion

On Mon, 17 Nov 2025, LI Qingwu wrote:

> Some HID over I2C devices need to signal reset completion to the host
> after firmware updates or device resets. Per the HID over I2C spec,
> devices signal completion by sending an empty input report (0x0000).
> 
> Add i2c_hid_wait_reset_complete() to allow drivers to synchronize
> with device reset operations. The function sets I2C_HID_RESET_PENDING
> and waits for the device's completion signal.
> 
> Returns: 0 on success, -ETIMEDOUT on timeout.
> 
> Signed-off-by: LI Qingwu <Qing-wu.Li@...ca-geosystems.com.cn>
> ---
>  drivers/hid/i2c-hid/i2c-hid-core.c | 27 +++++++++++++++++++++++++++
>  drivers/hid/i2c-hid/i2c-hid.h      |  1 +
>  2 files changed, 28 insertions(+)
> 
> diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
> index 63f46a2e5788..067ad0770dd9 100644
> --- a/drivers/hid/i2c-hid/i2c-hid-core.c
> +++ b/drivers/hid/i2c-hid/i2c-hid-core.c
> @@ -1401,6 +1401,33 @@ const struct dev_pm_ops i2c_hid_core_pm = {
>  };
>  EXPORT_SYMBOL_GPL(i2c_hid_core_pm);
>  
> +int i2c_hid_wait_reset_complete(struct device *dev, unsigned long timeout_ms)
> +{
> +	struct i2c_client *client;
> +	struct i2c_hid *ihid;
> +
> +	if (!dev)
> +		return -ENODEV;
> +
> +	client = to_i2c_client(dev);
> +	if (!client)
> +		return -ENODEV;
> +
> +	ihid = i2c_get_clientdata(client);
> +	if (!ihid)
> +		return -ENODEV;
> +
> +	set_bit(I2C_HID_RESET_PENDING, &ihid->flags);
> +	if (wait_event_timeout(ihid->wait,
> +			       !test_bit(I2C_HID_RESET_PENDING, &ihid->flags),
> +			       msecs_to_jiffies(timeout_ms)))
> +		return 0;
> +
> +	clear_bit(I2C_HID_RESET_PENDING, &ihid->flags);
> +	return -ETIMEDOUT;
> +}
> +EXPORT_SYMBOL_GPL(i2c_hid_wait_reset_complete);
> +
>  MODULE_DESCRIPTION("HID over I2C core driver");
>  MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@...il.com>");
>  MODULE_LICENSE("GPL");
> diff --git a/drivers/hid/i2c-hid/i2c-hid.h b/drivers/hid/i2c-hid/i2c-hid.h
> index 1724a435c783..8e5482baa679 100644
> --- a/drivers/hid/i2c-hid/i2c-hid.h
> +++ b/drivers/hid/i2c-hid/i2c-hid.h
> @@ -42,6 +42,7 @@ void i2c_hid_core_remove(struct i2c_client *client);
>  
>  void i2c_hid_core_shutdown(struct i2c_client *client);
>  
> +int i2c_hid_wait_reset_complete(struct device *dev, unsigned long timeout_ms);
>  extern const struct dev_pm_ops i2c_hid_core_pm;

Please resubmit this together in one go with the driver that makes use of 
the functionality.

Thanks,

-- 
Jiri Kosina
SUSE Labs


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ