Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu

2017-07-04 Thread Andy Shevchenko
On Tue, Jul 4, 2017 at 12:11 PM, Julia Lawall wrote: > Here is a revised version (not a patch because it doesn't support all of > the various modes) and the results. It doesn't return anything beyond > what was mentioned in previous mails. > > For the following code: > > ret = i2c_smbus_r

Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu

2017-07-04 Thread Julia Lawall
On Tue, 4 Jul 2017, Andy Shevchenko wrote: > On Tue, Jul 4, 2017 at 12:11 PM, Julia Lawall wrote: > > Here is a revised version (not a patch because it doesn't support all of > > the various modes) and the results. It doesn't return anything beyond > > what was mentioned in previous mails. > >

Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu

2017-07-04 Thread Julia Lawall
Here is a revised version (not a patch because it doesn't support all of the various modes) and the results. It doesn't return anything beyond what was mentioned in previous mails. For the following code: ret = i2c_smbus_read_word_data(chip->client, reg << 1); val[0] = (u16)ret &

Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu

2017-07-03 Thread Sebastian Reichel
Hi, On Mon, Jul 03, 2017 at 08:33:53PM +0300, Andy Shevchenko wrote: > On Mon, Jul 3, 2017 at 8:14 PM, Sebastian Reichel > wrote: > > On Mon, Jul 03, 2017 at 07:37:59PM +0300, Andy Shevchenko wrote: > >> On Mon, Jul 3, 2017 at 4:36 PM, Sebastian Reichel > >> wrote: > >> > On Sat, Jul 01, 2017 at

Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu

2017-07-03 Thread Andy Shevchenko
On Mon, Jul 3, 2017 at 8:14 PM, Sebastian Reichel wrote: > Hi, > > On Mon, Jul 03, 2017 at 07:37:59PM +0300, Andy Shevchenko wrote: >> On Mon, Jul 3, 2017 at 4:36 PM, Sebastian Reichel >> wrote: >> > On Sat, Jul 01, 2017 at 09:28:10PM +0200, Julia Lawall wrote: >> >> > * drivers/gpio/gpio-pca953

Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu

2017-07-03 Thread Sebastian Reichel
Hi, On Mon, Jul 03, 2017 at 07:37:59PM +0300, Andy Shevchenko wrote: > On Mon, Jul 3, 2017 at 4:36 PM, Sebastian Reichel > wrote: > > On Sat, Jul 01, 2017 at 09:28:10PM +0200, Julia Lawall wrote: > > > * drivers/gpio/gpio-pca953x.c (line 190-192) > > It has double conversion there: > 1. LE CPU

Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu

2017-07-03 Thread Andy Shevchenko
On Mon, Jul 3, 2017 at 4:36 PM, Sebastian Reichel wrote: > On Sat, Jul 01, 2017 at 09:28:10PM +0200, Julia Lawall wrote: > * drivers/gpio/gpio-pca953x.c (line 190-192) It has double conversion there: 1. LE CPU: Read as LE and converted to LE (no-op), so, just u16 2. BE CPU: Read as BE and conve

Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu

2017-07-03 Thread Sebastian Reichel
Hi Julia, On Sat, Jul 01, 2017 at 09:28:10PM +0200, Julia Lawall wrote: > As reported by Sebastian Reichel, i2c_smbus_read_word_data() returns native > endianness for little-endian bus (it basically has builtin > le16_to_cpu). Calling le16_to_cpu on the result breaks support on big > endian machin

[PATCH] coccinelle: api: detect unnecessary le16_to_cpu

2017-07-01 Thread Julia Lawall
As reported by Sebastian Reichel, i2c_smbus_read_word_data() returns native endianness for little-endian bus (it basically has builtin le16_to_cpu). Calling le16_to_cpu on the result breaks support on big endian machines by converting it back. This semantic patch give no reports on kernel code cur