spi: Replace lock/unlock patterns to guard
Subsystems (3)
PATCH 1/1 spi: Replace lock/unlock patterns to guard
Replace lock/unlock pattern with guard cleanup macro. This simplifies the code flow path by replacing the conditional jump with an early return.
Generated-by: Coccinelle SmPL
Signed-off-by Erick Karanja <[email protected]>
--- drivers/spi/spi-tegra20-sflash.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/spi/spi-tegra20-sflash.c +3 -5
@@ -359,7 +359,7 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_sflash_data *tsd) {struct spi_transfer *t = tsd->curr_xfer; -spin_lock (&tsd->lock); +guard (spinlock)(&tsd->lock);if (tsd->tx_status || tsd->rx_status || (tsd->status_reg &SPI_BSY )) {dev_err (tsd->dev,"CpuXfer ERROR bit set 0x%x\n" , tsd->status_reg);
@@ -370,7 +370,7 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_sflash_data *tsd)udelay (2 );reset_control_deassert (tsd->rst);complete (&tsd->xfer_completion); - goto exit; +return IRQ_HANDLED ; }if (tsd->cur_direction &DATA_DIR_RX )
@@ -383,13 +383,11 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_sflash_data *tsd)if (tsd->cur_pos == t->len) {complete (&tsd->xfer_completion); - goto exit; +return IRQ_HANDLED ; }tegra_sflash_calculate_curr_xfer_param (tsd->cur_spi, tsd, t);tegra_sflash_start_cpu_based_transfer (tsd, t); -exit: -spin_unlock (&tsd->lock);return IRQ_HANDLED ; }
Signature · 1 line
2.43.0
Mark Brown
maintainerQuoted 3 lines · Erick Karanja
Replace lock/unlock pattern with guard cleanup macro. This simplifies the code flow path by replacing the conditional jump with an early return.
Seriously, please fix your subject lines to follow the style for the subsystem and distinguish between the patches.