Message ID | 20190818182600.3047-2-olteanv@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Deterministic SPI latency with NXP DSPI driver | expand |
On Sun, Aug 18, 2019 at 09:25:56PM +0300, Vladimir Oltean wrote: > /* Extract head of queue */ > - ctlr->cur_msg = > - list_first_entry(&ctlr->queue, struct spi_message, queue); > + mesg = list_first_entry(&ctlr->queue, struct spi_message, queue); > + ctlr->cur_msg = mesg; Why mesg when the existing code uses msg as an abbreviation here?
Hi Mark, On Tue, 20 Aug 2019 at 21:21, Mark Brown <broonie@kernel.org> wrote: > > On Sun, Aug 18, 2019 at 09:25:56PM +0300, Vladimir Oltean wrote: > > > /* Extract head of queue */ > > - ctlr->cur_msg = > > - list_first_entry(&ctlr->queue, struct spi_message, queue); > > + mesg = list_first_entry(&ctlr->queue, struct spi_message, queue); > > + ctlr->cur_msg = mesg; > > Why mesg when the existing code uses msg as an abbreviation here? Does it matter? I took from spi_finalize_current_message which also uses mesg.
On Tue, Aug 20, 2019 at 10:36:43PM +0300, Vladimir Oltean wrote: > On Tue, 20 Aug 2019 at 21:21, Mark Brown <broonie@kernel.org> wrote: > > On Sun, Aug 18, 2019 at 09:25:56PM +0300, Vladimir Oltean wrote: > > > /* Extract head of queue */ > > > - ctlr->cur_msg = > > > - list_first_entry(&ctlr->queue, struct spi_message, queue); > > > + mesg = list_first_entry(&ctlr->queue, struct spi_message, queue); > > > + ctlr->cur_msg = mesg; > > Why mesg when the existing code uses msg as an abbreviation here? > Does it matter? I took from spi_finalize_current_message which also uses mesg. It's particularly visible when it's on the same line, flags up a question about if things are the same. Other things not being great doesn't preclude making this one better.
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index aef55acb5ccd..d96e04627982 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1265,8 +1265,9 @@ EXPORT_SYMBOL_GPL(spi_finalize_current_transfer); */ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread) { - unsigned long flags; + struct spi_message *mesg; bool was_busy = false; + unsigned long flags; int ret; /* Lock queue */ @@ -1325,10 +1326,10 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread) } /* Extract head of queue */ - ctlr->cur_msg = - list_first_entry(&ctlr->queue, struct spi_message, queue); + mesg = list_first_entry(&ctlr->queue, struct spi_message, queue); + ctlr->cur_msg = mesg; - list_del_init(&ctlr->cur_msg->queue); + list_del_init(&mesg->queue); if (ctlr->busy) was_busy = true; else @@ -1361,7 +1362,7 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread) if (ctlr->auto_runtime_pm) pm_runtime_put(ctlr->dev.parent); - ctlr->cur_msg->status = ret; + mesg->status = ret; spi_finalize_current_message(ctlr); mutex_unlock(&ctlr->io_mutex); @@ -1369,28 +1370,28 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread) } } - trace_spi_message_start(ctlr->cur_msg); + trace_spi_message_start(mesg); if (ctlr->prepare_message) { - ret = ctlr->prepare_message(ctlr, ctlr->cur_msg); + ret = ctlr->prepare_message(ctlr, mesg); if (ret) { dev_err(&ctlr->dev, "failed to prepare message: %d\n", ret); - ctlr->cur_msg->status = ret; + mesg->status = ret; spi_finalize_current_message(ctlr); goto out; } ctlr->cur_msg_prepared = true; } - ret = spi_map_msg(ctlr, ctlr->cur_msg); + ret = spi_map_msg(ctlr, mesg); if (ret) { - ctlr->cur_msg->status = ret; + mesg->status = ret; spi_finalize_current_message(ctlr); goto out; } - ret = ctlr->transfer_one_message(ctlr, ctlr->cur_msg); + ret = ctlr->transfer_one_message(ctlr, mesg); if (ret) { dev_err(&ctlr->dev, "failed to transfer one message from queue\n");
This helps a bit with line fitting now (the list_first_entry call) as well as during the next patch which needs to iterate through all transfers of ctlr->cur_msg so it timestamps them. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> --- drivers/spi/spi.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)