PCCARD - interruptible sleep
Attilio Rao
attilio at freebsd.org
Wed Nov 8 19:31:41 UTC 2006
2006/11/8, Warner Losh <imp at bsdimp.com>:
> From: "Attilio Rao" <attilio at freebsd.org>
> Subject: Re: PCCARD - interruptible sleep
> Date: Wed, 8 Nov 2006 14:43:59 +0100
>
> > 2006/11/8, Jacqueline P <jackie7691 at yahoo.com.mx>:
> > > Hi all
> > >
> > > how can I implement an interruptible sleep within my pccard smart card reader driver like ?
> > > For Linux I do this the following way
> > >
> > > // interruptible_pause()
> > > static inline void ipause(unsigned long amount) {
> > > set_current_state(TASK_INTERRUPTIBLE);
> > > schedule_timeout(amount);
> > > }
> > >
> > > and within my driver I use the function DELAY which does a busy wait.
> > >
> > > The problem is, that the driver does not recognize when the pccard is detached during a read / write operation.
> > >
> > > Does the kernel update the struct device_t, so that the driver can use the function device_is_attached() to determine that the device is detached ?
> >
> > You can implement a 'dying' flag in your softc structure (and
> > subsequent macro in order to handle).
>
> But that won't tell you if the hardware has disappeared. Experience
> has shown that dying isn't such a good idea in many cases and tends to
> cause more races than it solves.
Nothing that can't be solved with a softc lock?
Give an example please.
Attilio
--
Peace can only be achieved by understanding - A. Einstein
More information about the freebsd-drivers
mailing list