Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Jan 2012 01:51:30 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r230800 - stable/9/sys/dev/ppbus
Message-ID:  <201201310151.q0V1pUaZ012592@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Tue Jan 31 01:51:30 2012
New Revision: 230800
URL: http://svn.freebsd.org/changeset/base/230800

Log:
  MFC r227814:
  - Use ppb_assert_locked() rather than using explicit mtx_assert call
  - Make ppbus code agnostic in regard of INVARIANTS option

Modified:
  stable/9/sys/dev/ppbus/lpt.c
  stable/9/sys/dev/ppbus/ppb_base.c
  stable/9/sys/dev/ppbus/ppb_msq.c
  stable/9/sys/dev/ppbus/vpo.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/ppbus/lpt.c
==============================================================================
--- stable/9/sys/dev/ppbus/lpt.c	Tue Jan 31 01:45:20 2012	(r230799)
+++ stable/9/sys/dev/ppbus/lpt.c	Tue Jan 31 01:51:30 2012	(r230800)
@@ -447,10 +447,9 @@ lptout(void *arg)
 {
 	struct lpt_data *sc = arg;
 	device_t dev = sc->sc_dev;
-#if defined(INVARIANTS) || defined(LPT_DEBUG)
-	device_t ppbus = device_get_parent(dev);
-#endif
+	device_t ppbus;
 
+	ppbus = device_get_parent(dev);
 	ppb_assert_locked(ppbus);
 	lprintf(("T %x ", ppb_rstr(ppbus)));
 	if (sc->sc_state & OPEN) {

Modified: stable/9/sys/dev/ppbus/ppb_base.c
==============================================================================
--- stable/9/sys/dev/ppbus/ppb_base.c	Tue Jan 31 01:45:20 2012	(r230799)
+++ stable/9/sys/dev/ppbus/ppb_base.c	Tue Jan 31 01:51:30 2012	(r230800)
@@ -60,7 +60,7 @@ ppb_poll_bus(device_t bus, int max,
 	int i, j, error;
 	char r;
 
-	mtx_assert(ppb->ppc_lock, MA_OWNED);
+	ppb_assert_locked(bus);
 
 	/* try at least up to 10ms */
 	for (j = 0; j < ((how & PPB_POLL) ? max : 1); j++) {
@@ -96,12 +96,9 @@ ppb_poll_bus(device_t bus, int max,
 int
 ppb_get_epp_protocol(device_t bus)
 {
-#ifdef INVARIANTS
-	struct ppb_data *ppb = DEVTOSOFTC(bus);
-#endif
 	uintptr_t protocol;
 
-	mtx_assert(ppb->ppc_lock, MA_OWNED);
+	ppb_assert_locked(bus);
 	BUS_READ_IVAR(device_get_parent(bus), bus, PPC_IVAR_EPP_PROTO, &protocol);
 
 	return (protocol);
@@ -117,7 +114,7 @@ ppb_get_mode(device_t bus)
 	struct ppb_data *ppb = DEVTOSOFTC(bus);
 
 	/* XXX yet device mode = ppbus mode = chipset mode */
-	mtx_assert(ppb->ppc_lock, MA_OWNED);
+	ppb_assert_locked(bus);
 	return (ppb->mode);
 }
 
@@ -132,7 +129,7 @@ ppb_set_mode(device_t bus, int mode)
 	struct ppb_data *ppb = DEVTOSOFTC(bus);
 	int old_mode = ppb_get_mode(bus);
 
-	mtx_assert(ppb->ppc_lock, MA_OWNED);
+	ppb_assert_locked(bus);
 	if (PPBUS_SETMODE(device_get_parent(bus), mode))
 		return (-1);
 
@@ -150,11 +147,8 @@ ppb_set_mode(device_t bus, int mode)
 int
 ppb_write(device_t bus, char *buf, int len, int how)
 {
-#ifdef INVARIANTS
-	struct ppb_data *ppb = DEVTOSOFTC(bus);
-#endif
 
-	mtx_assert(ppb->ppc_lock, MA_OWNED);
+	ppb_assert_locked(bus);
 	return (PPBUS_WRITE(device_get_parent(bus), buf, len, how));
 }
 
@@ -166,11 +160,8 @@ ppb_write(device_t bus, char *buf, int l
 int
 ppb_reset_epp_timeout(device_t bus)
 {
-#ifdef INVARIANTS
-	struct ppb_data *ppb = DEVTOSOFTC(bus);
-#endif
 
-	mtx_assert(ppb->ppc_lock, MA_OWNED);
+	ppb_assert_locked(bus);
 	return(PPBUS_RESET_EPP(device_get_parent(bus)));
 }
 
@@ -182,11 +173,8 @@ ppb_reset_epp_timeout(device_t bus)
 int
 ppb_ecp_sync(device_t bus)
 {
-#ifdef INVARIANTS
-	struct ppb_data *ppb = DEVTOSOFTC(bus);
-#endif
 
-	mtx_assert(ppb->ppc_lock, MA_OWNED);
+	ppb_assert_locked(bus);
 	return (PPBUS_ECP_SYNC(device_get_parent(bus)));
 }
 
@@ -198,12 +186,9 @@ ppb_ecp_sync(device_t bus)
 int
 ppb_get_status(device_t bus, struct ppb_status *status)
 {
-#ifdef INVARIANTS
-	struct ppb_data *ppb = DEVTOSOFTC(bus);
-#endif
 	register char r;
 
-	mtx_assert(ppb->ppc_lock, MA_OWNED);
+	ppb_assert_locked(bus);
 
 	r = status->status = ppb_rstr(bus);
 

Modified: stable/9/sys/dev/ppbus/ppb_msq.c
==============================================================================
--- stable/9/sys/dev/ppbus/ppb_msq.c	Tue Jan 31 01:45:20 2012	(r230799)
+++ stable/9/sys/dev/ppbus/ppb_msq.c	Tue Jan 31 01:51:30 2012	(r230800)
@@ -117,13 +117,10 @@ mode2xfer(device_t bus, struct ppb_devic
 int
 ppb_MS_init(device_t bus, device_t dev, struct ppb_microseq *loop, int opcode)
 {
-#ifdef INVARIANTS
-	struct ppb_data *ppb = device_get_softc(bus);
-#endif
 	struct ppb_device *ppbdev = (struct ppb_device *)device_get_ivars(dev);
 	struct ppb_xfer *xfer = mode2xfer(bus, ppbdev, opcode);
 
-	mtx_assert(ppb->ppc_lock, MA_OWNED);
+	ppb_assert_locked(bus);
 	xfer->loop = loop;
 
 	return (0);

Modified: stable/9/sys/dev/ppbus/vpo.c
==============================================================================
--- stable/9/sys/dev/ppbus/vpo.c	Tue Jan 31 01:45:20 2012	(r230799)
+++ stable/9/sys/dev/ppbus/vpo.c	Tue Jan 31 01:51:30 2012	(r230800)
@@ -298,11 +298,8 @@ static void
 vpo_action(struct cam_sim *sim, union ccb *ccb)
 {
 	struct vpo_data *vpo = (struct vpo_data *)sim->softc;
-#ifdef INVARIANTS
-	device_t ppbus = device_get_parent(vpo->vpo_dev);
 
-	ppb_assert_locked(ppbus);
-#endif
+	ppb_assert_locked(device_get_parent(vpo->vpo_dev));
 	switch (ccb->ccb_h.func_code) {
 	case XPT_SCSI_IO:
 	{



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201310151.q0V1pUaZ012592>