mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 01:34:14 +08:00
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) {
|
||||
cs->hw_mode |= SPMODE_DIV16;
|
||||
pm = (mpc8xxx_spi->spibrg - 1) / (hz * 64) + 1;
|
||||
|
||||
WARN_ONCE(pm > 16, "%s: Requested speed is too low: %d Hz. "
|
||||
"Will use %d Hz instead.\n", dev_name(&spi->dev),
|
||||
hz, mpc8xxx_spi->spibrg / 1024);
|
||||
WARN_ONCE(pm > 16,
|
||||
"%s: Requested speed is too low: %d Hz. Will use %d Hz instead.\n",
|
||||
dev_name(&spi->dev), hz, mpc8xxx_spi->spibrg / 1024);
|
||||
if (pm > 16)
|
||||
pm = 16;
|
||||
} else {
|
||||
@ -727,12 +726,13 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
pinfo->gpios = kmalloc(ngpios * sizeof(*pinfo->gpios), GFP_KERNEL);
|
||||
pinfo->gpios = kmalloc_array(ngpios, sizeof(*pinfo->gpios),
|
||||
GFP_KERNEL);
|
||||
if (!pinfo->gpios)
|
||||
return -ENOMEM;
|
||||
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);
|
||||
if (!pinfo->alow_flags) {
|
||||
ret = -ENOMEM;
|
||||
@ -762,8 +762,9 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
|
||||
ret = gpio_direction_output(pinfo->gpios[i],
|
||||
pinfo->alow_flags[i]);
|
||||
if (ret) {
|
||||
dev_err(dev, "can't set output direction for gpio "
|
||||
"#%d: %d\n", i, ret);
|
||||
dev_err(dev,
|
||||
"can't set output direction for gpio #%d: %d\n",
|
||||
i, ret);
|
||||
goto err_loop;
|
||||
}
|
||||
}
|
||||
|
@ -621,8 +621,10 @@ void spi_unregister_device(struct spi_device *spi)
|
||||
if (!spi)
|
||||
return;
|
||||
|
||||
if (spi->dev.of_node)
|
||||
if (spi->dev.of_node) {
|
||||
of_node_clear_flag(spi->dev.of_node, OF_POPULATED);
|
||||
of_node_put(spi->dev.of_node);
|
||||
}
|
||||
if (ACPI_COMPANION(&spi->dev))
|
||||
acpi_device_clear_enumerated(ACPI_COMPANION(&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)
|
||||
return -EINVAL;
|
||||
|
||||
bi = kzalloc(n * sizeof(*bi), GFP_KERNEL);
|
||||
bi = kcalloc(n, sizeof(*bi), GFP_KERNEL);
|
||||
if (!bi)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -1603,11 +1605,13 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc)
|
||||
if (rc) {
|
||||
dev_err(&master->dev, "spi_device register error %s\n",
|
||||
nc->full_name);
|
||||
goto err_out;
|
||||
goto err_of_node_put;
|
||||
}
|
||||
|
||||
return spi;
|
||||
|
||||
err_of_node_put:
|
||||
of_node_put(nc);
|
||||
err_out:
|
||||
spi_dev_put(spi);
|
||||
return ERR_PTR(rc);
|
||||
|
Loading…
Reference in New Issue
Block a user