]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: arcnet: expand unnecessary I/O abstraction macros
authorEthan Nelson-Moore <enelsonmoore@gmail.com>
Thu, 21 May 2026 00:16:17 +0000 (17:16 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 23 May 2026 00:20:57 +0000 (17:20 -0700)
Now that the BUS_ALIGN variable has been removed, the
arcnet_in/out/read/write* macros behave identically to the functions
they wrap. Expand them and remove their definitions to make the code
easier to maintain.

Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Link: https://patch.msgid.link/20260521001631.45434-6-enelsonmoore@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/arcnet/arcdevice.h
drivers/net/arcnet/com20020-pci.c
drivers/net/arcnet/com20020.c
drivers/net/arcnet/com20020.h

index c870b8e21d4440effd7b729241a73996bc9ba914..a7c2173596794f89504159ab418266d46f57e2ee 100644 (file)
@@ -372,23 +372,5 @@ static inline void arcnet_set_addr(struct net_device *dev, u8 addr)
        dev_addr_set(dev, &addr);
 }
 
-/* I/O equivalents */
-
-/* addr and offset allow register like names to define the actual IO address */
-#define arcnet_inb(addr, offset)                                       \
-       inb((addr) + (offset))
-#define arcnet_outb(value, addr, offset)                               \
-       outb(value, (addr) + (offset))
-
-#define arcnet_insb(addr, offset, buffer, count)                       \
-       insb((addr) + (offset), buffer, count)
-#define arcnet_outsb(addr, offset, buffer, count)                      \
-       outsb((addr) + (offset), buffer, count)
-
-#define arcnet_readb(addr, offset)                                     \
-       readb((addr) + (offset))
-#define arcnet_writeb(value, addr, offset)                             \
-       writeb(value, (addr) + (offset))
-
 #endif                         /* __KERNEL__ */
 #endif                         /* _LINUX_ARCDEVICE_H */
index 6474c7be299256f89f277719f933efc7ead274ff..03bc51423a55a70f61788ef61a270b66e38d2f1d 100644 (file)
@@ -195,8 +195,8 @@ static int com20020pci_probe(struct pci_dev *pdev,
                 * ARCNET controller needs
                 * this access to detect bustype
                 */
-               arcnet_outb(0x00, ioaddr, COM20020_REG_W_COMMAND);
-               arcnet_inb(ioaddr, COM20020_REG_R_DIAGSTAT);
+               outb(0x00, ioaddr + COM20020_REG_W_COMMAND);
+               inb(ioaddr + COM20020_REG_R_DIAGSTAT);
 
                SET_NETDEV_DEV(dev, &pdev->dev);
                dev->base_addr = ioaddr;
@@ -224,7 +224,7 @@ static int com20020pci_probe(struct pci_dev *pdev,
                        snprintf(dev->name, sizeof(dev->name), "arc%d-%d", dev->dev_id, i);
                }
 
-               if (arcnet_inb(ioaddr, COM20020_REG_R_STATUS) == 0xFF) {
+               if (inb(ioaddr + COM20020_REG_R_STATUS) == 0xFF) {
                        pr_err("IO address %Xh is empty!\n", ioaddr);
                        ret = -EIO;
                        goto err_free_arcdev;
index adcf69cb9d50df7667226f9ef508a43b29818976..21f962357b0bed2c4e583dfb1aef46b8e3f7020a 100644 (file)
@@ -65,13 +65,13 @@ static void com20020_copy_from_card(struct net_device *dev, int bufnum,
        int ioaddr = dev->base_addr, ofs = 512 * bufnum + offset;
 
        /* set up the address register */
-       arcnet_outb((ofs >> 8) | RDDATAflag | AUTOINCflag,
-                   ioaddr, COM20020_REG_W_ADDR_HI);
-       arcnet_outb(ofs & 0xff, ioaddr, COM20020_REG_W_ADDR_LO);
+       outb((ofs >> 8) | RDDATAflag | AUTOINCflag,
+            ioaddr + COM20020_REG_W_ADDR_HI);
+       outb(ofs & 0xff, ioaddr + COM20020_REG_W_ADDR_LO);
 
        /* copy the data */
        TIME(dev, "insb", count,
-            arcnet_insb(ioaddr, COM20020_REG_RW_MEMDATA, buf, count));
+            insb(ioaddr + COM20020_REG_RW_MEMDATA, buf, count));
 }
 
 static void com20020_copy_to_card(struct net_device *dev, int bufnum,
@@ -80,12 +80,12 @@ static void com20020_copy_to_card(struct net_device *dev, int bufnum,
        int ioaddr = dev->base_addr, ofs = 512 * bufnum + offset;
 
        /* set up the address register */
-       arcnet_outb((ofs >> 8) | AUTOINCflag, ioaddr, COM20020_REG_W_ADDR_HI);
-       arcnet_outb(ofs & 0xff, ioaddr, COM20020_REG_W_ADDR_LO);
+       outb((ofs >> 8) | AUTOINCflag, ioaddr + COM20020_REG_W_ADDR_HI);
+       outb(ofs & 0xff, ioaddr + COM20020_REG_W_ADDR_LO);
 
        /* copy the data */
        TIME(dev, "outsb", count,
-            arcnet_outsb(ioaddr, COM20020_REG_RW_MEMDATA, buf, count));
+            outsb(ioaddr + COM20020_REG_RW_MEMDATA, buf, count));
 }
 
 /* Reset the card and check some basic stuff during the detection stage. */
@@ -94,9 +94,9 @@ int com20020_check(struct net_device *dev)
        int ioaddr = dev->base_addr, status;
        struct arcnet_local *lp = netdev_priv(dev);
 
-       arcnet_outb(XTOcfg(3) | RESETcfg, ioaddr, COM20020_REG_W_CONFIG);
+       outb(XTOcfg(3) | RESETcfg, ioaddr + COM20020_REG_W_CONFIG);
        udelay(5);
-       arcnet_outb(XTOcfg(3), ioaddr, COM20020_REG_W_CONFIG);
+       outb(XTOcfg(3), ioaddr + COM20020_REG_W_CONFIG);
        mdelay(RESETtime);
 
        lp->setup = lp->clockm ? 0 : (lp->clockp << 1);
@@ -107,23 +107,23 @@ int com20020_check(struct net_device *dev)
        lp->setup = lp->setup | P1MODE;
 
        com20020_set_subaddress(lp, ioaddr, SUB_SETUP1);
-       arcnet_outb(lp->setup, ioaddr, COM20020_REG_W_XREG);
+       outb(lp->setup, ioaddr + COM20020_REG_W_XREG);
 
        if (lp->clockm != 0) {
                com20020_set_subaddress(lp, ioaddr, SUB_SETUP2);
-               arcnet_outb(lp->setup2, ioaddr, COM20020_REG_W_XREG);
+               outb(lp->setup2, ioaddr + COM20020_REG_W_XREG);
 
                /* must now write the magic "restart operation" command */
                mdelay(1);
-               arcnet_outb(STARTIOcmd, ioaddr, COM20020_REG_W_COMMAND);
+               outb(STARTIOcmd, ioaddr + COM20020_REG_W_COMMAND);
        }
 
        lp->config = (lp->timeout << 3) | (lp->backplane << 2) | SUB_NODE;
        /* set node ID to 0x42 (but transmitter is disabled, so it's okay) */
-       arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
-       arcnet_outb(0x42, ioaddr, COM20020_REG_W_XREG);
+       outb(lp->config, ioaddr + COM20020_REG_W_CONFIG);
+       outb(0x42, ioaddr + COM20020_REG_W_XREG);
 
-       status = arcnet_inb(ioaddr, COM20020_REG_R_STATUS);
+       status = inb(ioaddr + COM20020_REG_R_STATUS);
 
        if ((status & 0x99) != (NORXflag | TXFREEflag | RESETflag)) {
                arc_printk(D_NORMAL, dev, "status invalid (%Xh).\n", status);
@@ -131,18 +131,17 @@ int com20020_check(struct net_device *dev)
        }
        arc_printk(D_INIT_REASONS, dev, "status after reset: %X\n", status);
 
-       arcnet_outb(CFLAGScmd | RESETclear | CONFIGclear,
-                   ioaddr, COM20020_REG_W_COMMAND);
-       status = arcnet_inb(ioaddr, COM20020_REG_R_STATUS);
+       outb(CFLAGScmd | RESETclear | CONFIGclear,
+            ioaddr + COM20020_REG_W_COMMAND);
+       status = inb(ioaddr + COM20020_REG_R_STATUS);
        arc_printk(D_INIT_REASONS, dev, "status after reset acknowledged: %X\n",
                   status);
 
        /* Read first location of memory */
-       arcnet_outb(0 | RDDATAflag | AUTOINCflag,
-                   ioaddr, COM20020_REG_W_ADDR_HI);
-       arcnet_outb(0, ioaddr, COM20020_REG_W_ADDR_LO);
+       outb(0 | RDDATAflag | AUTOINCflag, ioaddr + COM20020_REG_W_ADDR_HI);
+       outb(0, ioaddr + COM20020_REG_W_ADDR_LO);
 
-       status = arcnet_inb(ioaddr, COM20020_REG_RW_MEMDATA);
+       status = inb(ioaddr + COM20020_REG_RW_MEMDATA);
        if (status != TESTvalue) {
                arc_printk(D_NORMAL, dev, "Signature byte not found (%02Xh != D1h).\n",
                           status);
@@ -159,7 +158,7 @@ static int com20020_set_hwaddr(struct net_device *dev, void *addr)
 
        dev_addr_set(dev, hwaddr->sa_data);
        com20020_set_subaddress(lp, ioaddr, SUB_NODE);
-       arcnet_outb(dev->dev_addr[0], ioaddr, COM20020_REG_W_XREG);
+       outb(dev->dev_addr[0], ioaddr + COM20020_REG_W_XREG);
 
        return 0;
 }
@@ -170,7 +169,7 @@ static int com20020_netdev_open(struct net_device *dev)
        struct arcnet_local *lp = netdev_priv(dev);
 
        lp->config |= TXENcfg;
-       arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
+       outb(lp->config, ioaddr + COM20020_REG_W_CONFIG);
 
        return arcnet_open(dev);
 }
@@ -184,7 +183,7 @@ static int com20020_netdev_close(struct net_device *dev)
 
        /* disable transmitter */
        lp->config &= ~TXENcfg;
-       arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
+       outb(lp->config, ioaddr + COM20020_REG_W_CONFIG);
        return 0;
 }
 
@@ -220,24 +219,24 @@ int com20020_found(struct net_device *dev, int shared)
 
        /* FIXME: do this some other way! */
        if (!dev->dev_addr[0])
-               arcnet_set_addr(dev, arcnet_inb(ioaddr, 8));
+               arcnet_set_addr(dev, inb(ioaddr + 8));
 
        com20020_set_subaddress(lp, ioaddr, SUB_SETUP1);
-       arcnet_outb(lp->setup, ioaddr, COM20020_REG_W_XREG);
+       outb(lp->setup, ioaddr + COM20020_REG_W_XREG);
 
        if (lp->card_flags & ARC_CAN_10MBIT) {
                com20020_set_subaddress(lp, ioaddr, SUB_SETUP2);
-               arcnet_outb(lp->setup2, ioaddr, COM20020_REG_W_XREG);
+               outb(lp->setup2, ioaddr + COM20020_REG_W_XREG);
 
                /* must now write the magic "restart operation" command */
                mdelay(1);
-               arcnet_outb(STARTIOcmd, ioaddr, COM20020_REG_W_COMMAND);
+               outb(STARTIOcmd, ioaddr + COM20020_REG_W_COMMAND);
        }
 
        lp->config = (lp->timeout << 3) | (lp->backplane << 2) | SUB_NODE;
        /* Default 0x38 + register: Node ID */
-       arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
-       arcnet_outb(dev->dev_addr[0], ioaddr, COM20020_REG_W_XREG);
+       outb(lp->config, ioaddr + COM20020_REG_W_CONFIG);
+       outb(dev->dev_addr[0], ioaddr + COM20020_REG_W_XREG);
 
        /* reserve the irq */
        if (request_irq(dev->irq, arcnet_interrupt, shared,
@@ -288,26 +287,26 @@ static int com20020_reset(struct net_device *dev, int really_reset)
        arc_printk(D_DEBUG, dev, "%s: %d: %s: dev: %p, lp: %p, dev->name: %s\n",
                   __FILE__, __LINE__, __func__, dev, lp, dev->name);
        arc_printk(D_INIT, dev, "Resetting %s (status=%02Xh)\n",
-                  dev->name, arcnet_inb(ioaddr, COM20020_REG_R_STATUS));
+                  dev->name, inb(ioaddr + COM20020_REG_R_STATUS));
 
        arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
        lp->config |= (lp->timeout << 3) | (lp->backplane << 2);
        /* power-up defaults */
-       arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
+       outb(lp->config, ioaddr + COM20020_REG_W_CONFIG);
        arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
 
        if (really_reset) {
                /* reset the card */
-               arcnet_outb(lp->config | RESETcfg, ioaddr, COM20020_REG_W_CONFIG);
+               outb(lp->config | RESETcfg, ioaddr + COM20020_REG_W_CONFIG);
                udelay(5);
-               arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
+               outb(lp->config, ioaddr + COM20020_REG_W_CONFIG);
                mdelay(RESETtime * 2);
                                /* COM20020 seems to be slower sometimes */
        }
        /* clear flags & end reset */
        arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
-       arcnet_outb(CFLAGScmd | RESETclear | CONFIGclear,
-                   ioaddr, COM20020_REG_W_COMMAND);
+       outb(CFLAGScmd | RESETclear | CONFIGclear,
+            ioaddr + COM20020_REG_W_COMMAND);
 
        /* verify that the ARCnet signature byte is present */
        arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
@@ -321,7 +320,7 @@ static int com20020_reset(struct net_device *dev, int really_reset)
                return 1;
        }
        /* enable extended (512-byte) packets */
-       arcnet_outb(CONFIGcmd | EXTconf, ioaddr, COM20020_REG_W_COMMAND);
+       outb(CONFIGcmd | EXTconf, ioaddr + COM20020_REG_W_COMMAND);
 
        arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
 
@@ -334,22 +333,22 @@ static void com20020_setmask(struct net_device *dev, int mask)
        u_int ioaddr = dev->base_addr;
 
        arc_printk(D_DURING, dev, "Setting mask to %x at %x\n", mask, ioaddr);
-       arcnet_outb(mask, ioaddr, COM20020_REG_W_INTMASK);
+       outb(mask, ioaddr + COM20020_REG_W_INTMASK);
 }
 
 static void com20020_command(struct net_device *dev, int cmd)
 {
        u_int ioaddr = dev->base_addr;
 
-       arcnet_outb(cmd, ioaddr, COM20020_REG_W_COMMAND);
+       outb(cmd, ioaddr + COM20020_REG_W_COMMAND);
 }
 
 static int com20020_status(struct net_device *dev)
 {
        u_int ioaddr = dev->base_addr;
 
-       return arcnet_inb(ioaddr, COM20020_REG_R_STATUS) +
-               (arcnet_inb(ioaddr, COM20020_REG_R_DIAGSTAT) << 8);
+       return inb(ioaddr + COM20020_REG_R_STATUS) +
+               (inb(ioaddr + COM20020_REG_R_DIAGSTAT) << 8);
 }
 
 static void com20020_close(struct net_device *dev)
@@ -359,7 +358,7 @@ static void com20020_close(struct net_device *dev)
 
        /* disable transmitter */
        lp->config &= ~TXENcfg;
-       arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
+       outb(lp->config, ioaddr + COM20020_REG_W_CONFIG);
 }
 
 /* ARCnet does not support multicast, only unicast and broadcast */
@@ -374,14 +373,14 @@ static void com20020_set_rx_mode(struct net_device *dev)
                        arc_printk(D_NORMAL, dev, "Setting promiscuous flag...\n");
                com20020_set_subaddress(lp, ioaddr, SUB_SETUP1);
                lp->setup |= PROMISCset;
-               arcnet_outb(lp->setup, ioaddr, COM20020_REG_W_XREG);
+               outb(lp->setup, ioaddr + COM20020_REG_W_XREG);
        } else {
                /* Disable promiscuous mode, use normal mode */
                if ((lp->setup & PROMISCset))
                        arc_printk(D_NORMAL, dev, "Resetting promiscuous flag...\n");
                com20020_set_subaddress(lp, ioaddr, SUB_SETUP1);
                lp->setup &= ~PROMISCset;
-               arcnet_outb(lp->setup, ioaddr, COM20020_REG_W_XREG);
+               outb(lp->setup, ioaddr + COM20020_REG_W_XREG);
        }
 }
 
index 0bcc5d0a6903c34e305bab525b4989d30d912f59..e7aac0e81a137513b33760f70bb308fbba33158e 100644 (file)
@@ -123,9 +123,9 @@ static inline void com20020_set_subaddress(struct arcnet_local *lp,
 {
        if (val < 4) {
                lp->config = (lp->config & ~0x03) | val;
-               arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
+               outb(lp->config, ioaddr + COM20020_REG_W_CONFIG);
        } else {
-               arcnet_outb(val, ioaddr, COM20020_REG_W_SUBADR);
+               outb(val, ioaddr + COM20020_REG_W_SUBADR);
        }
 }