* [PATCH v2] core: devres: optionally build devres into the SPL
@ 2022-02-28 20:33 Angus Ainslie
2022-03-01 14:58 ` Simon Glass
0 siblings, 1 reply; 6+ messages in thread
From: Angus Ainslie @ 2022-02-28 20:33 UTC (permalink / raw)
To: u-boot; +Cc: sjg, kernel, uboot-imx, Angus Ainslie
Add a CONFIG_SPL_DEVRES option
Signed-off-by: Angus Ainslie <angus@akkea.ca>
---
Changes since v1:
Instead of gaurding the source add an SPL_DEVRES option
drivers/core/Kconfig | 13 +++++++++++++
drivers/core/Makefile | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index 8f7703c8b5..7e666708fe 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -206,6 +206,19 @@ config DEVRES
non-managed variants. For example, devres_alloc() to kzalloc(),
devm_kmalloc() to kmalloc(), etc.
+config SPL_DEVRES
+ bool "Managed device resources in the SPL"
+ depends on DM
+ help
+ This option enables the Managed device resources core support.
+ Device resources managed by the devres framework are automatically
+ released whether initialization fails half-way or the device gets
+ detached.
+
+ If this option is disabled, devres functions fall back to
+ non-managed variants. For example, devres_alloc() to kzalloc(),
+ devm_kmalloc() to kmalloc(), etc.
+
config DEBUG_DEVRES
bool "Managed device resources debugging functions"
depends on DEVRES
diff --git a/drivers/core/Makefile b/drivers/core/Makefile
index 5edd4e4135..0cbc3ab217 100644
--- a/drivers/core/Makefile
+++ b/drivers/core/Makefile
@@ -4,7 +4,7 @@
obj-y += device.o fdtaddr.o lists.o root.o uclass.o util.o
obj-$(CONFIG_$(SPL_TPL_)ACPIGEN) += acpi.o
-obj-$(CONFIG_DEVRES) += devres.o
+obj-$(CONFIG_$(SPL_TPL_)DEVRES) += devres.o
obj-$(CONFIG_$(SPL_)DM_DEVICE_REMOVE) += device-remove.o
obj-$(CONFIG_$(SPL_)SIMPLE_BUS) += simple-bus.o
obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] core: devres: optionally build devres into the SPL
2022-02-28 20:33 [PATCH v2] core: devres: optionally build devres into the SPL Angus Ainslie
@ 2022-03-01 14:58 ` Simon Glass
2022-03-18 22:41 ` Simon Glass
0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2022-03-01 14:58 UTC (permalink / raw)
To: Angus Ainslie; +Cc: U-Boot Mailing List, kernel, dl-uboot-imx
On Mon, 28 Feb 2022 at 13:33, Angus Ainslie <angus@akkea.ca> wrote:
>
> Add a CONFIG_SPL_DEVRES option
>
> Signed-off-by: Angus Ainslie <angus@akkea.ca>
> ---
>
> Changes since v1:
>
> Instead of gaurding the source add an SPL_DEVRES option
>
> drivers/core/Kconfig | 13 +++++++++++++
> drivers/core/Makefile | 2 +-
> 2 files changed, 14 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] core: devres: optionally build devres into the SPL
2022-03-01 14:58 ` Simon Glass
@ 2022-03-18 22:41 ` Simon Glass
2022-03-19 14:15 ` Angus Ainslie
0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2022-03-18 22:41 UTC (permalink / raw)
To: Angus Ainslie; +Cc: U-Boot Mailing List, kernel, dl-uboot-imx
Hi Angus,
On Tue, 1 Mar 2022 at 07:58, Simon Glass <sjg@chromium.org> wrote:
>
> On Mon, 28 Feb 2022 at 13:33, Angus Ainslie <angus@akkea.ca> wrote:
> >
> > Add a CONFIG_SPL_DEVRES option
> >
> > Signed-off-by: Angus Ainslie <angus@akkea.ca>
> > ---
> >
> > Changes since v1:
> >
> > Instead of gaurding the source add an SPL_DEVRES option
> >
> > drivers/core/Kconfig | 13 +++++++++++++
> > drivers/core/Makefile | 2 +-
> > 2 files changed, 14 insertions(+), 1 deletion(-)
Unfortunately this break the tests, e.g. building sandbox_spl - can
you please take a look?
sandbox_spl: +make O=build-sandbox_spl -s sandbox_spl_defconfig
+make O=build-sandbox_spl -s -j4
/usr/bin/ld: /tmp/ccsYY64W.ltrans0.ltrans.o: in function `device_unbind':
build-sandbox_spl/spl/../../drivers/core/device-remove.c:120:
undefined reference to `devres_release_all'
/usr/bin/ld: /tmp/ccsYY64W.ltrans0.ltrans.o: in function `device_free':
build-sandbox_spl/spl/../../drivers/core/device-remove.c:157:
undefined reference to `devres_release_probe'
collect2: error: ld returned 1 exit status
make[3]: *** [../scripts/Makefile.spl:509: spl/u-boot-spl] Error 1
make[2]: *** [Makefile:2094: spl/u-boot-spl] Error 2
make[1]: *** [Makefile:177: sub-make] Error 2
Exit code: 2
Regards,
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] core: devres: optionally build devres into the SPL
2022-03-18 22:41 ` Simon Glass
@ 2022-03-19 14:15 ` Angus Ainslie
2022-03-19 15:18 ` Angus Ainslie
0 siblings, 1 reply; 6+ messages in thread
From: Angus Ainslie @ 2022-03-19 14:15 UTC (permalink / raw)
To: Simon Glass; +Cc: U-Boot Mailing List, kernel, dl-uboot-imx
Hi Simon,
On 2022-03-18 15:41, Simon Glass wrote:
> Hi Angus,
>
> On Tue, 1 Mar 2022 at 07:58, Simon Glass <sjg@chromium.org> wrote:
>>
>> On Mon, 28 Feb 2022 at 13:33, Angus Ainslie <angus@akkea.ca> wrote:
>> >
>> > Add a CONFIG_SPL_DEVRES option
>> >
>> > Signed-off-by: Angus Ainslie <angus@akkea.ca>
>> > ---
>> >
>> > Changes since v1:
>> >
>> > Instead of gaurding the source add an SPL_DEVRES option
>> >
>> > drivers/core/Kconfig | 13 +++++++++++++
>> > drivers/core/Makefile | 2 +-
>> > 2 files changed, 14 insertions(+), 1 deletion(-)
>
> Unfortunately this break the tests, e.g. building sandbox_spl - can
> you please take a look?
>
> sandbox_spl: +make O=build-sandbox_spl -s sandbox_spl_defconfig
> +make O=build-sandbox_spl -s -j4
> /usr/bin/ld: /tmp/ccsYY64W.ltrans0.ltrans.o: in function
> `device_unbind':
> build-sandbox_spl/spl/../../drivers/core/device-remove.c:120:
> undefined reference to `devres_release_all'
> /usr/bin/ld: /tmp/ccsYY64W.ltrans0.ltrans.o: in function `device_free':
> build-sandbox_spl/spl/../../drivers/core/device-remove.c:157:
> undefined reference to `devres_release_probe'
> collect2: error: ld returned 1 exit status
> make[3]: *** [../scripts/Makefile.spl:509: spl/u-boot-spl] Error 1
> make[2]: *** [Makefile:2094: spl/u-boot-spl] Error 2
> make[1]: *** [Makefile:177: sub-make] Error 2
> Exit code: 2
>
So the problem here is that CONFIG_DM_DEVICE_REMOVE can be defined
without CONFIG_DEVRES being defined.
Is there a way to make DM_DEVICE_REMOVE dependant on DEVRES or do I need
to add "&& CONFIG_IS_ENABLED(DEVRES)" everywhere that I find
"CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)" ?
Thanks
Angus
> Regards,
> Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] core: devres: optionally build devres into the SPL
2022-03-19 14:15 ` Angus Ainslie
@ 2022-03-19 15:18 ` Angus Ainslie
2022-03-28 6:35 ` Simon Glass
0 siblings, 1 reply; 6+ messages in thread
From: Angus Ainslie @ 2022-03-19 15:18 UTC (permalink / raw)
To: Simon Glass; +Cc: U-Boot Mailing List, kernel, dl-uboot-imx
On 2022-03-19 07:15, Angus Ainslie wrote:
> Hi Simon,
>
> On 2022-03-18 15:41, Simon Glass wrote:
>> Hi Angus,
>>
>> On Tue, 1 Mar 2022 at 07:58, Simon Glass <sjg@chromium.org> wrote:
>>>
>>> On Mon, 28 Feb 2022 at 13:33, Angus Ainslie <angus@akkea.ca> wrote:
>>> >
>>> > Add a CONFIG_SPL_DEVRES option
>>> >
>>> > Signed-off-by: Angus Ainslie <angus@akkea.ca>
>>> > ---
>>> >
>>> > Changes since v1:
>>> >
>>> > Instead of gaurding the source add an SPL_DEVRES option
>>> >
>>> > drivers/core/Kconfig | 13 +++++++++++++
>>> > drivers/core/Makefile | 2 +-
>>> > 2 files changed, 14 insertions(+), 1 deletion(-)
>>
>> Unfortunately this break the tests, e.g. building sandbox_spl - can
>> you please take a look?
>>
>> sandbox_spl: +make O=build-sandbox_spl -s sandbox_spl_defconfig
>> +make O=build-sandbox_spl -s -j4
>> /usr/bin/ld: /tmp/ccsYY64W.ltrans0.ltrans.o: in function
>> `device_unbind':
>> build-sandbox_spl/spl/../../drivers/core/device-remove.c:120:
>> undefined reference to `devres_release_all'
>> /usr/bin/ld: /tmp/ccsYY64W.ltrans0.ltrans.o: in function
>> `device_free':
>> build-sandbox_spl/spl/../../drivers/core/device-remove.c:157:
>> undefined reference to `devres_release_probe'
>> collect2: error: ld returned 1 exit status
>> make[3]: *** [../scripts/Makefile.spl:509: spl/u-boot-spl] Error 1
>> make[2]: *** [Makefile:2094: spl/u-boot-spl] Error 2
>> make[1]: *** [Makefile:177: sub-make] Error 2
>> Exit code: 2
>>
>
> So the problem here is that CONFIG_DM_DEVICE_REMOVE can be defined
> without CONFIG_DEVRES being defined.
>
> Is there a way to make DM_DEVICE_REMOVE dependant on DEVRES or do I
> need to add "&& CONFIG_IS_ENABLED(DEVRES)" everywhere that I find
> "CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)" ?
>
The test failure can be "fixed" using this
diff --git a/configs/sandbox_noinst_defconfig
b/configs/sandbox_noinst_defconfig
index ec912cf0ec8..69c97921744 100644
--- a/configs/sandbox_noinst_defconfig
+++ b/configs/sandbox_noinst_defconfig
@@ -105,6 +105,7 @@ CONFIG_SYSCON=y
CONFIG_SPL_SYSCON=y
CONFIG_DEVRES=y
CONFIG_DEBUG_DEVRES=y
+CONFIG_SPL_DEVRES=y
# CONFIG_SPL_SIMPLE_BUS is not set
CONFIG_ADC=y
CONFIG_ADC_SANDBOX=y
diff --git a/configs/sandbox_spl_defconfig
b/configs/sandbox_spl_defconfig
index 1687ccf4530..2fcda46dfd1 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -107,6 +107,7 @@ CONFIG_SYSCON=y
CONFIG_SPL_SYSCON=y
CONFIG_DEVRES=y
CONFIG_DEBUG_DEVRES=y
+CONFIG_SPL_DEVRES=y
# CONFIG_SPL_SIMPLE_BUS is not set
CONFIG_ADC=y
CONFIG_ADC_SANDBOX=y
But is that the right way based on the questions above ?
> Thanks
> Angus
>
>> Regards,
>> Simon
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] core: devres: optionally build devres into the SPL
2022-03-19 15:18 ` Angus Ainslie
@ 2022-03-28 6:35 ` Simon Glass
0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2022-03-28 6:35 UTC (permalink / raw)
To: Angus Ainslie; +Cc: U-Boot Mailing List, kernel, dl-uboot-imx
Hi Angus,
On Sat, 19 Mar 2022 at 09:18, Angus Ainslie <angus@akkea.ca> wrote:
>
> On 2022-03-19 07:15, Angus Ainslie wrote:
> > Hi Simon,
> >
> > On 2022-03-18 15:41, Simon Glass wrote:
> >> Hi Angus,
> >>
> >> On Tue, 1 Mar 2022 at 07:58, Simon Glass <sjg@chromium.org> wrote:
> >>>
> >>> On Mon, 28 Feb 2022 at 13:33, Angus Ainslie <angus@akkea.ca> wrote:
> >>> >
> >>> > Add a CONFIG_SPL_DEVRES option
> >>> >
> >>> > Signed-off-by: Angus Ainslie <angus@akkea.ca>
> >>> > ---
> >>> >
> >>> > Changes since v1:
> >>> >
> >>> > Instead of gaurding the source add an SPL_DEVRES option
> >>> >
> >>> > drivers/core/Kconfig | 13 +++++++++++++
> >>> > drivers/core/Makefile | 2 +-
> >>> > 2 files changed, 14 insertions(+), 1 deletion(-)
> >>
> >> Unfortunately this break the tests, e.g. building sandbox_spl - can
> >> you please take a look?
> >>
> >> sandbox_spl: +make O=build-sandbox_spl -s sandbox_spl_defconfig
> >> +make O=build-sandbox_spl -s -j4
> >> /usr/bin/ld: /tmp/ccsYY64W.ltrans0.ltrans.o: in function
> >> `device_unbind':
> >> build-sandbox_spl/spl/../../drivers/core/device-remove.c:120:
> >> undefined reference to `devres_release_all'
> >> /usr/bin/ld: /tmp/ccsYY64W.ltrans0.ltrans.o: in function
> >> `device_free':
> >> build-sandbox_spl/spl/../../drivers/core/device-remove.c:157:
> >> undefined reference to `devres_release_probe'
> >> collect2: error: ld returned 1 exit status
> >> make[3]: *** [../scripts/Makefile.spl:509: spl/u-boot-spl] Error 1
> >> make[2]: *** [Makefile:2094: spl/u-boot-spl] Error 2
> >> make[1]: *** [Makefile:177: sub-make] Error 2
> >> Exit code: 2
> >>
> >
> > So the problem here is that CONFIG_DM_DEVICE_REMOVE can be defined
> > without CONFIG_DEVRES being defined.
> >
> > Is there a way to make DM_DEVICE_REMOVE dependant on DEVRES or do I
> > need to add "&& CONFIG_IS_ENABLED(DEVRES)" everywhere that I find
> > "CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)" ?
> >
>
> The test failure can be "fixed" using this
>
> diff --git a/configs/sandbox_noinst_defconfig
> b/configs/sandbox_noinst_defconfig
> index ec912cf0ec8..69c97921744 100644
> --- a/configs/sandbox_noinst_defconfig
> +++ b/configs/sandbox_noinst_defconfig
> @@ -105,6 +105,7 @@ CONFIG_SYSCON=y
> CONFIG_SPL_SYSCON=y
> CONFIG_DEVRES=y
> CONFIG_DEBUG_DEVRES=y
> +CONFIG_SPL_DEVRES=y
> # CONFIG_SPL_SIMPLE_BUS is not set
> CONFIG_ADC=y
> CONFIG_ADC_SANDBOX=y
> diff --git a/configs/sandbox_spl_defconfig
> b/configs/sandbox_spl_defconfig
> index 1687ccf4530..2fcda46dfd1 100644
> --- a/configs/sandbox_spl_defconfig
> +++ b/configs/sandbox_spl_defconfig
> @@ -107,6 +107,7 @@ CONFIG_SYSCON=y
> CONFIG_SPL_SYSCON=y
> CONFIG_DEVRES=y
> CONFIG_DEBUG_DEVRES=y
> +CONFIG_SPL_DEVRES=y
> # CONFIG_SPL_SIMPLE_BUS is not set
> CONFIG_ADC=y
> CONFIG_ADC_SANDBOX=y
>
> But is that the right way based on the questions above ?
I just sent a patch to update DEVRES to only be enabled on SPL. I
think DM_DEVICE_REMOVE should not depend on DEVRES., but perhaps the
other way around would make sense?
Regards,
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-28 6:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 20:33 [PATCH v2] core: devres: optionally build devres into the SPL Angus Ainslie
2022-03-01 14:58 ` Simon Glass
2022-03-18 22:41 ` Simon Glass
2022-03-19 14:15 ` Angus Ainslie
2022-03-19 15:18 ` Angus Ainslie
2022-03-28 6:35 ` Simon Glass
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.