From: brgl@bgdev.pl (Bartosz Golaszewski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/11] platform: use a dedicated list_head for early devices
Date: Tue, 24 Apr 2018 19:30:45 +0200 [thread overview]
Message-ID: <20180424173051.15099-6-brgl@bgdev.pl> (raw)
In-Reply-To: <20180424173051.15099-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The current implementation of early platform device support uses the
devres list head in struct device. This causes problems when adding
support for device tree based early devices. Use a dedicated list_head
which is included in struct device conditionally in order to avoid
adding bloat for all architectures.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
drivers/base/platform.c | 23 +++++++++++------------
include/linux/device.h | 4 ++++
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index af440d703f0b..90526acdcb84 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1264,12 +1264,10 @@ void __init early_platform_add_devices(struct platform_device **devs, int num)
for (i = 0; i < num; i++) {
dev = &devs[i]->dev;
- if (!dev->devres_head.next) {
- pm_runtime_early_init(dev);
- INIT_LIST_HEAD(&dev->devres_head);
- list_add_tail(&dev->devres_head,
- &early_platform_device_list);
- }
+ pm_runtime_early_init(dev);
+ INIT_LIST_HEAD(&dev->early_dev_head);
+ list_add_tail(&dev->early_dev_head,
+ &early_platform_device_list);
}
}
@@ -1310,7 +1308,7 @@ early_platform_match(struct early_platform_driver *epdrv, int id)
{
struct platform_device *pd;
- list_for_each_entry(pd, &early_platform_device_list, dev.devres_head)
+ list_for_each_entry(pd, &early_platform_device_list, dev.early_dev_head)
if (platform_match(&pd->dev, &epdrv->pdrv->driver))
if (pd->id == id)
return pd;
@@ -1328,7 +1326,7 @@ static int __init early_platform_left(struct early_platform_driver *epdrv,
{
struct platform_device *pd;
- list_for_each_entry(pd, &early_platform_device_list, dev.devres_head)
+ list_for_each_entry(pd, &early_platform_device_list, dev.early_dev_head)
if (platform_match(&pd->dev, &epdrv->pdrv->driver))
if (pd->id >= id)
return 1;
@@ -1465,11 +1463,12 @@ void __init early_platform_cleanup(void)
{
struct platform_device *pd, *pd2;
- /* clean up the devres list used to chain devices */
+ /* clean up the list used to chain devices */
list_for_each_entry_safe(pd, pd2, &early_platform_device_list,
- dev.devres_head) {
- list_del(&pd->dev.devres_head);
- memset(&pd->dev.devres_head, 0, sizeof(pd->dev.devres_head));
+ dev.early_dev_head) {
+ list_del(&pd->dev.early_dev_head);
+ memset(&pd->dev.early_dev_head, 0,
+ sizeof(pd->dev.early_dev_head));
}
}
diff --git a/include/linux/device.h b/include/linux/device.h
index 0059b99e1f25..4fadba0f9a35 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -979,6 +979,10 @@ struct device {
spinlock_t devres_lock;
struct list_head devres_head;
+#ifdef CONFIG_EARLY_PLATFORM_DEVICES
+ struct list_head early_dev_head;
+#endif
+
struct klist_node knode_class;
struct class *class;
const struct attribute_group **groups; /* optional groups */
--
2.17.0
next prev parent reply other threads:[~2018-04-24 17:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 17:30 [PATCH 00/11] platform: device tree support for early platform drivers Bartosz Golaszewski
2018-04-24 17:30 ` [PATCH 01/11] platform: early: provide early_platform_add_device() Bartosz Golaszewski
2018-04-24 17:30 ` [PATCH 02/11] platform: provide early_platform_driver_register_probe_all() Bartosz Golaszewski
2018-04-24 17:30 ` [PATCH 03/11] platform: make support for early platform devices conditional Bartosz Golaszewski
2018-04-24 19:31 ` Randy Dunlap
2018-04-25 14:02 ` Rich Felker
2018-04-24 17:30 ` [PATCH 04/11] of: platform: use pdev as name for vars of type struct platform_device Bartosz Golaszewski
2018-04-24 17:30 ` Bartosz Golaszewski [this message]
2018-04-26 4:27 ` [PATCH 05/11] platform: use a dedicated list_head for early devices kbuild test robot
2018-04-24 17:30 ` [PATCH 06/11] of: provide for_each_compatible_child_node() Bartosz Golaszewski
2018-04-24 17:30 ` [PATCH 07/11] dt-bindings: add bindings for early devices Bartosz Golaszewski
2018-04-24 17:30 ` [PATCH 08/11] of: platform: provide of_early_platform_populate() Bartosz Golaszewski
2018-04-24 17:30 ` [PATCH 09/11] platform: provide early_platform_driver() Bartosz Golaszewski
2018-04-24 17:30 ` [PATCH 10/11] of: platform: provide of_early_platform_probe() Bartosz Golaszewski
2018-04-26 3:46 ` kbuild test robot
2018-04-24 17:30 ` [PATCH 11/11] misc: implement a dummy early platform driver Bartosz Golaszewski
2018-04-24 17:55 ` [PATCH 00/11] platform: device tree support for early platform drivers Mark Rutland
2018-04-24 17:59 ` Rich Felker
2018-04-24 17:57 ` Rich Felker
2018-04-25 9:33 ` Bartosz Golaszewski
2018-04-24 18:19 ` Robin Murphy
2018-04-24 19:39 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180424173051.15099-6-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).