Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 08 Nov 2006 09:59:57 -0700 (MST)
From:      Warner Losh <imp@bsdimp.com>
To:        jackie7691@yahoo.com.mx
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: PCCARD - interruptible sleep
Message-ID:  <20061108.095957.41708696.imp@bsdimp.com>
In-Reply-To: <20061108103429.24496.qmail@web56014.mail.re3.yahoo.com>
References:  <20061108103429.24496.qmail@web56014.mail.re3.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
From: Jacqueline P <jackie7691@yahoo.com.mx>
Subject: PCCARD - interruptible sleep
Date: Wed, 8 Nov 2006 04:34:29 -0600 (CST)

> 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.

Use msleep instead to do the busy waiting, or limit the amount you
spin.

Alternatively, you can do these things in a task.

>   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 ?

No, because the device is still attached, even if the hardware is
gone.  However, you can ask "bus_child_present(your_devt)" and the
bridge will determine if the hardware is still there.

Warner



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