public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: lukma@denx.de, peng.fan@nxp.com, jh80.chung@samsung.com,
	bmeng.cn@gmail.com, sr@denx.de, xypron.glpk@gmx.de,
	sjg@chromium.org, masami.hiramatsu@linaro.org,
	u-boot@lists.denx.de
Subject: Re: [PATCH v3 08/19] dm: add tag support
Date: Thu, 10 Mar 2022 09:02:29 +0900	[thread overview]
Message-ID: <20220310000229.GA53281@laputa> (raw)
In-Reply-To: <YiiSUAP6xIn2yJ0c@hades>

On Wed, Mar 09, 2022 at 01:41:04PM +0200, Ilias Apalodimas wrote:
> Hi Akashi-san,
> 
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> > ---
> >  drivers/core/Makefile             |   2 +-
> >  drivers/core/root.c               |   2 +
> >  drivers/core/tag.c                | 139 ++++++++++++++++++++++++++++++
> >  include/asm-generic/global_data.h |   4 +
> >  include/dm/tag.h                  | 110 +++++++++++++++++++++++
> >  5 files changed, 256 insertions(+), 1 deletion(-)
> >  create mode 100644 drivers/core/tag.c
> >  create mode 100644 include/dm/tag.h
> > 
> > diff --git a/drivers/core/Makefile b/drivers/core/Makefile
> > index 5edd4e413576..3742e7574525 100644
> > --- a/drivers/core/Makefile
> > +++ b/drivers/core/Makefile
> > @@ -2,7 +2,7 @@
> >  #
> >  # Copyright (c) 2013 Google, Inc
> >  
> > -obj-y	+= device.o fdtaddr.o lists.o root.o uclass.o util.o
> > +obj-y	+= device.o fdtaddr.o lists.o root.o uclass.o util.o tag.o
> >  obj-$(CONFIG_$(SPL_TPL_)ACPIGEN) += acpi.o
> >  obj-$(CONFIG_DEVRES) += devres.o
> >  obj-$(CONFIG_$(SPL_)DM_DEVICE_REMOVE)	+= device-remove.o
> > diff --git a/drivers/core/root.c b/drivers/core/root.c
> > index 8efb4256b27e..86b3884fc674 100644
> > --- a/drivers/core/root.c
> > +++ b/drivers/core/root.c
> > @@ -199,6 +199,8 @@ int dm_init(bool of_live)
> >  			return ret;
> >  	}
> >  
> > +	INIT_LIST_HEAD((struct list_head *)&gd->dmtag_list);
> > +
> >  	return 0;
> >  }
> >  
> > diff --git a/drivers/core/tag.c b/drivers/core/tag.c
> > new file mode 100644
> > index 000000000000..6829bcd8806c
> > --- /dev/null
> > +++ b/drivers/core/tag.c
> > @@ -0,0 +1,139 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (c) 2021 Linaro Limited
> > + *			Author: AKASHI Takahiro
> > + */
> > +
> > +#include <malloc.h>
> > +#include <asm/global_data.h>
> > +#include <dm/tag.h>
> > +#include <linux/err.h>
> > +#include <linux/list.h>
> > +#include <linux/types.h>
> > +
> > +struct udevice;
> > +
> > +DECLARE_GLOBAL_DATA_PTR;
> > +
> > +int dev_tag_set_ptr(struct udevice *dev, enum dm_tag_t tag, void *ptr)
> > +{
> > +	struct dmtag_node *node;
> > +
> > +	if (!dev || tag >= DM_TAG_COUNT)
> > +		return -EINVAL;
> > +
> > +	list_for_each_entry(node, &gd->dmtag_list, sibling) {
> > +		if (node->dev == dev && node->tag == tag)
> > +			return -EEXIST;
> > +	}
> > +
> > +	node = calloc(sizeof(*node), 1);
> > +	if (!node)
> > +		return -ENOSPC;
> 
> Isn't -ENOMEM better here?

Ah, yes.

> > +
> > +	node->dev = dev;
> > +	node->tag = tag;
> > +	node->ptr = ptr;
> > +	list_add_tail(&node->sibling, (struct list_head *)&gd->dmtag_list);
> > +
> > +	return 0;
> > +}
> > +
> > +int dev_tag_set_val(struct udevice *dev, enum dm_tag_t tag, ulong val)
> 
> Is this used anywhere else apart from selftests?

Currently, no. It exists just for future simpler use cases.

-Takahiro Akashi

> > +{
> > +	struct dmtag_node *node;
> 
> 
> Thanks
> /Ilias

      reply	other threads:[~2022-03-10  0:02 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 11:36 [PATCH v3 00/19] efi_loader: more tightly integrate UEFI disks to driver model AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 01/19] scsi: call device_probe() after scanning AKASHI Takahiro
2022-03-08 13:30   ` Heinrich Schuchardt
2022-03-08 11:36 ` [PATCH v3 02/19] usb: storage: " AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 03/19] mmc: " AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 04/19] nvme: " AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 05/19] sata: " AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 06/19] block: ide: " AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 07/19] virtio: call device_probe() in scanning AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 09/19] dm: tag: add some document AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 10/19] test: dm: add tests for tag support AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 11/19] dm: disk: add UCLASS_PARTITION AKASHI Takahiro
2022-04-09 19:05   ` Heinrich Schuchardt
2022-04-13  3:16     ` AKASHI Takahiro
2022-04-14  6:17       ` AKASHI Takahiro
2022-04-14  7:13         ` Heinrich Schuchardt
2022-03-08 11:36 ` [PATCH v3 12/19] dm: blk: add a device-probe hook for scanning disk partitions AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 14/19] efi_loader: disk: a helper function to create efi_disk objects from udevice AKASHI Takahiro
2022-04-09 11:16   ` Heinrich Schuchardt
2022-04-11  9:06     ` AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 15/19] efi_loader: disk: a helper function to delete efi_disk objects AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 16/19] dm: disk: add read/write interfaces with udevice AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 17/19] efi_loader: disk: use udevice instead of blk_desc AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 18/19] efi_loader: disk: not create BLK device for BLK(IF_TYPE_EFI_LOADER) devices AKASHI Takahiro
2022-03-08 11:36 ` [PATCH v3 19/19] efi_driver: align with efi_disk-dm integration AKASHI Takahiro
2022-03-08 12:59 ` [PATCH v3 00/19] efi_loader: more tightly integrate UEFI disks to driver model Heinrich Schuchardt
2022-03-08 13:04   ` AKASHI Takahiro
2022-03-08 13:24     ` Heinrich Schuchardt
2022-03-08 16:20       ` Simon Glass
2022-03-08 16:49 ` Heinrich Schuchardt
2022-03-08 16:56   ` Simon Glass
2022-03-08 17:21     ` Heinrich Schuchardt
2022-03-08 17:37       ` Simon Glass
2022-03-08 19:15     ` Soeren Moch
2022-03-08 21:20       ` Simon Glass
2022-03-09  0:13         ` Tom Rini
2022-03-09  2:32           ` Simon Glass
2022-03-09  3:00             ` Tom Rini
2022-03-09  3:10               ` Simon Glass
2022-03-09  3:11                 ` Simon Glass
2022-03-09 14:25                 ` Tom Rini
2022-03-09 15:33                   ` Simon Glass
2022-03-11 18:26                     ` Simon Glass
2022-03-11 22:43                     ` Soeren Moch
2022-03-12  5:02                       ` Simon Glass
2022-03-14  8:27                         ` Soeren Moch
2022-03-14 12:57                           ` Tom Rini
2022-03-14 17:08                           ` Simon Glass
2022-03-14 19:12                             ` Soeren Moch
2022-03-14 19:21                               ` Simon Glass
2022-03-09  7:16               ` Mark Kettenis
2022-03-09  2:10   ` AKASHI Takahiro
2022-03-09  2:34     ` Simon Glass
2022-03-09  2:48       ` AKASHI Takahiro
2022-03-09  3:10         ` Simon Glass
2022-03-09  5:07           ` AKASHI Takahiro
2022-03-09 11:52             ` Heinrich Schuchardt
     [not found] ` <20220308113657.221101-9-takahiro.akashi@linaro.org>
2022-03-09 11:41   ` [PATCH v3 08/19] dm: add tag support Ilias Apalodimas
2022-03-10  0:02     ` AKASHI Takahiro [this message]

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=20220310000229.GA53281@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=bmeng.cn@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jh80.chung@samsung.com \
    --cc=lukma@denx.de \
    --cc=masami.hiramatsu@linaro.org \
    --cc=peng.fan@nxp.com \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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