use device_lookup_private to get softc
This commit is contained in:
parent
ee1dc8ea5f
commit
708f88d69f
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: qd.c,v 1.43 2008/03/11 05:34:01 matt Exp $ */
|
/* $NetBSD: qd.c,v 1.44 2008/06/12 23:06:14 cegger Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1988 Regents of the University of California.
|
* Copyright (c) 1988 Regents of the University of California.
|
||||||
@ -58,7 +58,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: qd.c,v 1.43 2008/03/11 05:34:01 matt Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: qd.c,v 1.44 2008/06/12 23:06:14 cegger Exp $");
|
||||||
|
|
||||||
#include "opt_ddb.h"
|
#include "opt_ddb.h"
|
||||||
|
|
||||||
@ -792,14 +792,12 @@ void qd_attach(parent, self, aux)
|
|||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
int
|
int
|
||||||
qdopen(dev, flag, mode, p)
|
qdopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||||
dev_t dev;
|
|
||||||
int flag, mode;
|
|
||||||
struct proc *p;
|
|
||||||
{
|
{
|
||||||
volatile struct dga *dga; /* ptr to gate array struct */
|
volatile struct dga *dga; /* ptr to gate array struct */
|
||||||
struct tty *tp;
|
struct tty *tp;
|
||||||
volatile struct duart *duart;
|
volatile struct duart *duart;
|
||||||
|
struct uba_softc *sc;
|
||||||
int unit;
|
int unit;
|
||||||
int minor_dev;
|
int minor_dev;
|
||||||
|
|
||||||
@ -809,8 +807,9 @@ qdopen(dev, flag, mode, p)
|
|||||||
/*
|
/*
|
||||||
* check for illegal conditions
|
* check for illegal conditions
|
||||||
*/
|
*/
|
||||||
if (unit >= qd_cd.cd_ndevs || qd_cd.cd_devs[unit] == NULL)
|
sc = device_lookup_private(&qd_cd, unit);
|
||||||
return (ENXIO); /* no such device or address */
|
if (sc == NULL)
|
||||||
|
return ENXIO;
|
||||||
|
|
||||||
duart = (struct duart *) qdmap[unit].duart;
|
duart = (struct duart *) qdmap[unit].duart;
|
||||||
dga = (struct dga *) qdmap[unit].dga;
|
dga = (struct dga *) qdmap[unit].dga;
|
||||||
@ -878,10 +877,7 @@ qdopen(dev, flag, mode, p)
|
|||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
int
|
int
|
||||||
qdclose(dev, flag, mode, p)
|
qdclose(dev_t dev, int flag, int mode, struct proc *p)
|
||||||
dev_t dev;
|
|
||||||
int flag, mode;
|
|
||||||
struct proc *p;
|
|
||||||
{
|
{
|
||||||
struct tty *tp;
|
struct tty *tp;
|
||||||
struct qdmap *qd;
|
struct qdmap *qd;
|
||||||
@ -899,8 +895,7 @@ qdclose(dev, flag, mode, p)
|
|||||||
unit = minor_dev >> 2; /* get QDSS number */
|
unit = minor_dev >> 2; /* get QDSS number */
|
||||||
qd = &qdmap[unit];
|
qd = &qdmap[unit];
|
||||||
|
|
||||||
uh = (struct uba_softc *)
|
uh = device_private(device_parent(device_lookup(&qd_cd, unit)));
|
||||||
device_parent((device_t )(qd_cd.cd_devs[unit]));
|
|
||||||
|
|
||||||
|
|
||||||
if ((minor_dev & 0x03) == 2) {
|
if ((minor_dev & 0x03) == 2) {
|
||||||
@ -1102,8 +1097,7 @@ qdioctl(dev, cmd, datap, flags, p)
|
|||||||
short *temp; /* a pointer to template RAM */
|
short *temp; /* a pointer to template RAM */
|
||||||
struct uba_softc *uh;
|
struct uba_softc *uh;
|
||||||
|
|
||||||
uh = (struct uba_softc *)
|
uh = device_private(device_parent(device_lookup(&qd_cd, unit)));
|
||||||
device_parent((device_t )(qd_cd.cd_devs[unit]));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* service graphic device ioctl commands
|
* service graphic device ioctl commands
|
||||||
@ -1718,8 +1712,7 @@ qd_strategy(bp)
|
|||||||
|
|
||||||
unit = (minor(bp->b_dev) >> 2) & 0x07;
|
unit = (minor(bp->b_dev) >> 2) & 0x07;
|
||||||
|
|
||||||
uh = (struct uba_softc *)
|
uh = device_private(device_parent(device_lookup(&qd_cd, unit)));
|
||||||
device_parent((device_t )(qd_cd.cd_devs[unit]));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* init pointers
|
* init pointers
|
||||||
@ -2313,8 +2306,7 @@ qdaint(arg)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qdiint(arg)
|
qdiint(void *arg)
|
||||||
void *arg;
|
|
||||||
{
|
{
|
||||||
device_t dv = arg;
|
device_t dv = arg;
|
||||||
struct _vs_event *event;
|
struct _vs_event *event;
|
||||||
@ -2785,7 +2777,7 @@ GET_TBUTTON:
|
|||||||
if (qdpolling)
|
if (qdpolling)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (unit >= qd_cd.cd_ndevs || qd_cd.cd_devs[unit] == NULL)
|
if (unit >= qd_cd.cd_ndevs || device_lookup(&qd_cd, unit) == NULL)
|
||||||
return; /* no such device or address */
|
return; /* no such device or address */
|
||||||
|
|
||||||
tp = qd_tty[unit << 2];
|
tp = qd_tty[unit << 2];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: agten.c,v 1.14 2008/05/17 17:55:50 macallan Exp $ */
|
/* $NetBSD: agten.c,v 1.15 2008/06/12 23:06:14 cegger Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 Michael Lorenz
|
* Copyright (c) 2007 Michael Lorenz
|
||||||
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: agten.c,v 1.14 2008/05/17 17:55:50 macallan Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: agten.c,v 1.15 2008/06/12 23:06:14 cegger Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* a driver for the Fujitsu AG-10e SBus framebuffer
|
* a driver for the Fujitsu AG-10e SBus framebuffer
|
||||||
@ -914,10 +914,10 @@ agten_fb_unblank(device_t dev)
|
|||||||
static int
|
static int
|
||||||
agten_fb_open(dev_t dev, int flags, int mode, struct lwp *l)
|
agten_fb_open(dev_t dev, int flags, int mode, struct lwp *l)
|
||||||
{
|
{
|
||||||
struct agten_softc *sc = device_private(agten_cd.cd_devs[minor(dev)]);
|
struct agten_softc *sc;
|
||||||
int unit = minor(dev);
|
|
||||||
|
|
||||||
if (unit >= agten_cd.cd_ndevs || agten_cd.cd_devs[unit] == NULL)
|
sc = device_lookup_private(&agten_cd, minor(dev));
|
||||||
|
if (sc == NULL)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
if (sc->sc_fb_is_open)
|
if (sc->sc_fb_is_open)
|
||||||
return 0;
|
return 0;
|
||||||
@ -931,7 +931,9 @@ agten_fb_open(dev_t dev, int flags, int mode, struct lwp *l)
|
|||||||
static int
|
static int
|
||||||
agten_fb_close(dev_t dev, int flags, int mode, struct lwp *l)
|
agten_fb_close(dev_t dev, int flags, int mode, struct lwp *l)
|
||||||
{
|
{
|
||||||
struct agten_softc *sc = device_private(agten_cd.cd_devs[minor(dev)]);
|
struct agten_softc *sc;
|
||||||
|
|
||||||
|
sc = device_lookup_private(&agten_cd, minor(dev));
|
||||||
|
|
||||||
sc->sc_fb_is_open--;
|
sc->sc_fb_is_open--;
|
||||||
if (sc->sc_fb_is_open < 0)
|
if (sc->sc_fb_is_open < 0)
|
||||||
@ -948,7 +950,7 @@ agten_fb_close(dev_t dev, int flags, int mode, struct lwp *l)
|
|||||||
static int
|
static int
|
||||||
agten_fb_ioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l)
|
agten_fb_ioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l)
|
||||||
{
|
{
|
||||||
struct agten_softc *sc = device_private(agten_cd.cd_devs[minor(dev)]);
|
struct agten_softc *sc = device_lookup_private(&agten_cd, minor(dev));
|
||||||
struct fbgattr *fba;
|
struct fbgattr *fba;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -1043,7 +1045,7 @@ agten_fb_ioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l)
|
|||||||
static paddr_t
|
static paddr_t
|
||||||
agten_fb_mmap(dev_t dev, off_t off, int prot)
|
agten_fb_mmap(dev_t dev, off_t off, int prot)
|
||||||
{
|
{
|
||||||
struct agten_softc *sc = device_private(agten_cd.cd_devs[minor(dev)]);
|
struct agten_softc *sc = device_lookup_private(&agten_cd, minor(dev));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mappings are subject to change
|
* mappings are subject to change
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: cd.c,v 1.281 2008/05/12 21:39:56 jnemeth Exp $ */
|
/* $NetBSD: cd.c,v 1.282 2008/06/12 23:06:14 cegger Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
|
* Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
|
||||||
@ -50,7 +50,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.281 2008/05/12 21:39:56 jnemeth Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.282 2008/06/12 23:06:14 cegger Exp $");
|
||||||
|
|
||||||
#include "rnd.h"
|
#include "rnd.h"
|
||||||
|
|
||||||
@ -934,7 +934,7 @@ cdbounce(struct buf *bp)
|
|||||||
struct cdbounce *bounce = (struct cdbounce *)bp->b_private;
|
struct cdbounce *bounce = (struct cdbounce *)bp->b_private;
|
||||||
struct buf *obp = bounce->obp;
|
struct buf *obp = bounce->obp;
|
||||||
struct cd_softc *cd =
|
struct cd_softc *cd =
|
||||||
device_private(cd_cd.cd_devs[CDUNIT(obp->b_dev)]);
|
device_lookup_private(&cd_cd, CDUNIT(obp->b_dev));
|
||||||
struct disklabel *lp = cd->sc_dk.dk_label;
|
struct disklabel *lp = cd->sc_dk.dk_label;
|
||||||
|
|
||||||
if (bp->b_error != 0) {
|
if (bp->b_error != 0) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: sequencer.c,v 1.48 2008/04/28 20:23:47 martin Exp $ */
|
/* $NetBSD: sequencer.c,v 1.49 2008/06/12 23:06:14 cegger Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.48 2008/04/28 20:23:47 martin Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.49 2008/06/12 23:06:14 cegger Exp $");
|
||||||
|
|
||||||
#include "sequencer.h"
|
#include "sequencer.h"
|
||||||
|
|
||||||
@ -1182,7 +1182,7 @@ midiseq_open(int unit, int flags)
|
|||||||
error = cdev_open(dev, flags, 0, 0);
|
error = cdev_open(dev, flags, 0, 0);
|
||||||
if (error)
|
if (error)
|
||||||
return (0);
|
return (0);
|
||||||
sc = device_private(midi_cd.cd_devs[unit]);
|
sc = device_lookup_private(&midi_cd, unit);
|
||||||
sc->seqopen = 1;
|
sc->seqopen = 1;
|
||||||
md = malloc(sizeof *md, M_DEVBUF, M_WAITOK|M_ZERO);
|
md = malloc(sizeof *md, M_DEVBUF, M_WAITOK|M_ZERO);
|
||||||
sc->seq_md = md;
|
sc->seq_md = md;
|
||||||
|
Loading…
Reference in New Issue
Block a user