Re: [PATCH] New: Omnikey CardMan 4040 PCMCIA Driver

From: Harald Welte
Date: Mon Sep 05 2005 - 11:39:22 EST


On Sat, Sep 03, 2005 at 04:27:00PM -0500, Chase Venters wrote:
> > Below you can find a driver for the Omnikey CardMan 4040 PCMCIA
> > Smartcard Reader.
>
> Someone correct me if I'm wrong, but wouldn't these #defines be a problem with
> the new HZ flexibility:
>
> #define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ)
> #define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ)
> #define CCID_DRIVER_MINIMUM_TIMEOUT (3*HZ)

The defines above certainly have no problems. They want to wait for
multiples of seconds.

> /* how often to poll for fifo status change */
> #define POLL_PERIOD (HZ/100)
>
> In particular, 2.6.13 allows a HZ of 100, which would define POLL_PERIOD to 0.
> Your later calls to mod_timer would be setting cmx_poll_timer to the current
> value of jiffies.

100/100 == 1. As far as my limited math skills go, only 0 divided by
something can give a result of zero ;)

So yes, the code would poll every 1/100th of a second, even with HZ=100.

Obviously, if HZ would ever go below 100, the code above would provide
some problems. I'm not sure what the future plans with HZ are, but I'll
add an #error statement in case HZ goes smaller than that.

> Also, you've got a typo in the comments:

thanks.

--
- Harald Welte <laforge@xxxxxxxxxxxx> http://gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)

Attachment: pgp00000.pgp
Description: PGP signature