Commit 1750b068 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc64: integrate vio.c with 2.6 driver model

From: anton@samba.org

From: Hollis Blanchard <hollisb@us.ibm.com>

integrate vio.c with 2.6 driver model
parent e114d758
This diff is collapsed.
......@@ -16,6 +16,7 @@
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/device.h>
#include <asm/hvcall.h>
#include <asm/prom.h>
#include <asm/scatterlist.h>
......@@ -40,11 +41,11 @@ struct vio_device_id;
struct TceTable;
int vio_register_driver(struct vio_driver *drv);
int vio_unregister_driver(struct vio_driver *drv);
void vio_unregister_driver(struct vio_driver *drv);
const struct vio_device_id * vio_match_device(const struct vio_device_id *ids,
const struct vio_dev *dev);
struct vio_dev * __devinit vio_register_device(struct device_node *node_vdev);
int __devinit vio_unregister_device(struct vio_dev *dev);
void __devinit vio_unregister_device(struct vio_dev *dev);
const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length);
int vio_get_irq(struct vio_dev *dev);
struct TceTable * vio_build_tce_table(struct vio_dev *dev);
......@@ -64,11 +65,11 @@ void *vio_alloc_consistent(struct vio_dev *dev, size_t size,
void vio_free_consistent(struct vio_dev *dev, size_t size, void *vaddr,
dma_addr_t dma_handle);
extern struct bus_type vio_bus_type;
struct vio_device_id {
char *type;
char *compat;
/* I don't think we need this
unsigned long driver_data; */ /* Data private to the driver */
};
struct vio_driver {
......@@ -76,55 +77,33 @@ struct vio_driver {
char *name;
const struct vio_device_id *id_table; /* NULL if wants all devices */
int (*probe) (struct vio_dev *dev, const struct vio_device_id *id); /* New device inserted */
void (*remove) (struct vio_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
int (*remove) (struct vio_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
unsigned long driver_data;
struct device_driver driver;
};
struct vio_bus;
static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
{
return container_of(drv, struct vio_driver, driver);
}
/*
* The vio_dev structure is used to describe virtual I/O devices.
*/
struct vio_dev {
struct list_head devices_list; /* node in list of all vio devices */
struct device_node *archdata; /* Open Firmware node */
struct vio_bus *bus; /* bus this device is on */
struct vio_driver *driver; /* owning driver */
struct device_node *archdata; /* Open Firmware node */
void *driver_data; /* data private to the driver */
unsigned long unit_address;
struct TceTable *tce_table; /* vio_map_* uses this */
struct TceTable *tce_table; /* vio_map_* uses this */
unsigned int irq;
struct proc_dir_entry *procent; /* device entry in /proc/bus/vio */
};
struct vio_bus {
struct list_head devices; /* list of virtual devices */
struct device dev;
};
static inline int vio_module_init(struct vio_driver *drv)
static inline struct vio_dev *to_vio_dev(struct device *dev)
{
int rc = vio_register_driver (drv);
if (rc > 0)
return 0;
/* iff CONFIG_HOTPLUG and built into kernel, we should
* leave the driver around for future hotplug events.
* For the module case, a hotplug daemon of some sort
* should load a module in response to an insert event. */
#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
if (rc == 0)
return 0;
#else
if (rc == 0)
rc = -ENODEV;
#endif
/* if we get here, we need to clean up vio driver instance
* and return some sort of error */
return rc;
return container_of(dev, struct vio_dev, dev);
}
#endif /* _PHYP_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment