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 23BC1C433EF for ; Wed, 9 Mar 2022 11:41:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 39C7F8399C; Wed, 9 Mar 2022 12:41:23 +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="V6thrJE/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9EC5383995; Wed, 9 Mar 2022 12:41:20 +0100 (CET) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 BB6688399E for ; Wed, 9 Mar 2022 12:41:08 +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=ilias.apalodimas@linaro.org Received: by mail-wm1-x32c.google.com with SMTP id bg31-20020a05600c3c9f00b00381590dbb33so1276943wmb.3 for ; Wed, 09 Mar 2022 03:41:08 -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:references:mime-version :content-disposition:in-reply-to; bh=BSGUnlNxlKfOkaKXD7af1CHfD2riJkA01DMy7HO/h8s=; b=V6thrJE/DYUcenQs/gcJBsRkdETms632umzsqr/AUFsGkYg9vEwzt6KgMjdYkZdWMs nWxlFjcJsq432oJ9nJvYBQ9uI3YMh4YekrEf1hK+LbUX7h8J65cEtmoHmciHwOY4miP5 ySf54nTdu6drlPncT/LuGf5vMD7nDxS5sR8LhLtOdPb3pL5dGWYH9k/Klj/8ebIF8Gkt z8GqCFVToCFbUtW6f7kek6hMpG8550X9JqewiemeSWxnxbf+MlzmWrotuw1Rctv4HXvJ FF/IAvJHEAsfd1frqi51qy8Ng6YZyy8qYgwUvf6JCpdcmNJ43e28TOMdvUVMfU0DHBbI I5HA== 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:references :mime-version:content-disposition:in-reply-to; bh=BSGUnlNxlKfOkaKXD7af1CHfD2riJkA01DMy7HO/h8s=; b=AOrj/AVzIv5llO3XxGVdvGqgW5NjmWaOiPbOMwG7C8zRUVIJ8SKRen3LfUpzW9Ge4W uJLlNBtam/4DxCClYojoRdWazxTz6izhXP+lY7YVdMW6GdANT5e/lpDU43ZbIaQhT7bg jaXOu60LVjaFNOyeQwZIEVTQ5/2QWGIPn9nQoatedR5xKSc7xVsw/zdgETUgLAlmMgxp A4XJmPgJNMGgHiRKGct2L+tWP3ielDy43XGYu3SFGdQxR8x+mE/WMuA+aqoHFmn0zLJO Yk5jJCK/3bFyBIySgdBE4pqMgSfUexNBQGN8QfGUEYBgOQlAqW+Hq9tPirswm0bvoxIj f49Q== X-Gm-Message-State: AOAM531E4nuM0txNZ90Wrr+2PtluUzDzKF4xhiXfkxLYm3xmfg0Z1qKC a0sUVUiALC/n+5Dq6zpGcksynw== X-Google-Smtp-Source: ABdhPJzsgrqeYUV/35wDzvvRHwehsbd1VZ57WXPyitTMo1uREjJPtGsapX1tw0zioemVd0dvVoh25w== X-Received: by 2002:a05:600c:3544:b0:389:bdcf:d6e3 with SMTP id i4-20020a05600c354400b00389bdcfd6e3mr7278052wmq.134.1646826067995; Wed, 09 Mar 2022 03:41:07 -0800 (PST) Received: from hades (athedsl-4461682.home.otenet.gr. [94.71.4.98]) by smtp.gmail.com with ESMTPSA id e18-20020adfdbd2000000b001e4bbbe5b92sm1570880wrj.76.2022.03.09.03.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 03:41:07 -0800 (PST) Date: Wed, 9 Mar 2022 13:41:04 +0200 From: Ilias Apalodimas To: AKASHI Takahiro 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: 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: <20220308113657.221101-9-takahiro.akashi@linaro.org> 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 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? > + > + 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? > +{ > + struct dmtag_node *node; Thanks /Ilias