Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (28 commits) sysfs: Shadow directory support Driver Core: Increase the default timeout value of the firmware subsystem Driver core: allow to delay the uevent at device creation time Driver core: add device_type to struct device Driver core: add uevent vars for devices of a class SYSFS: Fix missing include of list.h in sysfs.h HOWTO: Add a reference to Harbison and Steele sysfs: error handling in sysfs, fill_read_buffer() kobject: kobject_put cleanup sysfs: kobject_put cleanup sysfs: suppress lockdep warnings Driver core: fix race in sysfs between sysfs_remove_file() and read()/write() driver core: Change function call order in device_bind_driver(). driver core: Don't stop probing on ->probe errors. driver core fixes: device_register() retval check in platform.c driver core fixes: make_class_name() retval checks /sys/modules/*/holders USB: add the sysfs driver name to all modules SERIO: add the sysfs driver name to all modules PCI: add the sysfs driver name to all modules ...
This commit is contained in:
@@ -126,6 +126,7 @@ struct device_driver {
|
||||
struct klist_node knode_bus;
|
||||
|
||||
struct module * owner;
|
||||
const char * mod_name; /* used for built-in modules */
|
||||
|
||||
int (*probe) (struct device * dev);
|
||||
int (*remove) (struct device * dev);
|
||||
@@ -327,6 +328,13 @@ extern struct class_device *class_device_create(struct class *cls,
|
||||
__attribute__((format(printf,5,6)));
|
||||
extern void class_device_destroy(struct class *cls, dev_t devt);
|
||||
|
||||
struct device_type {
|
||||
struct device_attribute *attrs;
|
||||
int (*uevent)(struct device *dev, char **envp, int num_envp,
|
||||
char *buffer, int buffer_size);
|
||||
void (*release)(struct device *dev);
|
||||
};
|
||||
|
||||
/* interface for exporting device attributes */
|
||||
struct device_attribute {
|
||||
struct attribute attr;
|
||||
@@ -355,6 +363,7 @@ struct device {
|
||||
|
||||
struct kobject kobj;
|
||||
char bus_id[BUS_ID_SIZE]; /* position on parent bus */
|
||||
struct device_type *type;
|
||||
unsigned is_registered:1;
|
||||
struct device_attribute uevent_attr;
|
||||
struct device_attribute *devt_attr;
|
||||
@@ -390,9 +399,10 @@ struct device {
|
||||
|
||||
/* class_device migration path */
|
||||
struct list_head node;
|
||||
struct class *class; /* optional*/
|
||||
struct class *class;
|
||||
dev_t devt; /* dev_t, creates the sysfs "dev" */
|
||||
struct attribute_group **groups; /* optional groups */
|
||||
int uevent_suppress;
|
||||
|
||||
void (*release)(struct device * dev);
|
||||
};
|
||||
|
||||
@@ -1192,8 +1192,8 @@ void ide_init_disk(struct gendisk *, ide_drive_t *);
|
||||
extern int ideprobe_init(void);
|
||||
|
||||
extern void ide_scan_pcibus(int scan_direction) __init;
|
||||
extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner);
|
||||
#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE)
|
||||
extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
|
||||
#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
|
||||
void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *);
|
||||
extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d);
|
||||
|
||||
|
||||
@@ -74,9 +74,13 @@ extern void kobject_init(struct kobject *);
|
||||
extern void kobject_cleanup(struct kobject *);
|
||||
|
||||
extern int __must_check kobject_add(struct kobject *);
|
||||
extern int __must_check kobject_shadow_add(struct kobject *, struct dentry *);
|
||||
extern void kobject_del(struct kobject *);
|
||||
|
||||
extern int __must_check kobject_rename(struct kobject *, const char *new_name);
|
||||
extern int __must_check kobject_shadow_rename(struct kobject *kobj,
|
||||
struct dentry *new_parent,
|
||||
const char *new_name);
|
||||
extern int __must_check kobject_move(struct kobject *, struct kobject *);
|
||||
|
||||
extern int __must_check kobject_register(struct kobject *);
|
||||
|
||||
@@ -58,6 +58,7 @@ struct module_kobject
|
||||
{
|
||||
struct kobject kobj;
|
||||
struct module *mod;
|
||||
struct kobject *drivers_dir;
|
||||
};
|
||||
|
||||
/* These are either module local, or the kernel's dummy ones. */
|
||||
@@ -263,7 +264,7 @@ struct module
|
||||
struct module_attribute *modinfo_attrs;
|
||||
const char *version;
|
||||
const char *srcversion;
|
||||
struct kobject *drivers_dir;
|
||||
struct kobject *holders_dir;
|
||||
|
||||
/* Exported symbols */
|
||||
const struct kernel_symbol *syms;
|
||||
|
||||
@@ -529,10 +529,11 @@ struct net_device
|
||||
struct net_bridge_port *br_port;
|
||||
|
||||
/* class/net/name entry */
|
||||
struct class_device class_dev;
|
||||
struct device dev;
|
||||
/* space for optional statistics and wireless sysfs groups */
|
||||
struct attribute_group *sysfs_groups[3];
|
||||
};
|
||||
#define to_net_dev(d) container_of(d, struct net_device, dev)
|
||||
|
||||
#define NETDEV_ALIGN 32
|
||||
#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
|
||||
@@ -548,7 +549,7 @@ static inline void *netdev_priv(struct net_device *dev)
|
||||
/* Set the sysfs physical device reference for the network logical device
|
||||
* if set prior to registration will cause a symlink during initialization.
|
||||
*/
|
||||
#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev))
|
||||
#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
|
||||
|
||||
struct packet_type {
|
||||
__be16 type; /* This is really htons(ether_type). */
|
||||
|
||||
@@ -573,10 +573,11 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
|
||||
void pci_enable_bridges(struct pci_bus *bus);
|
||||
|
||||
/* Proper probing supporting hot-pluggable devices */
|
||||
int __must_check __pci_register_driver(struct pci_driver *, struct module *);
|
||||
int __must_check __pci_register_driver(struct pci_driver *, struct module *,
|
||||
const char *mod_name);
|
||||
static inline int __must_check pci_register_driver(struct pci_driver *driver)
|
||||
{
|
||||
return __pci_register_driver(driver, THIS_MODULE);
|
||||
return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
|
||||
}
|
||||
|
||||
void pci_unregister_driver(struct pci_driver *);
|
||||
|
||||
@@ -86,6 +86,11 @@ static inline void serio_register_port(struct serio *serio)
|
||||
void serio_unregister_port(struct serio *serio);
|
||||
void serio_unregister_child_port(struct serio *serio);
|
||||
|
||||
int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name);
|
||||
static inline int serio_register_driver(struct serio_driver *drv)
|
||||
{
|
||||
return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME);
|
||||
}
|
||||
int serio_register_driver(struct serio_driver *drv);
|
||||
void serio_unregister_driver(struct serio_driver *drv);
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
|
||||
* message's completion function when the transaction completes.
|
||||
*/
|
||||
struct spi_master {
|
||||
struct class_device cdev;
|
||||
struct device dev;
|
||||
|
||||
/* other than negative (== assign one dynamically), bus_num is fully
|
||||
* board-specific. usually that simplifies to being SOC-specific.
|
||||
@@ -216,17 +216,17 @@ struct spi_master {
|
||||
|
||||
static inline void *spi_master_get_devdata(struct spi_master *master)
|
||||
{
|
||||
return class_get_devdata(&master->cdev);
|
||||
return dev_get_drvdata(&master->dev);
|
||||
}
|
||||
|
||||
static inline void spi_master_set_devdata(struct spi_master *master, void *data)
|
||||
{
|
||||
class_set_devdata(&master->cdev, data);
|
||||
dev_set_drvdata(&master->dev, data);
|
||||
}
|
||||
|
||||
static inline struct spi_master *spi_master_get(struct spi_master *master)
|
||||
{
|
||||
if (!master || !class_device_get(&master->cdev))
|
||||
if (!master || !get_device(&master->dev))
|
||||
return NULL;
|
||||
return master;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ static inline struct spi_master *spi_master_get(struct spi_master *master)
|
||||
static inline void spi_master_put(struct spi_master *master)
|
||||
{
|
||||
if (master)
|
||||
class_device_put(&master->cdev);
|
||||
put_device(&master->dev);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,10 +11,12 @@
|
||||
#define _SYSFS_H_
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/list.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
struct kobject;
|
||||
struct module;
|
||||
struct nameidata;
|
||||
|
||||
struct attribute {
|
||||
const char * name;
|
||||
@@ -88,13 +90,13 @@ struct sysfs_dirent {
|
||||
#ifdef CONFIG_SYSFS
|
||||
|
||||
extern int __must_check
|
||||
sysfs_create_dir(struct kobject *);
|
||||
sysfs_create_dir(struct kobject *, struct dentry *);
|
||||
|
||||
extern void
|
||||
sysfs_remove_dir(struct kobject *);
|
||||
|
||||
extern int __must_check
|
||||
sysfs_rename_dir(struct kobject *, const char *new_name);
|
||||
sysfs_rename_dir(struct kobject *, struct dentry *, const char *new_name);
|
||||
|
||||
extern int __must_check
|
||||
sysfs_move_dir(struct kobject *, struct kobject *);
|
||||
@@ -126,11 +128,17 @@ int __must_check sysfs_create_group(struct kobject *,
|
||||
void sysfs_remove_group(struct kobject *, const struct attribute_group *);
|
||||
void sysfs_notify(struct kobject * k, char *dir, char *attr);
|
||||
|
||||
|
||||
extern int sysfs_make_shadowed_dir(struct kobject *kobj,
|
||||
void * (*follow_link)(struct dentry *, struct nameidata *));
|
||||
extern struct dentry *sysfs_create_shadow_dir(struct kobject *kobj);
|
||||
extern void sysfs_remove_shadow_dir(struct dentry *dir);
|
||||
|
||||
extern int __must_check sysfs_init(void);
|
||||
|
||||
#else /* CONFIG_SYSFS */
|
||||
|
||||
static inline int sysfs_create_dir(struct kobject * k)
|
||||
static inline int sysfs_create_dir(struct kobject * k, struct dentry *shadow)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -140,7 +148,9 @@ static inline void sysfs_remove_dir(struct kobject * k)
|
||||
;
|
||||
}
|
||||
|
||||
static inline int sysfs_rename_dir(struct kobject * k, const char *new_name)
|
||||
static inline int sysfs_rename_dir(struct kobject * k,
|
||||
struct dentry *new_parent,
|
||||
const char *new_name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -204,6 +214,12 @@ static inline void sysfs_notify(struct kobject * k, char *dir, char *attr)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int sysfs_make_shadowed_dir(struct kobject *kobj,
|
||||
void * (*follow_link)(struct dentry *, struct nameidata *))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int __must_check sysfs_init(void)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -868,10 +868,11 @@ struct usb_class_driver {
|
||||
* use these in module_init()/module_exit()
|
||||
* and don't forget MODULE_DEVICE_TABLE(usb, ...)
|
||||
*/
|
||||
extern int usb_register_driver(struct usb_driver *, struct module *);
|
||||
extern int usb_register_driver(struct usb_driver *, struct module *,
|
||||
const char *);
|
||||
static inline int usb_register(struct usb_driver *driver)
|
||||
{
|
||||
return usb_register_driver(driver, THIS_MODULE);
|
||||
return usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
|
||||
}
|
||||
extern void usb_deregister(struct usb_driver *);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user