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 2E724C433EF for ; Wed, 22 Jun 2022 20:10:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DEC3684176; Wed, 22 Jun 2022 22:10:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="LsjXZHwv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1332D84189; Wed, 22 Jun 2022 22:10:24 +0200 (CEST) Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) (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 DAE29840A2 for ; Wed, 22 Jun 2022 22:10:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf36.google.com with SMTP id cu16so26226934qvb.7 for ; Wed, 22 Jun 2022 13:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KZWmxdhKJRFluxgNIWJ/79OJRLB0ImXEEz4S2ioyUV0=; b=LsjXZHwvV55hfsp6PBmOdlBDRh4Po3tLuhAgM7BnDLwjJPY+B2DIGtfz/Amdl6s2fD Agb4sM6SnM807F5liPmQTeE1ThHY4QYM+jy7eo0Bsz06UTqf4aLw0T0VLaRRFnVs05IQ AomWbIp732tzgDjNC2hL1FPQpKf+nGjvVBurw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KZWmxdhKJRFluxgNIWJ/79OJRLB0ImXEEz4S2ioyUV0=; b=YRMVf1xoDdMgM9gLHv9I9TbURUOjTp6AZ0cJMVoXpsKYZXy0GYEDvYBATOfLjqW/LB pofyVQBUOITbspoY7TjpPK/MhPUIKSICKrsQdrgSlN8JTBbhKBPaOVhAj7UqUGtt/XBd ejpdSzbJWzwoFi/Au1Kg3fQvvDDx5mHPAD9sCMriLM9j9beSgCa2aDAvSBvaw1mwlL+e ZDb4A+AkOu9/kT+YrY08Zj3KQMCBxMxeqrzEFui64sQeydVJNiy5XOQJdAiScO+16rQ/ cJLOJU5skhVt7dt3EcEHSEbLLmr2tDwBbaCCEvr7q2XKEWAkAjTyKMqCyDZAV15rLMjO k8rw== X-Gm-Message-State: AJIora+QkTph80QgWIVgYqdB5N7Fk0T9lxDYqouvHT6+AuCgE3+EB+S+ BqIm1SA8gLGrbNlK7jz/HVzRBbtS+MYUmw== X-Google-Smtp-Source: AGRyM1tj3n4/wetbJDoL1Y2vRyJunEJyjty9Pkm+N8MKaDRMdWpmK9G6O5CeDZj2H9kRRQrAppez+A== X-Received: by 2002:a05:6214:c47:b0:470:7273:da3a with SMTP id r7-20020a0562140c4700b004707273da3amr2465232qvj.2.1655928620415; Wed, 22 Jun 2022 13:10:20 -0700 (PDT) Received: from bill-the-cat.lan (cpe-65-184-195-139.ec.res.rr.com. [65.184.195.139]) by smtp.gmail.com with ESMTPSA id c21-20020ac87dd5000000b00315a5fa4bf6sm2052616qte.7.2022.06.22.13.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jun 2022 13:10:19 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Cc: Bin Meng Subject: [PATCH] cmd/misc: Stop using a function pointer Date: Wed, 22 Jun 2022 16:10:18 -0400 Message-Id: <20220622201018.225713-1-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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", -- 2.25.1