Message ID | 20220301172859.5593309a@endymion.delvare |
---|---|
State | New |
Headers | show |
Series | [1/2] i2c: i801: Drop useless masking in i801_access | expand |
Hi Wolfram, On Wed, 2 Mar 2022 22:13:27 +0100, Wolfram Sang wrote: > On Tue, Mar 01, 2022 at 05:28:59PM +0100, Jean Delvare wrote: > > I went all the way back to kernel 2.6.12 and that masking was never > > needed. I suppose it was there in anticipation of software PEC > > support, but that was never added to the driver (and never will be, > > as this is made obsolete by hardware PEC). > > > > I'm also removing initialization to 0, which is not needed either, > > and would prevent the compiler from reporting an actual usage of > > uninitialized variables. > > > > Signed-off-by: Jean Delvare <jdelvare@suse.de> > > Applied to for-next, thanks! > > Jean, there are still some patches pending for i801, mainly from Heiner > and an interesting one from Hector. Do you have time for these? > > http://patchwork.ozlabs.org/project/linux-i2c/list/?series=&submitter=&state=&q=i801&archive=&delegate= Yes, they are on my to-do list and not forgotten. Just I had a fairly busy January and February. Plus I am currently investigating 2 i2c-i801 issues that have been reported to me privately, and I'd rather get them fixed first before we continue with driver cleanups. Stay tuned,
> Yes, they are on my to-do list and not forgotten. Just I had a fairly > busy January and February. Plus I am currently investigating 2 i2c-i801 > issues that have been reported to me privately, and I'd rather get them > fixed first before we continue with driver cleanups. OK, thanks for the heads up!
--- linux-5.16.orig/drivers/i2c/busses/i2c-i801.c 2022-03-01 10:41:26.946201705 +0100 +++ linux-5.16/drivers/i2c/busses/i2c-i801.c 2022-03-01 10:52:45.376001496 +0100 @@ -792,7 +792,7 @@ static s32 i801_access(struct i2c_adapte { int hwpec; int block = 0; - int ret = 0, xact = 0; + int ret, xact; struct i801_priv *priv = i2c_get_adapdata(adap); mutex_lock(&priv->acpi_lock); @@ -904,7 +904,7 @@ static s32 i801_access(struct i2c_adapte if ((read_write == I2C_SMBUS_WRITE) || (xact == I801_QUICK)) goto out; - switch (xact & 0x7f) { + switch (xact) { case I801_BYTE: /* Result put in SMBHSTDAT0 */ case I801_BYTE_DATA: data->byte = inb_p(SMBHSTDAT0(priv));
I went all the way back to kernel 2.6.12 and that masking was never needed. I suppose it was there in anticipation of software PEC support, but that was never added to the driver (and never will be, as this is made obsolete by hardware PEC). I'm also removing initialization to 0, which is not needed either, and would prevent the compiler from reporting an actual usage of uninitialized variables. Signed-off-by: Jean Delvare <jdelvare@suse.de> --- drivers/i2c/busses/i2c-i801.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)