linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Filipe Laíns" <lains@riseup.net>,
	"Bastien Nocera" <hadess@hadess.net>,
	"Jiri Kosina" <jikos@kernel.org>,
	"Benjamin Tissoires" <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH 2/2] HID: logitech-hidpp: Drop delayed_work_cb()
Date: Fri, 6 Oct 2023 10:21:30 +0200	[thread overview]
Message-ID: <d7f0bce7-7ada-c128-fab7-9049c0ec3f04@redhat.com> (raw)
In-Reply-To: <20231006081858.17677-3-hdegoede@redhat.com>

Hi,

On 10/6/23 10:18, Hans de Goede wrote:
> Drop delayed_work_cb() instead make hidpp_connect_event() the workqueue
> function itself.
> 
> Besides resulting in a small cleanup this will hopefully also make
> it clearer that going forward hidpp_connect_event() should only
> be run from a workqueue and not be directly involved.

Typo: s/involved/invoked/

Regards,

Hans



> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/hid/hid-logitech-hidpp.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 33f9cd98485a..15c36112902b 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -236,8 +236,6 @@ struct hidpp_device {
>  #define HIDPP20_ERROR_UNSUPPORTED		0x09
>  #define HIDPP20_ERROR				0xff
>  
> -static void hidpp_connect_event(struct hidpp_device *hidpp_dev);
> -
>  static int __hidpp_send_report(struct hid_device *hdev,
>  				struct hidpp_report *hidpp_report)
>  {
> @@ -451,13 +449,6 @@ static int hidpp_send_rap_command_sync(struct hidpp_device *hidpp_dev,
>  	return ret;
>  }
>  
> -static void delayed_work_cb(struct work_struct *work)
> -{
> -	struct hidpp_device *hidpp = container_of(work, struct hidpp_device,
> -							work);
> -	hidpp_connect_event(hidpp);
> -}
> -
>  static inline bool hidpp_match_answer(struct hidpp_report *question,
>  		struct hidpp_report *answer)
>  {
> @@ -4190,8 +4181,9 @@ static struct input_dev *hidpp_allocate_input(struct hid_device *hdev)
>  	return input_dev;
>  }
>  
> -static void hidpp_connect_event(struct hidpp_device *hidpp)
> +static void hidpp_connect_event(struct work_struct *work)
>  {
> +	struct hidpp_device *hidpp = container_of(work, struct hidpp_device, work);
>  	struct hid_device *hdev = hidpp->hid_dev;
>  	int ret = 0;
>  	bool connected = atomic_read(&hidpp->connected);
> @@ -4455,7 +4447,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  	    hidpp->quirks & HIDPP_QUIRK_UNIFYING)
>  		will_restart = true;
>  
> -	INIT_WORK(&hidpp->work, delayed_work_cb);
> +	INIT_WORK(&hidpp->work, hidpp_connect_event);
>  	mutex_init(&hidpp->io_mutex);
>  	mutex_init(&hidpp->send_mutex);
>  	init_waitqueue_head(&hidpp->wait);


      reply	other threads:[~2023-10-06  8:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06  8:18 [PATCH 0/2] HID: logitech-hidpp: Avoid hidpp_connect_event() running while probe() restarts IO Hans de Goede
2023-10-06  8:18 ` [PATCH 1/2] " Hans de Goede
2023-10-06 13:46   ` Benjamin Tissoires
2023-10-06 15:11     ` Hans de Goede
2023-10-06 16:28       ` Benjamin Tissoires
2023-10-06 17:24         ` Hans de Goede
2023-10-06 17:56           ` Hans de Goede
2023-10-06  8:18 ` [PATCH 2/2] HID: logitech-hidpp: Drop delayed_work_cb() Hans de Goede
2023-10-06  8:21   ` Hans de Goede [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=d7f0bce7-7ada-c128-fab7-9049c0ec3f04@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=hadess@hadess.net \
    --cc=jikos@kernel.org \
    --cc=lains@riseup.net \
    --cc=linux-input@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;
as well as URLs for NNTP newsgroup(s).