spi: imx: replace schedule() with cond_resched()
Subsystems (2)
PATCH 1/3 spi: imx: replace schedule() with cond_resched()
It's more rational that just do the schedule when necessary other than do it every time. Thus, it's better to replace schedule() with cond_resched() in fsl_lpspi_txfifo_empty(), which contributes to saving cpu time.
--- drivers/spi/spi-fsl-lpspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsl-lpspi.c +1 -1
@@ -178,7 +178,7 @@ static int fsl_lpspi_txfifo_empty(struct fsl_lpspi_data *fsl_lpspi)dev_dbg (fsl_lpspi->dev,"txfifo empty timeout\n" );return -ETIMEDOUT ; } -schedule (); +cond_resched (); }while (txcnt);
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1479985484-6641-1-git-send-email-pandy.gao-3arQi8VN3Tc@public.gmane.org
PATCH 2/3 spi: imx: fix potential shift truncation
There is a static checker warning in fsl_lpspi_set_cmd(). I intended to write "temp |= (fsl_lpspi->config.mode & 0x3) << 30", but used "temp |= (fsl_lpspi->config.mode & 0x11) << 30" by mistake.
This patch fixes this potential shift truncation.
--- drivers/spi/spi-fsl-lpspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsl-lpspi.c +1 -1
@@ -217,7 +217,7 @@ static void fsl_lpspi_set_cmd(struct fsl_lpspi_data *fsl_lpspi, temp |= fsl_lpspi->config.bpw -1 ; temp |= fsl_lpspi->config.prescale <<27 ; - temp |= (fsl_lpspi->config.mode &0x11 ) <<30 ; + temp |= (fsl_lpspi->config.mode &0x3 ) <<30 ; temp |= (fsl_lpspi->config.chip_select &0x3 ) <<24 ;/*
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1479985484-6641-2-git-send-email-pandy.gao-3arQi8VN3Tc@public.gmane.org
Applied "spi: imx: fix potential shift truncation" to the spi tree
The patch
spi: imx: fix potential shift truncation
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
e3a49390ebefec6f7e3d447b5ba3ba253dd51145Mon Sep 17 00:00:00 2001
From: Gao Pan <[email protected]>
Date: Thu, 24 Nov 2016 19:04:43 +0800
Subject: [PATCH] spi: imx: fix potential shift truncation
There is a static checker warning in fsl_lpspi_set_cmd(). I intended to write "temp |= (fsl_lpspi->config.mode & 0x3) << 30", but used "temp |= (fsl_lpspi->config.mode & 0x11) << 30" by mistake.
This patch fixes this potential shift truncation.
--- drivers/spi/spi-fsl-lpspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsl-lpspi.c +1 -1
@@ -215,7 +215,7 @@ static void fsl_lpspi_set_cmd(struct fsl_lpspi_data *fsl_lpspi, temp |= fsl_lpspi->config.bpw -1 ; temp |= fsl_lpspi->config.prescale <<27 ; - temp |= (fsl_lpspi->config.mode &0x11 ) <<30 ; + temp |= (fsl_lpspi->config.mode &0x3 ) <<30 ; temp |= (fsl_lpspi->config.chip_select &0x3 ) <<24 ;/*
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/3 spi: imx: use prepare_transfer_hardware() for lpspi
In reply to a message not in the archiveThe old driver enable clk in fsl_lpspi_prepare_message() and disable clk in fsl_lpspi_unprepare_message().
Rather than doing this per message it's a bit better to do it in prepare_transfer_hardware(), that way if there's a sequence of messages queued one after another we don't turn the clock on and off all the time.
--- drivers/spi/spi-fsl-lpspi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/spi/spi-fsl-lpspi.c +4 -6
@@ -148,16 +148,14 @@ static void fsl_lpspi_intctrl(struct fsl_lpspi_data *fsl_lpspi,writel (enable, fsl_lpspi->base +IMX7ULP_IER ); } -static int fsl_lpspi_prepare_message (struct spi_master *master, -struct spi_message *msg) +static int lpspi_prepare_xfer_hardware (struct spi_master *master) {struct fsl_lpspi_data *fsl_lpspi =spi_master_get_devdata (master);return clk_prepare_enable (fsl_lpspi->clk); } -static int -fsl_lpspi_unprepare_message (struct spi_master *master,struct spi_message *msg) +static int lpspi_unprepare_xfer_hardware (struct spi_master *master) {struct fsl_lpspi_data *fsl_lpspi =spi_master_get_devdata (master);
@@ -438,8 +436,8 @@ static int fsl_lpspi_probe(struct platform_device *pdev) fsl_lpspi->dev = &pdev->dev; master->transfer_one_message = fsl_lpspi_transfer_one_msg; - master->prepare_message = fsl_lpspi_prepare_message; - master->unprepare_message = fsl_lpspi_unprepare_message; + master->prepare_transfer_hardware = lpspi_prepare_xfer_hardware; + master->unprepare_transfer_hardware = lpspi_unprepare_xfer_hardware; master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH ; master->flags =SPI_MASTER_MUST_RX |SPI_MASTER_MUST_TX ; master->dev.of_node = pdev->dev.of_node;
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1479985484-6641-3-git-send-email-pandy.gao-3arQi8VN3Tc@public.gmane.org
Applied "spi: imx: use prepare_transfer_hardware() for lpspi" to the spi tree
The patch
spi: imx: use prepare_transfer_hardware() for lpspi
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
3ffa1a5dc696f661754bf145813433fda92371b2Mon Sep 17 00:00:00 2001
From: Gao Pan <[email protected]>
Date: Thu, 24 Nov 2016 19:04:44 +0800
Subject: [PATCH] spi: imx: use prepare_transfer_hardware() for lpspi
The old driver enable clk in fsl_lpspi_prepare_message() and disable clk in fsl_lpspi_unprepare_message().
Rather than doing this per message it's a bit better to do it in prepare_transfer_hardware(), that way if there's a sequence of messages queued one after another we don't turn the clock on and off all the time.
--- drivers/spi/spi-fsl-lpspi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/spi/spi-fsl-lpspi.c +4 -6
@@ -148,16 +148,14 @@ static void fsl_lpspi_intctrl(struct fsl_lpspi_data *fsl_lpspi,writel (enable, fsl_lpspi->base +IMX7ULP_IER ); } -static int fsl_lpspi_prepare_message (struct spi_master *master, -struct spi_message *msg) +static int lpspi_prepare_xfer_hardware (struct spi_master *master) {struct fsl_lpspi_data *fsl_lpspi =spi_master_get_devdata (master);return clk_prepare_enable (fsl_lpspi->clk); } -static int -fsl_lpspi_unprepare_message (struct spi_master *master,struct spi_message *msg) +static int lpspi_unprepare_xfer_hardware (struct spi_master *master) {struct fsl_lpspi_data *fsl_lpspi =spi_master_get_devdata (master);
@@ -438,8 +436,8 @@ static int fsl_lpspi_probe(struct platform_device *pdev) fsl_lpspi->dev = &pdev->dev; master->transfer_one_message = fsl_lpspi_transfer_one_msg; - master->prepare_message = fsl_lpspi_prepare_message; - master->unprepare_message = fsl_lpspi_unprepare_message; + master->prepare_transfer_hardware = lpspi_prepare_xfer_hardware; + master->unprepare_transfer_hardware = lpspi_unprepare_xfer_hardware; master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH ; master->flags =SPI_MASTER_MUST_RX |SPI_MASTER_MUST_TX ; master->dev.of_node = pdev->dev.of_node;
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Applied "spi: imx: replace schedule() with cond_resched()" to the spi tree
In reply to a message not in the archiveThe patch
spi: imx: replace schedule() with cond_resched()
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
14de3918eacfc624023775c319e85e6597514195Mon Sep 17 00:00:00 2001
From: Gao Pan <[email protected]>
Date: Thu, 24 Nov 2016 19:04:42 +0800
Subject: [PATCH] spi: imx: replace schedule() with cond_resched()
It's more rational that just do the schedule when necessary other than do it every time. Thus, it's better to replace schedule() with cond_resched() in fsl_lpspi_txfifo_empty(), which contributes to saving cpu time.
--- drivers/spi/spi-fsl-lpspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsl-lpspi.c +1 -1
@@ -176,7 +176,7 @@ static int fsl_lpspi_txfifo_empty(struct fsl_lpspi_data *fsl_lpspi)dev_dbg (fsl_lpspi->dev,"txfifo empty timeout\n" );return -ETIMEDOUT ; } -schedule (); +cond_resched (); }while (txcnt);
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html