spi: limit reaches -1, tested 0
Subsystems (2)
PATCH 1/1 spi: limit reaches -1, tested 0
With a postfix decrement limit will reach -1 rather than 0, so the warning will not be issued.
---
drivers/spi/spi_imx.c +1 -1
@@ -779,7 +779,7 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)/* Read trailing bytes */ limit = loops_per_jiffy <<1 ; -while ((read (drv_data) ==0 ) && limit--); +while ((read (drv_data) ==0 ) && --limit);if (limit ==0 ) dev_err(&drv_data->pdev->dev,
Quoted 4 lines · Roel Kluin
With a postfix decrement limit will reach -1 rather than 0, so the warning will not be issued.
Signed-off-by Roel Kluin <[email protected]>
Quoted 8 lines
---
drivers/spi/spi_imx.c +0
-0
drivers/spi/spi_imx.c static irqreturn_t interrupt_transfer(struct driver_data *drv_data) · line 785
Quoted 8 lines
drivers/spi/spi_imx.c +1
-1@@ -779,7 +779,7 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)/* Read trailing bytes */ limit = loops_per_jiffy <<1 ; -while ((read (drv_data) ==0 ) && limit--); +while ((read (drv_data) ==0 ) && --limit);if (limit ==0 ) dev_err(&drv_data->pdev->dev,
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
Quoted 17 lines · David Brownell
Quoted 4 lines · Roel Kluin
With a postfix decrement limit will reach -1 rather than 0, so the warning will not be issued.
Signed-off-by Roel Kluin <[email protected]>Acked-by David Brownell <[email protected]>Quoted 7 lines
---
drivers/spi/spi_imx.c +0
-0@@ -779,7 +779,7 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
Quoted 4 lines
drivers/spi/spi_imx.c static irqreturn_t interrupt_transfer(struct driver_data *drv_data) · line 782
Quoted 4 lines
drivers/spi/spi_imx.c +1
-1/* Read trailing bytes */ limit = loops_per_jiffy <<1 ; -while ((read (drv_data) ==0 ) && limit--); +while ((read (drv_data) ==0 ) && --limit);
... although I wouldn't have resisted the urge to make the loop body be "cpu_relax();" instead of an empty statement.
Quoted 8 lines
drivers/spi/spi_imx.c static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
Quoted 5 lines
drivers/spi/spi_imx.c +0
-0if (limit ==0 ) dev_err(&drv_data->pdev->dev,
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
Quoted 5 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +1
-1- while ((read(drv_data) == 0) && limit--); + while ((read(drv_data) == 0) && --limit);... although I wouldn't have resisted the urge to make the loop body be "
cpu_relax();" instead of an empty statement.
Ok, ---------------------------->8-------------------8<----------------------------- With a postfix decrement limit will reach -1 rather than 0, so the warning will not be issued.
---
drivers/spi/spi_imx.c +2 -1
@@ -779,7 +779,8 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)/* Read trailing bytes */ limit = loops_per_jiffy <<1 ; -while ((read (drv_data) ==0 ) && limit--); +while ((read (drv_data) ==0 ) && limit--) +cpu_relax ();if (limit ==0 ) dev_err(&drv_data->pdev->dev,
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
David Brownell
Acked-byQuoted 6 lines · Roel Kluin
Quoted 5 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +1
-1- while ((read(drv_data) == 0) && limit--); + while ((read(drv_data) == 0) && --limit);... although I wouldn't have resisted the urge to make the loop body be "
cpu_relax();" instead of an empty statement.
Quoted 6 lines
Ok, ---------------------------->8-------------------8<----------------------------- With a postfix decrement limit will reach -1 rather than 0, so the warning will not be issued.
Signed-off-by Roel Kluin <[email protected]>
Still:
Quoted 8 lines
---
drivers/spi/spi_imx.c +0
-0
drivers/spi/spi_imx.c static irqreturn_t interrupt_transfer(struct driver_data *drv_data) · line 786
Quoted 9 lines
drivers/spi/spi_imx.c +2
-1@@ -779,7 +779,8 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)/* Read trailing bytes */ limit = loops_per_jiffy <<1 ; -while ((read (drv_data) ==0 ) && limit--); +while ((read (drv_data) ==0 ) && limit--) +cpu_relax ();if (limit ==0 ) dev_err(&drv_data->pdev->dev,
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
Roel Kluin writes in first post:
Review
Quoted 2 lines
(quoted diff) +1
-1- while ((read(drv_data) == 0) && limit--); + while ((read(drv_data) == 0) && --limit);
Roel Kluin writes in last post:
drivers/spi/spi_imx.c static irqreturn_t interrupt_transfer(struct driver_data *drv_data) · line 783
Quoted 3 lines
drivers/spi/spi_imx.c +2
-1-while ((read (drv_data) ==0 ) && limit--); +while ((read (drv_data) ==0 ) && limit--) +cpu_relax ();
so should there be postfix or prefix decrement ? :)
Mariusz Ceier
Roel Kluin
Acked-by David BrownellQuoted 10 lines · Mariusz Ceier
Roel Kluin writes in first post:
Review
Quoted 2 lines
(quoted diff) +1
-1- while ((read(drv_data) == 0) && limit--); + while ((read(drv_data) == 0) && --limit);Roel Kluin writes in last post:
Review
Quoted 3 lines
(quoted diff) +2
-1- while ((read(drv_data) == 0) && limit--); + while ((read(drv_data) == 0) && limit--) + cpu_relax();so should there be postfix or prefix decrement ? :)
Thanks for spotting, I took the liberty to add David Brownell's Acked-by in this case. ----------------------->8------------------8<--------------------------- With a postfix decrement limit will reach -1 rather than 0, so the warning will not be issued.
---
drivers/spi/spi_imx.c +2 -1
@@ -779,7 +779,8 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)/* Read trailing bytes */ limit = loops_per_jiffy <<1 ; -while ((read (drv_data) ==0 ) && limit--); +while ((read (drv_data) ==0 ) && --limit) +cpu_relax ();if (limit ==0 ) dev_err(&drv_data->pdev->dev,
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com