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: <e8b6a6bf-fe4a-4ff3-addf-142212368903@kernel.org>
Date: Thu, 24 Jul 2025 10:57:58 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Lakshay Piplani <lakshay.piplani@....com>, linux-kernel@...r.kernel.org,
 linux-iio@...r.kernel.org, jic23@...nel.org, dlechner@...libre.com,
 nuno.sa@...log.com, andy@...nel.org, marcelo.schmitt1@...il.com,
 gregkh@...uxfoundation.org, viro@...iv.linux.org.uk, peterz@...radead.org,
 jstephan@...libre.com, robh@...nel.org, krzk+dt@...nel.org,
 conor+dt@...nel.org, devicetree@...r.kernel.org
Cc: vikash.bansal@....com, priyanka.jain@....com,
 shashank.rebbapragada@....com, Frank.Li@....com, carlos.song@....com,
 xiaoning.wang@....com, haibo.chen@....com
Subject: Re: [PATCH 2/2] iio: temperature: Add driver for NXP P3T175x
 temperature sensor.

On 24/07/2025 10:39, Lakshay Piplani wrote:
> +
> +static void p3t1755_ibi_handler(struct i3c_device *dev,
> +				const struct i3c_ibi_payload *payload)
> +{
> +	struct iio_dev *indio_dev = dev_get_drvdata(&dev->dev);
> +
> +	dev_dbg(&dev->dev, "IBI received, handling threshold event\n");

Drop

> +
> +	// Handle threshold event via helper
> +	p3t1755_push_thresh_event(indio_dev);
> +}
> +
> +/*
> + * Both P3T1755 and P3T1750 share the same I3C
> + * PID (0x011B:0x152A), making runtime differentiation
> + * impossible, so a common "p3t175x" name in sysfs
> + * and IIO for I3C based instances.
> + */
> +static const struct i3c_device_id p3t1755_i3c_ids[] = {
> +	I3C_DEVICE(0x011B, 0x152A, (void *)&p3t175x_channels_info),
> +	{ /* sentinel */ },
> +};
> +
> +MODULE_DEVICE_TABLE(i3c, p3t1755_i3c_ids);
> +
> +static int p3t1755_i3c_probe(struct i3c_device *i3cdev)
> +{
> +	const struct regmap_config p3t1755_i3c_regmap_config = {
> +	.reg_bits = 8,
> +	.val_bits = 8,
> +	};
> +
> +	const struct i3c_device_id *id = i3c_device_match_id(i3cdev, p3t1755_i3c_ids);
> +	const struct p3t17xx_info *chip = &p3t175x_channels_info;
> +	struct device_node *np = i3cdev->dev.of_node;
> +	bool alert_active_high = false;
> +	struct i3c_ibi_setup ibi_setup;
> +	struct regmap *regmap;
> +	bool tm_mode = false;
> +	int fq_bits = -1;
> +	int ret;
> +
> +	regmap = devm_regmap_init_i3c(i3cdev, &p3t1755_i3c_regmap_config);
> +	if (IS_ERR(regmap)) {
> +		dev_err_probe(&i3cdev->dev, PTR_ERR(regmap),
> +			      "Failed to register I3C regmap %ld\n", PTR_ERR(regmap));
> +		return PTR_ERR(regmap);

Syntax is return dev_err_probe

> +	}
> +
> +	/* Parse optional device tree property for alert polarity */
> +	alert_active_high = of_property_read_bool(np, "nxp,alert-active-high");
> +
> +	/* Parse optional device tree property for thermostat mode */
> +	tm_mode = of_property_read_bool(np, "nxp,interrupt-mode");
> +
> +	/* Optional fault queue length */
> +	if (np) {
> +		u32 fq;
> +
> +		if (!of_property_read_u32(np, "nxp,fault-queue", &fq)) {
> +			fq_bits = p3t1755_fault_queue_to_bits(fq);
> +			if (fq_bits < 0) {
> +				dev_err_probe(&i3cdev->dev, fq_bits,
> +					      "invalid nxp,fault-queue %u (1/2/4/6)\n", fq);

Syntax is return dev_err_probe

> +				return fq_bits;
> +			}
> +		}
> +	}
> +
> +	dev_info(&i3cdev->dev, "Using TM mode: %s\n", tm_mode ? "Interrupt" : "Comparator");
> +	dev_info(&i3cdev->dev, "Alert polarity: %s\n",
> +		 alert_active_high ? "Active-High" : "Active-Low");

Drivers should be silent on success. See coding style as well.

> +
> +	if (id && id->data)
> +		chip = (const struct p3t17xx_info *)id->data;
> +
> +	ret = p3t1755_probe(&i3cdev->dev, chip, regmap, tm_mode, alert_active_high, fq_bits);
> +	if (ret) {
> +		dev_err_probe(&i3cdev->dev, ret, "p3t175x probe failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	if (!tm_mode) {
> +		dev_warn(&i3cdev->dev, "IBI not supported in comparator mode, skipping IBI registration\n");
> +		return 0;
> +	}
> +
> +	ibi_setup.handler = p3t1755_ibi_handler;
> +	ibi_setup.num_slots = 4;
> +	ibi_setup.max_payload_len = 0;
> +
> +	ret = i3c_device_request_ibi(i3cdev, &ibi_setup);
> +	if (ret) {
> +		dev_err_probe(&i3cdev->dev, ret, "Failed to request IBI: %d\n", ret);

Syntax is return dev_err_probe

> +		return ret;
> +	}
> +
> +	ret = i3c_device_enable_ibi(i3cdev);
> +	if (ret) {
> +		dev_err_probe(&i3cdev->dev, ret, "Failed to enable IBI: %d\n", ret);

Syntax is return dev_err_probe

> +		i3c_device_free_ibi(i3cdev);
> +		return ret;
> +	}
> +
> +	dev_info(&i3cdev->dev, "IBI successfully registered\n");

Drivers should be silent on success. See coding style as well.

Same comments for all your other drivers here.


Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ