Re: [PATCH v2] i2c: aspeed: Deassert reset in probe

From: Joel Stanley
Date: Sun Oct 29 2017 - 23:18:29 EST


On Fri, Oct 27, 2017 at 7:23 AM, Wolfram Sang <wsa@xxxxxxxxxxxxx> wrote:
>> > + bus->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
>>
>> This could return error values in case of broken device trees, so you
>> may want to check IS_ERR(bus->rst) and handle the error here.

>From my understanding the optional variant of the API will set
silently fail. That was my intention - an outdated device tree would
result in the same behaviour as the old driver.

>>
>> > + reset_control_deassert(bus->rst);
>>
>> Otherwise this will dump a warning.
>>
>> > +
>> > ret = of_property_read_u32(pdev->dev.of_node,
>> > "bus-frequency", &bus->bus_frequency);
>> > if (ret < 0) {
>> > @@ -919,6 +925,8 @@ static int aspeed_i2c_remove_bus(struct platform_device *pdev)
>> >
>> > i2c_del_adapter(&bus->adap);
>> >
>> > + reset_control_assert(bus->rst);
>>
>> As will this.
>>
>> Reviewed-by: Philipp Zabel <philipp.zabel@xxxxxxxxx>
>
> Joel, do you want to fix it? I'd think it makes sense...

Sorry, I've been on vacation. I thought the _optional variant of the
API would do the right thing for my use case (silently fail on old
device trees), but I'll add a check.

v3 incoming.

Cheers,

Joel