From owner-freebsd-drivers@FreeBSD.ORG Wed Nov 8 13:44:02 2006 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E111F16A407 for ; Wed, 8 Nov 2006 13:44:02 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.236]) by mx1.FreeBSD.org (Postfix) with ESMTP id 47F3643D5F for ; Wed, 8 Nov 2006 13:44:00 +0000 (GMT) (envelope-from asmrookie@gmail.com) Received: by wx-out-0506.google.com with SMTP id i27so1606660wxd for ; Wed, 08 Nov 2006 05:43:59 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=LdDg4+g+RqmifMMacSQZAVAorwdu+HRUkDwBK87132kZpGQ94jz9A8zpZoAldKSgC1ItswYrX+6GaLblLcbyXe+OZ+N2y5bNkOGGLCe0z1qkEJX74w1sbgMGexU6bkJJ6E5npYu/Rt2QepYHfAhxUCjZiwmt8kxDzT4iDwc0JEw= Received: by 10.70.91.11 with SMTP id o11mr9489638wxb.1162993439662; Wed, 08 Nov 2006 05:43:59 -0800 (PST) Received: by 10.70.12.2 with HTTP; Wed, 8 Nov 2006 05:43:59 -0800 (PST) Message-ID: <3bbf2fe10611080543y61511b96nd49f71985e7cf6d1@mail.gmail.com> Date: Wed, 8 Nov 2006 14:43:59 +0100 From: "Attilio Rao" Sender: asmrookie@gmail.com To: "Jacqueline P" , freebsd-drivers@freebsd.org In-Reply-To: <20061108103429.24496.qmail@web56014.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20061108103429.24496.qmail@web56014.mail.re3.yahoo.com> X-Google-Sender-Auth: ae155cad57c2dd32 Cc: Subject: Re: PCCARD - interruptible sleep X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2006 13:44:03 -0000 2006/11/8, Jacqueline P : > 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). Attilio -- Peace can only be achieved by understanding - A. Einstein