lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 20 Jun 2018 09:11:19 +0000
From:   Michael Shych <michaelsh@...lanox.com>
To:     Peter Rosin <peda@...ntia.se>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     Wolfram Sang <wsa@...-dreams.de>,
        Vadim Pasternak <vadimp@...lanox.com>,
        Guenter Roeck <linux@...ck-us.net>,
        Akinobu Mita <akinobu.mita@...il.com>,
        Jean Delvare <jdelvare@...e.com>,
        "linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>
Subject: RE: [PATCH 2/5] i2c: mux: mlxcpld: make use of __i2c_smbus_xfer



> -----Original Message-----
> From: Peter Rosin [mailto:peda@...ntia.se]
> Sent: Wednesday, June 20, 2018 11:52 AM
> To: linux-kernel@...r.kernel.org
> Cc: Peter Rosin <peda@...ntia.se>; Wolfram Sang <wsa@...-dreams.de>;
> Vadim Pasternak <vadimp@...lanox.com>; Michael Shych
> <michaelsh@...lanox.com>; Guenter Roeck <linux@...ck-us.net>;
> Akinobu Mita <akinobu.mita@...il.com>; Jean Delvare
> <jdelvare@...e.com>; linux-i2c@...r.kernel.org
> Subject: [PATCH 2/5] i2c: mux: mlxcpld: make use of __i2c_smbus_xfer
> 
> This simplifies the code, and you get retries for free if the adapter
> does not support ->master_xfer.
> 
> Signed-off-by: Peter Rosin <peda@...ntia.se>

Acked-by: Michael Shych <michaelsh@...lanox.com>

> ---
>  drivers/i2c/muxes/i2c-mux-mlxcpld.c | 28 ++++------------------------
>  1 file changed, 4 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-mlxcpld.c b/drivers/i2c/muxes/i2c-
> mux-mlxcpld.c
> index 12ad8d65faf6..f2bf3e57ed67 100644
> --- a/drivers/i2c/muxes/i2c-mux-mlxcpld.c
> +++ b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
> @@ -94,31 +94,11 @@ static int mlxcpld_mux_reg_write(struct i2c_adapter
> *adap,
>  				 struct i2c_client *client, u8 val)
>  {
>  	struct mlxcpld_mux_plat_data *pdata = dev_get_platdata(&client-
> >dev);
> -	int ret = -ENODEV;
> -
> -	if (adap->algo->master_xfer) {
> -		struct i2c_msg msg;
> -		u8 msgbuf[] = {pdata->sel_reg_addr, val};
> -
> -		msg.addr = client->addr;
> -		msg.flags = 0;
> -		msg.len = 2;
> -		msg.buf = msgbuf;
> -		ret = __i2c_transfer(adap, &msg, 1);
> -
> -		if (ret >= 0 && ret != 1)
> -			ret = -EREMOTEIO;
> -	} else if (adap->algo->smbus_xfer) {
> -		union i2c_smbus_data data;
> -
> -		data.byte = val;
> -		ret = adap->algo->smbus_xfer(adap, client->addr,
> -					     client->flags, I2C_SMBUS_WRITE,
> -					     pdata->sel_reg_addr,
> -					     I2C_SMBUS_BYTE_DATA, &data);
> -	}
> +	union i2c_smbus_data data = { .byte = val };
> 
> -	return ret;
> +	return __i2c_smbus_xfer(adap, client->addr, client->flags,
> +				I2C_SMBUS_WRITE, pdata->sel_reg_addr,
> +				I2C_SMBUS_BYTE_DATA, &data);
>  }
> 
>  static int mlxcpld_mux_select_chan(struct i2c_mux_core *muxc, u32 chan)
> --
> 2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ