Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH v1 1/1] HID: intel-ish-hid: Fix a build error in devm_ishtp_alloc_workqueue()
@ 2025-10-24 12:25 Andy Shevchenko
  2025-10-24 12:27 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2025-10-24 12:25 UTC (permalink / raw)
  To: Zhang Lixu, Jiri Kosina, Srinivas Pandruvada, linux-input,
	linux-kernel, llvm
  Cc: Benjamin Tissoires, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Andy Shevchenko

clang 19 is not happy about the cast and in conjunction with CONFIG_WERROR=y
(which is default) leads to a build error:

drivers/hid/intel-ish-hid/ipc/ipc.c:935:36: error: cast from 'void (*)(struct workqueue_struct *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  935 |         if (devm_add_action_or_reset(dev, (void (*)(void *))destroy_workqueue,
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix this by providing an intermediate callback that has a correct type.

Fixes: 0d30dae38fe0 ("HID: intel-ish-hid: Use dedicated unbound workqueues to prevent resume blocking")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/hid/intel-ish-hid/ipc/ipc.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
index 59355e4a61f8..7bf4356d8ee6 100644
--- a/drivers/hid/intel-ish-hid/ipc/ipc.c
+++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
@@ -5,10 +5,11 @@
  * Copyright (c) 2014-2016, Intel Corporation.
  */
 
+#include <linux/delay.h>
 #include <linux/devm-helpers.h>
+#include <linux/err.h>
 #include <linux/sched.h>
 #include <linux/spinlock.h>
-#include <linux/delay.h>
 #include <linux/jiffies.h>
 #include "client.h"
 #include "hw-ish.h"
@@ -924,17 +925,23 @@ static const struct ishtp_hw_ops ish_hw_ops = {
 	.dma_no_cache_snooping = _dma_no_cache_snooping
 };
 
+static inline void devm_ishtp_destroy_workqueue(void *wq)
+{
+	destroy_workqueue(wq);
+}
+
 static struct workqueue_struct *devm_ishtp_alloc_workqueue(struct device *dev)
 {
 	struct workqueue_struct *wq;
+	int ret;
 
 	wq = alloc_workqueue("ishtp_unbound_%d", WQ_UNBOUND, 0, dev->id);
 	if (!wq)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
-	if (devm_add_action_or_reset(dev, (void (*)(void *))destroy_workqueue,
-				     wq))
-		return NULL;
+	ret = devm_add_action_or_reset(dev, devm_ishtp_destroy_workqueue, wq);
+	if (ret)
+		return ERR_PTR(ret);
 
 	return wq;
 }
@@ -950,6 +957,7 @@ static struct workqueue_struct *devm_ishtp_alloc_workqueue(struct device *dev)
 struct ishtp_device *ish_dev_init(struct pci_dev *pdev)
 {
 	struct ishtp_device *dev;
+	struct workqueue_struct *wq;
 	int	i;
 	int	ret;
 
@@ -959,9 +967,10 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev)
 	if (!dev)
 		return NULL;
 
-	dev->unbound_wq = devm_ishtp_alloc_workqueue(&pdev->dev);
-	if (!dev->unbound_wq)
+	wq = devm_ishtp_alloc_workqueue(&pdev->dev);
+	if (IS_ERR(wq))
 		return NULL;
+	dev->unbound_wq = wq;
 
 	dev->devc = &pdev->dev;
 	ishtp_device_init(dev);
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] HID: intel-ish-hid: Fix a build error in devm_ishtp_alloc_workqueue()
  2025-10-24 12:25 [PATCH v1 1/1] HID: intel-ish-hid: Fix a build error in devm_ishtp_alloc_workqueue() Andy Shevchenko
@ 2025-10-24 12:27 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2025-10-24 12:27 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Zhang Lixu, Srinivas Pandruvada, linux-input, linux-kernel, llvm,
	Benjamin Tissoires, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt

On Fri, 24 Oct 2025, Andy Shevchenko wrote:

> clang 19 is not happy about the cast and in conjunction with CONFIG_WERROR=y
> (which is default) leads to a build error:
> 
> drivers/hid/intel-ish-hid/ipc/ipc.c:935:36: error: cast from 'void (*)(struct workqueue_struct *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>   935 |         if (devm_add_action_or_reset(dev, (void (*)(void *))destroy_workqueue,
>       |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Fix this by providing an intermediate callback that has a correct type.
> 
> Fixes: 0d30dae38fe0 ("HID: intel-ish-hid: Use dedicated unbound workqueues to prevent resume blocking")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks Andy. Nathan beat you on this one:

	https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/commit/?h=for-6.19/intel-ish-v2&id=3644f4411713f52bf231574aa8759e3d8e20b341

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-24 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24 12:25 [PATCH v1 1/1] HID: intel-ish-hid: Fix a build error in devm_ishtp_alloc_workqueue() Andy Shevchenko
2025-10-24 12:27 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox