Merge remote-tracking branch 'spi/topic/core' into spi-next
This commit is contained in:
commit
42af2f5c52
|
@ -267,10 +267,9 @@ static int fsl_spi_setup_transfer(struct spi_device *spi,
|
||||||
if ((mpc8xxx_spi->spibrg / hz) > 64) {
|
if ((mpc8xxx_spi->spibrg / hz) > 64) {
|
||||||
cs->hw_mode |= SPMODE_DIV16;
|
cs->hw_mode |= SPMODE_DIV16;
|
||||||
pm = (mpc8xxx_spi->spibrg - 1) / (hz * 64) + 1;
|
pm = (mpc8xxx_spi->spibrg - 1) / (hz * 64) + 1;
|
||||||
|
WARN_ONCE(pm > 16,
|
||||||
WARN_ONCE(pm > 16, "%s: Requested speed is too low: %d Hz. "
|
"%s: Requested speed is too low: %d Hz. Will use %d Hz instead.\n",
|
||||||
"Will use %d Hz instead.\n", dev_name(&spi->dev),
|
dev_name(&spi->dev), hz, mpc8xxx_spi->spibrg / 1024);
|
||||||
hz, mpc8xxx_spi->spibrg / 1024);
|
|
||||||
if (pm > 16)
|
if (pm > 16)
|
||||||
pm = 16;
|
pm = 16;
|
||||||
} else {
|
} else {
|
||||||
|
@ -727,12 +726,13 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pinfo->gpios = kmalloc(ngpios * sizeof(*pinfo->gpios), GFP_KERNEL);
|
pinfo->gpios = kmalloc_array(ngpios, sizeof(*pinfo->gpios),
|
||||||
|
GFP_KERNEL);
|
||||||
if (!pinfo->gpios)
|
if (!pinfo->gpios)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));
|
memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));
|
||||||
|
|
||||||
pinfo->alow_flags = kzalloc(ngpios * sizeof(*pinfo->alow_flags),
|
pinfo->alow_flags = kcalloc(ngpios, sizeof(*pinfo->alow_flags),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!pinfo->alow_flags) {
|
if (!pinfo->alow_flags) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
@ -762,8 +762,9 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
|
||||||
ret = gpio_direction_output(pinfo->gpios[i],
|
ret = gpio_direction_output(pinfo->gpios[i],
|
||||||
pinfo->alow_flags[i]);
|
pinfo->alow_flags[i]);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "can't set output direction for gpio "
|
dev_err(dev,
|
||||||
"#%d: %d\n", i, ret);
|
"can't set output direction for gpio #%d: %d\n",
|
||||||
|
i, ret);
|
||||||
goto err_loop;
|
goto err_loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -621,8 +621,10 @@ void spi_unregister_device(struct spi_device *spi)
|
||||||
if (!spi)
|
if (!spi)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (spi->dev.of_node)
|
if (spi->dev.of_node) {
|
||||||
of_node_clear_flag(spi->dev.of_node, OF_POPULATED);
|
of_node_clear_flag(spi->dev.of_node, OF_POPULATED);
|
||||||
|
of_node_put(spi->dev.of_node);
|
||||||
|
}
|
||||||
if (ACPI_COMPANION(&spi->dev))
|
if (ACPI_COMPANION(&spi->dev))
|
||||||
acpi_device_clear_enumerated(ACPI_COMPANION(&spi->dev));
|
acpi_device_clear_enumerated(ACPI_COMPANION(&spi->dev));
|
||||||
device_unregister(&spi->dev);
|
device_unregister(&spi->dev);
|
||||||
|
@ -672,7 +674,7 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n)
|
||||||
if (!n)
|
if (!n)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
bi = kzalloc(n * sizeof(*bi), GFP_KERNEL);
|
bi = kcalloc(n, sizeof(*bi), GFP_KERNEL);
|
||||||
if (!bi)
|
if (!bi)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -1603,11 +1605,13 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc)
|
||||||
if (rc) {
|
if (rc) {
|
||||||
dev_err(&master->dev, "spi_device register error %s\n",
|
dev_err(&master->dev, "spi_device register error %s\n",
|
||||||
nc->full_name);
|
nc->full_name);
|
||||||
goto err_out;
|
goto err_of_node_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
return spi;
|
return spi;
|
||||||
|
|
||||||
|
err_of_node_put:
|
||||||
|
of_node_put(nc);
|
||||||
err_out:
|
err_out:
|
||||||
spi_dev_put(spi);
|
spi_dev_put(spi);
|
||||||
return ERR_PTR(rc);
|
return ERR_PTR(rc);
|
||||||
|
|
Loading…
Reference in New Issue