summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <greg@kroah.com>2004-09-24 10:07:32 -0700
committerGreg Kroah-Hartman <greg@kroah.com>2004-09-24 10:07:32 -0700
commitf413349679a606cd3f0d0e6b87c4a518173ef8af (patch)
tree6062da2db1a2e3d716c39c0abc7fa2d16a2d861e /include/linux
parent2d952a582ef77577dc903a756ab365520bdbd1f7 (diff)
parenta1e66cc0011a9f9fae58a5609e329357d747635d (diff)
Merge bk://kernel.bkbits.net//home/mochel/linux-2.6-core
into kroah.com:/home/greg/linux/BK/driver-2.6
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/device.h2
-rw-r--r--include/linux/kobject.h14
-rw-r--r--include/linux/kobject_uevent.h51
-rw-r--r--include/linux/module.h14
-rw-r--r--include/linux/netlink.h1
-rw-r--r--include/linux/pci.h2
6 files changed, 81 insertions, 3 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 4bb694c6737a..0b6148232700 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -106,6 +106,8 @@ struct device_driver {
struct kobject kobj;
struct list_head devices;
+ struct module * owner;
+
int (*probe) (struct device * dev);
int (*remove) (struct device * dev);
void (*shutdown) (struct device * dev);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 331d25b9cc41..157ce2cc1642 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -22,10 +22,14 @@
#include <linux/sysfs.h>
#include <linux/rwsem.h>
#include <linux/kref.h>
+#include <linux/kobject_uevent.h>
#include <asm/atomic.h>
#define KOBJ_NAME_LEN 20
+/* counter to tag the hotplug event, read only except for the kobject core */
+extern u64 hotplug_seqnum;
+
struct kobject {
char * k_name;
char name[KOBJ_NAME_LEN];
@@ -59,9 +63,7 @@ extern void kobject_unregister(struct kobject *);
extern struct kobject * kobject_get(struct kobject *);
extern void kobject_put(struct kobject *);
-extern void kobject_hotplug(const char *action, struct kobject *);
-
-extern char * kobject_get_path(struct kset *, struct kobject *, int);
+extern char * kobject_get_path(struct kobject *, int);
struct kobj_type {
void (*release)(struct kobject *);
@@ -234,5 +236,11 @@ struct subsys_attribute {
extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
+#ifdef CONFIG_HOTPLUG
+extern void kobject_hotplug(struct kobject *kobj, enum kobject_action action);
+#else
+static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { }
+#endif
+
#endif /* __KERNEL__ */
#endif /* _KOBJECT_H_ */
diff --git a/include/linux/kobject_uevent.h b/include/linux/kobject_uevent.h
new file mode 100644
index 000000000000..ad0f04424522
--- /dev/null
+++ b/include/linux/kobject_uevent.h
@@ -0,0 +1,51 @@
+/*
+ * kobject_uevent.h - list of kobject user events that can be generated
+ *
+ * Copyright (C) 2004 IBM Corp.
+ * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
+ *
+ * This file is released under the GPLv2.
+ *
+ */
+
+#ifndef _KOBJECT_EVENT_H_
+#define _KOBJECT_EVENT_H_
+
+/*
+ * If you add an action here, you must also add the proper string to the
+ * lib/kobject_uevent.c file.
+ */
+
+enum kobject_action {
+ KOBJ_ADD = 0x00, /* add event, for hotplug */
+ KOBJ_REMOVE = 0x01, /* remove event, for hotplug */
+ KOBJ_CHANGE = 0x02, /* a sysfs attribute file has changed */
+ KOBJ_MOUNT = 0x03, /* mount event for block devices */
+ KOBJ_UMOUNT = 0x04, /* umount event for block devices */
+ KOBJ_MAX_ACTION, /* must be last action listed */
+};
+
+
+#ifdef CONFIG_KOBJECT_UEVENT
+int kobject_uevent(struct kobject *kobj,
+ enum kobject_action action,
+ struct attribute *attr);
+int kobject_uevent_atomic(struct kobject *kobj,
+ enum kobject_action action,
+ struct attribute *attr);
+#else
+static inline int kobject_uevent(struct kobject *kobj,
+ enum kobject_action action,
+ struct attribute *attr)
+{
+ return 0;
+}
+static inline int kobject_uevent_atomic(struct kobject *kobj,
+ enum kobject_action action,
+ struct attribute *attr)
+{
+ return 0;
+}
+#endif
+
+#endif
diff --git a/include/linux/module.h b/include/linux/module.h
index fbf2dfc90015..27512af4e394 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -445,6 +445,11 @@ int register_module_notifier(struct notifier_block * nb);
int unregister_module_notifier(struct notifier_block * nb);
extern void print_modules(void);
+
+struct device_driver;
+void module_add_driver(struct module *, struct device_driver *);
+void module_remove_driver(struct device_driver *);
+
#else /* !CONFIG_MODULES... */
#define EXPORT_SYMBOL(sym)
#define EXPORT_SYMBOL_GPL(sym)
@@ -534,6 +539,15 @@ static inline int unregister_module_notifier(struct notifier_block * nb)
static inline void print_modules(void)
{
}
+
+static inline void module_add_driver(struct module *, struct device_driver *)
+{
+}
+
+static inline void module_remove_driver(struct device_driver *)
+{
+}
+
#endif /* CONFIG_MODULES */
#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 01864a8fd17f..e969de36edaa 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -17,6 +17,7 @@
#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */
#define NETLINK_IP6_FW 13
#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
+#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
#define NETLINK_TAPBASE 16 /* 16 to 31 are ethertap */
#define MAX_LINKS 32
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3f76ca047d2f..61ba98e2a3d8 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -631,9 +631,11 @@ struct pci_dynids {
unsigned int use_driver_data:1; /* pci_driver->driver_data is used */
};
+struct module;
struct pci_driver {
struct list_head node;
char *name;
+ struct module *owner;
const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */
int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */