From: Sergei Antonov <saproj@gmail.com>
To: u-boot@lists.denx.de, joe.hershberger@ni.com, rfried.dev@gmail.com
Cc: bmeng.cn@gmail.com, Sergei Antonov <saproj@gmail.com>
Subject: [PATCH 2/3] net: ftmac100: simplify priv->iobase casting
Date: Wed, 28 Dec 2022 14:54:22 +0300 [thread overview]
Message-ID: <20221228115423.1035149-2-saproj@gmail.com> (raw)
In-Reply-To: <20221228115423.1035149-1-saproj@gmail.com>
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 <saproj@gmail.com>
---
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
next prev parent reply other threads:[~2022-12-28 11:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-28 11:54 [PATCH 1/3] net: ftmac100: change driver name from nds32_mac to ftmac100 Sergei Antonov
2022-12-28 11:54 ` Sergei Antonov [this message]
2023-01-10 17:12 ` [PATCH 2/3] net: ftmac100: simplify priv->iobase casting Ramon Fried
2022-12-28 11:54 ` [PATCH 3/3] net: ftmac100: add mii read and write callbacks Sergei Antonov
2023-01-10 17:13 ` Ramon Fried
2023-01-19 19:55 ` Sergei Antonov
2023-02-04 0:30 ` Ramon Fried
2023-01-10 17:11 ` [PATCH 1/3] net: ftmac100: change driver name from nds32_mac to ftmac100 Ramon Fried
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221228115423.1035149-2-saproj@gmail.com \
--to=saproj@gmail.com \
--cc=bmeng.cn@gmail.com \
--cc=joe.hershberger@ni.com \
--cc=rfried.dev@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox