fix PCA waitforcompletion() return value
PATCH 1/1 fix PCA waitforcompletion() return value
ret is still -1, if during the polling read_byte() returns at once with I2C_PCA_CON_SI set. So ret > 0 would lead *_waitforcompletion() to return 0, in spite of the proper behavior.
The routine was rewritten, so that ret has always a proper value, before returning.
drivers/i2c/busses/i2c-pca-platform.c +7 -4
@@ -80,8 +80,8 @@static int i2c_pca_pf_waitforcompletion (void *pd) {struct i2c_pca_pf_data *i2c = pd; -long ret = ~0 ;unsigned long timeout; +long ret;if (i2c->irq) { ret = wait_event_timeout(i2c->wait,
@@ -90,10 +90,13 @@ }else {/* Do polling */ timeout = jiffies + i2c->adap.timeout; -while (((i2c->algo_data.read_byte (i2c,I2C_PCA_CON ) - &I2C_PCA_CON_SI ) ==0 ) - && (ret =time_before (jiffies, timeout))) +do { + ret =time_before (jiffies, timeout); +if (i2c->algo_data.read_byte (i2c,I2C_PCA_CON ) + &I2C_PCA_CON_SI ) +break ;udelay (100 ); + }while (ret); }return ret >0 ;
drivers/i2c/busses/i2c-pca-isa.c +8 -4
@@ -71,8 +71,8 @@static int pca_isa_waitforcompletion (void *pd) { -long ret = ~0 ;unsigned long timeout; +long ret;if (irq >-1 ) { ret = wait_event_timeout(pca_wait,
@@ -81,11 +81,15 @@ }else {/* Do polling */ timeout = jiffies + pca_isa_ops.timeout; -while (((pca_isa_readbyte (pd,I2C_PCA_CON ) - &I2C_PCA_CON_SI ) ==0 ) - && (ret =time_before (jiffies, timeout))) +do { + ret =time_before (jiffies, timeout); +if (pca_isa_readbyte (pd,I2C_PCA_CON ) + &I2C_PCA_CON_SI ) +break ;udelay (100 ); + }while (ret); } +return ret >0 ; }
Quoted 9 lines · Yegor Yefremov
ret is still -1, if during the polling
read_byte()returns at once withI2C_PCA_CON_SIset. So ret > 0 would lead*_waitforcompletion()to return 0, in spite of the proper behavior.The routine was rewritten, so that ret has always a proper value, before returning.
Signed-off-by Yegor Yefremov <yegorslists-gM/[email protected]>Reviewed-by Wolfram Sang <[email protected]>
Great! Jean, I think this is .36-relevant. Do you plan another pull-request (hmm, there is still my clientdata-patch ;))? Should probably go to stable, too.
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Hi Wolfram,
Quoted 8 lines · Wolfram Sang
Quoted 7 lines · Yegor Yefremov
ret is still -1, if during the polling
read_byte()returns at once withI2C_PCA_CON_SIset. So ret > 0 would lead*_waitforcompletion()to return 0, in spite of the proper behavior.The routine was rewritten, so that ret has always a proper value, before returning.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Yegor Yefremov <yegorslists-gM/[email protected]>Reviewed-by Wolfram Sang <[email protected]>Great! Jean, I think this is .36-relevant. Do you plan another pull-request (hmm, there is still my clientdata-patch ;))? Should probably go to stable, too.
Yes, I have a few i2c patches scheduled for 2.6.36 and plan to send Linus a pull request soon. I'm a little busy this week at work, and also due to a complete workstastion update so I must setup a number of things again and this temporarily hinders my efficiency.
Signature · 1 line
Jean Delvare
Quoted 14 lines · Jean Delvare
Hi Wolfram,
Quoted 11 lines · Wolfram Sang
Quoted 9 lines · Yegor Yefremov
ret is still -1, if during the polling
read_byte()returns at once withI2C_PCA_CON_SIset. So ret > 0 would lead*_waitforcompletion()to return 0, in spite of the proper behavior.The routine was rewritten, so that ret has always a proper value, before returning.
Signed-off-by Yegor Yefremov <yegorslists-gM/[email protected]>Reviewed-by Wolfram Sang <[email protected]>
Quoted 8 lines
Quoted 3 lines
Great! Jean, I think this is .36-relevant. Do you plan another pull-request (hmm, there is still my clientdata-patch ;))? Should probably go to stable, too.
Yes, I have a few i2c patches scheduled for 2.6.36 and plan to send Linus a pull request soon. I'm a little busy this week at work, and also due to a complete workstastion update so I must setup a number of things again and this temporarily hinders my efficiency.
Want me to push it, i've a few fixes too.
Signature · 4 lines
Ben Q: What's a light-year? A: One-third less calories than a regular year.
Quoted 19 lines · Ben Dooks
Quoted 18 lines · Jean Delvare
Hi Wolfram,
Quoted 14 lines · Wolfram Sang
Quoted 9 lines · Yegor Yefremov
ret is still -1, if during the polling
read_byte()returns at once withI2C_PCA_CON_SIset. So ret > 0 would lead*_waitforcompletion()to return 0, in spite of the proper behavior.The routine was rewritten, so that ret has always a proper value, before returning.
Signed-off-by Yegor Yefremov <yegorslists-gM/[email protected]>Reviewed-by Wolfram Sang <[email protected]>Great! Jean, I think this is .36-relevant. Do you plan another pull-request (hmm, there is still my clientdata-patch ;))? Should probably go to stable, too.
Quoted 6 lines
Quoted 4 lines
Yes, I have a few i2c patches scheduled for 2.6.36 and plan to send Linus a pull request soon. I'm a little busy this week at work, and also due to a complete workstastion update so I must setup a number of things again and this temporarily hinders my efficiency.
Want me to push it, i've a few fixes too.
No, thanks. It's already in my tree and ready to go to Linus. I know I'm lagging behind a bit these days but this should get better by the end of the week.
Signature · 1 line
Jean Delvare