Commit 04ba24b34ac8ea4885295a7f7f78f719bc8c859b

Authored by Jan Nikitenko
Committed by Grant Likely
1 parent b3a0894516

spi/au1550_spi: fix setupxfer not to override cfg with zeros

fix setupxfer() not to override generic configuration of speed_hz
and bits_per_word with zeros

Signed-off-by: Jan Nikitenko <jan.nikitenko@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

Showing 1 changed file with 8 additions and 2 deletions Side-by-side Diff

drivers/spi/au1550_spi.c
... ... @@ -237,8 +237,14 @@
237 237 unsigned bpw, hz;
238 238 u32 cfg, stat;
239 239  
240   - bpw = t ? t->bits_per_word : spi->bits_per_word;
241   - hz = t ? t->speed_hz : spi->max_speed_hz;
  240 + bpw = spi->bits_per_word;
  241 + hz = spi->max_speed_hz;
  242 + if (t) {
  243 + if (t->bits_per_word)
  244 + bpw = t->bits_per_word;
  245 + if (t->speed_hz)
  246 + hz = t->speed_hz;
  247 + }
242 248  
243 249 if (bpw < 4 || bpw > 24) {
244 250 dev_err(&spi->dev, "setupxfer: invalid bits_per_word=%d\n",