Re: [PATCH v6] i2c: mux: reg: use device property accessors
From: Abdurrahman Hussain
Date: Thu May 28 2026 - 17:52:29 EST
On Tue May 19, 2026 at 11:55 PM PDT, Wolfram Sang wrote:
> On Tue, May 19, 2026 at 02:18:50PM -0700, Abdurrahman Hussain wrote:
>> Convert the device-tree parsing path to the generic fwnode/device
>> property accessors so the driver can be probed on ACPI and swnode
>> platforms as well as OF. The helper is renamed from
>> i2c_mux_reg_probe_dt() to i2c_mux_reg_probe_fw() to reflect that.
>>
>> Accessor translation:
>>
>> of_parse_phandle("i2c-parent") +
>> of_find_i2c_adapter_by_node() -> fwnode_find_reference() +
>> i2c_find_adapter_by_fwnode()
>> of_get_child_count() -> device_get_child_node_count()
>> of_property_read_bool() -> device_property_read_bool()
>> for_each_child_of_node() -> device_for_each_child_node()
>> of_property_read_u32("reg") on ACPI device nodes:
>> acpi_get_local_address()
>> everything else (OF, swnode,
>> ACPI data nodes):
>> fwnode_property_read_u32()
>> of_property_read_u32("idle-state") -> device_property_read_u32()
>>
>> The child-node branch uses is_acpi_device_node() rather than
>> is_acpi_node(): the latter also matches ACPI data nodes (the
>> _DSD hierarchical-property children used by PRP0001-style
>> firmware), which have no ACPI handle and would make
>> acpi_get_local_address() fall back to evaluating _ADR against the
>> root namespace and return -ENODATA. Routing data nodes through
>> fwnode_property_read_u32() instead lets them resolve the "reg"
>> property the same way OF and swnode children do.
>>
>> Behavioural preservations (deliberate, to avoid regressing existing
>> users):
>>
>> - The three-way endian fallback is kept verbatim: an explicit
>> "little-endian" property wins, then "big-endian", and otherwise
>> the host's compile-time byte order. device_is_big_endian() is
>> not used here because it ignores "little-endian" and introduces
>> "native-endian" semantics, which would diverge from the binding.
>>
>> - The "if (!mux->data.reg)" guard around
>> devm_platform_get_and_ioremap_resource() in probe() is kept.
>> drivers/platform/mellanox/mlx-platform.c registers i2c-mux-reg
>> platform_devices with no memory resource and supplies a
>> pre-set .reg / .reg_size through struct
>> i2c_mux_reg_platform_data; without the guard those
>> registrations would fail in probe().
>>
>> - The "if (!mux->data.reg)" ioremap block (and the paired
>> reg_size validation that depends on it) is hoisted above
>> i2c_get_adapter(mux->data.parent), so the fwnode path
>> preserves master's ordering of "ioremap before parent-adapter
>> get". For platdata users the validation runs from a slightly
>> earlier position, but mux->data.reg_size is already set from
>> platdata by then, so the order is functionally neutral.
>>
>> The OF-only of_address_to_resource() translation in the old
>> probe_dt() is dropped because the same address is available from
>> the platform_device resource table on OF as well as ACPI, and the
>> existing fallback in probe() ioremaps it.
>>
>> Acked-by: Peter Rosin <peda@xxxxxxxxxxxxxx>
>> Signed-off-by: Abdurrahman Hussain <abdurrahman@xxxxxxxxxx>
>> Assisted-by: Claude-Code:claude-opus-4-7
>> Assisted-by: sashiko:gemini-3.1-pro-preview
>
> Acked-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
Hi Wolfram,
I noticed this patch didn't make it into 7.1-rc5. Is it still under
review? If not, will it make it during the next merge window?
Best regards,
Abdurrahman