Fix device_t/softc split botches that could be fatal. From
Chuck Silvers' patch posted current-users and tech-kern: http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html Should be pulled up to netbsd-6.
This commit is contained in:
parent
d862e30d4d
commit
19c63c3512
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fd.c,v 1.150 2011/07/17 23:18:23 mrg Exp $ */
|
||||
/* $NetBSD: fd.c,v 1.151 2012/10/10 16:51:50 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
@ -101,7 +101,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.150 2011/07/17 23:18:23 mrg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.151 2012/10/10 16:51:50 tsutsui Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_md.h"
|
||||
@ -174,7 +174,7 @@ enum fdc_state {
|
||||
|
||||
/* software state, per controller */
|
||||
struct fdc_softc {
|
||||
struct device *sc_dev;
|
||||
device_t sc_dev;
|
||||
bus_space_tag_t sc_bustag;
|
||||
|
||||
struct callout sc_timo_ch; /* timeout callout */
|
||||
@ -259,7 +259,7 @@ struct fd_type fd_types[] = {
|
||||
|
||||
/* software state, per disk (with up to 4 disks per ctlr) */
|
||||
struct fd_softc {
|
||||
struct device *sc_dv; /* generic device info */
|
||||
device_t sc_dv; /* generic device info */
|
||||
struct disk sc_dk; /* generic disk info */
|
||||
|
||||
struct fd_type *sc_deftype; /* default type descriptor */
|
||||
@ -342,7 +342,7 @@ void fdcretry(struct fdc_softc *);
|
||||
void fdfinish(struct fd_softc *, struct buf *);
|
||||
int fdformat(dev_t, struct ne7_fd_formb *, struct proc *);
|
||||
void fd_do_eject(struct fd_softc *);
|
||||
void fd_mountroot_hook(struct device *);
|
||||
void fd_mountroot_hook(device_t);
|
||||
static int fdconf(struct fdc_softc *);
|
||||
static void establish_chip_type(
|
||||
struct fdc_softc *,
|
||||
@ -547,7 +547,7 @@ fdcattach_mainbus(device_t parent, device_t self, void *aux)
|
||||
ma->ma_size,
|
||||
BUS_SPACE_MAP_LINEAR,
|
||||
&fdc->sc_handle) != 0) {
|
||||
printf("%s: cannot map registers\n", self->dv_xname);
|
||||
printf("%s: cannot map registers\n", device_xname(self));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -580,7 +580,7 @@ fdcattach_obio(device_t parent, device_t self, void *aux)
|
||||
sa->sa_slot, sa->sa_offset, sa->sa_size,
|
||||
BUS_SPACE_MAP_LINEAR, &fdc->sc_handle) != 0) {
|
||||
printf("%s: cannot map control registers\n",
|
||||
self->dv_xname);
|
||||
device_xname(self));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -890,7 +890,7 @@ fdstrategy(struct buf *bp)
|
||||
fdstart(fd);
|
||||
#ifdef DIAGNOSTIC
|
||||
else {
|
||||
struct fdc_softc *fdc = (void *)device_parent(fd->sc_dv);
|
||||
struct fdc_softc *fdc = device_private(device_parent(fd->sc_dv));
|
||||
if (fdc->sc_state == DEVIDLE) {
|
||||
printf("fdstrategy: controller inactive\n");
|
||||
fdcstart(fdc);
|
||||
@ -1012,7 +1012,7 @@ fd_motor_off(void *arg)
|
||||
|
||||
s = splbio();
|
||||
fd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
|
||||
fd_set_motor((struct fdc_softc *)device_parent(fd->sc_dv));
|
||||
fd_set_motor(device_private(device_parent(fd->sc_dv)));
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -2305,7 +2305,7 @@ fd_do_eject(struct fd_softc *fd)
|
||||
|
||||
/* ARGSUSED */
|
||||
void
|
||||
fd_mountroot_hook(struct device *dev)
|
||||
fd_mountroot_hook(device_t dev)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: memecc.c,v 1.14 2012/07/29 00:04:05 matt Exp $ */
|
||||
/* $NetBSD: memecc.c,v 1.15 2012/10/10 16:51:51 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: memecc.c,v 1.14 2012/07/29 00:04:05 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: memecc.c,v 1.15 2012/10/10 16:51:51 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -75,7 +75,7 @@ memecc_match(device_t parent, cfdata_t cf, void *aux)
|
||||
void
|
||||
memecc_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct memecc_softc *sc = (struct memecc_softc *)self;
|
||||
struct memecc_softc *sc = device_private(self);
|
||||
struct mainbus_attach_args *ma = aux;
|
||||
int node;
|
||||
uint32_t reg;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mha.c,v 1.52 2009/11/23 00:11:45 rmind Exp $ */
|
||||
/* $NetBSD: mha.c,v 1.53 2012/10/10 16:55:50 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
|
||||
@ -59,7 +59,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.52 2009/11/23 00:11:45 rmind Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.53 2012/10/10 16:55:50 tsutsui Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -337,7 +337,7 @@ mhaattach(device_t parent, device_t self, void *aux)
|
||||
/*
|
||||
* Fill in the adapter.
|
||||
*/
|
||||
sc->sc_adapter.adapt_dev = sc->sc_dev;
|
||||
sc->sc_adapter.adapt_dev = self;
|
||||
sc->sc_adapter.adapt_nchannels = 1;
|
||||
sc->sc_adapter.adapt_openings = 7;
|
||||
sc->sc_adapter.adapt_max_periph = 1;
|
||||
@ -674,7 +674,7 @@ mha_scsi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||
{
|
||||
struct scsipi_xfer *xs;
|
||||
struct scsipi_periph *periph;
|
||||
struct mha_softc *sc = (void *)chan->chan_adapter->adapt_dev;
|
||||
struct mha_softc *sc = device_private(chan->chan_adapter->adapt_dev);
|
||||
struct acb *acb;
|
||||
int s, flags;
|
||||
|
||||
@ -1949,7 +1949,7 @@ mha_timeout(void *arg)
|
||||
struct scsipi_xfer *xs = acb->xs;
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct mha_softc *sc =
|
||||
(void *)periph->periph_channel->chan_adapter->adapt_dev;
|
||||
device_private(periph->periph_channel->chan_adapter->adapt_dev);
|
||||
int s;
|
||||
|
||||
s = splbio();
|
||||
|
Loading…
Reference in New Issue
Block a user