summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorcegger <cegger@NetBSD.org>2008-06-11 23:54:45 +0000
committercegger <cegger@NetBSD.org>2008-06-11 23:54:45 +0000
commit3d8fe45fc9b9fd99ec318918dae348fe4eea8bcb (patch)
treede38d5046eefdc440b92e8969cd9757e4683d71b /sys
parentf70851c953e280e96f023dafed3eda2c23647353 (diff)
use device_lookup_private to get softc
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mac68k/dev/aed.c6
-rw-r--r--sys/arch/mac68k/nubus/cpi_nubus.c20
-rw-r--r--sys/arch/mips/adm5120/dev/uart.c21
-rw-r--r--sys/arch/mips/atheros/dev/athflash.c13
4 files changed, 25 insertions, 35 deletions
diff --git a/sys/arch/mac68k/dev/aed.c b/sys/arch/mac68k/dev/aed.c
index bdef56d2844..daba0720181 100644
--- a/sys/arch/mac68k/dev/aed.c
+++ b/sys/arch/mac68k/dev/aed.c
@@ -1,4 +1,4 @@
-/* $NetBSD: aed.c,v 1.27 2008/03/01 14:16:49 rmind Exp $ */
+/* $NetBSD: aed.c,v 1.28 2008/06/11 23:54:45 cegger Exp $ */
/*
* Copyright (C) 1994 Bradley A. Grantham
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.27 2008/03/01 14:16:49 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.28 2008/06/11 23:54:45 cegger Exp $");
#include "opt_adb.h"
@@ -415,7 +415,7 @@ aedopen(dev_t dev, int flag, int mode, struct lwp *l)
struct aed_softc *sc;
int s;
- sc = device_lookup(&aed_cd, minor(dev));
+ sc = device_lookup_private(&aed_cd, minor(dev));
if (sc == NULL)
return (ENXIO);
diff --git a/sys/arch/mac68k/nubus/cpi_nubus.c b/sys/arch/mac68k/nubus/cpi_nubus.c
index fd1136287b6..8cbbd6404c2 100644
--- a/sys/arch/mac68k/nubus/cpi_nubus.c
+++ b/sys/arch/mac68k/nubus/cpi_nubus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cpi_nubus.c,v 1.2 2008/05/23 10:46:10 hauke Exp $ */
+/* $NetBSD: cpi_nubus.c,v 1.3 2008/06/11 23:54:45 cegger Exp $ */
/*-
* Copyright (c) 2008 Hauke Fath
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpi_nubus.c,v 1.2 2008/05/23 10:46:10 hauke Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpi_nubus.c,v 1.3 2008/06/11 23:54:45 cegger Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -351,7 +351,6 @@ cpi_nubus_intr(void *arg)
int
cpi_open(dev_t device, int flag, int mode, struct lwp *l)
{
- int lpunit;
int err, ii, s;
struct cpi_softc *sc;
@@ -359,14 +358,7 @@ cpi_open(dev_t device, int flag, int mode, struct lwp *l)
printf("\tcpi_open() called...\n");
/* Consistency checks: Valid unit number, softc, device state */
- lpunit = CPI_UNIT(device);
- if (lpunit >= cpi_cd.cd_ndevs) {
- if (TRACE_OPEN)
- printf("Tried to cpi_open() invalid unit (%d >= %d)\n",
- lpunit, cpi_cd.cd_ndevs);
- return ENXIO;
- }
- sc = device_lookup(&cpi_cd, lpunit);
+ sc = device_lookup_private(&cpi_cd, CPI_UNIT(device));
if (NULL == sc) {
if (TRACE_OPEN)
printf("Tried to cpi_open() with NULL softc\n");
@@ -435,10 +427,8 @@ int
cpi_close(dev_t device, int flag, int mode, struct lwp *l)
{
struct cpi_softc *sc;
- int lpunit;
- lpunit = CPI_UNIT(device);
- sc = device_lookup(&cpi_cd, lpunit);
+ sc = device_lookup_private(&cpi_cd, CPI_UNIT(device));
if (TRACE_CLOSE)
printf("\tcpi_close() called (%lu hard, %lu bytes to port)\n",
@@ -472,7 +462,7 @@ cpi_write(dev_t device, struct uio *uio, int flags)
if (TRACE_WRITE)
printf("\tcpi_write() called for %u bytes\n", uio->uio_resid);
- sc = device_lookup(&cpi_cd, CPI_UNIT(device));
+ sc = device_lookup_private(&cpi_cd, CPI_UNIT(device));
/* Send data to printer, a line buffer full at a time */
while (uio->uio_resid > 0) {
diff --git a/sys/arch/mips/adm5120/dev/uart.c b/sys/arch/mips/adm5120/dev/uart.c
index e12016a936d..e40a978ae33 100644
--- a/sys/arch/mips/adm5120/dev/uart.c
+++ b/sys/arch/mips/adm5120/dev/uart.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uart.c,v 1.4 2008/01/09 08:15:53 elad Exp $ */
+/* $NetBSD: uart.c,v 1.5 2008/06/11 23:55:20 cegger Exp $ */
/*-
* Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uart.c,v 1.4 2008/01/09 08:15:53 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uart.c,v 1.5 2008/06/11 23:55:20 cegger Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -198,7 +198,7 @@ uart_cnpollc(dev_t dev, int on)
int
uart_open(dev_t dev, int flag, int mode, struct lwp *l)
{
- struct uart_softc *sc = device_lookup(&uart_cd, minor(dev));
+ struct uart_softc *sc = device_lookup_private(&uart_cd, minor(dev));
struct tty *tp = sc->sc_tty;
int s, error = 0;
@@ -230,7 +230,7 @@ uart_open(dev_t dev, int flag, int mode, struct lwp *l)
int
uart_close(dev_t dev, int flag, int mode, struct lwp *l)
{
- struct uart_softc *sc = device_lookup(&uart_cd, minor(dev));
+ struct uart_softc *sc = device_lookup_private(&uart_cd, minor(dev));
struct tty *tp = sc->sc_tty;
(*tp->t_linesw->l_close)(tp, flag);
@@ -242,7 +242,7 @@ uart_close(dev_t dev, int flag, int mode, struct lwp *l)
int
uart_read(dev_t dev, struct uio *uio, int flag)
{
- struct uart_softc *sc = device_lookup(&uart_cd, minor(dev));
+ struct uart_softc *sc = device_lookup_private(&uart_cd, minor(dev));
struct tty *tp = sc->sc_tty;
return ((*tp->t_linesw->l_read)(tp, uio, flag));
@@ -251,7 +251,7 @@ uart_read(dev_t dev, struct uio *uio, int flag)
int
uart_write(dev_t dev, struct uio *uio, int flag)
{
- struct uart_softc *sc = device_lookup(&uart_cd, minor(dev));
+ struct uart_softc *sc = device_lookup_private(&uart_cd, minor(dev));
struct tty *tp = sc->sc_tty;
return ((*tp->t_linesw->l_write)(tp, uio, flag));
@@ -260,7 +260,7 @@ uart_write(dev_t dev, struct uio *uio, int flag)
int
uart_poll(dev_t dev, int events, struct lwp *l)
{
- struct uart_softc *sc = device_lookup(&uart_cd, minor(dev));
+ struct uart_softc *sc = device_lookup_private(&uart_cd, minor(dev));
struct tty *tp = sc->sc_tty;
return ((*tp->t_linesw->l_poll)(tp, events, l));
@@ -269,7 +269,7 @@ uart_poll(dev_t dev, int events, struct lwp *l)
int
uart_ioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
{
- struct uart_softc *sc = device_lookup(&uart_cd, minor(dev));
+ struct uart_softc *sc = device_lookup_private(&uart_cd, minor(dev));
struct tty *tp = sc->sc_tty;
int error;
@@ -287,10 +287,9 @@ uart_param(struct tty *tp, struct termios *t)
}
struct tty*
-uart_tty(dev)
- dev_t dev;
+uart_tty(dev_t dev)
{
- struct uart_softc *sc = device_lookup(&uart_cd, minor(dev));
+ struct uart_softc *sc = device_lookup_private(&uart_cd, minor(dev));
return sc->sc_tty;
}
diff --git a/sys/arch/mips/atheros/dev/athflash.c b/sys/arch/mips/atheros/dev/athflash.c
index 62a931b161e..72b165f786e 100644
--- a/sys/arch/mips/atheros/dev/athflash.c
+++ b/sys/arch/mips/atheros/dev/athflash.c
@@ -1,4 +1,4 @@
-/* $NetBSD: athflash.c,v 1.2 2008/04/28 20:23:28 martin Exp $ */
+/* $NetBSD: athflash.c,v 1.3 2008/06/11 23:55:20 cegger Exp $ */
/*
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -82,7 +82,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: athflash.c,v 1.2 2008/04/28 20:23:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: athflash.c,v 1.3 2008/06/11 23:55:20 cegger Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -256,7 +256,8 @@ flashopen(dev_t dev, int flag, int mode, struct lwp *l)
{
struct flash_softc *sc;
- if ((sc = device_lookup(&athflash_cd, minor(dev))) == NULL)
+ sc = device_lookup_private(&athflash_cd, minor(dev));
+ if (sc == NULL)
return ENXIO;
if (sc->sc_status & FLASH_ST_BUSY)
return EBUSY;
@@ -269,7 +270,7 @@ flashclose(dev_t dev, int flag, int mode, struct lwp *l)
{
struct flash_softc *sc;
- sc = device_lookup(&athflash_cd, minor(dev));
+ sc = device_lookup_private(&athflash_cd, minor(dev));
sc->sc_status &= ~FLASH_ST_BUSY;
return 0;
}
@@ -285,7 +286,7 @@ flashread(dev_t dev, struct uio *uio, int flag)
int count;
int error;
- sc = device_lookup(&athflash_cd, minor(dev));
+ sc = device_lookup_private(&athflash_cd, minor(dev));
iot = sc->sc_iot;
ioh = sc->sc_ioh;
@@ -314,7 +315,7 @@ flashwrite(dev_t dev, struct uio *uio, int flag)
int stat;
int error;
- sc = device_lookup(&athflash_cd, minor(dev));
+ sc = device_lookup_private(&athflash_cd, minor(dev));
if (sc->sc_size < uio->uio_offset + uio->uio_resid)
return ENOSPC;