Merge tag 'v5.4-rc3' into spi-5.4
authorMark Brown <broonie@kernel.org>
Fri, 18 Oct 2019 17:30:49 +0000 (18:30 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 18 Oct 2019 17:30:49 +0000 (18:30 +0100)
Linux 5.4-rc3

1  2 
drivers/spi/spi.c

diff --combined drivers/spi/spi.c
@@@ -1711,7 -1711,15 +1711,7 @@@ static int of_spi_parse_dt(struct spi_c
                spi->mode |= SPI_3WIRE;
        if (of_property_read_bool(nc, "spi-lsb-first"))
                spi->mode |= SPI_LSB_FIRST;
 -
 -      /*
 -       * For descriptors associated with the device, polarity inversion is
 -       * handled in the gpiolib, so all chip selects are "active high" in
 -       * the logical sense, the gpiolib will invert the line if need be.
 -       */
 -      if (ctlr->use_gpio_descriptors)
 -              spi->mode |= SPI_CS_HIGH;
 -      else if (of_property_read_bool(nc, "spi-cs-high"))
 +      if (of_property_read_bool(nc, "spi-cs-high"))
                spi->mode |= SPI_CS_HIGH;
  
        /* Device DUAL/QUAD mode */
        }
        spi->chip_select = value;
  
 +      /*
 +       * For descriptors associated with the device, polarity inversion is
 +       * handled in the gpiolib, so all gpio chip selects are "active high"
 +       * in the logical sense, the gpiolib will invert the line if need be.
 +       */
 +      if ((ctlr->use_gpio_descriptors) && ctlr->cs_gpiods[spi->chip_select])
 +              spi->mode |= SPI_CS_HIGH;
 +
        /* Device speed */
        rc = of_property_read_u32(nc, "spi-max-frequency", &value);
        if (rc) {
@@@ -3655,37 -3655,25 +3655,25 @@@ EXPORT_SYMBOL_GPL(spi_write_then_read)
  /*-------------------------------------------------------------------------*/
  
  #if IS_ENABLED(CONFIG_OF)
- static int __spi_of_device_match(struct device *dev, const void *data)
- {
-       return dev->of_node == data;
- }
  /* must call put_device() when done with returned spi_device device */
  struct spi_device *of_find_spi_device_by_node(struct device_node *node)
  {
-       struct device *dev = bus_find_device(&spi_bus_type, NULL, node,
-                                               __spi_of_device_match);
+       struct device *dev = bus_find_device_by_of_node(&spi_bus_type, node);
        return dev ? to_spi_device(dev) : NULL;
  }
  EXPORT_SYMBOL_GPL(of_find_spi_device_by_node);
  #endif /* IS_ENABLED(CONFIG_OF) */
  
  #if IS_ENABLED(CONFIG_OF_DYNAMIC)
- static int __spi_of_controller_match(struct device *dev, const void *data)
- {
-       return dev->of_node == data;
- }
  /* the spi controllers are not using spi_bus, so we find it with another way */
  static struct spi_controller *of_find_spi_controller_by_node(struct device_node *node)
  {
        struct device *dev;
  
-       dev = class_find_device(&spi_master_class, NULL, node,
-                               __spi_of_controller_match);
+       dev = class_find_device_by_of_node(&spi_master_class, node);
        if (!dev && IS_ENABLED(CONFIG_SPI_SLAVE))
-               dev = class_find_device(&spi_slave_class, NULL, node,
-                                       __spi_of_controller_match);
+               dev = class_find_device_by_of_node(&spi_slave_class, node);
        if (!dev)
                return NULL;
  
@@@ -3756,11 -3744,6 +3744,6 @@@ static int spi_acpi_controller_match(st
        return ACPI_COMPANION(dev->parent) == data;
  }
  
- static int spi_acpi_device_match(struct device *dev, const void *data)
- {
-       return ACPI_COMPANION(dev) == data;
- }
  static struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev)
  {
        struct device *dev;
@@@ -3780,8 -3763,7 +3763,7 @@@ static struct spi_device *acpi_spi_find
  {
        struct device *dev;
  
-       dev = bus_find_device(&spi_bus_type, NULL, adev, spi_acpi_device_match);
+       dev = bus_find_device_by_acpi_dev(&spi_bus_type, adev);
        return dev ? to_spi_device(dev) : NULL;
  }