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 AF5B6C46467 for ; Thu, 19 Jan 2023 19:51:51 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 62E0085676; Thu, 19 Jan 2023 20:51:41 +0100 (CET) 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="U1TiIXY1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E20A182A24; Thu, 19 Jan 2023 20:51:38 +0100 (CET) Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (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 2924E8563D for ; Thu, 19 Jan 2023 20:51:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=saproj@gmail.com Received: by mail-wm1-x333.google.com with SMTP id m15so2389892wms.4 for ; Thu, 19 Jan 2023 11:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8jIYDvwHjvKUeqXvoGInxncup9pMO9IV489KmvBouCw=; b=U1TiIXY1UKkAsbcEifkKT9GKKZovGf1TOBk3XkpNsEOJj8eSTzMRsyDV9OfiekoJ+T b57ika1/RBH4NZ4FNaN9c52DmAuKlmuvqjoB0CR3dOSwEDFLtckAEX6UMZ0t07FMGpiU pNhUk9GmTdP45L4ISNO87BxnE769I5m5cKp5trU9sLEwddIUTTFtcIT8f3mjhA4h84Ll Gh/PTolDy01OMsaS5M7rOtRHY3ncXOm2QaYNbc89tBM2TXJGKky9aqDD8oSC7n7vkgPW PK5Lg+k1RRkrGf44Qm21HegX3CGbrvqAEOBND5Yo2tYrOGoXdwkCpzs9cee2Qpk/9sXg WOLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8jIYDvwHjvKUeqXvoGInxncup9pMO9IV489KmvBouCw=; b=M2O0Bl+eE2S8uDkHSdr1cmmZ1rwcz2/9TUKJpTgEQjnIUtqVlHa/i+nTR1fMWKnhAs 6dXzFNRYy3bipVSgou5tvTYHO+FLXHxJJ/UpXeU2tTUE7dm6F/omDVvf8JOICTVOTly+ BlSo56XMx7R+hIRLH2ymfdgKMQs6T0mjy9JhcNPpVaBHx73sJ3pefPnIwMPU9EHWti+U Q+D5mOb1P49/VV5evzQKhazG/bFp+x3vs7QY8jswfpWk2NdtRhhabNOcCwIJEknNv9DO hRzPUgWfv+qgGz3ZeGituxHKZdqkQZK/0Vrlxs8rqMFYSE70Woh//CaqEziA7oPPqYNt lizQ== X-Gm-Message-State: AFqh2krUYzgtiy+QSKhXU9pM1m/PJfjMJG1EPhq1yj8WcLw50OA2IF2B E8TaaqMo46Vm7f7a4ZhF4fh8/ggg8GA= X-Google-Smtp-Source: AMrXdXvgxuF3ThzvSv0wGswmJQkLjzixzBRZO7qV88VrwfSRsa0o5XPJMNCzmPN0TbUPl9yn0yHbuw== X-Received: by 2002:a05:600c:4fd2:b0:3da:f688:82e1 with SMTP id o18-20020a05600c4fd200b003daf68882e1mr11436946wmq.40.1674157893502; Thu, 19 Jan 2023 11:51:33 -0800 (PST) Received: from saproj-Latitude-5501.yandex.net ([2a02:6b8:0:40c:ed28:6515:90ec:5a28]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c350f00b003db0b0cc2afsm108330wmq.30.2023.01.19.11.51.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 11:51:33 -0800 (PST) From: Sergei Antonov To: u-boot@lists.denx.de, joe.hershberger@ni.com, rfried.dev@gmail.com Cc: bmeng.cn@gmail.com, Sergei Antonov Subject: [PATCH v2 2/3] net: ftmac100: simplify priv->iobase casting Date: Thu, 19 Jan 2023 22:51:15 +0300 Message-Id: <20230119195116.246711-2-saproj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230119195116.246711-1-saproj@gmail.com> References: <20230119195116.246711-1-saproj@gmail.com> 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 Replace 'phys_addr_t iobase' with 'struct ftmac100 *ftmac100' in order to cast once on assignment and remove casting in a number of other places. Signed-off-by: Sergei Antonov Reviewed-by: Ramon Fried --- v1 -> v2: no change drivers/net/ftmac100.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index b3da9479ea5e..bb39e837bbe7 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -28,7 +28,7 @@ struct ftmac100_data { struct ftmac100_rxdes rxdes[PKTBUFSRX]; int rx_index; const char *name; - phys_addr_t iobase; + struct ftmac100 *ftmac100; }; /* @@ -36,7 +36,7 @@ struct ftmac100_data { */ static void ftmac100_reset(struct ftmac100_data *priv) { - struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase; + struct ftmac100 *ftmac100 = priv->ftmac100; debug ("%s()\n", __func__); @@ -57,7 +57,7 @@ static void ftmac100_reset(struct ftmac100_data *priv) static void ftmac100_set_mac(struct ftmac100_data *priv , const unsigned char *mac) { - struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase; + struct ftmac100 *ftmac100 = priv->ftmac100; unsigned int maddr = mac[0] << 8 | mac[1]; unsigned int laddr = mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5]; @@ -72,7 +72,7 @@ static void ftmac100_set_mac(struct ftmac100_data *priv , */ static void _ftmac100_halt(struct ftmac100_data *priv) { - struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase; + struct ftmac100 *ftmac100 = priv->ftmac100; debug ("%s()\n", __func__); writel (0, &ftmac100->maccr); } @@ -82,7 +82,7 @@ static void _ftmac100_halt(struct ftmac100_data *priv) */ static int _ftmac100_init(struct ftmac100_data *priv, unsigned char enetaddr[6]) { - struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase; + struct ftmac100 *ftmac100 = priv->ftmac100; struct ftmac100_txdes *txdes = priv->txdes; struct ftmac100_rxdes *rxdes = priv->rxdes; unsigned int maccr; @@ -187,7 +187,7 @@ static int __ftmac100_recv(struct ftmac100_data *priv) */ static int _ftmac100_send(struct ftmac100_data *priv, void *packet, int length) { - struct ftmac100 *ftmac100 = (struct ftmac100 *)(uintptr_t)priv->iobase; + struct ftmac100 *ftmac100 = priv->ftmac100; struct ftmac100_txdes *curr_des = priv->txdes; ulong start; @@ -400,7 +400,7 @@ static int ftmac100_of_to_plat(struct udevice *dev) struct eth_pdata *pdata = dev_get_plat(dev); const char *mac; pdata->iobase = dev_read_addr(dev); - priv->iobase = pdata->iobase; + priv->ftmac100 = (struct ftmac100 *)pdata->iobase; mac = dtbmacaddr(0); if (mac) memcpy(pdata->enetaddr , mac , 6); -- 2.34.1