2024-03-25 15:06:16

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [RFC PATCH 2/2] mfd: rohm-bd71828: Add power off functionality

On 24/03/2024 21:12, Andreas Kemnade wrote:
> struct regmap_irq_chip_data *irq_data;
> @@ -542,7 +560,18 @@ static int bd71828_i2c_probe(struct i2c_client *i2c)
> ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, mfd, cells,
> NULL, 0, regmap_irq_get_domain(irq_data));
> if (ret)
> - dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n");
> + return dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n");
> +
> + if (of_device_is_system_power_controller(i2c->dev.of_node)) {
> + if (!pm_power_off) {
> + bd71828_dev = i2c;
> + pm_power_off = bd71828_power_off;
> + ret = devm_add_action_or_reset(&i2c->dev,
> + bd71828_remove_poweroff,
> + NULL);
> + } else
> + dev_warn(&i2c->dev, "Poweroff callback already assigned\n");

Missing {}

Please run scripts/checkpatch.pl and fix reported warnings. Some
warnings can be ignored, but the code here looks like it needs a fix.
Feel free to get in touch if the warning is not clear.

Best regards,
Krzysztof



2024-03-26 01:09:51

by Andreas Kemnade

[permalink] [raw]
Subject: Re: [RFC PATCH 2/2] mfd: rohm-bd71828: Add power off functionality

On Mon, 25 Mar 2024 13:13:13 +0100
Krzysztof Kozlowski <[email protected]> wrote:

> On 24/03/2024 21:12, Andreas Kemnade wrote:
> > struct regmap_irq_chip_data *irq_data;
> > @@ -542,7 +560,18 @@ static int bd71828_i2c_probe(struct i2c_client *i2c)
> > ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, mfd, cells,
> > NULL, 0, regmap_irq_get_domain(irq_data));
> > if (ret)
> > - dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n");
> > + return dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n");
> > +
> > + if (of_device_is_system_power_controller(i2c->dev.of_node)) {
> > + if (!pm_power_off) {
> > + bd71828_dev = i2c;
> > + pm_power_off = bd71828_power_off;
> > + ret = devm_add_action_or_reset(&i2c->dev,
> > + bd71828_remove_poweroff,
> > + NULL);
> > + } else
> > + dev_warn(&i2c->dev, "Poweroff callback already assigned\n");
>
> Missing {}
>
> Please run scripts/checkpatch.pl and fix reported warnings. Some
> warnings can be ignored, but the code here looks like it needs a fix.
> Feel free to get in touch if the warning is not clear.
>
No, it does not complain about the {}. I was a bit unsure whether it is
required or not, but I was sure that checkpatch.pl does catch such things.
Yes, documentation clearly says that braces are required in those cases.

Regards,
Andreas

2024-03-26 06:33:06

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [RFC PATCH 2/2] mfd: rohm-bd71828: Add power off functionality

On 25/03/2024 21:21, Andreas Kemnade wrote:
> On Mon, 25 Mar 2024 13:13:13 +0100
> Krzysztof Kozlowski <[email protected]> wrote:
>
>> On 24/03/2024 21:12, Andreas Kemnade wrote:
>>> struct regmap_irq_chip_data *irq_data;
>>> @@ -542,7 +560,18 @@ static int bd71828_i2c_probe(struct i2c_client *i2c)
>>> ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, mfd, cells,
>>> NULL, 0, regmap_irq_get_domain(irq_data));
>>> if (ret)
>>> - dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n");
>>> + return dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n");
>>> +
>>> + if (of_device_is_system_power_controller(i2c->dev.of_node)) {
>>> + if (!pm_power_off) {
>>> + bd71828_dev = i2c;
>>> + pm_power_off = bd71828_power_off;
>>> + ret = devm_add_action_or_reset(&i2c->dev,
>>> + bd71828_remove_poweroff,
>>> + NULL);
>>> + } else
>>> + dev_warn(&i2c->dev, "Poweroff callback already assigned\n");
>>
>> Missing {}
>>
>> Please run scripts/checkpatch.pl and fix reported warnings. Some
>> warnings can be ignored, but the code here looks like it needs a fix.
>> Feel free to get in touch if the warning is not clear.
>>
> No, it does not complain about the {}. I was a bit unsure whether it is
> required or not, but I was sure that checkpatch.pl does catch such things.
> Yes, documentation clearly says that braces are required in those cases.

"CHECK: braces {} should be used on all arms of this statement"

I will update my template-response to use --strict.


Best regards,
Krzysztof