mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Fix bogus busying mechanism from cdevsw callbacks:
- D_TRACKCLOSE may be used there as d_close() are expected to match up d_open() calls - Replace the hand-crafted counter and flag with the device_busy()/device_unbusy() proper usage. Sponsored by: Sandvine Incorporated Reported by: Mark Johnston <mjohnston at sandvine dot com> Tested by: Mark Johnston Reviewed by: emaste MFC after: 10 days
This commit is contained in:
parent
89d10571db
commit
04f798ecea
2 changed files with 4 additions and 12 deletions
|
|
@ -212,7 +212,7 @@ static struct aac_mntinforesp *
|
|||
|
||||
static struct cdevsw aac_cdevsw = {
|
||||
.d_version = D_VERSION,
|
||||
.d_flags = D_NEEDGIANT,
|
||||
.d_flags = D_NEEDGIANT | D_TRACKCLOSE,
|
||||
.d_open = aac_open,
|
||||
.d_close = aac_close,
|
||||
.d_ioctl = aac_ioctl,
|
||||
|
|
@ -660,9 +660,6 @@ aac_detach(device_t dev)
|
|||
sc = device_get_softc(dev);
|
||||
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
|
||||
|
||||
if (sc->aac_state & AAC_STATE_OPEN)
|
||||
return(EBUSY);
|
||||
|
||||
callout_drain(&sc->aac_daemontime);
|
||||
|
||||
/* Remove the child containers */
|
||||
|
|
@ -2804,8 +2801,7 @@ aac_open(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||
|
||||
sc = dev->si_drv1;
|
||||
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
|
||||
sc->aac_open_cnt++;
|
||||
sc->aac_state |= AAC_STATE_OPEN;
|
||||
device_busy(sc->aac_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2817,10 +2813,7 @@ aac_close(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||
|
||||
sc = dev->si_drv1;
|
||||
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
|
||||
sc->aac_open_cnt--;
|
||||
/* Mark this unit as no longer open */
|
||||
if (sc->aac_open_cnt == 0)
|
||||
sc->aac_state &= ~AAC_STATE_OPEN;
|
||||
device_unbusy(sc->aac_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,10 +319,9 @@ struct aac_softc
|
|||
/* controller features, limits and status */
|
||||
int aac_state;
|
||||
#define AAC_STATE_SUSPEND (1<<0)
|
||||
#define AAC_STATE_OPEN (1<<1)
|
||||
#define AAC_STATE_UNUSED0 (1<<1)
|
||||
#define AAC_STATE_INTERRUPTS_ON (1<<2)
|
||||
#define AAC_STATE_AIF_SLEEPER (1<<3)
|
||||
int aac_open_cnt;
|
||||
struct FsaRevision aac_revision;
|
||||
|
||||
/* controller hardware interface */
|
||||
|
|
|
|||
Loading…
Reference in a new issue