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 79D1FC433EF for ; Thu, 23 Jun 2022 00:23:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A3DB83DB8; Thu, 23 Jun 2022 02:23:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="P81RnwAw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C6A86840A2; Thu, 23 Jun 2022 02:23:44 +0200 (CEST) Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) (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 63EDB8344E for ; Thu, 23 Jun 2022 02:23:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qv1-xf2f.google.com with SMTP id p31so27658250qvp.5 for ; Wed, 22 Jun 2022 17:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ysbm583e0ELPTJ8goKSVFgAPLerDJGsFkub/sjpWNPI=; b=P81RnwAwNBe7/MvUeJ0r8fIorGJ1jBrnFfF0wPK2uPaS43gOJX8eGL/pHjRpKDUjfy pVYa1L+goKR0ni23W+Op3AYCQnzSk1U2VEZ+be8sMCTFYk2j+nMuBDqhuDek7ZAaVzbk Eg7APWorhIRObnLpi/Rophj36yseg6txXYnSqoSirf0UHWAiHDTFpTOOChmB1EKH3vZb nwywwak+VFLglmaOeu/T5qY1aw61y31vib+SM/w8cn3UfHwTMKSP0Ykd6gk4e0uhVv9h BwkCR7ggmkZSt+iQfmXLyypUFQqRQJxx0R0gCtuJzZWcD62lHwnoE1dymQ0g6ZAEbgyz 0QAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ysbm583e0ELPTJ8goKSVFgAPLerDJGsFkub/sjpWNPI=; b=fwdnvFLo06256yR81fl37EyNjZZ7eXGxuJVhm4BLzavECsJP7mVom1wpU6YariBNij TbkwJJS3RoNy4vmnaiQOJVqWlo6MtYNHz48n+QJKYjysMkmWVAk+dCNnt5v2+IYZeGll UVcP1yKfTtMjOmpR9zNf54p7vJJC9sX1ifmE3dwx/qkhB7VD5hXfeJhjCSmWT6DkMIor KH1nrJBhqbw1K2JXbNJPnADdNLWbr0WnFXBarDaqiAMpT8796/1Qk1xFVWoL3YaqSKDu XFzEsEsnu7pZ7s/qNP39X49Sf6rW8U0eda7QdtkzvqS4X++e2pgJnxmy0vnor0G8wjZd hS5g== X-Gm-Message-State: AJIora8seOTNVe3gjM10IZdkvbJKhXQd5RpZkRpErzE7Q9ZnGeTAEAaS HDTvfIFErw/k4s3QB5377Us= X-Google-Smtp-Source: AGRyM1vjbhcY5ZKJhFtHISWu7agYOS4vyA/r6w6iJpPnMS11Gsg0h8qFQua23FZSU3+sc7ksbu3i5Q== X-Received: by 2002:ac8:7c47:0:b0:305:346c:18b2 with SMTP id o7-20020ac87c47000000b00305346c18b2mr5552525qtv.118.1655943821071; Wed, 22 Jun 2022 17:23:41 -0700 (PDT) Received: from [192.168.1.201] (pool-173-73-95-180.washdc.fios.verizon.net. [173.73.95.180]) by smtp.gmail.com with ESMTPSA id bi20-20020a05620a319400b006a6dcd92eb3sm16913953qkb.121.2022.06.22.17.23.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jun 2022 17:23:40 -0700 (PDT) Subject: Re: [PATCH] cmd/misc: Stop using a function pointer To: Tom Rini , u-boot@lists.denx.de Cc: Bin Meng References: <20220622201018.225713-1-trini@konsulko.com> From: Sean Anderson Message-ID: <808428b4-640f-6f49-b91d-f69aad91fac5@gmail.com> Date: Wed, 22 Jun 2022 20:23:39 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20220622201018.225713-1-trini@konsulko.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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.6 at phobos.denx.de X-Virus-Status: Clean On 6/22/22 4:10 PM, Tom Rini wrote: > Currently, enabling CMD_MISC gives: > cmd/misc.c:67:25: warning: assignment to 'int (*)(struct udevice *, int, void *, int)' from incompatible pointer type 'int (*)(struct udevice *, int, const void *, int)' [-Wincompatible-pointer-types] > > Because 'misc_read' takes a void * and 'misc_write' takes a const void > *, both of which make sense for their operation. Given there's one > place we make use of the function pointer, just call read or write > directly for the operation we're called with. > > Cc: Bin Meng > Signed-off-by: Tom Rini > --- > cmd/misc.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/cmd/misc.c b/cmd/misc.c > index bcd8d960ee06..ec32b41ed1e9 100644 > --- a/cmd/misc.c > +++ b/cmd/misc.c > @@ -44,7 +44,6 @@ static int do_misc_list(struct cmd_tbl *cmdtp, int flag, > static int do_misc_op(struct cmd_tbl *cmdtp, int flag, > int argc, char *const argv[], enum misc_op op) > { > - int (*misc_op)(struct udevice *, int, void *, int); > struct udevice *dev; > int offset; > void *buf; > @@ -62,11 +61,10 @@ static int do_misc_op(struct cmd_tbl *cmdtp, int flag, > size = hextoul(argv[3], NULL); > > if (op == MISC_OP_READ) > - misc_op = misc_read; > + ret = misc_read(dev, offset, buf, size); > else > - misc_op = misc_write; > + ret = misc_write(dev, offset, buf, size); > > - ret = misc_op(dev, offset, buf, size); > if (ret < 0) { > if (ret == -ENOSYS) { > printf("The device does not support %s\n", > Reviewed-by: Sean Anderson