Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Nov 2006 20:30:00 +0100
From:      "Attilio Rao" <attilio@freebsd.org>
To:        "Warner Losh" <imp@bsdimp.com>
Cc:        freebsd-drivers@freebsd.org, jackie7691@yahoo.com.mx
Subject:   Re: PCCARD - interruptible sleep
Message-ID:  <3bbf2fe10611081130i1e34ab2end66bf238117cfcf8@mail.gmail.com>
In-Reply-To: <20061108.100125.104107782.imp@bsdimp.com>
References:  <20061108103429.24496.qmail@web56014.mail.re3.yahoo.com> <3bbf2fe10611080543y61511b96nd49f71985e7cf6d1@mail.gmail.com> <20061108.100125.104107782.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2006/11/8, Warner Losh <imp@bsdimp.com>:
> From: "Attilio Rao" <attilio@freebsd.org>
> Subject: Re: PCCARD - interruptible sleep
> Date: Wed, 8 Nov 2006 14:43:59 +0100
>
> > 2006/11/8, Jacqueline P <jackie7691@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3bbf2fe10611081130i1e34ab2end66bf238117cfcf8>