diff mbox

sysfs: Fix build when sysfs is disabled

Message ID alpine.DEB.2.00.1301251211410.3815@chino.kir.corp.google.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

David Rientjes Jan. 25, 2013, 8:13 p.m. UTC
"sysfs: Functions for adding/removing symlinks to/from attribute groups" 
causes a build failure when CONFIG_SYSFS is disabled:

drivers/acpi/power.c: In function 'acpi_power_hide_list':
drivers/acpi/power.c:463: error: implicit declaration of function 'sysfs_remove_link_from_group'
drivers/acpi/power.c: In function 'acpi_power_expose_list':
drivers/acpi/power.c:486: error: implicit declaration of function 'sysfs_add_link_to_group'

We need to define empty functions for this config to avoid ifdefs in the 
code.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 include/linux/sysfs.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Greg Kroah-Hartman Jan. 25, 2013, 8:42 p.m. UTC | #1
On Fri, Jan 25, 2013 at 12:13:59PM -0800, David Rientjes wrote:
> "sysfs: Functions for adding/removing symlinks to/from attribute groups" 
> causes a build failure when CONFIG_SYSFS is disabled:
> 
> drivers/acpi/power.c: In function 'acpi_power_hide_list':
> drivers/acpi/power.c:463: error: implicit declaration of function 'sysfs_remove_link_from_group'
> drivers/acpi/power.c: In function 'acpi_power_expose_list':
> drivers/acpi/power.c:486: error: implicit declaration of function 'sysfs_add_link_to_group'
> 
> We need to define empty functions for this config to avoid ifdefs in the 
> code.
> 
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  include/linux/sysfs.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Rafael has to take this through his tree.

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael Wysocki Jan. 25, 2013, 8:52 p.m. UTC | #2
On Friday, January 25, 2013 12:13:59 PM David Rientjes wrote:
> "sysfs: Functions for adding/removing symlinks to/from attribute groups" 
> causes a build failure when CONFIG_SYSFS is disabled:
> 
> drivers/acpi/power.c: In function 'acpi_power_hide_list':
> drivers/acpi/power.c:463: error: implicit declaration of function 'sysfs_remove_link_from_group'
> drivers/acpi/power.c: In function 'acpi_power_expose_list':
> drivers/acpi/power.c:486: error: implicit declaration of function 'sysfs_add_link_to_group'
> 
> We need to define empty functions for this config to avoid ifdefs in the 
> code.

Can you please send me the .config that triggered those errors?  It will be
useful for future build testing.

Thanks,
Rafael


> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  include/linux/sysfs.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
> --- a/include/linux/sysfs.h
> +++ b/include/linux/sysfs.h
> @@ -330,6 +330,18 @@ static inline void sysfs_unmerge_group(struct kobject *kobj,
>  {
>  }
>  
> +static inline int sysfs_add_link_to_group(struct kobject *kobj,
> +		const char *group_name, struct kobject *target,
> +		const char *link_name)
> +{
> +	return 0;
> +}
> +
> +static inline void sysfs_remove_link_from_group(struct kobject *kobj,
> +		const char *group_name, const char *link_name)
> +{
> +}
> +
>  static inline void sysfs_notify(struct kobject *kobj, const char *dir,
>  				const char *attr)
>  {
Rafael Wysocki Jan. 25, 2013, 8:53 p.m. UTC | #3
On Friday, January 25, 2013 12:42:34 PM Greg Kroah-Hartman wrote:
> On Fri, Jan 25, 2013 at 12:13:59PM -0800, David Rientjes wrote:
> > "sysfs: Functions for adding/removing symlinks to/from attribute groups" 
> > causes a build failure when CONFIG_SYSFS is disabled:
> > 
> > drivers/acpi/power.c: In function 'acpi_power_hide_list':
> > drivers/acpi/power.c:463: error: implicit declaration of function 'sysfs_remove_link_from_group'
> > drivers/acpi/power.c: In function 'acpi_power_expose_list':
> > drivers/acpi/power.c:486: error: implicit declaration of function 'sysfs_add_link_to_group'
> > 
> > We need to define empty functions for this config to avoid ifdefs in the 
> > code.
> > 
> > Signed-off-by: David Rientjes <rientjes@google.com>
> > ---
> >  include/linux/sysfs.h | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> 
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> Rafael has to take this through his tree.

Thanks for the patch and review.

I will fold it into the original patch to reduce bisection pain.

Thanks,
Rafael
David Rientjes Jan. 25, 2013, 9:34 p.m. UTC | #4
On Fri, 25 Jan 2013, Rafael J. Wysocki wrote:

> Can you please send me the .config that triggered those errors?  It will be
> useful for future build testing.
> 

Anything with CONFIG_SYSFS disabled.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -330,6 +330,18 @@  static inline void sysfs_unmerge_group(struct kobject *kobj,
 {
 }
 
+static inline int sysfs_add_link_to_group(struct kobject *kobj,
+		const char *group_name, struct kobject *target,
+		const char *link_name)
+{
+	return 0;
+}
+
+static inline void sysfs_remove_link_from_group(struct kobject *kobj,
+		const char *group_name, const char *link_name)
+{
+}
+
 static inline void sysfs_notify(struct kobject *kobj, const char *dir,
 				const char *attr)
 {