Hi,

ifm_status name is used twice in struct ifmediareq and ifmedia.

net/if.h:       uint64_t        ifm_status;             /* media status */
net/if_media.h: ifm_stat_cb_t   ifm_status;     /* media status driver callback 
*/

Can we rename one of them?  Makes reading the code and grepping
easier.  struct ifmedia is within #ifdef _KERNEL.  Calling both
callbacks _cb keeps them consistent.

ok?

bluhm

Index: dev/pci/if_pcn.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/dev/pci/if_pcn.c,v
retrieving revision 1.47
diff -u -p -r1.47 if_pcn.c
--- dev/pci/if_pcn.c    11 Mar 2022 18:00:48 -0000      1.47
+++ dev/pci/if_pcn.c    9 Jul 2022 18:38:12 -0000
@@ -1622,7 +1622,7 @@ pcn_init(struct ifnet *ifp)
        }
 
        /* Set the media. */
-       (void) (*sc->sc_mii.mii_media.ifm_change)(ifp);
+       (void) (*sc->sc_mii.mii_media.ifm_change_cb)(ifp);
 
        /* Enable interrupts and external activity (and ACK IDON). */
        pcn_csr_write(sc, LE_CSR0, LE_C0_INEA|LE_C0_STRT|LE_C0_IDON);
Index: dev/usb/if_athn_usb.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/dev/usb/if_athn_usb.c,v
retrieving revision 1.64
diff -u -p -r1.64 if_athn_usb.c
--- dev/usb/if_athn_usb.c       21 Apr 2022 21:03:03 -0000      1.64
+++ dev/usb/if_athn_usb.c       9 Jul 2022 18:37:57 -0000
@@ -354,7 +354,7 @@ athn_usb_attachhook(struct device *self)
        ic->ic_ampdu_tx_stop = athn_usb_ampdu_tx_stop;
 #endif
        ic->ic_newstate = athn_usb_newstate;
-       ic->ic_media.ifm_change = athn_usb_media_change;
+       ic->ic_media.ifm_change_cb = athn_usb_media_change;
        timeout_set(&sc->scan_to, athn_usb_next_scan, usc);
 
        ops->rx_enable = athn_usb_rx_enable;
Index: net/if_media.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_media.c,v
retrieving revision 1.32
diff -u -p -r1.32 if_media.c
--- net/if_media.c      7 Apr 2022 16:41:13 -0000       1.32
+++ net/if_media.c      9 Jul 2022 18:37:01 -0000
@@ -113,8 +113,8 @@ ifmedia_init(struct ifmedia *ifm, uint64
        ifm->ifm_cur = NULL;
        ifm->ifm_media = 0;
        ifm->ifm_mask = dontcare_mask;          /* IF don't-care bits */
-       ifm->ifm_change = change_callback;
-       ifm->ifm_status = status_callback;
+       ifm->ifm_change_cb = change_callback;
+       ifm->ifm_status_cb = status_callback;
 }
 
 /*
@@ -276,7 +276,7 @@ ifmedia_ioctl(struct ifnet *ifp, struct 
                oldmedia = ifm->ifm_media;
                ifm->ifm_cur = match;
                ifm->ifm_media = newmedia;
-               error = (*ifm->ifm_change)(ifp);
+               error = (*ifm->ifm_change_cb)(ifp);
                if (error && error != ENETRESET) {
                        ifm->ifm_cur = oldentry;
                        ifm->ifm_media = oldmedia;
@@ -300,7 +300,7 @@ ifmedia_ioctl(struct ifnet *ifp, struct 
                    ifm->ifm_cur->ifm_media : IFM_NONE;
                ifmr->ifm_mask = ifm->ifm_mask;
                ifmr->ifm_status = 0;
-               (*ifm->ifm_status)(ifp, ifmr);
+               (*ifm->ifm_status_cb)(ifp, ifmr);
 
                /*
                 * Count them so we know a-priori how much is the max we'll
Index: net/if_media.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_media.h,v
retrieving revision 1.42
diff -u -p -r1.42 if_media.h
--- net/if_media.h      10 Nov 2021 04:46:25 -0000      1.42
+++ net/if_media.h      9 Jul 2022 18:36:23 -0000
@@ -98,8 +98,8 @@ struct ifmedia {
        uint64_t        ifm_media;      /* current user-set media word */
        struct ifmedia_entry *ifm_cur;  /* currently selected media */
        TAILQ_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */
-       ifm_change_cb_t ifm_change;     /* media change driver callback */
-       ifm_stat_cb_t   ifm_status;     /* media status driver callback */
+       ifm_change_cb_t ifm_change_cb;  /* media change driver callback */
+       ifm_stat_cb_t   ifm_status_cb;  /* media status driver callback */
 };
 
 /* Initialize an interface's struct if_media field. */

Reply via email to