Use device_lookup_private() to get softc.
This commit is contained in:
parent
40b72ee81a
commit
a0e4edbb58
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: maple.c,v 1.37 2008/06/04 12:41:41 ad Exp $ */
|
/* $NetBSD: maple.c,v 1.38 2008/06/08 16:39:43 tsutsui Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||||
@ -62,7 +62,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.37 2008/06/04 12:41:41 ad Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.38 2008/06/08 16:39:43 tsutsui Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/device.h>
|
#include <sys/device.h>
|
||||||
@ -1602,7 +1602,7 @@ mapleopen(dev_t dev, int flag, int mode, struct lwp *l)
|
|||||||
{
|
{
|
||||||
struct maple_softc *sc;
|
struct maple_softc *sc;
|
||||||
|
|
||||||
sc = device_lookup(&maple_cd, MAPLEBUSUNIT(dev));
|
sc = device_lookup_private(&maple_cd, MAPLEBUSUNIT(dev));
|
||||||
if (sc == NULL) /* make sure it was attached */
|
if (sc == NULL) /* make sure it was attached */
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
@ -1625,7 +1625,7 @@ mapleclose(dev_t dev, int flag, int mode, struct lwp *l)
|
|||||||
{
|
{
|
||||||
struct maple_softc *sc;
|
struct maple_softc *sc;
|
||||||
|
|
||||||
sc = device_lookup(&maple_cd, MAPLEBUSUNIT(dev));
|
sc = device_lookup_private(&maple_cd, MAPLEBUSUNIT(dev));
|
||||||
|
|
||||||
sc->sc_port_units_open[MAPLEPORT(dev)] &= ~(1 << MAPLESUBUNIT(dev));
|
sc->sc_port_units_open[MAPLEPORT(dev)] &= ~(1 << MAPLESUBUNIT(dev));
|
||||||
|
|
||||||
@ -1658,7 +1658,7 @@ mapleioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
|||||||
struct maple_softc *sc;
|
struct maple_softc *sc;
|
||||||
struct maple_unit *u;
|
struct maple_unit *u;
|
||||||
|
|
||||||
sc = device_lookup(&maple_cd, MAPLEBUSUNIT(dev));
|
sc = device_lookup_private(&maple_cd, MAPLEBUSUNIT(dev));
|
||||||
u = &sc->sc_unit[MAPLEPORT(dev)][MAPLESUBUNIT(dev)];
|
u = &sc->sc_unit[MAPLEPORT(dev)][MAPLESUBUNIT(dev)];
|
||||||
|
|
||||||
return maple_unit_ioctl(&sc->sc_dev, u, cmd, data, flag, l);
|
return maple_unit_ioctl(&sc->sc_dev, u, cmd, data, flag, l);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: mlcd.c,v 1.9 2008/04/28 20:23:16 martin Exp $ */
|
/* $NetBSD: mlcd.c,v 1.10 2008/06/08 16:39:43 tsutsui Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: mlcd.c,v 1.9 2008/04/28 20:23:16 martin Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: mlcd.c,v 1.10 2008/06/08 16:39:43 tsutsui Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/device.h>
|
#include <sys/device.h>
|
||||||
@ -464,7 +464,7 @@ mlcdopen(dev_t dev, int flags, int devtype, struct lwp *l)
|
|||||||
|
|
||||||
unit = MLCD_UNIT(dev);
|
unit = MLCD_UNIT(dev);
|
||||||
part = MLCD_PART(dev);
|
part = MLCD_PART(dev);
|
||||||
if ((sc = device_lookup(&mlcd_cd, unit)) == NULL
|
if ((sc = device_lookup_private(&mlcd_cd, unit)) == NULL
|
||||||
|| sc->sc_stat == MLCD_INIT
|
|| sc->sc_stat == MLCD_INIT
|
||||||
|| sc->sc_stat == MLCD_INIT2
|
|| sc->sc_stat == MLCD_INIT2
|
||||||
|| part >= sc->sc_npt || (pt = &sc->sc_pt[part])->pt_flags == 0)
|
|| part >= sc->sc_npt || (pt = &sc->sc_pt[part])->pt_flags == 0)
|
||||||
@ -604,7 +604,7 @@ mlcd_buf_alloc(int dev, int flags)
|
|||||||
* malloc() may sleep, and the device may be detached during sleep.
|
* malloc() may sleep, and the device may be detached during sleep.
|
||||||
* XXX this check is not complete.
|
* XXX this check is not complete.
|
||||||
*/
|
*/
|
||||||
if (sc != device_lookup(&mlcd_cd, unit)
|
if (sc != device_lookup_private(&mlcd_cd, unit)
|
||||||
|| sc->sc_stat == MLCD_INIT
|
|| sc->sc_stat == MLCD_INIT
|
||||||
|| sc->sc_stat == MLCD_INIT2
|
|| sc->sc_stat == MLCD_INIT2
|
||||||
|| part >= sc->sc_npt || pt != &sc->sc_pt[part]
|
|| part >= sc->sc_npt || pt != &sc->sc_pt[part]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: mmemcard.c,v 1.15 2008/04/28 20:23:16 martin Exp $ */
|
/* $NetBSD: mmemcard.c,v 1.16 2008/06/08 16:39:43 tsutsui Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: mmemcard.c,v 1.15 2008/04/28 20:23:16 martin Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: mmemcard.c,v 1.16 2008/06/08 16:39:43 tsutsui Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
@ -622,7 +622,7 @@ mmemopen(dev_t dev, int flags, int devtype, struct lwp *l)
|
|||||||
unit = MMEM_UNIT(diskunit);
|
unit = MMEM_UNIT(diskunit);
|
||||||
part = MMEM_PART(diskunit);
|
part = MMEM_PART(diskunit);
|
||||||
labelpart = DISKPART(dev);
|
labelpart = DISKPART(dev);
|
||||||
if ((sc = device_lookup(&mmem_cd, unit)) == NULL
|
if ((sc = device_lookup_private(&mmem_cd, unit)) == NULL
|
||||||
|| sc->sc_stat == MMEM_INIT
|
|| sc->sc_stat == MMEM_INIT
|
||||||
|| sc->sc_stat == MMEM_INIT2
|
|| sc->sc_stat == MMEM_INIT2
|
||||||
|| part >= sc->sc_npt || (pt = &sc->sc_pt[part])->pt_flags == 0)
|
|| part >= sc->sc_npt || (pt = &sc->sc_pt[part])->pt_flags == 0)
|
||||||
@ -677,7 +677,7 @@ mmemstrategy(struct buf *bp)
|
|||||||
diskunit = DISKUNIT(bp->b_dev);
|
diskunit = DISKUNIT(bp->b_dev);
|
||||||
unit = MMEM_UNIT(diskunit);
|
unit = MMEM_UNIT(diskunit);
|
||||||
part = MMEM_PART(diskunit);
|
part = MMEM_PART(diskunit);
|
||||||
if ((sc = device_lookup(&mmem_cd, unit)) == NULL
|
if ((sc = device_lookup_private(&mmem_cd, unit)) == NULL
|
||||||
|| sc->sc_stat == MMEM_INIT
|
|| sc->sc_stat == MMEM_INIT
|
||||||
|| sc->sc_stat == MMEM_INIT2
|
|| sc->sc_stat == MMEM_INIT2
|
||||||
|| part >= sc->sc_npt || (pt = &sc->sc_pt[part])->pt_flags == 0)
|
|| part >= sc->sc_npt || (pt = &sc->sc_pt[part])->pt_flags == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user