linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix compilation for non CONFIG_HOTPLUG case
@ 2007-07-29 16:07 Niklaus Giger
  2007-07-29 16:45 ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Niklaus Giger @ 2007-07-29 16:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-embedded, kristen.c.accardi

Fixes compilation issues for embedded boards which do not support HOTPLUG

Signed-off-by: Niklaus Giger <niklaus.giger@member.fsf.org>
---
 drivers/base/core.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 3599ab2..a09bfc8 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -24,7 +24,9 @@
 #include "base.h"
 #include "power/power.h"

+#ifdef CONFIG_HOTPLUG
 extern const char *kobject_actions[];
+#endif

 int (*platform_notify)(struct device * dev) = NULL;
 int (*platform_notify_remove)(struct device * dev) = NULL;
@@ -306,11 +308,13 @@ static ssize_t store_uevent(struct device *dev, struct 
device_attribute *attr,
 			    const char *buf, size_t count)
 {
 	size_t len = count;
+#ifdef CONFIG_HOTPLUG
 	enum kobject_action action;
-
+#endif
 	if (len && buf[len-1] == '\n')
 		len--;

+#ifdef CONFIG_HOTPLUG
 	for (action = 0; action < KOBJ_MAX; action++) {
 		if (strncmp(kobject_actions[action], buf, len) != 0)
 			continue;
@@ -319,11 +323,14 @@ static ssize_t store_uevent(struct device *dev, struct 
device_attribute *attr,
 		kobject_uevent(&dev->kobj, action);
 		goto out;
 	}
+#endif

 	dev_err(dev, "uevent: unsupported action-string; this will "
 		     "be ignored in a future kernel version\n");
 	kobject_uevent(&dev->kobj, KOBJ_ADD);
+#ifdef CONFIG_HOTPLUG
 out:
+#endif
 	return count;
 }

--
1.5.2.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix compilation for non CONFIG_HOTPLUG case
  2007-07-29 16:07 [PATCH] Fix compilation for non CONFIG_HOTPLUG case Niklaus Giger
@ 2007-07-29 16:45 ` Sergei Shtylyov
  2007-07-29 17:07   ` Gabriel C
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2007-07-29 16:45 UTC (permalink / raw)
  To: niklaus.giger; +Cc: linux-kernel, kristen.c.accardi, linuxppc-embedded

Hello.

Niklaus Giger wrote:

> Fixes compilation issues for embedded boards which do not support HOTPLUG

> Signed-off-by: Niklaus Giger <niklaus.giger@member.fsf.org>

> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 3599ab2..a09bfc8 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -24,7 +24,9 @@
>  #include "base.h"
>  #include "power/power.h"
> 
> +#ifdef CONFIG_HOTPLUG
>  extern const char *kobject_actions[];
> +#endif

    No need for #ifdef around extern declarations.

>  int (*platform_notify)(struct device * dev) = NULL;
>  int (*platform_notify_remove)(struct device * dev) = NULL;
> @@ -306,11 +308,13 @@ static ssize_t store_uevent(struct device *dev, struct 
> device_attribute *attr,
>  			    const char *buf, size_t count)
>  {
>  	size_t len = count;
> +#ifdef CONFIG_HOTPLUG
>  	enum kobject_action action;
> -
> +#endif

    Please don't remove newline between the declaration block and the code.

>  	if (len && buf[len-1] == '\n')
>  		len--;
> 
> +#ifdef CONFIG_HOTPLUG
>  	for (action = 0; action < KOBJ_MAX; action++) {
>  		if (strncmp(kobject_actions[action], buf, len) != 0)
>  			continue;
> @@ -319,11 +323,14 @@ static ssize_t store_uevent(struct device *dev, struct 
> device_attribute *attr,
>  		kobject_uevent(&dev->kobj, action);
>  		goto out;

    Grr... cleanup style abuse -- ISO a mere return they used goto. :-/

>  	}
> +#endif
> 
>  	dev_err(dev, "uevent: unsupported action-string; this will "
>  		     "be ignored in a future kernel version\n");
>  	kobject_uevent(&dev->kobj, KOBJ_ADD);
> +#ifdef CONFIG_HOTPLUG
>  out:
> +#endif

    Well, #ifdef'ing out label seems too much.

>  	return count;
>  }

WBR, Sergei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix compilation for non CONFIG_HOTPLUG case
  2007-07-29 16:45 ` Sergei Shtylyov
@ 2007-07-29 17:07   ` Gabriel C
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriel C @ 2007-07-29 17:07 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: niklaus.giger, linux-kernel, kristen.c.accardi, linuxppc-embedded

This problem is already fixed in -mm .

http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.23-rc1/2.6.23-rc1-mm1/broken-out/gregkh-driver-kobject-fix-link-error-when-config_hotplug-is-disabled.patch


Regards,

Gabriel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-29 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-29 16:07 [PATCH] Fix compilation for non CONFIG_HOTPLUG case Niklaus Giger
2007-07-29 16:45 ` Sergei Shtylyov
2007-07-29 17:07   ` Gabriel C

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).