* Re: [PATCH -next] drivers/base/power: fix build error without SYSFS
2020-03-02 9:29 [PATCH -next] drivers/base/power: fix build error without SYSFS Hongbo Yao
@ 2020-03-02 9:23 ` Greg KH
2020-03-03 2:26 ` Hongbo Yao
2020-03-02 9:31 ` Christian Brauner
1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2020-03-02 9:23 UTC (permalink / raw)
To: Hongbo Yao
Cc: christian.brauner, linux-kernel, linux-pm, chenzhou10, rjw, pavel
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@huawei.com>
> Fixes: 3b52fc5d7876 ("drivers/base/power: add dpm_sysfs_change_owner()")
> Signed-off-by: Hongbo Yao <yaohongbo@huawei.com>
> ---
> drivers/base/power/power.h | 10 +++++++++-
> drivers/base/power/sysfs.c | 2 ++
You shouldn't have to add #ifdefs to a .c file here, it should all be
able to be fixed in the .h file by putting proper "empty" functions.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH -next] drivers/base/power: fix build error without SYSFS
@ 2020-03-02 9:29 Hongbo Yao
2020-03-02 9:23 ` Greg KH
2020-03-02 9:31 ` Christian Brauner
0 siblings, 2 replies; 5+ messages in thread
From: Hongbo Yao @ 2020-03-02 9:29 UTC (permalink / raw)
To: gregkh, christian.brauner
Cc: linux-kernel, linux-pm, yaohongbo, chenzhou10, rjw, pavel
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@huawei.com>
Fixes: 3b52fc5d7876 ("drivers/base/power: add dpm_sysfs_change_owner()")
Signed-off-by: Hongbo Yao <yaohongbo@huawei.com>
---
drivers/base/power/power.h | 10 +++++++++-
drivers/base/power/sysfs.c | 2 ++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index 54292cdd7808..4bd88f696be9 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -74,7 +74,6 @@ extern int pm_qos_sysfs_add_flags(struct device *dev);
extern void pm_qos_sysfs_remove_flags(struct device *dev);
extern int pm_qos_sysfs_add_latency_tolerance(struct device *dev);
extern void pm_qos_sysfs_remove_latency_tolerance(struct device *dev);
-extern int dpm_sysfs_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid);
#else /* CONFIG_PM */
@@ -89,6 +88,15 @@ static inline void pm_runtime_remove(struct device *dev) {}
static inline int dpm_sysfs_add(struct device *dev) { return 0; }
static inline void dpm_sysfs_remove(struct device *dev) {}
+
+#endif
+
+#if defined(CONFIG_PM) && defined(CONFIG_SYSFS)
+
+extern int dpm_sysfs_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid);
+
+#else
+
static inline int dpm_sysfs_change_owner(struct device *dev, kuid_t kuid,
kgid_t kgid) { return 0; }
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index 2b99fe1eb207..d6749f374ded 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -698,6 +698,7 @@ int dpm_sysfs_add(struct device *dev)
return rc;
}
+#ifdef CONFIG_SYSFS
int dpm_sysfs_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid)
{
int rc;
@@ -736,6 +737,7 @@ int dpm_sysfs_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid)
}
return 0;
}
+#endif
int wakeup_sysfs_add(struct device *dev)
{
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH -next] drivers/base/power: fix build error without SYSFS
2020-03-02 9:29 [PATCH -next] drivers/base/power: fix build error without SYSFS Hongbo Yao
2020-03-02 9:23 ` Greg KH
@ 2020-03-02 9:31 ` Christian Brauner
2020-03-03 3:17 ` Hongbo Yao
1 sibling, 1 reply; 5+ messages in thread
From: Christian Brauner @ 2020-03-02 9:31 UTC (permalink / raw)
To: Hongbo Yao; +Cc: gregkh, linux-kernel, linux-pm, chenzhou10, rjw, pavel
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@huawei.com>
> Fixes: 3b52fc5d7876 ("drivers/base/power: add dpm_sysfs_change_owner()")
> Signed-off-by: Hongbo Yao <yaohongbo@huawei.com>
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
.
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.
Christian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] drivers/base/power: fix build error without SYSFS
2020-03-02 9:23 ` Greg KH
@ 2020-03-03 2:26 ` Hongbo Yao
0 siblings, 0 replies; 5+ messages in thread
From: Hongbo Yao @ 2020-03-03 2:26 UTC (permalink / raw)
To: Greg KH; +Cc: christian.brauner, linux-kernel, linux-pm, chenzhou10, rjw, pavel
On 2020/3/2 17:23, Greg KH 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@huawei.com>
>> Fixes: 3b52fc5d7876 ("drivers/base/power: add dpm_sysfs_change_owner()")
>> Signed-off-by: Hongbo Yao <yaohongbo@huawei.com>
>> ---
>> drivers/base/power/power.h | 10 +++++++++-
>> drivers/base/power/sysfs.c | 2 ++
>
> You shouldn't have to add #ifdefs to a .c file here, it should all be
> able to be fixed in the .h file by putting proper "empty" functions.
I think it's a little difficult to fix this without changing the .c file,
unless changing the Kconfig.
This function was implemeted when CONFIG_PM=y, and if CONFIG_PM=n, this
function would be "empty".
However, I found this function should depends on CONFIG_SYSFS, if
CONFIG_SYSFS=n, this function should also be empty, so only changing the
dependency of the header file will cause redefinition.
thanks,
Hongbo.
> thanks,
>
> greg k-h
>
> .
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] drivers/base/power: fix build error without SYSFS
2020-03-02 9:31 ` Christian Brauner
@ 2020-03-03 3:17 ` Hongbo Yao
0 siblings, 0 replies; 5+ messages in thread
From: Hongbo Yao @ 2020-03-03 3:17 UTC (permalink / raw)
To: Christian Brauner; +Cc: gregkh, linux-kernel, linux-pm, chenzhou10, rjw, pavel
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@huawei.com>
>> Fixes: 3b52fc5d7876 ("drivers/base/power: add dpm_sysfs_change_owner()")
>> Signed-off-by: Hongbo Yao <yaohongbo@huawei.com>
>
> 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
>
> .
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-03 3:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 9:29 [PATCH -next] drivers/base/power: fix build error without SYSFS Hongbo Yao
2020-03-02 9:23 ` Greg KH
2020-03-03 2:26 ` Hongbo Yao
2020-03-02 9:31 ` Christian Brauner
2020-03-03 3:17 ` Hongbo Yao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).