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:	Tue, 3 May 2016 23:38:45 +0200
From:	Wolfram Sang <wsa@...-dreams.de>
To:	Peter Rosin <peda@...ntia.se>
Cc:	linux-kernel@...r.kernel.org, Jonathan Corbet <corbet@....net>,
	Peter Korsgaard <peter.korsgaard@...co.com>,
	Guenter Roeck <linux@...ck-us.net>,
	Jonathan Cameron <jic23@...nel.org>,
	Hartmut Knaack <knaack.h@....de>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Peter Meerwald <pmeerw@...erw.net>,
	Antti Palosaari <crope@....fi>,
	Mauro Carvalho Chehab <mchehab@....samsung.com>,
	Rob Herring <robh+dt@...nel.org>,
	Frank Rowand <frowand.list@...il.com>,
	Grant Likely <grant.likely@...aro.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"David S. Miller" <davem@...emloft.net>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Kalle Valo <kvalo@...eaurora.org>,
	Jiri Slaby <jslaby@...e.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Lucas De Marchi <lucas.demarchi@...el.com>,
	Adriana Reus <adriana.reus@...el.com>,
	Matt Ranostay <matt.ranostay@...el.com>,
	Krzysztof Kozlowski <k.kozlowski@...sung.com>,
	Hans Verkuil <hans.verkuil@...co.com>,
	Terry Heo <terryheo@...gle.com>, Arnd Bergmann <arnd@...db.de>,
	Tommi Rantala <tt.rantala@...il.com>,
	Crestez Dan Leonard <leonard.crestez@...el.com>,
	linux-i2c@...r.kernel.org, linux-doc@...r.kernel.org,
	linux-iio@...r.kernel.org, linux-media@...r.kernel.org,
	devicetree@...r.kernel.org, Peter Rosin <peda@...ator.liu.se>
Subject: Re: [PATCH v7 18/24] i2c-mux: relax locking of the top i2c adapter
 during mux-locked muxing

> +static int i2c_mux_trylock_bus(struct i2c_adapter *adapter, int flags)
> +{
> +	struct i2c_mux_priv *priv = adapter->algo_data;
> +	struct i2c_adapter *parent = priv->muxc->parent;
> +
> +	if (!rt_mutex_trylock(&parent->mux_lock))
> +		return 0;
> +	if (!(flags & I2C_LOCK_ADAPTER))
> +		return 1;
> +	if (parent->trylock_bus(parent, flags))
> +		return 1;
> +	rt_mutex_unlock(&parent->mux_lock);
> +	return 0;
> +}

This function needs a few short comments why we can leave in this or
that state. Not everyone knows the exit values of trylock by heart and
then it can look a little confusing.

>  static int i2c_parent_trylock_bus(struct i2c_adapter *adapter, int flags)
> @@ -111,7 +189,12 @@ static int i2c_parent_trylock_bus(struct i2c_adapter *adapter, int flags)
>  	struct i2c_mux_priv *priv = adapter->algo_data;
>  	struct i2c_adapter *parent = priv->muxc->parent;
>  
> -	return parent->trylock_bus(parent, flags);
> +	if (!rt_mutex_trylock(&parent->mux_lock))
> +		return 0;
> +	if (parent->trylock_bus(parent, flags))
> +		return 1;
> +	rt_mutex_unlock(&parent->mux_lock);
> +	return 0;
>  }

Same comment as i2c_mux_trylock_bus.

>  struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter *parent,
>  				   struct device *dev, int max_adapters,
> @@ -140,6 +250,8 @@ struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter *parent,
>  
>  	muxc->parent = parent;
>  	muxc->dev = dev;
> +	if (flags & I2C_MUX_LOCKED)
> +		muxc->mux_locked = 1;

s/1/true/;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ