From: Jie Zhan <zhanjie9@hisilicon.com>
To: "yubowen (H)" <yubowen8@huawei.com>, <linuxarm@huawei.com>,
<liudingyuan@h-partners.com>, <andi.shyti@kernel.org>,
<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <prime.zeng@hisilicon.com>, <wanghuiqiang@huawei.com>,
<xuwei5@huawei.com>, <zhangpengjie2@huawei.com>
Subject: Re: [PATCH v3] i2c: hisi: Add I2C bus recovery support
Date: Thu, 17 Sep 2026 16:28:11 +0800 [thread overview]
Message-ID: <5e00c73f-fdb2-42f9-92cd-652fd8be4489@hisilicon.com> (raw)
In-Reply-To: <ffcc17b2-7d4e-4ade-b8c4-2a64567a20e3@huawei.com>
On 9/17/2026 10:39 AM, yubowen (H) wrote:
[ ... ]
>>> +static int hisi_i2c_recovery_init(struct hisi_i2c_controller *ctlr)
>>> +{
>>> + struct platform_device *pdev = to_platform_device(ctlr->dev);
>>> + struct i2c_adapter *adapter = &ctlr->adapter;
>>> + int ret;
>>> +
>>> + if (acpi_disabled)
>>> + return -ENODEV;
>> Is #ifdef CONFIG_ACPI still useful if 'acpi_disabled' is checked?
> Thanks for the review, Jie.
>
> Both guards are needed; they operate at different layers and cannot replace each other.
>
> - #ifdef CONFIG_ACPI is a compile-time guard to prevent errors caused by functions
>
> like acpi_has_method
>
> - acpi_disabled() is a runtime check, it is 1 by default and set to 0 when the platform
>
> boots via acpi.
if not CONFIG_ACPI, acpi_disabled would be 1.
>
> Other comments will be fixed in v4.
>
>
> Thanks
>
> Bowen
>
>>> +
>>> + ret = hisi_i2c_get_bus_recovery_res(ctlr, pdev);
>>> + if (ret)
>>> + return ret;
>>> +
>>> + ctlr->rinfo = (struct i2c_bus_recovery_info){
>> Neat: (struct i2c_bus_recovery_info) {
>> Good to add a space.
>>> + .get_scl = hisi_i2c_recovery_get_scl,
>>> + .get_sda = hisi_i2c_recovery_get_sda,
>>> + .set_scl = hisi_i2c_recovery_set_scl,
>>> + .prepare_recovery = hisi_i2c_prepare_recovery,
>>> + .unprepare_recovery = hisi_i2c_unprepare_recovery,
>>> + .recover_bus = i2c_generic_scl_recovery,
>>> + };
>>> + adapter->bus_recovery_info = &ctlr->rinfo;
>>> + ctlr->acpi_handle = ACPI_HANDLE(ctlr->dev);
>> Neat: a blank line before return 0.
>>> + return 0;
>>> +}
>>> +#else
>>> +static int hisi_i2c_recovery_init(struct hisi_i2c_controller *ctlr) { return -ENODEV; }
>>> +#endif /* CONFIG_ACPI */
>>> +
>>> static int hisi_i2c_start_xfer(struct hisi_i2c_controller *ctlr)
>>> {
>>> struct i2c_msg *msg = ctlr->msgs;
>>> @@ -504,6 +645,10 @@ static int hisi_i2c_probe(struct platform_device *pdev)
>>> adapter->dev.parent = dev;
>>> i2c_set_adapdata(adapter, ctlr);
>>>
>>> + ret = hisi_i2c_recovery_init(ctlr);
>>> + if (ret)
>>> + dev_info(ctlr->dev, "I2C bus recovery not available\n");
>>> +
>> Move this before setting 'adapter' and i2c_set_adapdata()?
>>
>> Recovery init should be done before the final preparation of 'adapter'.
>>> ret = devm_i2c_add_adapter(dev, adapter);
>>> if (ret)
>>> return ret;
prev parent reply other threads:[~2026-09-17 8:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 2:39 [PATCH v3] i2c: hisi: Add I2C bus recovery support Bowen Yu
2026-09-11 9:25 ` Jie Zhan
[not found] ` <ffcc17b2-7d4e-4ade-b8c4-2a64567a20e3@huawei.com>
2026-09-17 8:28 ` Jie Zhan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5e00c73f-fdb2-42f9-92cd-652fd8be4489@hisilicon.com \
--to=zhanjie9@hisilicon.com \
--cc=andi.shyti@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=liudingyuan@h-partners.com \
--cc=prime.zeng@hisilicon.com \
--cc=wanghuiqiang@huawei.com \
--cc=xuwei5@huawei.com \
--cc=yubowen8@huawei.com \
--cc=zhangpengjie2@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox