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 99108C77B7A for ; Tue, 16 May 2023 12:16:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 722B785DEA; Tue, 16 May 2023 14:16:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de 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=gmx.de header.i=xypron.glpk@gmx.de header.b="Brnj1Zd/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2556786649; Tue, 16 May 2023 14:16:18 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (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 D459585D52 for ; Tue, 16 May 2023 14:16:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1684239372; i=xypron.glpk@gmx.de; bh=gMUfFzZQzwPYfTsbVgcVXItktYsAQRHvRtOZ8Ch26r0=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=Brnj1Zd/b9Et5/RPqEW+7N502OXLHSQoQDEfSUteqkIH/Q9Oth7YbhBbmj5CPFNUq QVTk074oGjYEfZ2yZEXslinc0LPugNwpabun5a7Lqb2NZ3C4spW0FMFT7t2L0DQvLL ndPMavxNJV+JYFnWHr8ak32nvyFP0Cw5tz7aKfC56dB3aQHMde/6SO/caWQEuFgjjy R/n1n8sLi7CD8hYAda+Clh3lI3wn9PY3kd+aS5RgIoauUqCzLydTm62aBE8bxGzJ3x TIAbVKGDGlGfdXFJl+UdivqPnmZaOaB2LcpzLhVaGXUDW9zU2/dLuoQVCT8LFES4O1 7vrfJxqLQPy+g== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.123.67] ([88.152.145.137]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MNKhs-1pnGty2MP4-00Olpz; Tue, 16 May 2023 14:16:12 +0200 Message-ID: Date: Tue, 16 May 2023 14:16:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] cmd: tlv_eeprom: fix signature for populate_serial_number function Content-Language: en-US To: Dennis Gilmore , Stefan Roese Cc: Baruch Siach , u-boot@lists.denx.de, Josua Mayer References: <20230516082734.13254-1-josua@solid-run.com> <5c9fb87c-5157-626f-78a0-2503782e552c@gmx.de> From: Heinrich Schuchardt In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:l0mnv+4lKYzX3Q8hJgXqra4xtZmCqy+HADLFQFyCJGwYZe0uu6k 9F2tPKbtf2YP8/3pCPxdNh3n4sBRqzzgwQVC1lUvTGcujXsDRdPnKKrkyY/ry59h5XjUY8q os6iJsiN+Jp4/9nDKK1LXiuzBbDByOghtjHZ7oDklRmtrFshZ1Ex+BabT6lng4KovRqXQtK pB3VAZkyZbR+ZDz56qjCA== UI-OutboundReport: notjunk:1;M01:P0:a7zvqQzbaKU=;s3f86B3eWwV84vhxL7G8ZO49wAs SdvO6J6M1abaOhCax32VYEHaDI3ZYMPGBkIzhzqPjt3xPCxXHhJY7Ypfi6jHDumRfZ3HSMDeU FPK+H5alYMBmHDTEVjT7doHnh4nWN/VR7K2vsaqWcgTVTEtJ7e8rlesuj+nlxAil0wIgG7qJ0 sO9PGso5AsZnSDBtQ6FoMJX4PAkibt8i7PybbFrEhO6Mlg0HNY+npAYyY+WSGICXTNtB+Dmls daK9+azCEz0du7wvr4VNtk8AZonYQ5jiAQDhTSgxQRAkE4DOiWQsK+11xLvAFPHze4io9r5d7 tF1C04VbPMlATsElm16NggKas/62hV0nrTZYt4jb8/Af+X2JUrKJPVEVz915b5JGZ23XDoipi DjhZJlg3dFxNcd5ZrDL8CvryzAfvvN4+oSvrlMzFrvpQKcIu5WHh9zCnqQRQR7aOoh2U1c1Tw VY1dMHhjeL4Q/o6XF4biQtNIWdr8xFR1G3KT692oH0uBkPBrhLg22PsKXYt513jj+Aia6fBbg FJdyC1lnkWAJjqwL7iG3yXOWLvpMkm/9X3jMO1gLz0B1kNgv5VaBettj8mLlGk3CFG8/+nroj O6gbTKWJ3vV29rbp1ZuAi1KwrSQ592/v/Ntcd3jStNcHpLAyIc+bYVwVaCwPy9fGsVdhTM3hP 5jYwZ6dnAqdSm9EGy8mSi/Vw2/xnIbSxN63YM/0HZCYhBWcupYiF2fi3ksivxFNit/pcoctHl ZUIPSadIf+Pr17cOd8qWLQRKGzdMxCWFshVV8GjAi7/w/eHEHFiiBiVA5I0Motl7TSa5/DzYt kLDvuz2EfvlhbuPOHtOHZbWnWVYqRuRrAMI2VSP67F29GdmJ3krGXnHydm6Trf4PGGFQW8TzV PZmTKPgp3XthgobpHB2sKsmtWePs3ny/GO1F5zgODFJxvHXupxQjBcES/0RM8bNIQwWQGHtlZ WsTNuEPE6qJ7xsPHfLfUfqU7xUo= 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 5/16/23 13:49, Josua Mayer wrote: > Hi Heinrich, > > Am 16.05.23 um 14:21 schrieb Heinrich Schuchardt: >> On 5/16/23 10:27, Josua Mayer wrote: >>> populate_serial_number is not used internally for the tlv_eeprom >>> command, but rather provided as a library function for external use.. >>> Remove the devnum that had recently been added by mistake, returning t= he >>> function to its original signature. >>> >>> Instead place a 0-initialised member variable inside the function to >>> same purpose, along with a node that it only supports reading from the >> >> %s/node/note/ > Good find! >> >>> first EEPROM in the system. >>> >>> Fixes: dfda0c0 ("cmd: tlv_eeprom: remove use of global variable >>> current_dev") >>> Signed-off-by: Josua Mayer >>> Cc: Stefan Roese >>> Cc: Baruch Siach >>> Cc: Heinrich Schuchardt >>> --- >>> =C2=A0 cmd/tlv_eeprom.c | 3 ++- >>> =C2=A0 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c >>> index 79796394c5c..0ca4d714645 100644 >>> --- a/cmd/tlv_eeprom.c >>> +++ b/cmd/tlv_eeprom.c >>> @@ -1100,11 +1100,12 @@ int mac_read_from_eeprom(void) >>> =C2=A0=C2=A0 * >>> =C2=A0=C2=A0 *=C2=A0 This function must be called after relocation. >>> =C2=A0=C2=A0 */ >>> -int populate_serial_number(int devnum) >>> +int populate_serial_number(void) >> >> If populate_serial_number() is to be used as a library function, it >> should live in lib/ or possibly in drivers/misc/. The definition needs >> to be provided in an include file. Otherwise the function should be >> deleted. >> >> Where will this library function be used? > I don't know for sure. GitHub search finds its use in board files on > some old ONIE u-boot forks. > > Main purpose of this patch right now is to undo my accidental change and > restore the default behaviour: > The previous instance of devnum variable inside tlv_eeprom.c would have > had value 0 by default. The right places to call the function might be board/solidrun/clearfog/clearfog.c and board/kobol/helios4/helios4.c as these platforms enable CMD_TLV_EEPROM. But I have no such board. The function has remained unused in upstream U-Boot since 2020. If we do not plan to use it, it should be removed. Stefan and Dennis, what are your thoughts? Best regards Heinrich > > >> >> Shouldn't the EEPROM with the serial number be identified via the >> device-tree? > Something like that would be nice. > However we also want to use identical device-tree between Linux and U-Bo= ot. > I am not sure if we have such indication. >> >> Best regards >> >> Heinrich >> >>> =C2=A0 { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 char serialstr[257]; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int eeprom_index; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct tlvinfo_tlv *eeprom_tlv; >>> +=C2=A0=C2=A0=C2=A0 int devnum =3D 0; // TODO: support multiple EEPROM= s >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (env_get("serial#")) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0; >> > > - Josua Mayer >