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: <Y/S1ftKmV92TL8VO@smile.fi.intel.com>
Date:   Tue, 21 Feb 2023 14:13:50 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Okan Sahin <okan.sahin@...log.com>
Cc:     Lee Jones <lee@...nel.org>, Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        ChiYuan Huang <cy_huang@...htek.com>,
        Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
        William Breathitt Gray <william.gray@...aro.org>,
        Ramona Bolboaca <ramona.bolboaca@...log.com>,
        Caleb Connolly <caleb.connolly@...aro.org>,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-iio@...r.kernel.org
Subject: Re: [PATCH v5 5/5]  mfd: max77541: Add ADI MAX77541/MAX77540 PMIC
 Support

On Tue, Feb 21, 2023 at 01:39:13PM +0300, Okan Sahin wrote:
> MFD driver for MAX77541/MAX77540 to enable its sub
> devices.
> 
> The MAX77541 is a multi-function devices. It includes
> buck converter and ADC.
> 
> The MAX77540 is a high-efficiency buck converter
> with two 3A switching phases.
> 
> They have same regmap except for ADC part of MAX77541.

Extra space in the Subject.

...

> +#include <linux/of_device.h>

Why?

...

> +static const struct regmap_config max77541_regmap_config = {
> +	.reg_bits   = 8,
> +	.val_bits   = 8,

Do you need lock of regmap?

> +};

...

> +static const struct mfd_cell max77540_devs[] = {

> +	MFD_CELL_OF("max77540-regulator", NULL, NULL, 0, 0,
> +		    NULL),

Perfectly one line.

> +};

> +static const struct mfd_cell max77541_devs[] = {
> +	MFD_CELL_OF("max77541-regulator", NULL, NULL, 0, 0,
> +		    NULL),
> +	MFD_CELL_OF("max77541-adc", NULL, NULL, 0, 0,
> +		    NULL),

Ditto.

> +};

...

> +	if (max77541->chip->id == MAX77541) {
> +		ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq,
> +					       IRQF_ONESHOT | IRQF_SHARED, 0,
> +					       &max77541_adc_irq_chip,
> +					       &max77541->irq_adc);
> +		if (ret)
> +			return ret;
> +	}

> +	return ret;

return 0;

...

> +static const struct i2c_device_id max77541_i2c_id[];

What for?

...

> +	if (dev->of_node)
> +		max77541->chip  = of_device_get_match_data(dev);
> +	else
> +		max77541->chip  = (struct chip_info *)
> +					i2c_match_id(max77541_i2c_id,
> +						     client)->driver_data;

Oh. Please use

	const struct i2c_device_id *id = i2c_client_get_device_id(client);
	...
	max77541->chip  = device_get_match_data(dev); // needs property.h
	if (!max77541->chip)
		max77541->chip  = (struct chip_info *)id->driver_data;

> +	if (!max77541->chip)
> +		return -EINVAL;

...

> +#ifndef __MAX77541_MFD_H__
> +#define __MAX77541_MFD_H__

Can we go towards consistency in this?
Seems to me the most used patter so far is

#ifndef __LINUX_MFD_MAX77541_H

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ