Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 2009 03:49:43 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192719 - head/sys/dev/msk
Message-ID:  <200905250349.n4P3nhMl009871@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Mon May 25 03:49:43 2009
New Revision: 192719
URL: http://svn.freebsd.org/changeset/base/192719

Log:
  Use bit definition to represent MSI and detach state instead of
  using separate variables in softc.

Modified:
  head/sys/dev/msk/if_msk.c
  head/sys/dev/msk/if_mskreg.h

Modified: head/sys/dev/msk/if_msk.c
==============================================================================
--- head/sys/dev/msk/if_msk.c	Mon May 25 03:42:33 2009	(r192718)
+++ head/sys/dev/msk/if_msk.c	Mon May 25 03:49:43 2009	(r192719)
@@ -923,7 +923,7 @@ msk_ioctl(struct ifnet *ifp, u_long comm
 				    & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
 					msk_rxfilter(sc_if);
 			} else {
-				if (sc_if->msk_detach == 0)
+				if ((sc_if->msk_flags & MSK_FLAG_DETACH) == 0)
 					msk_init_locked(sc_if);
 			}
 		} else {
@@ -1645,7 +1645,7 @@ mskc_attach(device_t dev)
 			if (sc->msk_num_port == 1 &&
 			    pci_alloc_msi(dev, &msir) == 0) {
 				if (msic == msir) {
-					sc->msk_msi = 1;
+					sc->msk_pflags |= MSK_FLAG_MSI;
 					sc->msk_irq_spec = msic == 2 ?
 					    msk_irq_spec_msi2 :
 					    msk_irq_spec_msi;
@@ -1771,7 +1771,7 @@ msk_detach(device_t dev)
 	ifp = sc_if->msk_ifp;
 	if (device_is_attached(dev)) {
 		/* XXX */
-		sc_if->msk_detach = 1;
+		sc_if->msk_flags |= MSK_FLAG_DETACH;
 		msk_stop(sc_if);
 		/* Can't hold locks while calling detach. */
 		MSK_IF_UNLOCK(sc_if);
@@ -1855,7 +1855,7 @@ mskc_detach(device_t dev)
 		sc->msk_intrhand[1] = NULL;
 	}
 	bus_release_resources(dev, sc->msk_irq_spec, sc->msk_irq);
-	if (sc->msk_msi)
+	if ((sc->msk_pflags & MSK_FLAG_MSI) != 0)
 		pci_release_msi(dev);
 	bus_release_resources(dev, sc->msk_res_spec, sc->msk_res);
 	mtx_destroy(&sc->msk_mtx);

Modified: head/sys/dev/msk/if_mskreg.h
==============================================================================
--- head/sys/dev/msk/if_mskreg.h	Mon May 25 03:42:33 2009	(r192718)
+++ head/sys/dev/msk/if_mskreg.h	Mon May 25 03:49:43 2009	(r192719)
@@ -2343,7 +2343,6 @@ struct msk_softc {
 	uint32_t		msk_intrhwemask;
 	uint32_t		msk_pflags;
 	int			msk_clock;
-	int			msk_msi;
 	struct msk_if_softc	*msk_if[2];
 	device_t		msk_devs[2];
 	int			msk_txqsize;
@@ -2382,9 +2381,11 @@ struct msk_if_softc {
 	int			msk_phytype;
 	int			msk_phyaddr;
 	uint32_t		msk_flags;
+#define	MSK_FLAG_MSI		0x0001
 #define	MSK_FLAG_RAMBUF		0x0010
 #define	MSK_FLAG_NOJUMBO	0x0020
 #define	MSK_FLAG_SUSPEND	0x2000
+#define	MSK_FLAG_DETACH		0x4000
 #define	MSK_FLAG_LINK		0x8000
 	struct callout		msk_tick_ch;
 	int			msk_watchdog_timer;
@@ -2397,7 +2398,6 @@ struct msk_if_softc {
 	struct msk_hw_stats	msk_stats;
 	struct task		msk_tx_task;
 	int			msk_if_flags;
-	int			msk_detach;
 	uint16_t		msk_vtag;	/* VLAN tag id. */
 };
 



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