[U-Boot] watchdog: dm: Change uclass name to watchdog and enable DM_UC_FLAG_SEQ_ALIAS

Message ID 719059b5d684352df738249f8ad5fcab20f0381e.1531291555.git.michal.simek@xilinx.com
State New
Delegated to: Michal Simek
Headers show
Series
  • [U-Boot] watchdog: dm: Change uclass name to watchdog and enable DM_UC_FLAG_SEQ_ALIAS
Related show

Commit Message

Michal Simek July 11, 2018, 6:45 a.m.
uclass name is used by dev_read_alias_seq which return seq number when
aliases are used.

Code fragment:
168 int dev_read_alias_seq(struct udevice *dev, int *devnump)
169 {
170         ofnode node = dev_ofnode(dev);
171         const char *uc_name = dev->uclass->uc_drv->name;
172         int ret;
173
174         if (ofnode_is_np(node)) {
175                 ret = of_alias_get_id(ofnode_to_np(node), uc_name);

Also this patch enables DM_UC_FLAG_SEQ_ALIAS to be in sync with Linux
which is also using watchdog name for watchdog aliases.

drivers/watchdog/watchdog_core.c:215:
 ret = of_alias_get_id(wdd->parent->of_node, "watchdog");

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/watchdog/wdt-uclass.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Simon Glass July 11, 2018, 8:13 p.m. | #1
On 11 July 2018 at 00:45, Michal Simek <michal.simek@xilinx.com> wrote:
> uclass name is used by dev_read_alias_seq which return seq number when
> aliases are used.
>
> Code fragment:
> 168 int dev_read_alias_seq(struct udevice *dev, int *devnump)
> 169 {
> 170         ofnode node = dev_ofnode(dev);
> 171         const char *uc_name = dev->uclass->uc_drv->name;
> 172         int ret;
> 173
> 174         if (ofnode_is_np(node)) {
> 175                 ret = of_alias_get_id(ofnode_to_np(node), uc_name);
>
> Also this patch enables DM_UC_FLAG_SEQ_ALIAS to be in sync with Linux
> which is also using watchdog name for watchdog aliases.
>
> drivers/watchdog/watchdog_core.c:215:
>  ret = of_alias_get_id(wdd->parent->of_node, "watchdog");
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  drivers/watchdog/wdt-uclass.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Patch

diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 4a619f71fe91..f6f2fe3739d3 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -65,5 +65,6 @@  int wdt_expire_now(struct udevice *dev, ulong flags)
 
 UCLASS_DRIVER(wdt) = {
 	.id		= UCLASS_WDT,
-	.name		= "wdt",
+	.name		= "watchdog",
+	.flags		= DM_UC_FLAG_SEQ_ALIAS,
 };