mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2] pmdomain: fix collision in names when registering
@ 2025-12-16 10:47 Maud Spierings via B4 Relay
  2025-12-16 10:50 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Maud Spierings via B4 Relay @ 2025-12-16 10:47 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Maud Spierings

From: Maud Spierings <maudspierings@gocontroll.com>

After adding the imx8m-blk-ctrl driver errors started appearing about
the genpd device already being registered.

incorperate some extra device details in the device name so this
possible collision goes away.

Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
---
Changes in v2:
- Change virt_dev->id into DEVICE_ID_SINGLE to drop the trailing index
  number.
- Link to v1: https://lore.kernel.org/r/20251216-genpd_fix-v1-1-b4ca268d3b31@gocontroll.com
---

It wasn't just errors, it started crashing but that is a seperate issue.
It at least loads normally with this change
---
 drivers/base/power.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/power.c b/drivers/base/power.c
index c71389422a..cffd043627 100644
--- a/drivers/base/power.c
+++ b/drivers/base/power.c
@@ -506,11 +506,11 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,
 	if (!virt_dev)
 		return ERR_PTR(-ENOMEM);
 
-	dev_set_name(virt_dev, "genpd");
+	dev_set_name(virt_dev, "genpd:%u:%s", index, dev_name(dev));
 	virt_dev->bus = &genpd_bus_type;
 	virt_dev->parent = dev;
 	virt_dev->of_node = dev->of_node;
-	virt_dev->id = index;
+	virt_dev->id = DEVICE_ID_SINGLE;
 
 	ret = device_register(virt_dev);
 	if (ret) {

---
base-commit: 63898c48611dfe51409ff1f4e1c30de4b2737c48
change-id: 20251216-genpd_fix-0f1ed7d8cbb2

Best regards,
-- 
Maud Spierings <maudspierings@gocontroll.com>





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

* Re: [PATCH v2] pmdomain: fix collision in names when registering
  2025-12-16 10:47 [PATCH v2] pmdomain: fix collision in names when registering Maud Spierings via B4 Relay
@ 2025-12-16 10:50 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2025-12-16 10:50 UTC (permalink / raw)
  To: maudspierings, Sascha Hauer, BAREBOX

On 12/16/25 11:47 AM, Maud Spierings via B4 Relay wrote:
> From: Maud Spierings <maudspierings@gocontroll.com>
> 
> After adding the imx8m-blk-ctrl driver errors started appearing about
> the genpd device already being registered.
> 
> incorperate some extra device details in the device name so this
> possible collision goes away.
> 
> Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

@Sascha, I think this is a candidate for master as this can affect other
setups as well, when there are multiple power domain drivers (e.g. with
SCMI)

Thanks,
Ahmad

> ---
> Changes in v2:
> - Change virt_dev->id into DEVICE_ID_SINGLE to drop the trailing index
>   number.
> - Link to v1: https://lore.kernel.org/r/20251216-genpd_fix-v1-1-b4ca268d3b31@gocontroll.com
> ---
> 
> It wasn't just errors, it started crashing but that is a seperate issue.
> It at least loads normally with this change
> ---
>  drivers/base/power.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/power.c b/drivers/base/power.c
> index c71389422a..cffd043627 100644
> --- a/drivers/base/power.c
> +++ b/drivers/base/power.c
> @@ -506,11 +506,11 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,
>  	if (!virt_dev)
>  		return ERR_PTR(-ENOMEM);
>  
> -	dev_set_name(virt_dev, "genpd");
> +	dev_set_name(virt_dev, "genpd:%u:%s", index, dev_name(dev));
>  	virt_dev->bus = &genpd_bus_type;
>  	virt_dev->parent = dev;
>  	virt_dev->of_node = dev->of_node;
> -	virt_dev->id = index;
> +	virt_dev->id = DEVICE_ID_SINGLE;
>  
>  	ret = device_register(virt_dev);
>  	if (ret) {
> 
> ---
> base-commit: 63898c48611dfe51409ff1f4e1c30de4b2737c48
> change-id: 20251216-genpd_fix-0f1ed7d8cbb2
> 
> Best regards,

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-16 10:47 [PATCH v2] pmdomain: fix collision in names when registering Maud Spierings via B4 Relay
2025-12-16 10:50 ` Ahmad Fatoum

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