Re: [PATCH] power: supply: move power_supply_attr_group into #ifdef block

From: Sebastian Reichel
Date: Wed Feb 28 2024 - 17:09:12 EST



On Wed, 28 Feb 2024 10:46:28 -0300, Ricardo B. Marliere wrote:
> When building with CONFIG_SYSFS=n, the build error below is triggered:
>
> ld: drivers/power/supply/power_supply_core.o:(.data+0x0): undefined
> reference to `power_supply_attr_group'
>
> The problem is that power_supply_attr_group is needed in
> power_supply_core.c but defined in power_supply_sysfs.c, which is only
> targeted with CONFIG_SYSFS=y. Therefore, move the extern declaration into
> the #ifdef block that checks for CONFIG_SYSFS, and define an empty static
> const struct otherwise. This is safe because the macro __ATRIBUTE_GROUPS in
> power_supply_core.c will expand into an empty attribute_group array.
>
> [...]

Applied, thanks!

[1/1] power: supply: move power_supply_attr_group into #ifdef block
commit: ea4367c40c79a5f16cb0de8a94a6b72697d37f06

Best regards,
--
Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>