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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27f4fda0-a00b-4278-a5a1-1cea4a3be97c@wanadoo.fr>
Date: Tue, 10 Dec 2024 23:07:43 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Dzmitry Sankouski <dsankouski@...il.com>,
 Sebastian Reichel <sre@...nel.org>, Chanwoo Choi <cw00.choi@...sung.com>,
 Krzysztof Kozlowski <krzk@...nel.org>, Lee Jones <lee@...nel.org>,
 Rob Herring <robh@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
 Dmitry Torokhov <dmitry.torokhov@...il.com>, Pavel Machek <pavel@....cz>,
 Hans de Goede <hdegoede@...hat.com>,
 Marek Szyprowski <m.szyprowski@...sung.com>,
 Sebastian Krzyszkowiak <sebastian.krzyszkowiak@...i.sm>,
 Purism Kernel Team <kernel@...i.sm>
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
 devicetree@...r.kernel.org, linux-input@...r.kernel.org,
 linux-leds@...r.kernel.org
Subject: Re: [PATCH v11 8/9] power: supply: max77705: Add charger driver for
 Maxim 77705

Le 09/12/2024 à 12:26, Dzmitry Sankouski a écrit :
> Add driver for Maxim 77705 switch-mode charger (part of max77705
> MFD driver) providing power supply class information to userspace.
> 
> The driver is configured through DTS (battery and system related
> settings).
> 
> Signed-off-by: Dzmitry Sankouski <dsankouski@...il.com>
> 

...

> +static void max77705_chgin_isr_work(struct work_struct *work)
> +{
> +	struct max77705_charger_data *charger =
> +		container_of(work, struct max77705_charger_data, chgin_work);

Missing new line.

> +	power_supply_changed(charger->psy_chg);
> +}

...

> +static int max77705_charger_probe(struct platform_device *pdev)
> +{
> +	struct power_supply_config pscfg = {};
> +	struct i2c_client *i2c_chg;
> +	struct max77693_dev *max77705;
> +	struct max77705_charger_data *chg;
> +	struct device *dev, *parent;
> +	struct regmap_irq_chip_data *irq_data;
> +	int ret;
> +
> +	dev = &pdev->dev;
> +	parent = dev->parent;
> +	max77705 = dev_get_drvdata(parent);
> +
> +	chg = devm_kzalloc(dev, sizeof(*chg), GFP_KERNEL);
> +	if (!chg)
> +		return -ENOMEM;
> +
> +	platform_set_drvdata(pdev, chg);
> +
> +	i2c_chg = devm_i2c_new_dummy_device(dev, max77705->i2c->adapter, I2C_ADDR_CHG);
> +	if (IS_ERR(i2c_chg))
> +		return PTR_ERR(i2c_chg);
> +
> +	chg->regmap = devm_regmap_init_i2c(i2c_chg, &max77705_chg_regmap_config);
> +	if (IS_ERR(chg->regmap))
> +		return PTR_ERR(chg->regmap);
> +
> +	chg->dev = dev;
> +
> +	ret = regmap_update_bits(chg->regmap,
> +				MAX77705_CHG_REG_INT_MASK,
> +				MAX77705_CHGIN_IM, 0);
> +	if (ret)
> +		return ret;
> +
> +	pscfg.of_node = dev->of_node;
> +	pscfg.drv_data = chg;
> +
> +	chg->psy_chg = devm_power_supply_register(dev, &max77705_charger_psy_desc, &pscfg);
> +	if (IS_ERR(chg->psy_chg))
> +		return PTR_ERR(chg->psy_chg);
> +
> +	max77705_charger_irq_chip.irq_drv_data = chg;
> +	ret = devm_regmap_add_irq_chip(chg->dev, chg->regmap, max77705->irq,
> +					IRQF_ONESHOT | IRQF_SHARED, 0,
> +					&max77705_charger_irq_chip,
> +					&irq_data);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to add irq chip\n");
> +
> +	chg->wqueue = create_singlethread_workqueue(dev_name(dev));
> +	if (IS_ERR(chg->wqueue))
> +		return dev_err_probe(dev, PTR_ERR(chg->wqueue), "failed to create workqueue\n");
> +
> +	INIT_WORK(&chg->chgin_work, max77705_chgin_isr_work);
> +
> +	max77705_charger_initialize(chg);
> +
> +	ret = devm_add_action_or_reset(dev, max77705_charger_disable, chg);

*Based on naming only*, it is strange to add an action to disable 
something that seems to be enabled a few lines below.

Should this be after a successfulmax77705_charger_enable()?

> +	if (ret)
> +		return ret;
> +
> +	return max77705_charger_enable(chg);
> +}

...

CJ

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ