svn commit: r308840 - in head/sys/arm/ti: . am335x omap4

Olivier Houchard cognet at FreeBSD.org
Sat Nov 19 15:43:24 UTC 2016


Author: cognet
Date: Sat Nov 19 15:43:22 2016
New Revision: 308840
URL: https://svnweb.freebsd.org/changeset/base/308840

Log:
  The only remaining offender that used ti_chip() without checking for
  compatibility first was the gpio code, so change that, and re-assert
  that the TI chip is a known chip

Modified:
  head/sys/arm/ti/am335x/am335x_gpio.c
  head/sys/arm/ti/omap4/omap4_gpio.c
  head/sys/arm/ti/ti_cpuid.h

Modified: head/sys/arm/ti/am335x/am335x_gpio.c
==============================================================================
--- head/sys/arm/ti/am335x/am335x_gpio.c	Sat Nov 19 15:38:13 2016	(r308839)
+++ head/sys/arm/ti/am335x/am335x_gpio.c	Sat Nov 19 15:43:22 2016	(r308840)
@@ -65,8 +65,6 @@ static struct ofw_compat_data compat_dat
 static int
 am335x_gpio_probe(device_t dev)
 {
-	if (ti_chip() != CHIP_AM335X)
-		return (ENXIO);
 
 	if (!ofw_bus_status_okay(dev))
 		return (ENXIO);
@@ -74,6 +72,9 @@ am335x_gpio_probe(device_t dev)
 	if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
 		return (ENXIO);
 
+	if (ti_chip() != CHIP_AM335X)
+		return (ENXIO);
+
 	device_set_desc(dev, "TI AM335x General Purpose I/O (GPIO)");
 
 	return (0);

Modified: head/sys/arm/ti/omap4/omap4_gpio.c
==============================================================================
--- head/sys/arm/ti/omap4/omap4_gpio.c	Sat Nov 19 15:38:13 2016	(r308839)
+++ head/sys/arm/ti/omap4/omap4_gpio.c	Sat Nov 19 15:43:22 2016	(r308840)
@@ -59,14 +59,14 @@ static struct ofw_compat_data compat_dat
 static int
 omap4_gpio_probe(device_t dev)
 {
-	if (ti_chip() != CHIP_OMAP_4)
-		return (ENXIO);
 
 	if (!ofw_bus_status_okay(dev))
 		return (ENXIO);
 
 	if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
 		return (ENXIO);
+	if (ti_chip() != CHIP_OMAP_4)
+		return (ENXIO);
 
 	device_set_desc(dev, "TI OMAP4 General Purpose I/O (GPIO)");
 

Modified: head/sys/arm/ti/ti_cpuid.h
==============================================================================
--- head/sys/arm/ti/ti_cpuid.h	Sat Nov 19 15:38:13 2016	(r308839)
+++ head/sys/arm/ti/ti_cpuid.h	Sat Nov 19 15:43:22 2016	(r308840)
@@ -74,6 +74,7 @@ extern int _ti_chip;
 
 static __inline int ti_chip(void)
 {
+	KASSERT(_ti_chip != -1, ("Can't determine TI Chip"));
 	return _ti_chip;
 }
 


More information about the svn-src-all mailing list