Re: [PATCH 1/2] New Omnikey Cardman 4040 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 14, 2005 at 02:19:43AM -0700, Andrew Morton wrote:
> Harald Welte <[email protected]> wrote:
> >
> > Add new Omnikey Cardman 4040 smartcard reader driver
> >
> 
> I see a timer, but I see no del_timer_sync() anywhere.  Cannot the timer be
> left pending after device shutdown or rmmod?

Please see the patch below (against -rc1-mm1):

[CM4040] CardMan 4040 Driver Update

* Don't initialize variable in bss
* Introduce and use function to stop polling timer
* Remove unneeded dev_info variable

Signed-off-by: Harald Welte <[email protected]>

--- a/drivers/char/pcmcia/cm4040_cs.c	2005-09-18 18:56:29.000000000 +0200
+++ b/drivers/char/pcmcia/cm4040_cs.c	2005-09-18 20:17:14.000000000 +0200
@@ -85,8 +85,7 @@
 	struct timer_list 	poll_timer;
 };
 
-static dev_info_t dev_info = MODULE_NAME;
-static dev_link_t *dev_table[CM_MAX_DEV] = { NULL, };
+static dev_link_t *dev_table[CM_MAX_DEV];
 
 #ifndef PCMCIA_DEBUG
 #define	xoutb	outb
@@ -138,6 +137,11 @@
 	mod_timer(&dev->poll_timer, jiffies + POLL_PERIOD);
 }
 
+static void cm4040_stop_poll(struct reader_dev *dev)
+{
+	del_timer_sync(&dev->poll_timer);
+}
+
 static int wait_for_bulk_out_ready(struct reader_dev *dev)
 {
 	int i, rc;
@@ -485,6 +489,8 @@
 	if (link == NULL)
 		return -ENODEV;
 
+	cm4040_stop_poll(dev);
+
 	link->open = 0;
 	wake_up(&dev->devq);
 
@@ -627,7 +633,7 @@
 
 	link->state |= DEV_SUSPEND;
 	if (link->state & DEV_CONFIG)
-		pcmcia_release_configuration(link->handle);
+		pcmcia_release_configuration(p_dev);
 
 	return 0;
 }
@@ -643,7 +649,6 @@
 	return 0;
 }
 
-
 static void reader_release(dev_link_t *link)
 {
 	cm4040_reader_release(link->priv);
@@ -713,6 +718,8 @@
 	if (link->state & DEV_CONFIG)
 		reader_release(link);
 
+	cm4040_stop_poll(dev);
+
 	dev_table[devno] = NULL;
 	kfree(dev);
 
-- 
- Harald Welte <[email protected]>          	        http://gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)

Attachment: pgpOZB1LTE98Y.pgp
Description: PGP signature


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux