#ifndef _DEVICE_H_
#define _DEVICE_H_
+#include <linux/config.h>
#include <linux/ioport.h>
#include <linux/kobject.h>
#include <linux/klist.h>
extern void bus_rescan_devices(struct bus_type * bus);
+extern struct bus_type * get_bus(struct bus_type * bus);
+extern void put_bus(struct bus_type * bus);
+
+extern struct bus_type * find_bus(char * name);
+
/* iterator helpers for buses */
int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data,
struct subsystem subsys;
struct list_head children;
- struct list_head devices;
struct list_head interfaces;
struct semaphore sem; /* locks both the children and interfaces lists */
extern int class_register(struct class *);
extern void class_unregister(struct class *);
+extern struct class * class_get(struct class *);
+extern void class_put(struct class *);
+
struct class_attribute {
struct attribute attr;
* @node: for internal use by the driver core only.
* @kobj: for internal use by the driver core only.
* @devt_attr: for internal use by the driver core only.
- * @groups: optional additional groups to be created
* @dev: if set, a symlink to the struct device is created in the sysfs
* directory for this struct class device.
* @class_data: pointer to whatever you want to store here for this struct
struct device * dev; /* not necessary, but nice to have */
void * class_data; /* class-specific data */
struct class_device *parent; /* parent of this child device, if there is one */
- struct attribute_group ** groups; /* optional groups */
void (*release)(struct class_device *dev);
int (*uevent)(struct class_device *dev, char **envp,
struct kobject kobj;
char bus_id[BUS_ID_SIZE]; /* position on parent bus */
struct device_attribute uevent_attr;
- struct device_attribute *devt_attr;
struct semaphore sem; /* semaphore to synchronize calls to
* its driver.
struct dma_coherent_mem *dma_mem; /* internal for coherent mem
override */
- /* class_device migration path */
- struct list_head node;
- struct class *class; /* optional*/
- dev_t devt; /* dev_t, creates the sysfs "dev" */
-
void (*release)(struct device * dev);
};
extern void device_release_driver(struct device * dev);
extern int device_attach(struct device * dev);
extern void driver_attach(struct device_driver * drv);
-extern void device_reprobe(struct device *dev);
-/*
- * Easy functions for dynamically creating devices on the fly
- */
-extern struct device *device_create(struct class *cls, struct device *parent,
- dev_t devt, char *fmt, ...)
- __attribute__((format(printf,4,5)));
-extern void device_destroy(struct class *cls, dev_t devt);
/*
* Platform "fixup" functions - allow the platform to have their say
extern void put_device(struct device * dev);
-/* drivers/base/power/shutdown.c */
+/* drivers/base/power.c */
extern void device_shutdown(void);
extern void firmware_unregister(struct subsystem *);
/* debugging and troubleshooting/diagnostic helpers. */
-extern const char *dev_driver_string(struct device *dev);
#define dev_printk(level, dev, format, arg...) \
- printk(level "%s %s: " format , dev_driver_string(dev) , (dev)->bus_id , ## arg)
+ printk(level "%s %s: " format , (dev)->driver ? (dev)->driver->name : "" , (dev)->bus_id , ## arg)
#ifdef DEBUG
#define dev_dbg(dev, format, arg...) \
dev_printk(KERN_INFO , dev , format , ## arg)
#define dev_warn(dev, format, arg...) \
dev_printk(KERN_WARNING , dev , format , ## arg)
-#define dev_notice(dev, format, arg...) \
- dev_printk(KERN_NOTICE , dev , format , ## arg)
/* Create alias, so I can be autoloaded. */
#define MODULE_ALIAS_CHARDEV(major,minor) \