From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F4A9C433F5 for ; Thu, 10 Mar 2022 00:02:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 19EBD839B3; Thu, 10 Mar 2022 01:02:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="DvB8pb1T"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8C376839B3; Thu, 10 Mar 2022 01:02:41 +0100 (CET) Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 02842839B0 for ; Thu, 10 Mar 2022 01:02:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x530.google.com with SMTP id t14so3300457pgr.3 for ; Wed, 09 Mar 2022 16:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=2fVXWX6zuHbAfMeVuVZuWzGTmFOh725eyuhVPV6To3A=; b=DvB8pb1Tnw56lpYDagcnvJ4VmSheDLgwM5O9hAR5aRECryLWGGyfAsx8Jty71cDnXk F/aRkKx+jbTJpbSZZtpIANcY3MFabmLRVSHCq/2RSNgDg8XaQ9ep3+hjp7/HiYbmTb0M jLizEbfTXeYhu80QU1JDyArGgjbWHfD3K4EER6SzS473XDnXfIOHOLVDZ/Xf8vNU96k6 2VbnED2T8k7DAH79+x83LdLvRKnelGdz64uhczyxyJ0+Vtt7qwXwDUU0w9NCDSKjM4YG PLtN+T53fMeJ0pHBiOwRKhlhgJiOgjDFkndcX3bHZS+IhTiUZAIrl8UZRbD+EULQFlyZ gnFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=2fVXWX6zuHbAfMeVuVZuWzGTmFOh725eyuhVPV6To3A=; b=XWbjdGNg0FnmPrEeVbdeSxVPAb2PAmHbuhisKTWhO3fIx6mxxeZg3G4fAAu+H+/Enm HL1BK5C5A209RzyrIrk/T1iY2Lp2iF9WVxWMeIIxIZdRfdgKKiyKqDdbO33Ifxr2b8cR yuRnPdp/51xISwEQan2xWYs/LscV2OlS8c8E65vYM5dLWoB7Gqwom7rSubjGlgtTFxUZ FnvP7LB+lzllA4ewNYHA7ykZlxivyDpZ2PfgcgSUs2fArbDNkWq9AQJJATl6dzHDeAOh kiLgdhyo14Vw3TVwN5MN+GqA8ytcbzZl4mWHbmOdtL8fqRE5CF4upSnGQcsHYkoyANOj y9jQ== X-Gm-Message-State: AOAM53229O33IGyqaWkluqhC9ZC9T5DQMSKjS5ltdHxuuGxVbmJWARCF jSeT9aOuLgDcISQmtzV17T32ew== X-Google-Smtp-Source: ABdhPJwjdoqCSUGB1J7FUAjCnhiBZVymDJn47gzVg+rWic5uXKA3/xuqsBH58u5ZSFnE2vnUaLVgBQ== X-Received: by 2002:a65:6bd4:0:b0:374:1fe3:e18a with SMTP id e20-20020a656bd4000000b003741fe3e18amr1788782pgw.621.1646870554133; Wed, 09 Mar 2022 16:02:34 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:7cb3:6afd:fb79:f69c]) by smtp.gmail.com with ESMTPSA id u10-20020a056a00124a00b004f741eb11d0sm4617244pfi.149.2022.03.09.16.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 16:02:33 -0800 (PST) Date: Thu, 10 Mar 2022 09:02:29 +0900 From: AKASHI Takahiro To: Ilias Apalodimas 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 Message-ID: <20220310000229.GA53281@laputa> Mail-Followup-To: AKASHI Takahiro , Ilias Apalodimas , 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 References: <20220308113657.221101-1-takahiro.akashi@linaro.org> <20220308113657.221101-9-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On Wed, Mar 09, 2022 at 01:41:04PM +0200, Ilias Apalodimas wrote: > Hi Akashi-san, > > > Signed-off-by: AKASHI Takahiro > > Reviewed-by: Simon Glass > > --- > > 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 > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +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