svn commit: r212756 - head/sys/dev/aac
Attilio Rao
attilio at FreeBSD.org
Thu Sep 16 17:49:10 UTC 2010
Author: attilio
Date: Thu Sep 16 17:49:10 2010
New Revision: 212756
URL: http://svn.freebsd.org/changeset/base/212756
Log:
Implement device unbusying via a cdevpriv destructor.
Suggested by: jhb
Tested by: Mark Johnston <mjohnston at sandvine dot com>
Reviewed by: emaste, jhb
MFC after: 10 days
X-MFC: r212661
Modified:
head/sys/dev/aac/aac.c
Modified: head/sys/dev/aac/aac.c
==============================================================================
--- head/sys/dev/aac/aac.c Thu Sep 16 17:32:37 2010 (r212755)
+++ head/sys/dev/aac/aac.c Thu Sep 16 17:49:10 2010 (r212756)
@@ -189,9 +189,9 @@ static char *aac_describe_code(struct aa
/* Management Interface */
static d_open_t aac_open;
-static d_close_t aac_close;
static d_ioctl_t aac_ioctl;
static d_poll_t aac_poll;
+static void aac_cdevpriv_dtor(void *arg);
static int aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib);
static int aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t arg);
static void aac_handle_aif(struct aac_softc *sc,
@@ -212,9 +212,8 @@ static struct aac_mntinforesp *
static struct cdevsw aac_cdevsw = {
.d_version = D_VERSION,
- .d_flags = D_NEEDGIANT | D_TRACKCLOSE,
+ .d_flags = D_NEEDGIANT,
.d_open = aac_open,
- .d_close = aac_close,
.d_ioctl = aac_ioctl,
.d_poll = aac_poll,
.d_name = "aac",
@@ -2802,18 +2801,7 @@ aac_open(struct cdev *dev, int flags, in
sc = dev->si_drv1;
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
device_busy(sc->aac_dev);
-
- return 0;
-}
-
-static int
-aac_close(struct cdev *dev, int flags, int fmt, struct thread *td)
-{
- struct aac_softc *sc;
-
- sc = dev->si_drv1;
- fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
- device_unbusy(sc->aac_dev);
+ devfs_set_cdevpriv(sc, aac_cdevpriv_dtor);
return 0;
}
@@ -3201,6 +3189,21 @@ out:
}
/*
+ * cdevpriv interface private destructor.
+ */
+static void
+aac_cdevpriv_dtor(void *arg)
+{
+ struct aac_softc *sc;
+
+ sc = arg;
+ fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
+ mtx_lock(&Giant);
+ device_unbusy(sc->aac_dev);
+ mtx_unlock(&Giant);
+}
+
+/*
* Handle an AIF sent to us by the controller; queue it for later reference.
* If the queue fills up, then drop the older entries.
*/
More information about the svn-src-all
mailing list