Re: [PATCH -next] drivers/base/power: fix build error without SYSFS

From: Hongbo Yao
Date: Mon Mar 02 2020 - 22:17:55 EST




On 2020/3/2 17:31, Christian Brauner wrote:
> On Mon, Mar 02, 2020 at 05:29:18PM +0800, Hongbo Yao wrote:
>> If CONFIG_SYSFS=n, the following error is seen while building
>> drivers/base/power/sysfs.c:
>>
>> drivers/base/power/sysfs.c: In function dpm_sysfs_change_owner:
>> drivers/base/power/sysfs.c:708:44: error: passing argument 2 of
>> sysfs_group_change_owner from incompatible pointer type
>> [-Werror=incompatible-pointer-types]
>> rc = sysfs_group_change_owner(&dev->kobj, &pm_attr_group, kuid, kgid);
>> ^
>> In file included from ./include/linux/kobject.h:20:0,
>> from ./include/linux/device.h:17,
>> from drivers/base/power/sysfs.c:3:
>> ./include/linux/sysfs.h:564:19: note: expected const struct
>> attribute_group ** but argument is of type const struct attribute_group *
>>
>> dpm_sysfs_change_owner() should only used when CONFIG_SYSFS is
>> defined.
>>
>> Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
>> Fixes: 3b52fc5d7876 ("drivers/base/power: add dpm_sysfs_change_owner()")
>> Signed-off-by: Hongbo Yao <yaohongbo@xxxxxxxxxx>
>
> Thanks for catching this!
> An organizational comment first. The series this belongs to is sitting
> in Dave Miller's net-next tree. So this fix needs to go through his tree
> to. This just means, you should Cc the netdev kernel mailing list and
> append make the subject
> [PATCH net-next] drivers/base/power: fix build error without SYSFS
> .

Thanks, I'll resend it with this tag .


> But about the fix. It strikes me as odd that this fails in pm_attr_group
> since dpm_sysfs_add() doesn't but also unconditionally accesses pm_attr_group.

The two functions have different parameter types when CONFIG_SYSFS=n.

> Christian
>
> .
>