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: <20230728031943.1479106-1-like@awinic.com>
Date:   Fri, 28 Jul 2023 03:19:43 +0000
From:   like@...nic.com
To:     krzysztof.kozlowski@...aro.org
Cc:     broonie@...nel.org, conor+dt@...nel.org,
        devicetree@...r.kernel.org, krzysztof.kozlowski+dt@...aro.org,
        lgirdwood@...il.com, liangdong@...nic.com, like@...nic.com,
        linux-kernel@...r.kernel.org, liweilei@...nic.com,
        robh+dt@...nel.org, wangweidong.a@...nic.com
Subject: Re: [PATCH V1 1/2] regulator: aw37503: add regulator driver for AWINIC AW37503

Hello Krzysztof Kozlowski,
Thank you very much for your advice.

> On 26/07/2023 10:16, like@...nic.com wrote:
> > From: Alec Li <like@...nic.com>
> > 
> > Add regulator driver for the device AWINIC AW37503 which is single
> > inductor - dual output power supply device. AW37503 device is
> > designed to support general positive/negative driven applications
> > like TFT display panels.
> > 
> 
> Thank you for your patch. There is something to discuss/improve.
> 
> 
> > +
> > +static int aw37503_probe(struct i2c_client *client)
> > +{
> > +	struct device *dev = &client->dev;
> > +	struct aw37503_regulator *chip;
> > +	struct regulator_dev *rdev;
> > +	struct regmap *regmap;
> > +	struct regulator_config config = { };
> > +	int id;
> > +	int ret;
> > +
> > +	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
> > +	if (!chip)
> > +		return -ENOMEM;
> > +
> > +	regmap = devm_regmap_init_i2c(client, &aw37503_regmap_config);
> > +	if (IS_ERR(regmap)) {
> > +		ret = PTR_ERR(regmap);
> > +		dev_err(dev, "regmap init failed: %d\n", ret);
> > +		return ret;
> 
> return dev_err_probe

I will modify it as suggested.

> > +	}
> > +
> > +	i2c_set_clientdata(client, chip);
> > +	chip->dev = dev;
> > +
> > +	for (id = 0; id < AW37503_MAX_REGULATORS; ++id) {
> > +		config.regmap = regmap;
> > +		config.dev = dev;
> > +		config.driver_data = chip;
> > +
> > +		rdev = devm_regulator_register(dev, &aw_regs_desc[id],
> > +					       &config);
> > +		if (IS_ERR(rdev)) {
> > +			ret = PTR_ERR(rdev);
> > +			dev_err(dev, "regulator %s register failed: %d\n",
> > +				aw_regs_desc[id].name, ret);
> > +			return ret;
> 
> return dev_err_probe will be easier

I will modify it as suggested.

> > +		}
> > +	}
> > +	return 0;
> > +}
> > +
> > +static const struct i2c_device_id aw37503_id[] = {
> > +	{.name = "aw37503",},
> > +	{},
> > +};
> > +MODULE_DEVICE_TABLE(i2c, aw37503_id);
> > +
> > +static const struct of_device_id aw37503_dt_ids[] = {
> > +	{.compatible = "awinic,aw37503",},
> > +	{ /* Sentinel */ },
> > +};
> > +
> > +MODULE_DEVICE_TABLE(of, aw37503_dt_ids);
> > +
> > +static struct i2c_driver aw37503_i2c_driver = {
> > +	.driver = {
> > +		.name = "aw37503",
> > +		.of_match_table = of_match_ptr(aw37503_dt_ids),
> 
> Drop of_match_ptr()

I will modify it as suggested.


Best regards,
Alec Li

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ