2023-07-21 10:13:01

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 01/22] genirq/devres: Add devm_request_threaded_irq_probe() and devm_request_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So add devm_request_threaded_irq_probe() and devm_request_irq_probe(),
which ensure that all error handling branches print error information.
In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
---
include/linux/interrupt.h | 15 +++++++++++++++
kernel/irq/devres.c | 40 +++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index a92bce40b04b..60a3d3bdcf45 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -201,6 +201,21 @@ extern void free_percpu_nmi(unsigned int irq, void __percpu *percpu_dev_id);

struct device;

+extern int __must_check
+devm_request_threaded_irq_probe(struct device *dev, unsigned int irq,
+ irq_handler_t handler, irq_handler_t thread_fn,
+ unsigned long irqflags, const char *devname,
+ void *dev_id, const char *info);
+
+static inline int __must_check
+devm_request_irq_probe(struct device *dev, unsigned int irq,
+ irq_handler_t handler, unsigned long irqflags,
+ const char *devname, void *dev_id, const char *info)
+{
+ return devm_request_threaded_irq_probe(dev, irq, handler, NULL, irqflags,
+ devname, dev_id, info);
+}
+
extern int __must_check
devm_request_threaded_irq(struct device *dev, unsigned int irq,
irq_handler_t handler, irq_handler_t thread_fn,
diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c
index f6e5515ee077..40494eabb060 100644
--- a/kernel/irq/devres.c
+++ b/kernel/irq/devres.c
@@ -79,6 +79,46 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
}
EXPORT_SYMBOL(devm_request_threaded_irq);

+/**
+ * devm_request_threaded_irq_probe - allocate an interrupt line for a managed device(recommended)
+ * @dev: device to request interrupt for
+ * @irq: Interrupt line to allocate
+ * @handler: Function to be called when the IRQ occurs
+ * @thread_fn: function to be called in a threaded interrupt context. NULL
+ * for devices which handle everything in @handler
+ * @irqflags: Interrupt type flags
+ * @devname: An ascii name for the claiming device, dev_name(dev) if NULL
+ * @dev_id: A cookie passed back to the handler function
+ * @info: Optional additional error log
+ *
+ * This is a variant of the devm_request_threaded_irq function.
+ * It will print an error message by default when the request fails,
+ * and the consumer can add a special error msg.
+ *
+ * Except for the extra @info argument, this function takes the
+ * same arguments and performs the same function as
+ * devm_request_threaded_irq(). IRQs requested with this function will be
+ * automatically freed on driver detach.
+ *
+ * If an IRQ allocated with this function needs to be freed
+ * separately, devm_free_irq() must be used.
+ */
+int devm_request_threaded_irq_probe(struct device *dev, unsigned int irq,
+ irq_handler_t handler, irq_handler_t thread_fn,
+ unsigned long irqflags, const char *devname,
+ void *dev_id, const char *info)
+{
+ int rc;
+
+ rc = devm_request_threaded_irq(dev, irq, handler, NULL, irqflags, devname, dev_id);
+ if (rc)
+ return dev_err_probe(dev, rc, "Failed to request %sinterrupt %u %s %s\n",
+ thread_fn ? "threaded " : "", irq, devname ? : dev_name(dev),
+ info ? : "");
+ return 0;
+}
+EXPORT_SYMBOL(devm_request_threaded_irq_probe);
+
/**
* devm_request_any_context_irq - allocate an interrupt line for a managed device
* @dev: device to request interrupt for
--
2.39.0



2023-07-21 10:14:12

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 06/22] thermal/drivers/qcom/lmh: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
---
drivers/thermal/qcom/lmh.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/qcom/lmh.c b/drivers/thermal/qcom/lmh.c
index f6edb12ec004..48a14d7e8bf5 100644
--- a/drivers/thermal/qcom/lmh.c
+++ b/drivers/thermal/qcom/lmh.c
@@ -207,11 +207,10 @@ static int lmh_probe(struct platform_device *pdev)

/* Disable the irq and let cpufreq enable it when ready to handle the interrupt */
irq_set_status_flags(lmh_data->irq, IRQ_NOAUTOEN);
- ret = devm_request_irq(dev, lmh_data->irq, lmh_handle_irq,
- IRQF_ONESHOT | IRQF_NO_SUSPEND,
- "lmh-irq", lmh_data);
+ ret = devm_request_irq_probe(dev, lmh_data->irq, lmh_handle_irq,
+ IRQF_ONESHOT | IRQF_NO_SUSPEND,
+ "lmh-irq", lmh_data, NULL);
if (ret) {
- dev_err(dev, "Error %d registering irq %x\n", ret, lmh_data->irq);
irq_domain_remove(lmh_data->domain);
return ret;
}
--
2.39.0


2023-07-21 10:14:22

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 09/22] thermal/drivers/qcom/temp-alarm: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
---
drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
index 0e8ebfcd84c5..1b4a7eca181e 100644
--- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
+++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
@@ -455,8 +455,8 @@ static int qpnp_tm_probe(struct platform_device *pdev)

devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev);

- ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, qpnp_tm_isr,
- IRQF_ONESHOT, node->name, chip);
+ ret = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, qpnp_tm_isr,
+ IRQF_ONESHOT, node->name, chip, NULL);
if (ret < 0)
return ret;

--
2.39.0


2023-07-21 10:15:02

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 15/22] thermal/drivers/mediatek/lvts_thermal: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
drivers/thermal/mediatek/lvts_thermal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index b693fac2d677..1e12410820df 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -1148,10 +1148,10 @@ static int lvts_probe(struct platform_device *pdev)
* At this point the LVTS is initialized and enabled. We can
* safely enable the interrupt.
*/
- ret = devm_request_threaded_irq(dev, irq, NULL, lvts_irq_handler,
- IRQF_ONESHOT, dev_name(dev), lvts_td);
+ ret = devm_request_threaded_irq_probe(dev, irq, NULL, lvts_irq_handler,
+ IRQF_ONESHOT, dev_name(dev), lvts_td, NULL);
if (ret)
- return dev_err_probe(dev, ret, "Failed to request interrupt\n");
+ return ret;

platform_set_drvdata(pdev, lvts_td);

--
2.39.0


2023-07-21 10:15:09

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 10/22] thermal: intel: int340x: processor_thermal: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Acked-by: Rafael J. Wysocki <[email protected]>
---
.../intel/int340x_thermal/processor_thermal_device_pci.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
index 0d1e98007270..ee766904b314 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
@@ -258,13 +258,10 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
irq_flag = IRQF_SHARED;

irq = pci_irq_vector(pdev, 0);
- ret = devm_request_threaded_irq(&pdev->dev, irq,
- proc_thermal_irq_handler, NULL,
- irq_flag, KBUILD_MODNAME, pci_info);
- if (ret) {
- dev_err(&pdev->dev, "Request IRQ %d failed\n", pdev->irq);
+ ret = devm_request_threaded_irq_probe(&pdev->dev, irq, proc_thermal_irq_handler,
+ NULL, irq_flag, KBUILD_MODNAME, pci_info, NULL);
+ if (ret)
goto err_free_vectors;
- }

ret = thermal_zone_device_enable(pci_info->tzone);
if (ret)
--
2.39.0


2023-07-21 10:15:12

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 03/22] thermal/drivers/armada: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Acked-by: Miquel Raynal <[email protected]>
---
drivers/thermal/armada_thermal.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 9f6dc4fc9112..b7f549b6f825 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -913,15 +913,12 @@ static int armada_thermal_probe(struct platform_device *pdev)

/* The overheat interrupt feature is not mandatory */
if (irq > 0) {
- ret = devm_request_threaded_irq(&pdev->dev, irq,
- armada_overheat_isr,
- armada_overheat_isr_thread,
- 0, NULL, priv);
- if (ret) {
- dev_err(&pdev->dev, "Cannot request threaded IRQ %d\n",
- irq);
+ ret = devm_request_threaded_irq_probe(&pdev->dev, irq,
+ armada_overheat_isr,
+ armada_overheat_isr_thread,
+ 0, NULL, priv, NULL);
+ if (ret)
return ret;
- }
}

/*
--
2.39.0


2023-07-21 10:15:16

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 21/22] thermal/drivers/uniphier: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/uniphier_thermal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c
index aef6119cc004..34d8eb2138d3 100644
--- a/drivers/thermal/uniphier_thermal.c
+++ b/drivers/thermal/uniphier_thermal.c
@@ -278,9 +278,9 @@ static int uniphier_tm_probe(struct platform_device *pdev)
return ret;
}

- ret = devm_request_threaded_irq(dev, irq, uniphier_tm_alarm_irq,
- uniphier_tm_alarm_irq_thread,
- 0, "thermal", tdev);
+ ret = devm_request_threaded_irq_probe(dev, irq, uniphier_tm_alarm_irq,
+ uniphier_tm_alarm_irq_thread,
+ 0, "thermal", tdev, NULL);
if (ret)
return ret;

--
2.39.0


2023-07-21 10:16:02

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 14/22] drivers/thermal/rcar_gen3_thermal: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
---
drivers/thermal/rcar_gen3_thermal.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index 9029d01e029b..ff9cd43e1881 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -467,9 +467,10 @@ static int rcar_gen3_thermal_request_irqs(struct rcar_gen3_thermal_priv *priv,
if (!irqname)
return -ENOMEM;

- ret = devm_request_threaded_irq(dev, irq, NULL,
- rcar_gen3_thermal_irq,
- IRQF_ONESHOT, irqname, priv);
+ ret = devm_request_threaded_irq_probe(dev, irq, NULL,
+ rcar_gen3_thermal_irq,
+ IRQF_ONESHOT, irqname,
+ priv, NULL);
if (ret)
return ret;
}
--
2.39.0


2023-07-21 10:16:07

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 07/22] thermal/drivers/db8500: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/db8500_thermal.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
index fca5c2c93bf9..0ef8fc2eb4a1 100644
--- a/drivers/thermal/db8500_thermal.c
+++ b/drivers/thermal/db8500_thermal.c
@@ -164,25 +164,21 @@ static int db8500_thermal_probe(struct platform_device *pdev)
if (low_irq < 0)
return low_irq;

- ret = devm_request_threaded_irq(dev, low_irq, NULL,
+ ret = devm_request_threaded_irq_probe(dev, low_irq, NULL,
prcmu_low_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
- "dbx500_temp_low", th);
- if (ret < 0) {
- dev_err(dev, "failed to allocate temp low irq\n");
+ "dbx500_temp_low", th, "temp low");
+ if (ret < 0)
return ret;
- }

high_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_HIGH");
if (high_irq < 0)
return high_irq;

- ret = devm_request_threaded_irq(dev, high_irq, NULL,
+ ret = devm_request_threaded_irq_probe(dev, high_irq, NULL,
prcmu_high_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
- "dbx500_temp_high", th);
- if (ret < 0) {
- dev_err(dev, "failed to allocate temp high irq\n");
+ "dbx500_temp_high", th, "temp high");
+ if (ret < 0)
return ret;
- }

/* register of thermal sensor and get info from DT */
th->tz = devm_thermal_of_zone_register(dev, 0, th, &thdev_ops);
--
2.39.0


2023-07-21 10:16:15

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v5 14/22] drivers/thermal/rcar_gen3_thermal: convert to use devm_request*_irq_probe()

On 21/07/2023 11:46, Yangtao Li wrote:
> There are more than 700 calls to devm_request_threaded_irq method and
> more than 1000 calls to devm_request_irq method. Most drivers only
> request one interrupt resource, and these error messages are basically
> the same. If error messages are printed everywhere, more than 2000 lines
> of code can be saved by removing the msg in the driver.
>

All your subject prefixes are totally mixed up.

Please use subject prefixes matching the subsystem. You can get them for
example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
your patch is touching.

Best regards,
Krzysztof


2023-07-21 10:36:08

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 13/22] thermal/drivers/rockchip: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Acked-by: Heiko Stuebner <[email protected]>
---
drivers/thermal/rockchip_thermal.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 77231a9d28ff..11061f6ef323 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1577,13 +1577,12 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
"failed to register sensor[%d].\n", i);
}

- error = devm_request_threaded_irq(&pdev->dev, irq, NULL,
- &rockchip_thermal_alarm_irq_thread,
- IRQF_ONESHOT,
- "rockchip_thermal", thermal);
+ error = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL,
+ &rockchip_thermal_alarm_irq_thread,
+ IRQF_ONESHOT,
+ "rockchip_thermal", thermal, "tsadc");
if (error)
- return dev_err_probe(&pdev->dev, error,
- "failed to request tsadc irq.\n");
+ return error;

thermal->chip->control(thermal->regs, true);

--
2.39.0


2023-07-21 10:37:03

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 16/22] thermal: max77620: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/max77620_thermal.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c
index 61c7622d9945..92289498fa17 100644
--- a/drivers/thermal/max77620_thermal.c
+++ b/drivers/thermal/max77620_thermal.c
@@ -121,23 +121,19 @@ static int max77620_thermal_probe(struct platform_device *pdev)
return ret;
}

- ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm1, NULL,
- max77620_thermal_irq,
- IRQF_ONESHOT | IRQF_SHARED,
- dev_name(&pdev->dev), mtherm);
- if (ret < 0) {
- dev_err(&pdev->dev, "Failed to request irq1: %d\n", ret);
+ ret = devm_request_threaded_irq_probe(&pdev->dev, mtherm->irq_tjalarm1, NULL,
+ max77620_thermal_irq,
+ IRQF_ONESHOT | IRQF_SHARED,
+ dev_name(&pdev->dev), mtherm, "irq1");
+ if (ret < 0)
return ret;
- }

- ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm2, NULL,
- max77620_thermal_irq,
- IRQF_ONESHOT | IRQF_SHARED,
- dev_name(&pdev->dev), mtherm);
- if (ret < 0) {
- dev_err(&pdev->dev, "Failed to request irq2: %d\n", ret);
+ ret = devm_request_threaded_irq_probe(&pdev->dev, mtherm->irq_tjalarm2, NULL,
+ max77620_thermal_irq,
+ IRQF_ONESHOT | IRQF_SHARED,
+ dev_name(&pdev->dev), mtherm, "irq2");
+ if (ret < 0)
return ret;
- }

platform_set_drvdata(pdev, mtherm);

--
2.39.0


2023-07-21 10:38:24

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 02/22] thermal/drivers/sun8i: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Acked-by: Jernej Skrabec <[email protected]>
---
drivers/thermal/sun8i_thermal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
index 195f3c5d0b38..a952804ff993 100644
--- a/drivers/thermal/sun8i_thermal.c
+++ b/drivers/thermal/sun8i_thermal.c
@@ -512,9 +512,9 @@ static int sun8i_ths_probe(struct platform_device *pdev)
* registered yet, we deffer the registration of the interrupt to
* the end.
*/
- ret = devm_request_threaded_irq(dev, irq, NULL,
- sun8i_irq_thread,
- IRQF_ONESHOT, "ths", tmdev);
+ ret = devm_request_threaded_irq_probe(dev, irq, NULL,
+ sun8i_irq_thread,
+ IRQF_ONESHOT, "ths", tmdev, NULL);
if (ret)
return ret;

--
2.39.0


2023-07-21 10:42:01

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 19/22] thermal/drivers/qcom/tsens-v0_1: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
---
drivers/thermal/qcom/tsens.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 98c356acfe98..d4528d36c085 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -1171,21 +1171,18 @@ static int tsens_register_irq(struct tsens_priv *priv, char *irqname,
} else {
/* VER_0 interrupt is TRIGGER_RISING, VER_0_1 and up is ONESHOT */
if (tsens_version(priv) == VER_0)
- ret = devm_request_threaded_irq(&pdev->dev, irq,
- thread_fn, NULL,
- IRQF_TRIGGER_RISING,
- dev_name(&pdev->dev),
- priv);
+ ret = devm_request_threaded_irq_probe(&pdev->dev, irq,
+ thread_fn, NULL,
+ IRQF_TRIGGER_RISING,
+ dev_name(&pdev->dev),
+ priv, NULL);
else
- ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
- thread_fn, IRQF_ONESHOT,
- dev_name(&pdev->dev),
- priv);
+ ret = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL,
+ thread_fn, IRQF_ONESHOT,
+ dev_name(&pdev->dev),
+ priv, NULL);

- if (ret)
- dev_err(&pdev->dev, "%s: failed to get irq\n",
- __func__);
- else
+ if (!ret)
enable_irq_wake(irq);
}

--
2.39.0


2023-07-21 10:50:37

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 20/22] thermal: qcom-spmi-adc-tm5: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
---
drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
index 5ddc39b2be32..90d46dc60806 100644
--- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
+++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
@@ -1044,8 +1044,9 @@ static int adc_tm5_probe(struct platform_device *pdev)
return ret;
}

- return devm_request_threaded_irq(dev, irq, NULL, adc_tm->data->isr,
- IRQF_ONESHOT, adc_tm->data->irq_name, adc_tm);
+ return devm_request_threaded_irq_probe(dev, irq, NULL, adc_tm->data->isr,
+ IRQF_ONESHOT, adc_tm->data->irq_name,
+ adc_tm, NULL);
}

static const struct of_device_id adc_tm5_match_table[] = {
--
2.39.0


2023-07-21 10:51:01

by 李扬韬

[permalink] [raw]
Subject: [PATCH v5 22/22] thermal/drivers/imx: convert to use devm_request*_irq_probe()

There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.

And tglx point out that:

If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

519 messages total (there are probably more)

352 unique messages

323 unique messages after lower casing

Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.

186 of these messages do not deliver any useful information,
e.g. "no irq", "

The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.

In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.

Cc: Thomas Gleixner <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/imx_thermal.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index a94ec0a0c9dd..3131a09f9906 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -746,13 +746,12 @@ static int imx_thermal_probe(struct platform_device *pdev)
if (ret)
goto thermal_zone_unregister;

- ret = devm_request_threaded_irq(&pdev->dev, data->irq,
- imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread,
- 0, "imx_thermal", data);
- if (ret < 0) {
- dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret);
+ ret = devm_request_threaded_irq_probe(&pdev->dev, data->irq,
+ imx_thermal_alarm_irq,
+ imx_thermal_alarm_irq_thread,
+ 0, "imx_thermal", data, "alarm");
+ if (ret < 0)
goto thermal_zone_unregister;
- }

pm_runtime_put(data->dev);

--
2.39.0


2023-07-21 11:09:40

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v5 02/22] thermal/drivers/sun8i: convert to use devm_request*_irq_probe()

On Fri, Jul 21, 2023 at 11:47 AM Yangtao Li <[email protected]> wrote:
>
> There are more than 700 calls to devm_request_threaded_irq method and
> more than 1000 calls to devm_request_irq method. Most drivers only
> request one interrupt resource, and these error messages are basically
> the same. If error messages are printed everywhere, more than 2000 lines
> of code can be saved by removing the msg in the driver.
>
> And tglx point out that:
>
> If we actually look at the call sites of
> devm_request_threaded_irq() then the vast majority of them print more or
> less lousy error messages. A quick grep/sed/awk/sort/uniq revealed
>
> 519 messages total (there are probably more)
>
> 352 unique messages
>
> 323 unique messages after lower casing
>
> Those 323 are mostly just variants of the same patterns with
> slight modifications in formatting and information provided.
>
> 186 of these messages do not deliver any useful information,
> e.g. "no irq", "
>
> The most useful one of all is: "could request wakeup irq: %d"
>
> So there is certainly an argument to be made that this particular
> function should print a well formatted and informative error message.
>
> It's not a general allocator like kmalloc(). It's specialized and in the
> vast majority of cases failing to request the interrupt causes the
> device probe to fail. So having proper and consistent information why
> the device cannot be used _is_ useful.
>
> So convert to use devm_request*_irq_probe() API, which ensure that all
> error handling branches print error information.
>
> In this way, when this function fails, the upper-layer functions can
> directly return an error code without missing debugging information.
> Otherwise, the error message will be printed redundantly or missing.
>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Krzysztof Kozlowski <[email protected]>
> Cc: "Uwe Kleine-König" <[email protected]>
> Cc: Jonathan Cameron <[email protected]>
> Cc: AngeloGioacchino Del Regno <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
> Acked-by: Jernej Skrabec <[email protected]>

It is not clear to me what the purpose of sending these patches is.

Because the devm_request_threaded_irq_probe() definition is not there
in the current -rc kernels AFAICS, it looks like they are sent in
order to collect tags from people. If so, there should be a cover
letter making that clear.

As it stands, it is also unclear how you want them to be merged.

Moreover, sending the series without patch [01/22] to linux-pm has not
been helpful.

Thanks!

> ---
> drivers/thermal/sun8i_thermal.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index 195f3c5d0b38..a952804ff993 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -512,9 +512,9 @@ static int sun8i_ths_probe(struct platform_device *pdev)
> * registered yet, we deffer the registration of the interrupt to
> * the end.
> */
> - ret = devm_request_threaded_irq(dev, irq, NULL,
> - sun8i_irq_thread,
> - IRQF_ONESHOT, "ths", tmdev);
> + ret = devm_request_threaded_irq_probe(dev, irq, NULL,
> + sun8i_irq_thread,
> + IRQF_ONESHOT, "ths", tmdev, NULL);
> if (ret)
> return ret;
>
> --
> 2.39.0
>