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 0E440EB64DC for ; Mon, 3 Jul 2023 12:08:57 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E14E48626D; Mon, 3 Jul 2023 14:08:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 0A21586601; Mon, 3 Jul 2023 14:08:53 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 34C918619E for ; Mon, 3 Jul 2023 14:08:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=abdellatif.elkhlifi@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3B89C2F4; Mon, 3 Jul 2023 05:09:32 -0700 (PDT) Received: from e130802.arm.com (unknown [10.57.77.143]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 93AD23F73F; Mon, 3 Jul 2023 05:08:48 -0700 (PDT) Date: Mon, 3 Jul 2023 13:08:42 +0100 From: Abdellatif El Khlifi To: Ilias Apalodimas Cc: nd@arm.com, u-boot@lists.denx.de Subject: Re: [PATCH v13 05/10] arm_ffa: introduce armffa command Message-ID: <20230703120842.GA82669@e130802.arm.com> References: <20230606134856.GA1871110@bill-the-cat> <20230616152817.319869-1-abdellatif.elkhlifi@arm.com> <20230616152817.319869-6-abdellatif.elkhlifi@arm.com> <20230703095507.GA54322@e130802.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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.8 at phobos.denx.de X-Virus-Status: Clean Hi Ilias, On Mon, Jul 03, 2023 at 12:59:58PM +0300, Ilias Apalodimas wrote: > > > [...] > > > > +int do_ffa_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) > > > > +{ > > > > + struct ffa_send_direct_data msg = { > > > > + .data0 = 0xaaaaaaaa, > > > > + .data1 = 0xbbbbbbbb, > > > > + .data2 = 0xcccccccc, > > > > + .data3 = 0xdddddddd, > > > > + .data4 = 0xeeeeeeee, > > > > + }; > > > > + u16 part_id; > > > > + int ret; > > > > + struct udevice *dev; > > > > + > > > > + if (argc != 2) { > > > > + log_err("Missing argument\n"); > > > > + return CMD_RET_USAGE; > > > > + } > > > > + > > > > + errno = 0; > > > > + part_id = strtoul(argv[1], NULL, 16); > > > > + > > > > + if (errno) { > > > > > > Is errno used in strtoul? > > > > Yes, please refer to [1]. > > > > [1]: https://man7.org/linux/man-pages/man3/strtoul.3.html > > > that's what the libc version does. Can you check the u-boot version? > Short answer: errno not used in strtoul() an I'm gonna remove the errno check. More details: strtoul() is defined as simple_strtoul() in strto.c errno variable is not set by simple_strtoul() or its callees. errno.h is included by strto.c to access the error codes. > > > ... > > > > +int do_ffa_devlist(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) > > > > +{ > > > > + struct udevice *dev; > > > > + int ret; > > > > + > > > > + ret = ffa_get_dev(&dev); > > > > + if (ret) > > > > + return CMD_RET_FAILURE; > > > > + > > > > + log_info("device name %s, dev %p, driver name %s, ops %p\n", > > > > + dev->name, > > > > + (void *)map_to_sysmem(dev), > > > > + dev->driver->name, > > > > + (void *)map_to_sysmem(dev->driver->ops)); > > > > > > Isn't it more useful to print the physical address map_to_sysmem() retuns? > > > > That's what map_to_sysmem() does, it returns a physical address and it's shown in the log. > > I dont have access to u-boot source right, but why do you need all > these void * casts then? Because map_to_sysmem() returns an 'phys_addr_t' (aka 'long long unsigned int') . However, %p expects 'void *'. Compilation warning: cmd/armffa.c:181:18: warning: format ‘%p’ expects argument of type ‘void *’, but argument 3 has type ‘phys_addr_t’ {aka ‘long long unsigned int’} [8; ;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wformat=-Wformat=8;;] 181 | log_info("device name %s, dev %p, driver name %s, ops %p\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 182 | dev->name, 183 | map_to_sysmem(dev), | ~~~~~~~~~~~~~~~~~~ | | | phys_addr_t {aka long long unsigned int} Cheers, Abdellatif