Thread: [Linux1394-cvslog] rev 798 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2003-02-22 08:15:42
|
Author: bencollins Date: 2003-02-22 03:15:01 -0500 (Sat, 22 Feb 2003) New Revision: 798 Modified: trunk/hosts.c trunk/hosts.h trunk/ohci1394.c trunk/pcilynx.c Log: Cleanup module ref counting. Patch from Christoph Hellwig. Modified: trunk/ohci1394.c ============================================================================== --- trunk/ohci1394.c (original) +++ trunk/ohci1394.c 2003-02-22 03:15:02.000000000 -0500 @@ -966,16 +966,6 @@ dma_trm_reset(&ohci->at_resp_context); break; - case MODIFY_USAGE: - if (arg) { - if (try_module_get(THIS_MODULE)) - retval = 1; - } else { - module_put(THIS_MODULE); - retval = 1; - } - break; - case ISO_LISTEN_CHANNEL: { u64 mask; @@ -3202,6 +3192,7 @@ } static struct hpsb_host_driver ohci1394_driver = { + .owner = THIS_MODULE, .name = OHCI1394_DRIVER_NAME, .get_rom = ohci_get_rom, .transmit_packet = ohci_transmit, Modified: trunk/hosts.c ============================================================================== --- trunk/hosts.c (original) +++ trunk/hosts.c 2003-02-22 03:15:02.000000000 -0500 @@ -11,6 +11,7 @@ */ #include <linux/config.h> +#include <linux/module.h> #include <linux/types.h> #include <linux/list.h> #include <linux/init.h> @@ -69,8 +70,7 @@ spin_lock_irqsave(&hosts_lock, flags); list_for_each(lh, &hosts) { if (host == list_entry(lh, struct hpsb_host, host_list)) { - if (host->driver->devctl(host, MODIFY_USAGE, 1)) { - host->driver->devctl(host, MODIFY_USAGE, 1); + if (try_module_get(host->driver->owner)) { host->refcount++; retval = 1; } @@ -95,7 +95,7 @@ { unsigned long flags; - host->driver->devctl(host, MODIFY_USAGE, 0); + module_put(host->driver->owner); spin_lock_irqsave(&hosts_lock, flags); host->refcount--; Modified: trunk/hosts.h ============================================================================== --- trunk/hosts.h (original) +++ trunk/hosts.h 2003-02-22 03:15:02.000000000 -0500 @@ -92,12 +92,6 @@ * Return void. */ CANCEL_REQUESTS, - /* Decrease host usage count if arg == 0, increase otherwise. Return - * 1 for success, 0 for failure. Increase usage may fail if the driver - * is in the process of shutting itself down. Decrease usage can not - * fail. */ - MODIFY_USAGE, - /* Start or stop receiving isochronous channel in arg. Return void. * This acts as an optimization hint, hosts are not required not to * listen on unrequested channels. */ @@ -147,6 +141,7 @@ }; struct hpsb_host_driver { + struct module *owner; const char *name; /* This function must store a pointer to the configuration ROM into the Modified: trunk/pcilynx.c ============================================================================== --- trunk/pcilynx.c (original) +++ trunk/pcilynx.c 2003-02-22 03:15:02.000000000 -0500 @@ -801,17 +801,6 @@ break; - case MODIFY_USAGE: - if (arg) { - if (try_module_get(THIS_MODULE)) - retval = 1; - } else { - module_put(THIS_MODULE); - retval = 1; - } - - break; - case ISO_LISTEN_CHANNEL: spin_lock_irqsave(&lynx->iso_rcv.lock, flags); @@ -1904,6 +1893,7 @@ }; static struct hpsb_host_driver lynx_driver = { + .owner = THIS_MODULE, .name = PCILYNX_DRIVER_NAME, .get_rom = get_lynx_rom, .transmit_packet = lynx_transmit, |