> I got another idea: if we have a guarantee that the two USB > interfaces are probed one at a time, then we can move the global > things into struct rtl_priv. The first probe call will allocate > the arrays and initialise the mutexes. The second probe call > will obtain those from the first struct rtl_priv: > > int rtl_usb_probe(struct usb_interface *intf, ...) { > udev = interface_to_usbdev(intf); > struct ieee80211_hw *first_hw = usb_get_intfdata(udev->actconfig->interface[0]); > struct rtl_priv *first_rtlpriv = rtl_priv(first_hw); > Could it have racing when obtaining mutexes from second probe? Should we need a lock to ensure the sequence? When driver is going to down, how can mutexes get free safely? It seems like we still need another global lock to ensure that.