aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mlx/mlx.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/mlx/mlx.c')
-rw-r--r--sys/dev/mlx/mlx.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c
index bed697b0423c..f0c7591803e0 100644
--- a/sys/dev/mlx/mlx.c
+++ b/sys/dev/mlx/mlx.c
@@ -522,7 +522,7 @@ mlx_startup(struct mlx_softc *sc)
{
struct mlx_enq_sys_drive *mes;
struct mlx_sysdrive *dr;
- int i, error;
+ int i;
debug_called(1);
@@ -560,15 +560,14 @@ mlx_startup(struct mlx_softc *sc)
dr->ms_sectors = 63;
dr->ms_cylinders = dr->ms_size / (255 * 63);
}
- dr->ms_disk = device_add_child(sc->mlx_dev, /*"mlxd"*/NULL, -1);
+ dr->ms_disk = device_add_child(sc->mlx_dev, /*"mlxd"*/NULL, DEVICE_UNIT_ANY);
if (dr->ms_disk == 0)
device_printf(sc->mlx_dev, "device_add_child failed\n");
device_set_ivars(dr->ms_disk, dr);
}
}
free(mes, M_DEVBUF);
- if ((error = bus_generic_attach(sc->mlx_dev)) != 0)
- device_printf(sc->mlx_dev, "bus_generic_attach returned %d", error);
+ bus_attach_children(sc->mlx_dev);
/* mark controller back up */
MLX_IO_LOCK(sc);
@@ -643,7 +642,7 @@ mlx_shutdown(device_t dev)
static int
mlx_shutdown_locked(struct mlx_softc *sc)
{
- int i, error;
+ int error;
debug_called(1);
@@ -661,17 +660,11 @@ mlx_shutdown_locked(struct mlx_softc *sc)
printf("done\n");
}
MLX_IO_UNLOCK(sc);
-
+
/* delete all our child devices */
- for (i = 0; i < MLX_MAXDRIVES; i++) {
- if (sc->mlx_sysdrive[i].ms_disk != 0) {
- if ((error = device_delete_child(sc->mlx_dev, sc->mlx_sysdrive[i].ms_disk)) != 0)
- return (error);
- sc->mlx_sysdrive[i].ms_disk = 0;
- }
- }
+ error = bus_generic_detach(sc->mlx_dev);
- return (0);
+ return (error);
}
/********************************************************************************
@@ -2075,8 +2068,8 @@ mlx_user_command(struct mlx_softc *sc, struct mlx_usercommand *mu)
goto out;
}
MLX_IO_UNLOCK(sc);
- if (((kbuf = malloc(mu->mu_datasize, M_DEVBUF, M_WAITOK)) == NULL) ||
- (error = copyin(mu->mu_buf, kbuf, mu->mu_datasize))) {
+ kbuf = malloc(mu->mu_datasize, M_DEVBUF, M_WAITOK);
+ if ((error = copyin(mu->mu_buf, kbuf, mu->mu_datasize))) {
MLX_IO_LOCK(sc);
goto out;
}