[PATCH] net: apne: convert to lib8390
From: Arnd Bergmann
Date: Fri Apr 05 2024 - 15:47:51 EST
The apne driver still uses the ISA-style inb()/outb() wappers through the
8390.c helper module, which won't work in the future.
Change it to include lib8390.c like all the other m68k variants of this
driver do, so it can have custom MMIO abstractions.
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
diff --git a/drivers/net/ethernet/8390/Makefile b/drivers/net/ethernet/8=
390/Makefile
index 85c83c566ec6..ec1b325da4e4 100644
--- a/drivers/net/ethernet/8390/Makefile
+++ b/drivers/net/ethernet/8390/Makefile
@@ -4,7 +4,7 @@
#
=20
obj-$(CONFIG_MAC8390) +=3D mac8390.o
-obj-$(CONFIG_APNE) +=3D apne.o 8390.o
+obj-$(CONFIG_APNE) +=3D apne.o
obj-$(CONFIG_ARM_ETHERH) +=3D etherh.o
obj-$(CONFIG_AX88796) +=3D ax88796.o
obj-$(CONFIG_HYDRA) +=3D hydra.o
diff --git a/drivers/net/ethernet/8390/apne.c b/drivers/net/ethernet/839=
0/apne.c
index 828edca8d30c..ea3747723b3c 100644
--- a/drivers/net/ethernet/8390/apne.c
+++ b/drivers/net/ethernet/8390/apne.c
@@ -41,7 +41,15 @@
#include <asm/amigayle.h>
#include <asm/amipcmcia.h>
=20
-#include "8390.h"
+#define ei_inb(port) in_8(port)
+#define ei_outb(val, port) out_8(port, val)
+#define ei_inb_p(port) in_8(port)
+#define ei_outb_p(val, port) out_8(port, val)
+
+static const char version[] =3D
+ "apne.c:v1.1 7/10/98 Alain Malek (Alain.Malek@xxxxxxxxxx)\n";
+
+#include "lib8390.c"
=20
/* ---- No user-serviceable parts below ---- */
=20
@@ -105,14 +113,21 @@ static int init_pcmcia(void);
#define MANUAL_HWADDR5 0x9a
*/
=20
-static const char version[] =3D
- "apne.c:v1.1 7/10/98 Alain Malek (Alain.Malek@xxxxxxxxxx)\n";
-
static int apne_owned; /* signal if card already owned */
=20
-static u32 apne_msg_enable;
-module_param_named(msg_enable, apne_msg_enable, uint, 0444);
-MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.=
h for bitmap)");
+static const struct net_device_ops apne_netdev_ops =3D {
+ .ndo_open =3D __ei_open,
+ .ndo_stop =3D __ei_close,
+ .ndo_start_xmit =3D __ei_start_xmit,
+ .ndo_tx_timeout =3D __ei_tx_timeout,
+ .ndo_get_stats =3D __ei_get_stats,
+ .ndo_set_rx_mode =3D __ei_set_multicast_list,
+ .ndo_validate_addr =3D eth_validate_addr,
+ .ndo_set_mac_address =3D eth_mac_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller =3D __ei_poll,
+#endif
+};
=20
static struct net_device * __init apne_probe(void)
{
@@ -141,11 +156,11 @@ static struct net_device * __init apne_probe(void)
return ERR_PTR(-ENODEV);
}
=20
- dev =3D alloc_ei_netdev();
+ dev =3D ____alloc_ei_netdev(0);
if (!dev)
return ERR_PTR(-ENOMEM);
ei_local =3D netdev_priv(dev);
- ei_local->msg_enable =3D apne_msg_enable;
+ ei_local->msg_enable =3D msg_enable;
=20
/* disable pcmcia irq for readtuple */
pcmcia_disable_irq();
@@ -203,7 +218,7 @@ static int __init apne_probe1(struct net_device *dev=
, int ioaddr)
#endif
static unsigned version_printed;
=20
- if ((apne_msg_enable & NETIF_MSG_DRV) && (version_printed++ =3D=3D =
0))
+ if ((msg_enable & NETIF_MSG_DRV) && (version_printed++ =3D=3D 0))
netdev_info(dev, version);
=20
netdev_info(dev, "PCMCIA NE*000 ethercard probe");
@@ -309,7 +324,7 @@ static int __init apne_probe1(struct net_device *dev=
, int ioaddr)
=20
dev->base_addr =3D ioaddr;
dev->irq =3D IRQ_AMIGA_PORTS;
- dev->netdev_ops =3D &ei_netdev_ops;
+ dev->netdev_ops =3D &apne_netdev_ops;
=20
/* Install the Interrupt handler */
i =3D request_irq(dev->irq, apne_interrupt, IRQF_SHARED, DRV_NAME, =
dev);
@@ -333,7 +348,7 @@ static int __init apne_probe1(struct net_device *dev=
, int ioaddr)
ei_status.block_output =3D &apne_block_output;
ei_status.get_8390_hdr =3D &apne_get_8390_hdr;
=20
- NS8390_init(dev, 0);
+ __NS8390_init(dev, 0);
=20
pcmcia_ack_int(pcmcia_get_intreq()); /* ack PCMCIA int req */
pcmcia_enable_irq();
@@ -513,7 +528,7 @@ apne_block_output(struct net_device *dev, int count,
if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
netdev_warn(dev, "timeout waiting for Tx RDC.\n");
apne_reset_8390(dev);
- NS8390_init(dev,1);
+ __NS8390_init(dev,1);
break;
}
=20
@@ -534,10 +549,10 @@ static irqreturn_t apne_interrupt(int irq, void *d=
ev_id)
pcmcia_ack_int(pcmcia_intreq);
return IRQ_NONE;
}
- if (apne_msg_enable & NETIF_MSG_INTR)
+ if (msg_enable & NETIF_MSG_INTR)
pr_debug("pcmcia intreq =3D %x\n", pcmcia_intreq);
pcmcia_disable_irq(); /* to get rid of the sti() within ei_interr=
upt */
- ei_interrupt(irq, dev_id);
+ __ei_interrupt(irq, dev_id);
pcmcia_ack_int(pcmcia_get_intreq());
pcmcia_enable_irq();
return IRQ_HANDLED;