svn commit: r286918 - in head/sys: conf dev/cyapa dev/ichiic dev/isl

Michael Gmelin grembo at FreeBSD.org
Wed Aug 19 09:49:31 UTC 2015


Author: grembo (ports committer)
Date: Wed Aug 19 09:49:29 2015
New Revision: 286918
URL: https://svnweb.freebsd.org/changeset/base/286918

Log:
  Allow building a kernel with baked in ig4, isl and cyapa drivers.
  
  Also addresses jhb's remarks on D2811 and D3068.
  
  PR:		202059
  Differential Revision:	https://reviews.freebsd.org/D3351
  Reviewed by:	jhb
  Approved by:	jhb

Modified:
  head/sys/conf/files
  head/sys/dev/cyapa/cyapa.c
  head/sys/dev/ichiic/ig4_iic.c
  head/sys/dev/isl/isl.c

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed Aug 19 06:08:11 2015	(r286917)
+++ head/sys/conf/files	Wed Aug 19 09:49:29 2015	(r286918)
@@ -1236,6 +1236,7 @@ t5fw.fw			optional cxgbe					\
 dev/cy/cy.c			optional cy
 dev/cy/cy_isa.c			optional cy isa
 dev/cy/cy_pci.c			optional cy pci
+dev/cyapa/cyapa.c		optional cyapa smbus
 dev/dc/if_dc.c			optional dc pci
 dev/dc/dcphy.c			optional dc pci
 dev/dc/pnphy.c			optional dc pci
@@ -1461,8 +1462,8 @@ dev/hptiop/hptiop.c		optional hptiop scb
 dev/hwpmc/hwpmc_logging.c	optional hwpmc
 dev/hwpmc/hwpmc_mod.c		optional hwpmc
 dev/hwpmc/hwpmc_soft.c		optional hwpmc
-dev/ichiic/ig4_iic.c		optional ichiic
-dev/ichiic/ig4_pci.c		optional ichiic pci
+dev/ichiic/ig4_iic.c		optional ig4 smbus
+dev/ichiic/ig4_pci.c		optional ig4 pci smbus
 dev/ichsmb/ichsmb.c		optional ichsmb
 dev/ichsmb/ichsmb_pci.c		optional ichsmb pci
 dev/ida/ida.c			optional ida
@@ -1557,6 +1558,7 @@ dev/iscsi_initiator/isc_soc.c	optional i
 dev/iscsi_initiator/isc_sm.c	optional iscsi_initiator scbus
 dev/iscsi_initiator/isc_subr.c	optional iscsi_initiator scbus
 dev/ismt/ismt.c			optional ismt
+dev/isl/isl.c			optional isl smbus
 dev/isp/isp.c			optional isp
 dev/isp/isp_freebsd.c		optional isp
 dev/isp/isp_library.c		optional isp

Modified: head/sys/dev/cyapa/cyapa.c
==============================================================================
--- head/sys/dev/cyapa/cyapa.c	Wed Aug 19 06:08:11 2015	(r286917)
+++ head/sys/dev/cyapa/cyapa.c	Wed Aug 19 09:49:29 2015	(r286918)
@@ -149,7 +149,6 @@ struct cyapa_fifo {
 struct cyapa_softc {
 	device_t dev;
 	int	count;			/* >0 if device opened */
-	int	unit;
 	int	addr;
 	struct cdev *devnode;
 	struct selinfo selinfo;
@@ -450,7 +449,6 @@ static int
 cyapa_probe(device_t dev)
 {
 	struct cyapa_cap cap;
-	int unit;
 	int addr;
 	int error;
 
@@ -463,8 +461,6 @@ cyapa_probe(device_t dev)
 	if (addr != 0x67)
 		return (ENXIO);
 
-	unit = device_get_unit(dev);
-
 	error = init_device(dev, &cap, addr, 1);
 	if (error != 0)
 		return (ENXIO);
@@ -486,7 +482,7 @@ cyapa_attach(device_t dev)
 	sc->reporting_mode = 1;
 
 	unit = device_get_unit(dev);
-	addr = *((unsigned char*) device_get_ivars(dev));
+	addr = smbus_get_addr(dev);
 
 	if (init_device(dev, &cap, addr, 0))
 		return (ENXIO);
@@ -494,7 +490,6 @@ cyapa_attach(device_t dev)
 	mtx_init(&sc->mutex, "cyapa", NULL, MTX_DEF);
 
 	sc->dev = dev;
-	sc->unit = unit;
 	sc->addr = addr;
 
 	knlist_init_mtx(&sc->selinfo.si_note, &sc->mutex);

Modified: head/sys/dev/ichiic/ig4_iic.c
==============================================================================
--- head/sys/dev/ichiic/ig4_iic.c	Wed Aug 19 06:08:11 2015	(r286917)
+++ head/sys/dev/ichiic/ig4_iic.c	Wed Aug 19 09:49:29 2015	(r286918)
@@ -74,8 +74,8 @@ static void ig4iic_intr(void *cookie);
 static void ig4iic_dump(ig4iic_softc_t *sc);
 
 static int ig4_dump;
-SYSCTL_INT(_debug, OID_AUTO, ig4_dump, CTLTYPE_INT | CTLFLAG_RW,
-	   &ig4_dump, 0, "");
+SYSCTL_INT(_debug, OID_AUTO, ig4_dump, CTLFLAG_RW,
+	   &ig4_dump, 0, "Dump controller registers");
 
 /*
  * Low-level inline support functions

Modified: head/sys/dev/isl/isl.c
==============================================================================
--- head/sys/dev/isl/isl.c	Wed Aug 19 06:08:11 2015	(r286917)
+++ head/sys/dev/isl/isl.c	Wed Aug 19 09:49:29 2015	(r286918)
@@ -71,12 +71,9 @@ __FBSDID("$FreeBSD$");
 
 struct isl_softc {
 	device_t	dev;
-	int		unit;
 	int		addr;
 
 	struct sx	isl_sx;
-	struct sysctl_ctx_list *sysctl_ctx;
-	struct sysctl_oid *sysctl_tree;
 };
 
 /* Returns < 0 on problem. */
@@ -85,8 +82,7 @@ static int isl_read_sensor(device_t dev,
 /*
  * Initialize the device
  */
-static
-int
+static int
 init_device(device_t dev, int addr, int probe)
 {
 	static char bl_init[] = { 0x00 };
@@ -145,7 +141,6 @@ static driver_t isl_driver = {
 static int
 isl_probe(device_t dev)
 {
-	int unit;
 	int addr;
 	int error;
 
@@ -158,8 +153,6 @@ isl_probe(device_t dev)
 	if (addr != 0x44)
 		return (ENXIO);
 
-	unit = device_get_unit(dev);
-
 	error = init_device(dev, addr, 1);
 	if (error)
 		return (ENXIO);
@@ -173,7 +166,8 @@ static int
 isl_attach(device_t dev)
 {
 	struct isl_softc *sc;
-	int unit;
+	struct sysctl_ctx_list *sysctl_ctx;
+	struct sysctl_oid *sysctl_tree;
 	int addr;
 	int use_als;
 	int use_ir;
@@ -184,8 +178,7 @@ isl_attach(device_t dev)
 	if (!sc)
 		return (ENOMEM);
 
-	unit = device_get_unit(dev);
-	addr = *((unsigned char*) device_get_ivars(dev));
+	addr = smbus_get_addr(dev);
 
 	if (init_device(dev, addr, 0))
 		return (ENXIO);
@@ -193,48 +186,47 @@ isl_attach(device_t dev)
 	sx_init(&sc->isl_sx, "ISL read lock");
 
 	sc->dev = dev;
-	sc->unit = unit;
 	sc->addr = addr;
 
-	sc->sysctl_ctx = device_get_sysctl_ctx(dev);
-	sc->sysctl_tree = device_get_sysctl_tree(dev);
+	sysctl_ctx = device_get_sysctl_ctx(dev);
+	sysctl_tree = device_get_sysctl_tree(dev);
 
 	use_als = isl_read_sensor(dev, addr, CMD1_MASK_ALS_ONCE) >= 0;
 	use_ir = isl_read_sensor(dev, addr, CMD1_MASK_IR_ONCE) >= 0;
 	use_prox = isl_read_sensor(dev, addr, CMD1_MASK_PROX_ONCE) >= 0;
 
 	if (use_als) {
-		SYSCTL_ADD_PROC(sc->sysctl_ctx,
-	 		SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
+		SYSCTL_ADD_PROC(sysctl_ctx,
+	 		SYSCTL_CHILDREN(sysctl_tree), OID_AUTO,
 			    "als", CTLTYPE_INT | CTLFLAG_RD,
 			    sc, ISL_METHOD_ALS, isl_sysctl, "I",
 			    "Current ALS sensor read-out");
 	}
 
 	if (use_ir) {
-		SYSCTL_ADD_PROC(sc->sysctl_ctx,
-			SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
+		SYSCTL_ADD_PROC(sysctl_ctx,
+			SYSCTL_CHILDREN(sysctl_tree), OID_AUTO,
 			    "ir", CTLTYPE_INT | CTLFLAG_RD,
 			    sc, ISL_METHOD_IR, isl_sysctl, "I",
 			    "Current IR sensor read-out");
 	}
 
 	if (use_prox) {
-		SYSCTL_ADD_PROC(sc->sysctl_ctx,
-			SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
+		SYSCTL_ADD_PROC(sysctl_ctx,
+			SYSCTL_CHILDREN(sysctl_tree), OID_AUTO,
 			    "prox", CTLTYPE_INT | CTLFLAG_RD,
 			    sc, ISL_METHOD_PROX, isl_sysctl, "I",
 			    "Current proximity sensor read-out");
 	}
 
-	SYSCTL_ADD_PROC(sc->sysctl_ctx,
-		SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_PROC(sysctl_ctx,
+		SYSCTL_CHILDREN(sysctl_tree), OID_AUTO,
 		    "resolution", CTLTYPE_INT | CTLFLAG_RD,
 		    sc, ISL_METHOD_RESOLUTION, isl_sysctl, "I",
 		    "Current proximity sensor resolution");
 
-	SYSCTL_ADD_PROC(sc->sysctl_ctx,
-	SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_PROC(sysctl_ctx,
+	SYSCTL_CHILDREN(sysctl_tree), OID_AUTO,
 	    "range", CTLTYPE_INT | CTLFLAG_RD,
 	    sc, ISL_METHOD_RANGE, isl_sysctl, "I",
 	    "Current proximity sensor range");
@@ -307,7 +299,8 @@ isl_sysctl(SYSCTL_HANDLER_ARGS)
 	return (0);
 }
 
-static int isl_read_sensor(device_t dev, int addr, uint8_t cmd_mask)
+static int
+isl_read_sensor(device_t dev, int addr, uint8_t cmd_mask)
 {
 	device_t bus;
 	uint8_t rbyte;


More information about the svn-src-all mailing list