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
This commit is contained in:
cognet 2016-11-19 15:43:22 +00:00
parent 4141a1b905
commit 02fe2c3f5e
3 changed files with 6 additions and 4 deletions

View File

@ -65,8 +65,6 @@ static struct ofw_compat_data compat_data[] = {
static int static int
am335x_gpio_probe(device_t dev) am335x_gpio_probe(device_t dev)
{ {
if (ti_chip() != CHIP_AM335X)
return (ENXIO);
if (!ofw_bus_status_okay(dev)) if (!ofw_bus_status_okay(dev))
return (ENXIO); return (ENXIO);
@ -74,6 +72,9 @@ am335x_gpio_probe(device_t dev)
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO); return (ENXIO);
if (ti_chip() != CHIP_AM335X)
return (ENXIO);
device_set_desc(dev, "TI AM335x General Purpose I/O (GPIO)"); device_set_desc(dev, "TI AM335x General Purpose I/O (GPIO)");
return (0); return (0);

View File

@ -59,14 +59,14 @@ static struct ofw_compat_data compat_data[] = {
static int static int
omap4_gpio_probe(device_t dev) omap4_gpio_probe(device_t dev)
{ {
if (ti_chip() != CHIP_OMAP_4)
return (ENXIO);
if (!ofw_bus_status_okay(dev)) if (!ofw_bus_status_okay(dev))
return (ENXIO); return (ENXIO);
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO); return (ENXIO);
if (ti_chip() != CHIP_OMAP_4)
return (ENXIO);
device_set_desc(dev, "TI OMAP4 General Purpose I/O (GPIO)"); device_set_desc(dev, "TI OMAP4 General Purpose I/O (GPIO)");

View File

@ -74,6 +74,7 @@ extern int _ti_chip;
static __inline int ti_chip(void) static __inline int ti_chip(void)
{ {
KASSERT(_ti_chip != -1, ("Can't determine TI Chip"));
return _ti_chip; return _ti_chip;
} }