Hi,
I have discovered that Linux has a macro called SET_MODULE_OWNER()
which sets an "owner" field to THIS_MODULE. This macro has the added
benefit of not generating any code for non-modular builds, and so I
have modified my patches accordingly.
Cheers,
Chris
--- linux-2.4.16/drivers/usb/CDCEther.c.orig Tue Dec 4 23:56:12 2001
+++ linux-2.4.16/drivers/usb/CDCEther.c Tue Dec 4 23:57:17 2001
@@ -337,13 +337,9 @@
ether_dev_t *ether_dev = (ether_dev_t *)net->priv;
int res;
- // We are finally getting used!
- MOD_INC_USE_COUNT;
-
// Turn on the USB and let the packets flow!!!
if ( (res = enable_net_traffic( ether_dev )) ) {
err( __FUNCTION__ "can't enable_net_traffic() - %d", res );
- MOD_DEC_USE_COUNT;
return -EIO;
}
@@ -390,9 +386,6 @@
usb_unlink_urb( ðer_dev->rx_urb );
usb_unlink_urb( ðer_dev->tx_urb );
usb_unlink_urb( ðer_dev->intr_urb );
-
- // We are not being used now.
- MOD_DEC_USE_COUNT;
// That's it. I'm done.
return 0;
@@ -1210,6 +1203,7 @@
// Now that we have an ethernet device, let's set it up
// (And I don't mean "set [it] up the bomb".)
net->priv = ether_dev;
+ SET_MODULE_OWNER(net);
net->open = CDCEther_open;
net->stop = CDCEther_close;
net->watchdog_timeo = CDC_ETHER_TX_TIMEOUT;
--- linux-2.4.16/drivers/usb/kaweth.c.orig Tue Dec 4 23:37:07 2001
+++ linux-2.4.16/drivers/usb/kaweth.c Tue Dec 4 23:38:07 2001
@@ -544,8 +544,6 @@
netif_start_queue(net);
- MOD_INC_USE_COUNT;
-
kaweth_async_set_rx_mode(kaweth);
return 0;
}
@@ -565,8 +563,6 @@
kaweth->status &= ~KAWETH_STATUS_CLOSING;
- MOD_DEC_USE_COUNT;
-
printk("Dev usage: %d", kaweth->dev->refcnt.counter);
return 0;
@@ -890,7 +886,8 @@
memcpy(kaweth->net->dev_addr,
&kaweth->configuration.hw_addr,
sizeof(kaweth->configuration.hw_addr));
-
+
+ SET_MODULE_OWNER(kaweth->net);
kaweth->net->priv = kaweth;
kaweth->net->open = kaweth_open;
kaweth->net->stop = kaweth_close;
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel