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 201CCEB64D7 for ; Sat, 17 Jun 2023 00:43:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 619A9847B6; Sat, 17 Jun 2023 02:43:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=mailbox.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; secure) header.d=mailbox.org header.i=@mailbox.org header.b="glLFyNGP"; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.b="AHRwSYHb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 087EA8627B; Sat, 17 Jun 2023 02:43:40 +0200 (CEST) Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 96B72801CD for ; Sat, 17 Jun 2023 02:43:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@mailbox.org Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4Qjchn0VzQz9sR0; Sat, 17 Jun 2023 02:43:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1686962617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zLD23iPOTOuKISj9qMv6x0feazWIXH+pTSQL4Qut0Ak=; b=glLFyNGPjuBDeWohcuQTsBZMN0JMnUu34inojJJCxdYRLmaD8uvlloFs6h1mg97d4xhvHE qqKN8pq3dK6ikwsSTH6cuw8LR0UVLEOwbl/PPebjt7Uas/FlOJ7JsaJyQ4eShfYzQWxWws 2216XUKAo6qa2PqsKl2c5PfsKVuzyzdrk7q9c4ruG26yj95LgPv2Pq6ldypEVgliaEg7wj AV7YZZnEfrVdeI26FbzRBMDUNgR2SFQJEcWgpTA4JAlrOSBdLQjJ3VOKj9/VfgGwYXulzP Zu2ZsNhG0pC+sOGBHzyhzI1Xqz3I/F+Cva+9WlZl9ji55MIdoldx8qi1gzq4cA== Message-ID: <446b6cc4-2bd5-156f-7bc4-e0a9ddb2e872@mailbox.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1686962615; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zLD23iPOTOuKISj9qMv6x0feazWIXH+pTSQL4Qut0Ak=; b=AHRwSYHbZ2Tq2NZcHM1CUIpVoQ+K6l/2ev1C5XqNT1aIECufNbZyJRoB2uUOGs/bdkcTFU mm+h2XmXWH4Szu0QaaaD+u3dkn1paCdgUBH/uXIHjTH/7I0CFtGo1xLw5WbEOM3jOAM2ft u+M00G9KYYHeXu8cxl7Rq0y7NdN2jjldrG8KGfZz1PcL7/Q9mmBa/slCEaUYEH3osSpo46 +P7g8EgRJtLm5Md356BaNccqkHtfR+eusITEWPaO0FgwHctXg9F3qtZXK7kCfk7fdrYvvl V9HZGxXRucLiCc4YNfGIDZYeXf/4lAV/i17rrYuN3QFHGacA/JKm9WH8JE0ilQ== Date: Sat, 17 Jun 2023 02:43:33 +0200 MIME-Version: 1.0 Subject: Re: [PATCH v1 3/4] sysinfo: rcar3: Implement BOARD_ID and BOARD_REVISION Content-Language: en-US To: Detlev Casanova , u-boot@lists.denx.de Cc: Marek Vasut , Hai Pham , Tam Nguyen References: <20230616152122.588168-1-detlev.casanova@collabora.com> <20230616152122.588168-4-detlev.casanova@collabora.com> From: Marek Vasut In-Reply-To: <20230616152122.588168-4-detlev.casanova@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-MBO-RS-ID: be963c50f1fd56b8617 X-MBO-RS-META: t7dmq8w6ohhue3wbyw4pqyurq8faecxk X-Rspamd-Queue-Id: 4Qjchn0VzQz9sR0 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.8 at phobos.denx.de X-Virus-Status: Clean On 6/16/23 17:21, Detlev Casanova wrote: > Expose that information to the command shell to let scripts select the > correct devicetree name. > > Signed-off-by: Detlev Casanova > --- > drivers/sysinfo/rcar3.c | 46 ++++++++++++++++++++++++++++++++--------- > 1 file changed, 36 insertions(+), 10 deletions(-) > > diff --git a/drivers/sysinfo/rcar3.c b/drivers/sysinfo/rcar3.c > index 7b127986da7..89ad46c5422 100644 > --- a/drivers/sysinfo/rcar3.c > +++ b/drivers/sysinfo/rcar3.c > @@ -32,6 +32,8 @@ > */ > struct sysinfo_rcar_priv { > char boardmodel[64]; > + u8 id; > + char revision[4]; > u8 val; > }; > > @@ -48,17 +50,37 @@ static int sysinfo_rcar_get_str(struct udevice *dev, int id, size_t size, char * > > switch (id) { > case SYSINFO_ID_BOARD_MODEL: > - strncpy(val, priv->boardmodel, size); > - val[size - 1] = '\0'; > + strlcpy(val, priv->boardmodel, size); > + break; > + case SYSINFO_ID_BOARD_REVISION: > + strlcpy(val, priv->revision, size); > + break; > + default: > + return -EINVAL; > + }; > + > + val[size - 1] = '\0'; > + return 0; > +} > + > +static int sysinfo_rcar_get_int(struct udevice *dev, int id, int *val) > +{ > + struct sysinfo_rcar_priv *priv = dev_get_priv(dev); > + > + switch (id) { > + case SYSINFO_ID_BOARD_ID: > + *val = priv->id; > return 0; Why not return SYSINFO_ID_BOARD_REVISION as integer here ? [...]