* [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates
@ 2024-01-22 12:42 Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 1/4] bitmap: define a cleanup function for bitmaps Bartosz Golaszewski
` (3 more replies)
0 siblings, 4 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2024-01-22 12:42 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Thomas Gleixner,
Marc Zyngier, Peter Zijlstra
Cc: linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
I'm resending it one last time. As it's been almost 5 months since the
initial submission and there were no reviews for the irq_sim part, I'll
take it through the GPIO tree for the next merge window.
--
Here are a couple of updates to the interrupt simulator. Two are minor:
remove an unused field and reorder includes for readability. The third
one simplifies the error paths by using new cleanup macros. To that end
we also add a cleanup definition for dynamic bitmaps.
v1 -> v2:
- add a NULL-pointer check to the bitmap cleanup macro as advised by
Peter Zijlstra
- initialize managed pointers when declaring them to create a clear pairing
between the type and the cleanup action
Bartosz Golaszewski (4):
bitmap: define a cleanup function for bitmaps
genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx
genirq/irq_sim: order headers alphabetically
genirq/irq_sim: shrink code by using cleanup helpers
include/linux/bitmap.h | 3 +++
kernel/irq/irq_sim.c | 30 ++++++++++++------------------
2 files changed, 15 insertions(+), 18 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RESEND PATCH v2 1/4] bitmap: define a cleanup function for bitmaps
2024-01-22 12:42 [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates Bartosz Golaszewski
@ 2024-01-22 12:42 ` Bartosz Golaszewski
2024-01-26 12:53 ` [tip: irq/core] bitmap: Define " tip-bot2 for Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 2/4] genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx Bartosz Golaszewski
` (2 subsequent siblings)
3 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2024-01-22 12:42 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Thomas Gleixner,
Marc Zyngier, Peter Zijlstra
Cc: linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Add support for autopointers for bitmaps allocated with bitmap_alloc()
et al.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Yury Norov <yury.norov@gmail.com>
---
include/linux/bitmap.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 99451431e4d6..df24c8fb1009 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -6,6 +6,7 @@
#include <linux/align.h>
#include <linux/bitops.h>
+#include <linux/cleanup.h>
#include <linux/errno.h>
#include <linux/find.h>
#include <linux/limits.h>
@@ -127,6 +128,8 @@ unsigned long *bitmap_alloc_node(unsigned int nbits, gfp_t flags, int node);
unsigned long *bitmap_zalloc_node(unsigned int nbits, gfp_t flags, int node);
void bitmap_free(const unsigned long *bitmap);
+DEFINE_FREE(bitmap, unsigned long *, if (_T) bitmap_free(_T))
+
/* Managed variants of the above. */
unsigned long *devm_bitmap_alloc(struct device *dev,
unsigned int nbits, gfp_t flags);
--
2.40.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: irq/core] bitmap: Define a cleanup function for bitmaps
2024-01-22 12:42 ` [RESEND PATCH v2 1/4] bitmap: define a cleanup function for bitmaps Bartosz Golaszewski
@ 2024-01-26 12:53 ` tip-bot2 for Bartosz Golaszewski
0 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Bartosz Golaszewski @ 2024-01-26 12:53 UTC (permalink / raw)
To: linux-tip-commits
Cc: Bartosz Golaszewski, Thomas Gleixner, Andy Shevchenko,
Yury Norov, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: d12a82848eac28d248e67940378fe4a72b0a8cd3
Gitweb: https://git.kernel.org/tip/d12a82848eac28d248e67940378fe4a72b0a8cd3
Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
AuthorDate: Mon, 22 Jan 2024 13:42:40 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 26 Jan 2024 13:44:48 +01:00
bitmap: Define a cleanup function for bitmaps
Add support for autopointers for bitmaps allocated with bitmap_alloc()
et al.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Yury Norov <yury.norov@gmail.com>
Link: https://lore.kernel.org/r/20240122124243.44002-2-brgl@bgdev.pl
---
include/linux/bitmap.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 9945143..df24c8f 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -6,6 +6,7 @@
#include <linux/align.h>
#include <linux/bitops.h>
+#include <linux/cleanup.h>
#include <linux/errno.h>
#include <linux/find.h>
#include <linux/limits.h>
@@ -127,6 +128,8 @@ unsigned long *bitmap_alloc_node(unsigned int nbits, gfp_t flags, int node);
unsigned long *bitmap_zalloc_node(unsigned int nbits, gfp_t flags, int node);
void bitmap_free(const unsigned long *bitmap);
+DEFINE_FREE(bitmap, unsigned long *, if (_T) bitmap_free(_T))
+
/* Managed variants of the above. */
unsigned long *devm_bitmap_alloc(struct device *dev,
unsigned int nbits, gfp_t flags);
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RESEND PATCH v2 2/4] genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx
2024-01-22 12:42 [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 1/4] bitmap: define a cleanup function for bitmaps Bartosz Golaszewski
@ 2024-01-22 12:42 ` Bartosz Golaszewski
2024-01-26 12:53 ` [tip: irq/core] genirq/irq_sim: Remove " tip-bot2 for Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 3/4] genirq/irq_sim: order headers alphabetically Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 4/4] genirq/irq_sim: shrink code by using cleanup helpers Bartosz Golaszewski
3 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2024-01-22 12:42 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Thomas Gleixner,
Marc Zyngier, Peter Zijlstra
Cc: linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
The irqnum field is unused. Remove it.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
kernel/irq/irq_sim.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index dd76323ea3fd..f5ebb3ba6f9a 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -19,7 +19,6 @@ struct irq_sim_work_ctx {
};
struct irq_sim_irq_ctx {
- int irqnum;
bool enabled;
struct irq_sim_work_ctx *work_ctx;
};
--
2.40.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: irq/core] genirq/irq_sim: Remove unused field from struct irq_sim_irq_ctx
2024-01-22 12:42 ` [RESEND PATCH v2 2/4] genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx Bartosz Golaszewski
@ 2024-01-26 12:53 ` tip-bot2 for Bartosz Golaszewski
0 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Bartosz Golaszewski @ 2024-01-26 12:53 UTC (permalink / raw)
To: linux-tip-commits
Cc: Bartosz Golaszewski, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 3832f390423302e373a1818f6cf8cb29ebf3a195
Gitweb: https://git.kernel.org/tip/3832f390423302e373a1818f6cf8cb29ebf3a195
Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
AuthorDate: Mon, 22 Jan 2024 13:42:41 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 26 Jan 2024 13:44:48 +01:00
genirq/irq_sim: Remove unused field from struct irq_sim_irq_ctx
The irqnum field is unused. Remove it.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240122124243.44002-3-brgl@bgdev.pl
---
kernel/irq/irq_sim.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index dd76323..f5ebb3b 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -19,7 +19,6 @@ struct irq_sim_work_ctx {
};
struct irq_sim_irq_ctx {
- int irqnum;
bool enabled;
struct irq_sim_work_ctx *work_ctx;
};
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RESEND PATCH v2 3/4] genirq/irq_sim: order headers alphabetically
2024-01-22 12:42 [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 1/4] bitmap: define a cleanup function for bitmaps Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 2/4] genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx Bartosz Golaszewski
@ 2024-01-22 12:42 ` Bartosz Golaszewski
2024-01-26 12:53 ` [tip: irq/core] genirq/irq_sim: Order " tip-bot2 for Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 4/4] genirq/irq_sim: shrink code by using cleanup helpers Bartosz Golaszewski
3 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2024-01-22 12:42 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Thomas Gleixner,
Marc Zyngier, Peter Zijlstra
Cc: linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
For better readability and maintenance keep headers in alphabetical
order.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
kernel/irq/irq_sim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index f5ebb3ba6f9a..b0d50b48dbd1 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -4,10 +4,10 @@
* Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
*/
+#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irq_sim.h>
#include <linux/irq_work.h>
-#include <linux/interrupt.h>
#include <linux/slab.h>
struct irq_sim_work_ctx {
--
2.40.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: irq/core] genirq/irq_sim: Order headers alphabetically
2024-01-22 12:42 ` [RESEND PATCH v2 3/4] genirq/irq_sim: order headers alphabetically Bartosz Golaszewski
@ 2024-01-26 12:53 ` tip-bot2 for Bartosz Golaszewski
0 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Bartosz Golaszewski @ 2024-01-26 12:53 UTC (permalink / raw)
To: linux-tip-commits
Cc: Bartosz Golaszewski, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 8dab7fd47e53865d37fce73c67bac97b41d5d64a
Gitweb: https://git.kernel.org/tip/8dab7fd47e53865d37fce73c67bac97b41d5d64a
Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
AuthorDate: Mon, 22 Jan 2024 13:42:42 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 26 Jan 2024 13:44:48 +01:00
genirq/irq_sim: Order headers alphabetically
For better readability and maintenance keep headers in alphabetical
order.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240122124243.44002-4-brgl@bgdev.pl
---
kernel/irq/irq_sim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index f5ebb3b..b0d50b4 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -4,10 +4,10 @@
* Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
*/
+#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irq_sim.h>
#include <linux/irq_work.h>
-#include <linux/interrupt.h>
#include <linux/slab.h>
struct irq_sim_work_ctx {
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RESEND PATCH v2 4/4] genirq/irq_sim: shrink code by using cleanup helpers
2024-01-22 12:42 [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates Bartosz Golaszewski
` (2 preceding siblings ...)
2024-01-22 12:42 ` [RESEND PATCH v2 3/4] genirq/irq_sim: order headers alphabetically Bartosz Golaszewski
@ 2024-01-22 12:42 ` Bartosz Golaszewski
2024-01-26 12:53 ` [tip: irq/core] genirq/irq_sim: Shrink " tip-bot2 for Bartosz Golaszewski
2024-01-29 10:16 ` [tip: irq/core] genirq/irq_sim: Shrink code by using <linux/cleanup.h> helpers tip-bot2 for Bartosz Golaszewski
3 siblings, 2 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2024-01-22 12:42 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Thomas Gleixner,
Marc Zyngier, Peter Zijlstra
Cc: linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Use the new __free helper from linux/cleanup.h to remove all gotos and
simplify the error paths.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
kernel/irq/irq_sim.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index b0d50b48dbd1..82b7b5051249 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -4,6 +4,7 @@
* Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
*/
+#include <linux/cleanup.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irq_sim.h>
@@ -163,33 +164,27 @@ static const struct irq_domain_ops irq_sim_domain_ops = {
struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
unsigned int num_irqs)
{
- struct irq_sim_work_ctx *work_ctx;
-
- work_ctx = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
+ struct irq_sim_work_ctx *work_ctx __free(kfree) =
+ kmalloc(sizeof(*work_ctx), GFP_KERNEL);
if (!work_ctx)
- goto err_out;
+ return ERR_PTR(-ENOMEM);
- work_ctx->pending = bitmap_zalloc(num_irqs, GFP_KERNEL);
- if (!work_ctx->pending)
- goto err_free_work_ctx;
+ unsigned long *pending __free(bitmap) = bitmap_zalloc(num_irqs,
+ GFP_KERNEL);
+ if (!pending)
+ return ERR_PTR(-ENOMEM);
work_ctx->domain = irq_domain_create_linear(fwnode, num_irqs,
&irq_sim_domain_ops,
work_ctx);
if (!work_ctx->domain)
- goto err_free_bitmap;
+ return ERR_PTR(-ENOMEM);
work_ctx->irq_count = num_irqs;
work_ctx->work = IRQ_WORK_INIT_HARD(irq_sim_handle_irq);
+ work_ctx->pending = no_free_ptr(pending);
- return work_ctx->domain;
-
-err_free_bitmap:
- bitmap_free(work_ctx->pending);
-err_free_work_ctx:
- kfree(work_ctx);
-err_out:
- return ERR_PTR(-ENOMEM);
+ return no_free_ptr(work_ctx)->domain;
}
EXPORT_SYMBOL_GPL(irq_domain_create_sim);
--
2.40.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: irq/core] genirq/irq_sim: Shrink code by using cleanup helpers
2024-01-22 12:42 ` [RESEND PATCH v2 4/4] genirq/irq_sim: shrink code by using cleanup helpers Bartosz Golaszewski
@ 2024-01-26 12:53 ` tip-bot2 for Bartosz Golaszewski
2024-01-26 21:05 ` Nathan Chancellor
2024-01-29 10:16 ` [tip: irq/core] genirq/irq_sim: Shrink code by using <linux/cleanup.h> helpers tip-bot2 for Bartosz Golaszewski
1 sibling, 1 reply; 22+ messages in thread
From: tip-bot2 for Bartosz Golaszewski @ 2024-01-26 12:53 UTC (permalink / raw)
To: linux-tip-commits
Cc: Bartosz Golaszewski, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 590610d72a790458431cbbebc71ee24521533b5e
Gitweb: https://git.kernel.org/tip/590610d72a790458431cbbebc71ee24521533b5e
Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
AuthorDate: Mon, 22 Jan 2024 13:42:43 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 26 Jan 2024 13:44:48 +01:00
genirq/irq_sim: Shrink code by using cleanup helpers
Use the new __free() mechanism to remove all gotos and simplify the error
paths.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240122124243.44002-5-brgl@bgdev.pl
---
kernel/irq/irq_sim.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index b0d50b4..fe8fd30 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -4,6 +4,7 @@
* Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
*/
+#include <linux/cleanup.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irq_sim.h>
@@ -163,33 +164,27 @@ static const struct irq_domain_ops irq_sim_domain_ops = {
struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
unsigned int num_irqs)
{
- struct irq_sim_work_ctx *work_ctx;
+ struct irq_sim_work_ctx *work_ctx __free(kfree) = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
+ unsigned long *pending;
- work_ctx = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
if (!work_ctx)
- goto err_out;
+ return ERR_PTR(-ENOMEM);
- work_ctx->pending = bitmap_zalloc(num_irqs, GFP_KERNEL);
- if (!work_ctx->pending)
- goto err_free_work_ctx;
+ pending = __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL);
+ if (!pending)
+ return ERR_PTR(-ENOMEM);
work_ctx->domain = irq_domain_create_linear(fwnode, num_irqs,
&irq_sim_domain_ops,
work_ctx);
if (!work_ctx->domain)
- goto err_free_bitmap;
+ return ERR_PTR(-ENOMEM);
work_ctx->irq_count = num_irqs;
work_ctx->work = IRQ_WORK_INIT_HARD(irq_sim_handle_irq);
+ work_ctx->pending = no_free_ptr(pending);
- return work_ctx->domain;
-
-err_free_bitmap:
- bitmap_free(work_ctx->pending);
-err_free_work_ctx:
- kfree(work_ctx);
-err_out:
- return ERR_PTR(-ENOMEM);
+ return no_free_ptr(work_ctx)->domain;
}
EXPORT_SYMBOL_GPL(irq_domain_create_sim);
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [tip: irq/core] genirq/irq_sim: Shrink code by using cleanup helpers
2024-01-26 12:53 ` [tip: irq/core] genirq/irq_sim: Shrink " tip-bot2 for Bartosz Golaszewski
@ 2024-01-26 21:05 ` Nathan Chancellor
2024-01-26 22:15 ` Bartosz Golaszewski
0 siblings, 1 reply; 22+ messages in thread
From: Nathan Chancellor @ 2024-01-26 21:05 UTC (permalink / raw)
To: Thomas Gleixner, x86
Cc: linux-tip-commits, Bartosz Golaszewski, maz, linux-kernel
On Fri, Jan 26, 2024 at 12:53:36PM -0000, tip-bot2 for Bartosz Golaszewski wrote:
> The following commit has been merged into the irq/core branch of tip:
>
> Commit-ID: 590610d72a790458431cbbebc71ee24521533b5e
> Gitweb: https://git.kernel.org/tip/590610d72a790458431cbbebc71ee24521533b5e
> Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> AuthorDate: Mon, 22 Jan 2024 13:42:43 +01:00
> Committer: Thomas Gleixner <tglx@linutronix.de>
> CommitterDate: Fri, 26 Jan 2024 13:44:48 +01:00
>
> genirq/irq_sim: Shrink code by using cleanup helpers
>
> Use the new __free() mechanism to remove all gotos and simplify the error
> paths.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Link: https://lore.kernel.org/r/20240122124243.44002-5-brgl@bgdev.pl
>
> ---
> kernel/irq/irq_sim.c | 25 ++++++++++---------------
> 1 file changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
> index b0d50b4..fe8fd30 100644
> --- a/kernel/irq/irq_sim.c
> +++ b/kernel/irq/irq_sim.c
> @@ -4,6 +4,7 @@
> * Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
> */
>
> +#include <linux/cleanup.h>
> #include <linux/interrupt.h>
> #include <linux/irq.h>
> #include <linux/irq_sim.h>
> @@ -163,33 +164,27 @@ static const struct irq_domain_ops irq_sim_domain_ops = {
> struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
> unsigned int num_irqs)
> {
> - struct irq_sim_work_ctx *work_ctx;
> + struct irq_sim_work_ctx *work_ctx __free(kfree) = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
> + unsigned long *pending;
>
> - work_ctx = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
> if (!work_ctx)
> - goto err_out;
> + return ERR_PTR(-ENOMEM);
>
> - work_ctx->pending = bitmap_zalloc(num_irqs, GFP_KERNEL);
> - if (!work_ctx->pending)
> - goto err_free_work_ctx;
> + pending = __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL);
Apologies if this has already been reported elsewhere. This does not
match what was sent and it causes the build to break with both GCC:
In file included from include/linux/compiler_types.h:89,
from <command-line>:
kernel/irq/irq_sim.c: In function 'irq_domain_create_sim':
include/linux/compiler_attributes.h:76:41: error: expected expression before '__attribute__'
76 | #define __cleanup(func) __attribute__((__cleanup__(func)))
| ^~~~~~~~~~~~~
include/linux/cleanup.h:64:25: note: in expansion of macro '__cleanup'
64 | #define __free(_name) __cleanup(__free_##_name)
| ^~~~~~~~~
kernel/irq/irq_sim.c:173:19: note: in expansion of macro '__free'
173 | pending = __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL);
| ^~~~~~
and Clang:
kernel/irq/irq_sim.c:173:12: error: expected expression
173 | pending = __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL);
| ^
include/linux/cleanup.h:64:23: note: expanded from macro '__free'
64 | #define __free(_name) __cleanup(__free_##_name)
| ^
include/linux/compiler-clang.h:15:25: note: expanded from macro '__cleanup'
15 | #define __cleanup(func) __maybe_unused __attribute__((__cleanup__(func)))
| ^
include/linux/compiler_attributes.h:344:41: note: expanded from macro '__maybe_unused'
344 | #define __maybe_unused __attribute__((__unused__))
| ^
1 error generated.
This was initially noticed by our CI:
https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/7671789235/job/20915505965
https://storage.tuxsuite.com/public/clangbuiltlinux/continuous-integration2/builds/2bVGKZUmat8fRr582Nh8hNA6FXD/build.log
Cheers,
Nathan
> + if (!pending)
> + return ERR_PTR(-ENOMEM);
>
> work_ctx->domain = irq_domain_create_linear(fwnode, num_irqs,
> &irq_sim_domain_ops,
> work_ctx);
> if (!work_ctx->domain)
> - goto err_free_bitmap;
> + return ERR_PTR(-ENOMEM);
>
> work_ctx->irq_count = num_irqs;
> work_ctx->work = IRQ_WORK_INIT_HARD(irq_sim_handle_irq);
> + work_ctx->pending = no_free_ptr(pending);
>
> - return work_ctx->domain;
> -
> -err_free_bitmap:
> - bitmap_free(work_ctx->pending);
> -err_free_work_ctx:
> - kfree(work_ctx);
> -err_out:
> - return ERR_PTR(-ENOMEM);
> + return no_free_ptr(work_ctx)->domain;
> }
> EXPORT_SYMBOL_GPL(irq_domain_create_sim);
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [tip: irq/core] genirq/irq_sim: Shrink code by using cleanup helpers
2024-01-26 21:05 ` Nathan Chancellor
@ 2024-01-26 22:15 ` Bartosz Golaszewski
2024-01-29 10:13 ` Ingo Molnar
0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2024-01-26 22:15 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Thomas Gleixner, x86, linux-tip-commits, maz, linux-kernel
On Fri, 26 Jan 2024 at 22:05, Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Fri, Jan 26, 2024 at 12:53:36PM -0000, tip-bot2 for Bartosz Golaszewski wrote:
> > The following commit has been merged into the irq/core branch of tip:
> >
> > Commit-ID: 590610d72a790458431cbbebc71ee24521533b5e
> > Gitweb: https://git.kernel.org/tip/590610d72a790458431cbbebc71ee24521533b5e
> > Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > AuthorDate: Mon, 22 Jan 2024 13:42:43 +01:00
> > Committer: Thomas Gleixner <tglx@linutronix.de>
> > CommitterDate: Fri, 26 Jan 2024 13:44:48 +01:00
> >
> > genirq/irq_sim: Shrink code by using cleanup helpers
> >
> > Use the new __free() mechanism to remove all gotos and simplify the error
> > paths.
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > Link: https://lore.kernel.org/r/20240122124243.44002-5-brgl@bgdev.pl
> >
> > ---
> > kernel/irq/irq_sim.c | 25 ++++++++++---------------
> > 1 file changed, 10 insertions(+), 15 deletions(-)
> >
> > diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
> > index b0d50b4..fe8fd30 100644
> > --- a/kernel/irq/irq_sim.c
> > +++ b/kernel/irq/irq_sim.c
> > @@ -4,6 +4,7 @@
> > * Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > */
> >
> > +#include <linux/cleanup.h>
> > #include <linux/interrupt.h>
> > #include <linux/irq.h>
> > #include <linux/irq_sim.h>
> > @@ -163,33 +164,27 @@ static const struct irq_domain_ops irq_sim_domain_ops = {
> > struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
> > unsigned int num_irqs)
> > {
> > - struct irq_sim_work_ctx *work_ctx;
> > + struct irq_sim_work_ctx *work_ctx __free(kfree) = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
> > + unsigned long *pending;
> >
> > - work_ctx = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
> > if (!work_ctx)
> > - goto err_out;
> > + return ERR_PTR(-ENOMEM);
> >
> > - work_ctx->pending = bitmap_zalloc(num_irqs, GFP_KERNEL);
> > - if (!work_ctx->pending)
> > - goto err_free_work_ctx;
> > + pending = __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL);
>
> Apologies if this has already been reported elsewhere. This does not
> match what was sent and it causes the build to break with both GCC:
>
I did not see any other report. I don't know what happened here but
this was a ninja edit as it's not what I sent. If Thomas' intention
was to move the variable declaration and detach it from the assignment
then 'pending' should at least be set to NULL and __free() must
decorate the declaration.
But the coding style of declaring variables when they're first
assigned their auto-cleaned value is what Linus Torvalds explicitly
asked me to do when I first started sending PRs containing uses of
linux/cleanup.h.
Bartosz
> In file included from include/linux/compiler_types.h:89,
> from <command-line>:
> kernel/irq/irq_sim.c: In function 'irq_domain_create_sim':
> include/linux/compiler_attributes.h:76:41: error: expected expression before '__attribute__'
> 76 | #define __cleanup(func) __attribute__((__cleanup__(func)))
> | ^~~~~~~~~~~~~
> include/linux/cleanup.h:64:25: note: in expansion of macro '__cleanup'
> 64 | #define __free(_name) __cleanup(__free_##_name)
> | ^~~~~~~~~
> kernel/irq/irq_sim.c:173:19: note: in expansion of macro '__free'
> 173 | pending = __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL);
> | ^~~~~~
>
> and Clang:
>
> kernel/irq/irq_sim.c:173:12: error: expected expression
> 173 | pending = __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL);
> | ^
> include/linux/cleanup.h:64:23: note: expanded from macro '__free'
> 64 | #define __free(_name) __cleanup(__free_##_name)
> | ^
> include/linux/compiler-clang.h:15:25: note: expanded from macro '__cleanup'
> 15 | #define __cleanup(func) __maybe_unused __attribute__((__cleanup__(func)))
> | ^
> include/linux/compiler_attributes.h:344:41: note: expanded from macro '__maybe_unused'
> 344 | #define __maybe_unused __attribute__((__unused__))
> | ^
> 1 error generated.
>
> This was initially noticed by our CI:
>
> https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/7671789235/job/20915505965
> https://storage.tuxsuite.com/public/clangbuiltlinux/continuous-integration2/builds/2bVGKZUmat8fRr582Nh8hNA6FXD/build.log
>
> Cheers,
> Nathan
>
> > + if (!pending)
> > + return ERR_PTR(-ENOMEM);
> >
> > work_ctx->domain = irq_domain_create_linear(fwnode, num_irqs,
> > &irq_sim_domain_ops,
> > work_ctx);
> > if (!work_ctx->domain)
> > - goto err_free_bitmap;
> > + return ERR_PTR(-ENOMEM);
> >
> > work_ctx->irq_count = num_irqs;
> > work_ctx->work = IRQ_WORK_INIT_HARD(irq_sim_handle_irq);
> > + work_ctx->pending = no_free_ptr(pending);
> >
> > - return work_ctx->domain;
> > -
> > -err_free_bitmap:
> > - bitmap_free(work_ctx->pending);
> > -err_free_work_ctx:
> > - kfree(work_ctx);
> > -err_out:
> > - return ERR_PTR(-ENOMEM);
> > + return no_free_ptr(work_ctx)->domain;
> > }
> > EXPORT_SYMBOL_GPL(irq_domain_create_sim);
> >
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [tip: irq/core] genirq/irq_sim: Shrink code by using cleanup helpers
2024-01-26 22:15 ` Bartosz Golaszewski
@ 2024-01-29 10:13 ` Ingo Molnar
2024-01-29 10:37 ` Bartosz Golaszewski
0 siblings, 1 reply; 22+ messages in thread
From: Ingo Molnar @ 2024-01-29 10:13 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Nathan Chancellor, Thomas Gleixner, x86, linux-tip-commits, maz,
linux-kernel, Linus Torvalds
* Bartosz Golaszewski <bartosz.golaszewski@linaro.org> wrote:
> On Fri, 26 Jan 2024 at 22:05, Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > > Committer: Thomas Gleixner <tglx@linutronix.de>
> > > CommitterDate: Fri, 26 Jan 2024 13:44:48 +01:00
> > >
> > > genirq/irq_sim: Shrink code by using cleanup helpers
> > >
> > > Use the new __free() mechanism to remove all gotos and simplify the error
> > > paths.
> > >
> > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > > Link: https://lore.kernel.org/r/20240122124243.44002-5-brgl@bgdev.pl
> > >
> > > ---
> > > kernel/irq/irq_sim.c | 25 ++++++++++---------------
> > > 1 file changed, 10 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
> > > index b0d50b4..fe8fd30 100644
> > > --- a/kernel/irq/irq_sim.c
> > > +++ b/kernel/irq/irq_sim.c
> > > @@ -4,6 +4,7 @@
> > > * Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > > */
> > >
> > > +#include <linux/cleanup.h>
> > > #include <linux/interrupt.h>
> > > #include <linux/irq.h>
> > > #include <linux/irq_sim.h>
> > > @@ -163,33 +164,27 @@ static const struct irq_domain_ops irq_sim_domain_ops = {
> > > struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
> > > unsigned int num_irqs)
> > > {
> > > - struct irq_sim_work_ctx *work_ctx;
> > > + struct irq_sim_work_ctx *work_ctx __free(kfree) = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
> > > + unsigned long *pending;
> > >
> > > - work_ctx = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
> > > if (!work_ctx)
> > > - goto err_out;
> > > + return ERR_PTR(-ENOMEM);
> > >
> > > - work_ctx->pending = bitmap_zalloc(num_irqs, GFP_KERNEL);
> > > - if (!work_ctx->pending)
> > > - goto err_free_work_ctx;
> > > + pending = __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL);
> >
> > Apologies if this has already been reported elsewhere. This does not
> > match what was sent and it causes the build to break with both GCC:
> >
>
> I did not see any other report. I don't know what happened here but
> this was a ninja edit as it's not what I sent. If Thomas' intention
> was to move the variable declaration and detach it from the assignment
> then 'pending' should at least be set to NULL and __free() must
> decorate the declaration.
>
> But the coding style of declaring variables when they're first
> assigned their auto-cleaned value is what Linus Torvalds explicitly
> asked me to do when I first started sending PRs containing uses of
> linux/cleanup.h.
Ok - I've rebased tip:irq/core with the original patch.
Do you have a reference to Linus's mail about C++ style definition
of variables? I can see the validity of the pattern in this context,
but it's explicitly against the kernel coding style AFAICS, which
I suppose prompted Thomas's edit. I'd like to have an URL handy when the
inevitable checkpatch 'fix' gets submitted. ;-)
Thanks,
Ingo
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [tip: irq/core] genirq/irq_sim: Shrink code by using cleanup helpers
2024-01-29 10:13 ` Ingo Molnar
@ 2024-01-29 10:37 ` Bartosz Golaszewski
0 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2024-01-29 10:37 UTC (permalink / raw)
To: Ingo Molnar
Cc: Nathan Chancellor, Thomas Gleixner, x86, linux-tip-commits, maz,
linux-kernel, Linus Torvalds
On Mon, 29 Jan 2024 at 11:13, Ingo Molnar <mingo@kernel.org> wrote:
>
>
> * Bartosz Golaszewski <bartosz.golaszewski@linaro.org> wrote:
>
> > On Fri, 26 Jan 2024 at 22:05, Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > > Committer: Thomas Gleixner <tglx@linutronix.de>
> > > > CommitterDate: Fri, 26 Jan 2024 13:44:48 +01:00
> > > >
> > > > genirq/irq_sim: Shrink code by using cleanup helpers
> > > >
> > > > Use the new __free() mechanism to remove all gotos and simplify the error
> > > > paths.
> > > >
> > > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > > > Link: https://lore.kernel.org/r/20240122124243.44002-5-brgl@bgdev.pl
> > > >
> > > > ---
> > > > kernel/irq/irq_sim.c | 25 ++++++++++---------------
> > > > 1 file changed, 10 insertions(+), 15 deletions(-)
> > > >
> > > > diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
> > > > index b0d50b4..fe8fd30 100644
> > > > --- a/kernel/irq/irq_sim.c
> > > > +++ b/kernel/irq/irq_sim.c
> > > > @@ -4,6 +4,7 @@
> > > > * Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > > > */
> > > >
> > > > +#include <linux/cleanup.h>
> > > > #include <linux/interrupt.h>
> > > > #include <linux/irq.h>
> > > > #include <linux/irq_sim.h>
> > > > @@ -163,33 +164,27 @@ static const struct irq_domain_ops irq_sim_domain_ops = {
> > > > struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
> > > > unsigned int num_irqs)
> > > > {
> > > > - struct irq_sim_work_ctx *work_ctx;
> > > > + struct irq_sim_work_ctx *work_ctx __free(kfree) = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
> > > > + unsigned long *pending;
> > > >
> > > > - work_ctx = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
> > > > if (!work_ctx)
> > > > - goto err_out;
> > > > + return ERR_PTR(-ENOMEM);
> > > >
> > > > - work_ctx->pending = bitmap_zalloc(num_irqs, GFP_KERNEL);
> > > > - if (!work_ctx->pending)
> > > > - goto err_free_work_ctx;
> > > > + pending = __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL);
> > >
> > > Apologies if this has already been reported elsewhere. This does not
> > > match what was sent and it causes the build to break with both GCC:
> > >
> >
> > I did not see any other report. I don't know what happened here but
> > this was a ninja edit as it's not what I sent. If Thomas' intention
> > was to move the variable declaration and detach it from the assignment
> > then 'pending' should at least be set to NULL and __free() must
> > decorate the declaration.
> >
> > But the coding style of declaring variables when they're first
> > assigned their auto-cleaned value is what Linus Torvalds explicitly
> > asked me to do when I first started sending PRs containing uses of
> > linux/cleanup.h.
>
> Ok - I've rebased tip:irq/core with the original patch.
>
> Do you have a reference to Linus's mail about C++ style definition
> of variables? I can see the validity of the pattern in this context,
> but it's explicitly against the kernel coding style AFAICS, which
> I suppose prompted Thomas's edit. I'd like to have an URL handy when the
> inevitable checkpatch 'fix' gets submitted. ;-)
>
Sure, here's one rant I was the target of:
https://lore.kernel.org/all/CAHk-=wgRHiV5VSxtfXA4S6aLUmcQYEuB67u3BJPJPtuESs1JyA@mail.gmail.com/
Bartosz
^ permalink raw reply [flat|nested] 22+ messages in thread
* [tip: irq/core] genirq/irq_sim: Shrink code by using <linux/cleanup.h> helpers
2024-01-22 12:42 ` [RESEND PATCH v2 4/4] genirq/irq_sim: shrink code by using cleanup helpers Bartosz Golaszewski
2024-01-26 12:53 ` [tip: irq/core] genirq/irq_sim: Shrink " tip-bot2 for Bartosz Golaszewski
@ 2024-01-29 10:16 ` tip-bot2 for Bartosz Golaszewski
1 sibling, 0 replies; 22+ messages in thread
From: tip-bot2 for Bartosz Golaszewski @ 2024-01-29 10:16 UTC (permalink / raw)
To: linux-tip-commits
Cc: Bartosz Golaszewski, Ingo Molnar, Thomas Gleixner,
Nathan Chancellor, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: aafd753555c0ecb9c7ce11ff14429a34c8c0a14b
Gitweb: https://git.kernel.org/tip/aafd753555c0ecb9c7ce11ff14429a34c8c0a14b
Author: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
AuthorDate: Mon, 22 Jan 2024 13:42:43 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Mon, 29 Jan 2024 11:07:57 +01:00
genirq/irq_sim: Shrink code by using <linux/cleanup.h> helpers
Use the new __free() mechanism to remove all gotos and simplify the error
paths.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20240122124243.44002-5-brgl@bgdev.pl
---
kernel/irq/irq_sim.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index b0d50b4..38d6ae6 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -4,6 +4,7 @@
* Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
*/
+#include <linux/cleanup.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irq_sim.h>
@@ -163,33 +164,27 @@ static const struct irq_domain_ops irq_sim_domain_ops = {
struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
unsigned int num_irqs)
{
- struct irq_sim_work_ctx *work_ctx;
+ struct irq_sim_work_ctx *work_ctx __free(kfree) =
+ kmalloc(sizeof(*work_ctx), GFP_KERNEL);
- work_ctx = kmalloc(sizeof(*work_ctx), GFP_KERNEL);
if (!work_ctx)
- goto err_out;
+ return ERR_PTR(-ENOMEM);
- work_ctx->pending = bitmap_zalloc(num_irqs, GFP_KERNEL);
- if (!work_ctx->pending)
- goto err_free_work_ctx;
+ unsigned long *pending __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL);
+ if (!pending)
+ return ERR_PTR(-ENOMEM);
work_ctx->domain = irq_domain_create_linear(fwnode, num_irqs,
&irq_sim_domain_ops,
work_ctx);
if (!work_ctx->domain)
- goto err_free_bitmap;
+ return ERR_PTR(-ENOMEM);
work_ctx->irq_count = num_irqs;
work_ctx->work = IRQ_WORK_INIT_HARD(irq_sim_handle_irq);
+ work_ctx->pending = no_free_ptr(pending);
- return work_ctx->domain;
-
-err_free_bitmap:
- bitmap_free(work_ctx->pending);
-err_free_work_ctx:
- kfree(work_ctx);
-err_out:
- return ERR_PTR(-ENOMEM);
+ return no_free_ptr(work_ctx)->domain;
}
EXPORT_SYMBOL_GPL(irq_domain_create_sim);
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates
@ 2023-11-15 16:59 Bartosz Golaszewski
2023-11-29 9:18 ` Bartosz Golaszewski
0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2023-11-15 16:59 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Thomas Gleixner,
Marc Zyngier, Peter Zijlstra
Cc: linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Here are a couple of updates to the interrupt simulator. Two are minor:
remove an unused field and reorder includes for readability. The third
one simplifies the error paths by using new cleanup macros. To that end
we also add a cleanup definition for dynamic bitmaps.
Resending rebased on top of v6.7-rc1 and with tags collected.
v1 -> v2:
- add a NULL-pointer check to the bitmap cleanup macro as advised by
Peter Zijlstra
- initialize managed pointers when declaring them to create a clear pairing
between the type and the cleanup action
Bartosz Golaszewski (4):
bitmap: define a cleanup function for bitmaps
genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx
genirq/irq_sim: order headers alphabetically
genirq/irq_sim: shrink code by using cleanup helpers
include/linux/bitmap.h | 3 +++
kernel/irq/irq_sim.c | 30 ++++++++++++------------------
2 files changed, 15 insertions(+), 18 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates
2023-11-15 16:59 [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates Bartosz Golaszewski
@ 2023-11-29 9:18 ` Bartosz Golaszewski
2023-11-29 19:57 ` Yury Norov
2023-12-04 8:47 ` Bartosz Golaszewski
0 siblings, 2 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2023-11-29 9:18 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Thomas Gleixner,
Marc Zyngier, Peter Zijlstra
Cc: linux-kernel, Bartosz Golaszewski
On Wed, Nov 15, 2023 at 5:59 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Here are a couple of updates to the interrupt simulator. Two are minor:
> remove an unused field and reorder includes for readability. The third
> one simplifies the error paths by using new cleanup macros. To that end
> we also add a cleanup definition for dynamic bitmaps.
>
> Resending rebased on top of v6.7-rc1 and with tags collected.
>
> v1 -> v2:
> - add a NULL-pointer check to the bitmap cleanup macro as advised by
> Peter Zijlstra
> - initialize managed pointers when declaring them to create a clear pairing
> between the type and the cleanup action
>
> Bartosz Golaszewski (4):
> bitmap: define a cleanup function for bitmaps
> genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx
> genirq/irq_sim: order headers alphabetically
> genirq/irq_sim: shrink code by using cleanup helpers
>
> include/linux/bitmap.h | 3 +++
> kernel/irq/irq_sim.c | 30 ++++++++++++------------------
> 2 files changed, 15 insertions(+), 18 deletions(-)
>
> --
> 2.40.1
>
It's been two weeks since this submission and ~2.5 months since the
first one so I guess, a gentle ping is in order. This is not a very
controversial series - can this be applied?
Bart
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates
2023-11-29 9:18 ` Bartosz Golaszewski
@ 2023-11-29 19:57 ` Yury Norov
2023-11-29 20:50 ` Bartosz Golaszewski
2023-12-04 8:47 ` Bartosz Golaszewski
1 sibling, 1 reply; 22+ messages in thread
From: Yury Norov @ 2023-11-29 19:57 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Andy Shevchenko, Rasmus Villemoes, Thomas Gleixner, Marc Zyngier,
Peter Zijlstra, linux-kernel, Bartosz Golaszewski
On Wed, Nov 29, 2023 at 10:18:15AM +0100, Bartosz Golaszewski wrote:
> On Wed, Nov 15, 2023 at 5:59 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > Here are a couple of updates to the interrupt simulator. Two are minor:
> > remove an unused field and reorder includes for readability. The third
> > one simplifies the error paths by using new cleanup macros. To that end
> > we also add a cleanup definition for dynamic bitmaps.
> >
> > Resending rebased on top of v6.7-rc1 and with tags collected.
> >
> > v1 -> v2:
> > - add a NULL-pointer check to the bitmap cleanup macro as advised by
> > Peter Zijlstra
> > - initialize managed pointers when declaring them to create a clear pairing
> > between the type and the cleanup action
> >
> > Bartosz Golaszewski (4):
> > bitmap: define a cleanup function for bitmaps
> > genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx
> > genirq/irq_sim: order headers alphabetically
> > genirq/irq_sim: shrink code by using cleanup helpers
> >
> > include/linux/bitmap.h | 3 +++
> > kernel/irq/irq_sim.c | 30 ++++++++++++------------------
> > 2 files changed, 15 insertions(+), 18 deletions(-)
> >
> > --
> > 2.40.1
> >
>
> It's been two weeks since this submission and ~2.5 months since the
> first one so I guess, a gentle ping is in order. This is not a very
> controversial series - can this be applied?
Hi Bartosz,
I'm the first in the list for this series, but really only 1st patch
is related to bitmaps, and I already acked it. If you prefer that, I
can pull it in the bitmap tree.
Thanks,
Yury
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates
2023-11-29 19:57 ` Yury Norov
@ 2023-11-29 20:50 ` Bartosz Golaszewski
0 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2023-11-29 20:50 UTC (permalink / raw)
To: Yury Norov
Cc: Andy Shevchenko, Rasmus Villemoes, Thomas Gleixner, Marc Zyngier,
Peter Zijlstra, linux-kernel, Bartosz Golaszewski
On Wed, Nov 29, 2023 at 8:59 PM Yury Norov <yury.norov@gmail.com> wrote:
>
> On Wed, Nov 29, 2023 at 10:18:15AM +0100, Bartosz Golaszewski wrote:
> > On Wed, Nov 15, 2023 at 5:59 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > >
> > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > >
> > > Here are a couple of updates to the interrupt simulator. Two are minor:
> > > remove an unused field and reorder includes for readability. The third
> > > one simplifies the error paths by using new cleanup macros. To that end
> > > we also add a cleanup definition for dynamic bitmaps.
> > >
> > > Resending rebased on top of v6.7-rc1 and with tags collected.
> > >
> > > v1 -> v2:
> > > - add a NULL-pointer check to the bitmap cleanup macro as advised by
> > > Peter Zijlstra
> > > - initialize managed pointers when declaring them to create a clear pairing
> > > between the type and the cleanup action
> > >
> > > Bartosz Golaszewski (4):
> > > bitmap: define a cleanup function for bitmaps
> > > genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx
> > > genirq/irq_sim: order headers alphabetically
> > > genirq/irq_sim: shrink code by using cleanup helpers
> > >
> > > include/linux/bitmap.h | 3 +++
> > > kernel/irq/irq_sim.c | 30 ++++++++++++------------------
> > > 2 files changed, 15 insertions(+), 18 deletions(-)
> > >
> > > --
> > > 2.40.1
> > >
> >
> > It's been two weeks since this submission and ~2.5 months since the
> > first one so I guess, a gentle ping is in order. This is not a very
> > controversial series - can this be applied?
>
> Hi Bartosz,
>
> I'm the first in the list for this series, but really only 1st patch
> is related to bitmaps, and I already acked it. If you prefer that, I
> can pull it in the bitmap tree.
>
> Thanks,
> Yury
If there's a risk it will conflict then you can apply it and provide
Thomas with an immutable branch against the irq tree, otherwise I
think Thomas can pick up all the patches.
Bartosz
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates
2023-11-29 9:18 ` Bartosz Golaszewski
2023-11-29 19:57 ` Yury Norov
@ 2023-12-04 8:47 ` Bartosz Golaszewski
2023-12-11 9:14 ` Bartosz Golaszewski
1 sibling, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2023-12-04 8:47 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Thomas Gleixner,
Marc Zyngier, Peter Zijlstra
Cc: linux-kernel, Bartosz Golaszewski
On Wed, Nov 29, 2023 at 10:18 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Wed, Nov 15, 2023 at 5:59 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > Here are a couple of updates to the interrupt simulator. Two are minor:
> > remove an unused field and reorder includes for readability. The third
> > one simplifies the error paths by using new cleanup macros. To that end
> > we also add a cleanup definition for dynamic bitmaps.
> >
> > Resending rebased on top of v6.7-rc1 and with tags collected.
> >
> > v1 -> v2:
> > - add a NULL-pointer check to the bitmap cleanup macro as advised by
> > Peter Zijlstra
> > - initialize managed pointers when declaring them to create a clear pairing
> > between the type and the cleanup action
> >
> > Bartosz Golaszewski (4):
> > bitmap: define a cleanup function for bitmaps
> > genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx
> > genirq/irq_sim: order headers alphabetically
> > genirq/irq_sim: shrink code by using cleanup helpers
> >
> > include/linux/bitmap.h | 3 +++
> > kernel/irq/irq_sim.c | 30 ++++++++++++------------------
> > 2 files changed, 15 insertions(+), 18 deletions(-)
> >
> > --
> > 2.40.1
> >
>
> It's been two weeks since this submission and ~2.5 months since the
> first one so I guess, a gentle ping is in order. This is not a very
> controversial series - can this be applied?
>
> Bart
Another ping...
Bartosz
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates
2023-12-04 8:47 ` Bartosz Golaszewski
@ 2023-12-11 9:14 ` Bartosz Golaszewski
2023-12-19 20:17 ` Bartosz Golaszewski
0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2023-12-11 9:14 UTC (permalink / raw)
To: Thomas Gleixner
Cc: linux-kernel, Bartosz Golaszewski, Yury Norov, Andy Shevchenko,
Marc Zyngier, Peter Zijlstra, Rasmus Villemoes
On Mon, Dec 4, 2023 at 9:47 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Wed, Nov 29, 2023 at 10:18 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > On Wed, Nov 15, 2023 at 5:59 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > >
> > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > >
> > > Here are a couple of updates to the interrupt simulator. Two are minor:
> > > remove an unused field and reorder includes for readability. The third
> > > one simplifies the error paths by using new cleanup macros. To that end
> > > we also add a cleanup definition for dynamic bitmaps.
> > >
> > > Resending rebased on top of v6.7-rc1 and with tags collected.
> > >
> > > v1 -> v2:
> > > - add a NULL-pointer check to the bitmap cleanup macro as advised by
> > > Peter Zijlstra
> > > - initialize managed pointers when declaring them to create a clear pairing
> > > between the type and the cleanup action
> > >
> > > Bartosz Golaszewski (4):
> > > bitmap: define a cleanup function for bitmaps
> > > genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx
> > > genirq/irq_sim: order headers alphabetically
> > > genirq/irq_sim: shrink code by using cleanup helpers
> > >
> > > include/linux/bitmap.h | 3 +++
> > > kernel/irq/irq_sim.c | 30 ++++++++++++------------------
> > > 2 files changed, 15 insertions(+), 18 deletions(-)
> > >
> > > --
> > > 2.40.1
> > >
> >
> > It's been two weeks since this submission and ~2.5 months since the
> > first one so I guess, a gentle ping is in order. This is not a very
> > controversial series - can this be applied?
> >
> > Bart
>
> Another ping...
>
> Bartosz
Thomas,
Is there any formal reason why this cannot be processed?
Bartosz
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates
2023-12-11 9:14 ` Bartosz Golaszewski
@ 2023-12-19 20:17 ` Bartosz Golaszewski
2023-12-20 14:06 ` Andy Shevchenko
0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2023-12-19 20:17 UTC (permalink / raw)
To: Thomas Gleixner
Cc: linux-kernel, Bartosz Golaszewski, Yury Norov, Andy Shevchenko,
Marc Zyngier, Peter Zijlstra, Rasmus Villemoes
On Mon, Dec 11, 2023 at 10:14 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Mon, Dec 4, 2023 at 9:47 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > On Wed, Nov 29, 2023 at 10:18 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > >
> > > On Wed, Nov 15, 2023 at 5:59 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > > >
> > > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > > >
> > > > Here are a couple of updates to the interrupt simulator. Two are minor:
> > > > remove an unused field and reorder includes for readability. The third
> > > > one simplifies the error paths by using new cleanup macros. To that end
> > > > we also add a cleanup definition for dynamic bitmaps.
> > > >
> > > > Resending rebased on top of v6.7-rc1 and with tags collected.
> > > >
> > > > v1 -> v2:
> > > > - add a NULL-pointer check to the bitmap cleanup macro as advised by
> > > > Peter Zijlstra
> > > > - initialize managed pointers when declaring them to create a clear pairing
> > > > between the type and the cleanup action
> > > >
> > > > Bartosz Golaszewski (4):
> > > > bitmap: define a cleanup function for bitmaps
> > > > genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx
> > > > genirq/irq_sim: order headers alphabetically
> > > > genirq/irq_sim: shrink code by using cleanup helpers
> > > >
> > > > include/linux/bitmap.h | 3 +++
> > > > kernel/irq/irq_sim.c | 30 ++++++++++++------------------
> > > > 2 files changed, 15 insertions(+), 18 deletions(-)
> > > >
> > > > --
> > > > 2.40.1
> > > >
> > >
> > > It's been two weeks since this submission and ~2.5 months since the
> > > first one so I guess, a gentle ping is in order. This is not a very
> > > controversial series - can this be applied?
> > >
> > > Bart
> >
> > Another ping...
> >
> > Bartosz
>
> Thomas,
>
> Is there any formal reason why this cannot be processed?
>
> Bartosz
Ping.
Bartosz
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates
2023-12-19 20:17 ` Bartosz Golaszewski
@ 2023-12-20 14:06 ` Andy Shevchenko
0 siblings, 0 replies; 22+ messages in thread
From: Andy Shevchenko @ 2023-12-20 14:06 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Thomas Gleixner, linux-kernel, Bartosz Golaszewski, Yury Norov,
Marc Zyngier, Peter Zijlstra, Rasmus Villemoes
On Tue, Dec 19, 2023 at 09:17:38PM +0100, Bartosz Golaszewski wrote:
> On Mon, Dec 11, 2023 at 10:14 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > On Mon, Dec 4, 2023 at 9:47 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > > On Wed, Nov 29, 2023 at 10:18 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > > > On Wed, Nov 15, 2023 at 5:59 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
...
> > > > It's been two weeks since this submission and ~2.5 months since the
> > > > first one so I guess, a gentle ping is in order. This is not a very
> > > > controversial series - can this be applied?
> > >
> > > Another ping...
> >
> > Is there any formal reason why this cannot be processed?
>
> Ping.
Instead you can now just say that you are going to apply this via your tree,
if there won't be objections, e.g., within a week (or two as it's a holiday
season).
In the PR to Linus you can explain why it's taken like this.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2024-01-29 10:37 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-22 12:42 [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 1/4] bitmap: define a cleanup function for bitmaps Bartosz Golaszewski
2024-01-26 12:53 ` [tip: irq/core] bitmap: Define " tip-bot2 for Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 2/4] genirq/irq_sim: remove unused field from struct irq_sim_irq_ctx Bartosz Golaszewski
2024-01-26 12:53 ` [tip: irq/core] genirq/irq_sim: Remove " tip-bot2 for Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 3/4] genirq/irq_sim: order headers alphabetically Bartosz Golaszewski
2024-01-26 12:53 ` [tip: irq/core] genirq/irq_sim: Order " tip-bot2 for Bartosz Golaszewski
2024-01-22 12:42 ` [RESEND PATCH v2 4/4] genirq/irq_sim: shrink code by using cleanup helpers Bartosz Golaszewski
2024-01-26 12:53 ` [tip: irq/core] genirq/irq_sim: Shrink " tip-bot2 for Bartosz Golaszewski
2024-01-26 21:05 ` Nathan Chancellor
2024-01-26 22:15 ` Bartosz Golaszewski
2024-01-29 10:13 ` Ingo Molnar
2024-01-29 10:37 ` Bartosz Golaszewski
2024-01-29 10:16 ` [tip: irq/core] genirq/irq_sim: Shrink code by using <linux/cleanup.h> helpers tip-bot2 for Bartosz Golaszewski
-- strict thread matches above, loose matches on Subject: below --
2023-11-15 16:59 [RESEND PATCH v2 0/4] genirq/irq_sim: misc updates Bartosz Golaszewski
2023-11-29 9:18 ` Bartosz Golaszewski
2023-11-29 19:57 ` Yury Norov
2023-11-29 20:50 ` Bartosz Golaszewski
2023-12-04 8:47 ` Bartosz Golaszewski
2023-12-11 9:14 ` Bartosz Golaszewski
2023-12-19 20:17 ` Bartosz Golaszewski
2023-12-20 14:06 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.