[PATCH] openfirmware: generate device table for userspace

This converts the usage of struct of_match to struct of_device_id,
similar to pci_device_id.  This allows a device table to be generated,
which can be parsed by depmod(8) to generate a map file for module
loading.

In order for hotplug to work with macio devices, patches to
module-init-tools and hotplug must be applied.  Those patches are
available at:

 ftp://ftp.suse.com/pub/people/jeffm/linux/macio-hotplug/

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Jeff Mahoney 2005-07-06 15:44:41 -04:00 • committed by Linus Torvalds
commit 5e6557722e
19 changed files with 91 additions and 93 deletions

View file

@ -1,6 +1,7 @@
#ifndef __MACIO_ASIC_H__
#define __MACIO_ASIC_H__
#include <linux/mod_devicetable.h>
#include <asm/of_device.h>
extern struct bus_type macio_bus_type;
@ -120,10 +121,10 @@ static inline struct pci_dev *macio_get_pci_dev(struct macio_dev *mdev)
struct macio_driver
{
char *name;
struct of_match *match_table;
struct of_device_id *match_table;
struct module *owner;
int (*probe)(struct macio_dev* dev, const struct of_match *match);
int (*probe)(struct macio_dev* dev, const struct of_device_id *match);
int (*remove)(struct macio_dev* dev);
int (*suspend)(struct macio_dev* dev, pm_message_t state);

View file

@ -24,20 +24,8 @@ struct of_device
};
#define to_of_device(d) container_of(d, struct of_device, dev)
/*
* Struct used for matching a device
*/
struct of_match
{
char *name;
char *type;
char *compatible;
void *data;
};
#define OF_ANY_MATCH ((char *)-1L)
extern const struct of_match *of_match_device(
const struct of_match *matches, const struct of_device *dev);
extern const struct of_device_id *of_match_device(
const struct of_device_id *matches, const struct of_device *dev);
extern struct of_device *of_dev_get(struct of_device *dev);
extern void of_dev_put(struct of_device *dev);
@ -49,10 +37,10 @@ extern void of_dev_put(struct of_device *dev);
struct of_platform_driver
{
char *name;
struct of_match *match_table;
struct of_device_id *match_table;
struct module *owner;
int (*probe)(struct of_device* dev, const struct of_match *match);
int (*probe)(struct of_device* dev, const struct of_device_id *match);
int (*remove)(struct of_device* dev);
int (*suspend)(struct of_device* dev, pm_message_t state);

View file

@ -174,6 +174,17 @@ struct serio_device_id {
__u8 proto;
};
/*
* Struct used for matching a device
*/
struct of_device_id
{
char name[32];
char type[32];
char compatible[128];
void *data;
};
/* PCMCIA */