* [PATCH] core: devres: don't use devres code when CONFIG_DEVRES is not defined
@ 2022-02-02 23:16 Angus Ainslie
2022-02-19 22:12 ` Simon Glass
0 siblings, 1 reply; 4+ messages in thread
From: Angus Ainslie @ 2022-02-02 23:16 UTC (permalink / raw)
To: u-boot; +Cc: Simon Glass, kernel, Angus Ainslie
Put guards around the devres code so that it isn't compiled during the SPL.
Signed-off-by: Angus Ainslie <angus@akkea.ca>
---
drivers/core/devres.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/core/devres.c b/drivers/core/devres.c
index 313ddc7089..92a237c64c 100644
--- a/drivers/core/devres.c
+++ b/drivers/core/devres.c
@@ -91,6 +91,7 @@ void *_devres_alloc(dr_release_t release, size_t size, gfp_t gfp)
return dr->data;
}
+#if CONFIG_DEVRES
void devres_free(void *res)
{
if (res) {
@@ -257,7 +258,7 @@ void devres_get_stats(const struct udevice *dev, struct devres_stats *stats)
}
}
-#endif
+#endif /* CONFIG_DEBUG_DEVRES */
/*
* Managed kmalloc/kfree
@@ -292,3 +293,4 @@ void devm_kfree(struct udevice *dev, void *p)
rc = devres_destroy(dev, devm_kmalloc_release, devm_kmalloc_match, p);
assert_noisy(!rc);
}
+#endif /* CONFIG_DEVRES */
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] core: devres: don't use devres code when CONFIG_DEVRES is not defined
2022-02-02 23:16 [PATCH] core: devres: don't use devres code when CONFIG_DEVRES is not defined Angus Ainslie
@ 2022-02-19 22:12 ` Simon Glass
2022-02-21 12:50 ` Angus Ainslie
0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2022-02-19 22:12 UTC (permalink / raw)
To: Angus Ainslie; +Cc: U-Boot Mailing List, kernel
On Wed, 2 Feb 2022 at 16:16, Angus Ainslie <angus@akkea.ca> wrote:
>
> Put guards around the devres code so that it isn't compiled during the SPL.
>
> Signed-off-by: Angus Ainslie <angus@akkea.ca>
> ---
> drivers/core/devres.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
I think the correct fix here is to change the Makefile rule for this file to use
CONFIG_$(SPL_)DEVRES
instead of
CONFIG_DEVRES
Can you try it?
Regards,
Simon
[..]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] core: devres: don't use devres code when CONFIG_DEVRES is not defined
2022-02-19 22:12 ` Simon Glass
@ 2022-02-21 12:50 ` Angus Ainslie
2022-02-26 18:37 ` Simon Glass
0 siblings, 1 reply; 4+ messages in thread
From: Angus Ainslie @ 2022-02-21 12:50 UTC (permalink / raw)
To: Simon Glass; +Cc: U-Boot Mailing List, kernel
Hi Simon,
On 2022-02-19 14:12, Simon Glass wrote:
> On Wed, 2 Feb 2022 at 16:16, Angus Ainslie <angus@akkea.ca> wrote:
>>
>> Put guards around the devres code so that it isn't compiled during the
>> SPL.
>>
>> Signed-off-by: Angus Ainslie <angus@akkea.ca>
>> ---
>> drivers/core/devres.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> I think the correct fix here is to change the Makefile rule for this
> file to use
>
> CONFIG_$(SPL_)DEVRES
>
> instead of
>
> CONFIG_DEVRES
>
> Can you try it?
>
I think it will work that way and I did think about doing the patch that
way. My concern was that it might break some boards because they are
expecting DEVRES in the SPL.
I can rework the patch that way but not sure how I'd test which boards
needed the CONFIG_SPL_DEVRES defined.
Thanks
Angus
> Regards,
> Simon
> [..]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] core: devres: don't use devres code when CONFIG_DEVRES is not defined
2022-02-21 12:50 ` Angus Ainslie
@ 2022-02-26 18:37 ` Simon Glass
0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2022-02-26 18:37 UTC (permalink / raw)
To: Angus Ainslie; +Cc: U-Boot Mailing List, kernel
Hi Angus,
On Mon, 21 Feb 2022 at 05:50, Angus Ainslie <angus@akkea.ca> wrote:
>
> Hi Simon,
>
> On 2022-02-19 14:12, Simon Glass wrote:
> > On Wed, 2 Feb 2022 at 16:16, Angus Ainslie <angus@akkea.ca> wrote:
> >>
> >> Put guards around the devres code so that it isn't compiled during the
> >> SPL.
> >>
> >> Signed-off-by: Angus Ainslie <angus@akkea.ca>
> >> ---
> >> drivers/core/devres.c | 4 +++-
> >> 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > I think the correct fix here is to change the Makefile rule for this
> > file to use
> >
> > CONFIG_$(SPL_)DEVRES
> >
> > instead of
> >
> > CONFIG_DEVRES
> >
> > Can you try it?
> >
>
> I think it will work that way and I did think about doing the patch that
> way. My concern was that it might break some boards because they are
> expecting DEVRES in the SPL.
>
> I can rework the patch that way but not sure how I'd test which boards
> needed the CONFIG_SPL_DEVRES defined.
I very much doubt any are, but the maintainers can test them as
needed. After all, freeing memory is not normally supported in SPL,
except with full malloc().
Regards,
Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-26 18:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 23:16 [PATCH] core: devres: don't use devres code when CONFIG_DEVRES is not defined Angus Ainslie
2022-02-19 22:12 ` Simon Glass
2022-02-21 12:50 ` Angus Ainslie
2022-02-26 18:37 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).