Skip to content

Commit

Permalink
[PATCH] Kobject: fix build error
Browse files Browse the repository at this point in the history
This fixes a build error for various odd combinations of CONFIG_HOTPLUG
and CONFIG_NET.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Nigel Cunningham <ncunningham@cyclades.com>
Cc: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
kaysievers authored and gregkh committed Apr 27, 2006
1 parent 913e7ec commit 4d17ffd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/linux/kobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ struct subsys_attribute {
extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);

#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
#if defined(CONFIG_HOTPLUG)
void kobject_uevent(struct kobject *kobj, enum kobject_action action);

int add_uevent_var(char **envp, int num_envp, int *cur_index,
Expand Down
8 changes: 7 additions & 1 deletion lib/kobject_uevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
#define BUFFER_SIZE 2048 /* buffer for the variables */
#define NUM_ENVP 32 /* number of env pointers */

#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
#if defined(CONFIG_HOTPLUG)
u64 uevent_seqnum;
char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
static DEFINE_SPINLOCK(sequence_lock);
#if defined(CONFIG_NET)
static struct sock *uevent_sock;
#endif

static char *action_to_string(enum kobject_action action)
{
Expand Down Expand Up @@ -155,6 +157,7 @@ void kobject_uevent(struct kobject *kobj, enum kobject_action action)
spin_unlock(&sequence_lock);
sprintf(seq_buff, "SEQNUM=%llu", (unsigned long long)seq);

#if defined(CONFIG_NET)
/* send netlink message */
if (uevent_sock) {
struct sk_buff *skb;
Expand All @@ -179,6 +182,7 @@ void kobject_uevent(struct kobject *kobj, enum kobject_action action)
netlink_broadcast(uevent_sock, skb, 0, 1, GFP_KERNEL);
}
}
#endif

/* call uevent_helper, usually only enabled during early boot */
if (uevent_helper[0]) {
Expand Down Expand Up @@ -249,6 +253,7 @@ int add_uevent_var(char **envp, int num_envp, int *cur_index,
}
EXPORT_SYMBOL_GPL(add_uevent_var);

#if defined(CONFIG_NET)
static int __init kobject_uevent_init(void)
{
uevent_sock = netlink_kernel_create(NETLINK_KOBJECT_UEVENT, 1, NULL,
Expand All @@ -264,5 +269,6 @@ static int __init kobject_uevent_init(void)
}

postcore_initcall(kobject_uevent_init);
#endif

#endif /* CONFIG_HOTPLUG */

0 comments on commit 4d17ffd

Please sign in to comment.