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]
Message-ID: <ZtOD0e3ZBnabdK34@shikoro>
Date: Sat, 31 Aug 2024 22:57:53 +0200
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: Farouk Bouabid <farouk.bouabid@...rry.de>
Cc: Andi Shyti <andi.shyti@...nel.org>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Quentin Schulz <quentin.schulz@...rry.de>,
	Peter Rosin <peda@...ntia.se>, Jean Delvare <jdelvare@...e.com>,
	Guenter Roeck <linux@...ck-us.net>,
	Heiko Stuebner <heiko@...ech.de>, linux-i2c@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-hwmon@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-rockchip@...ts.infradead.org
Subject: Re: [PATCH v6 2/8] i2c: muxes: add support for tsd,mule-i2c
 multiplexer

Hi,

On Thu, Jul 25, 2024 at 03:27:48PM +0200, Farouk Bouabid wrote:
> Theobroma Systems Mule is an MCU that emulates a set of I2C devices,
> among which an amc6821 and devices that are reachable through an I2C-mux.
> The devices on the mux can be selected by writing the appropriate device
> number to an I2C config register (amc6821 reg 0xff).
> 
> This driver is expected to be probed as a platform device with amc6821
> as its parent i2c device.
> 
> Add support for the mule-i2c-mux platform driver. The amc6821 driver
> support for the mux will be added in a later commit.

Seems like DT maintainers are happy with the approach. From the I2C
perspective, this seems suitable as well. Just a few minor comments. Can
be fixed incrementally, from my POV. But basically:

Reviewed-by: Wolfram Sang <wsa+renesas@...g-engineering.com>


> +static inline int __mux_select(struct regmap *regmap, u32 dev)
> +{
> +	return regmap_write(regmap, MUX_CONFIG_REG, dev);
> +}

Does this really need to be a seperate function? I'd vote for merging it
into 'mux_select'. Also the __-prefix often means unlocked versions of
some call, so it is also a bit misleading.

> +static int mule_i2c_mux_probe(struct platform_device *pdev)
> +{
> +	struct device *mux_dev = &pdev->dev;
> +	struct mule_i2c_reg_mux *priv;
> +	struct i2c_client *client;
> +	struct i2c_mux_core *muxc;
> +	struct device_node *dev;
> +	unsigned int readback;
> +	int ndev, ret;
> +	bool old_fw;
> +
> +	/* Count devices on the mux */
> +	ndev = of_get_child_count(mux_dev->of_node);
> +	dev_dbg(mux_dev, "%d devices on the mux\n", ndev);
> +
> +	client = to_i2c_client(mux_dev->parent);
> +
> +	muxc = i2c_mux_alloc(client->adapter, mux_dev, ndev, sizeof(*priv),
> +			     I2C_MUX_LOCKED, mux_select, mux_deselect);
> +	if (!muxc)
> +		return dev_err_probe(mux_dev, -ENOMEM,
> +				     "Failed to allocate mux struct\n");

alloc_functions usually print something when failing.

> +		ret = i2c_mux_add_adapter(muxc, 0, reg);
> +		if (ret)
> +			return dev_err_probe(mux_dev, ret,
> +					     "Failed to add i2c mux adapter %d\n", reg);

The 'add_adapter' functions for sure print something when failing.

Thanks!

   Wolfram


Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ