Commit bf54a2b3 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

m68k: amiga - Zorro bus modalias support

Add Amiga Zorro bus modalias and uevent support
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent 0b7f1a7e
...@@ -674,6 +674,7 @@ static struct zorro_device_id a2065_zorro_tbl[] __devinitdata = { ...@@ -674,6 +674,7 @@ static struct zorro_device_id a2065_zorro_tbl[] __devinitdata = {
{ ZORRO_PROD_AMERISTAR_A2065 }, { ZORRO_PROD_AMERISTAR_A2065 },
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE(zorro, a2065_zorro_tbl);
static struct zorro_driver a2065_driver = { static struct zorro_driver a2065_driver = {
.name = "a2065", .name = "a2065",
......
...@@ -145,6 +145,7 @@ static struct zorro_device_id ariadne_zorro_tbl[] __devinitdata = { ...@@ -145,6 +145,7 @@ static struct zorro_device_id ariadne_zorro_tbl[] __devinitdata = {
{ ZORRO_PROD_VILLAGE_TRONIC_ARIADNE }, { ZORRO_PROD_VILLAGE_TRONIC_ARIADNE },
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE(zorro, ariadne_zorro_tbl);
static struct zorro_driver ariadne_driver = { static struct zorro_driver ariadne_driver = {
.name = "ariadne", .name = "ariadne",
......
...@@ -71,6 +71,7 @@ static struct zorro_device_id hydra_zorro_tbl[] __devinitdata = { ...@@ -71,6 +71,7 @@ static struct zorro_device_id hydra_zorro_tbl[] __devinitdata = {
{ ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET }, { ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET },
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE(zorro, hydra_zorro_tbl);
static struct zorro_driver hydra_driver = { static struct zorro_driver hydra_driver = {
.name = "hydra", .name = "hydra",
......
...@@ -102,6 +102,7 @@ static struct zorro_device_id zorro8390_zorro_tbl[] __devinitdata = { ...@@ -102,6 +102,7 @@ static struct zorro_device_id zorro8390_zorro_tbl[] __devinitdata = {
{ ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, }, { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, },
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE(zorro, zorro8390_zorro_tbl);
static struct zorro_driver zorro8390_driver = { static struct zorro_driver zorro8390_driver = {
.name = "zorro8390", .name = "zorro8390",
......
...@@ -69,6 +69,7 @@ static struct zorro_device_id zorro7xx_zorro_tbl[] __devinitdata = { ...@@ -69,6 +69,7 @@ static struct zorro_device_id zorro7xx_zorro_tbl[] __devinitdata = {
}, },
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE(zorro, zorro7xx_zorro_tbl);
static int __devinit zorro7xx_init_one(struct zorro_dev *z, static int __devinit zorro7xx_init_one(struct zorro_dev *z,
const struct zorro_device_id *ent) const struct zorro_device_id *ent)
......
...@@ -299,6 +299,7 @@ static const struct zorro_device_id cirrusfb_zorro_table[] = { ...@@ -299,6 +299,7 @@ static const struct zorro_device_id cirrusfb_zorro_table[] = {
}, },
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE(zorro, cirrusfb_zorro_table);
static const struct { static const struct {
zorro_id id2; zorro_id id2;
......
...@@ -219,6 +219,7 @@ static struct zorro_device_id fm2fb_devices[] __devinitdata = { ...@@ -219,6 +219,7 @@ static struct zorro_device_id fm2fb_devices[] __devinitdata = {
{ ZORRO_PROD_HELFRICH_RAINBOW_II }, { ZORRO_PROD_HELFRICH_RAINBOW_II },
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE(zorro, fm2fb_devices);
static struct zorro_driver fm2fb_driver = { static struct zorro_driver fm2fb_driver = {
.name = "fm2fb", .name = "fm2fb",
......
...@@ -137,10 +137,34 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv) ...@@ -137,10 +137,34 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv)
return 0; return 0;
} }
static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
{
#ifdef CONFIG_HOTPLUG
struct zorro_dev *z;
if (!dev)
return -ENODEV;
z = to_zorro_dev(dev);
if (!z)
return -ENODEV;
if (add_uevent_var(env, "ZORRO_ID=%08X", z->id) ||
add_uevent_var(env, "ZORRO_SLOT_NAME=%s", dev_name(dev)) ||
add_uevent_var(env, "ZORRO_SLOT_ADDR=%04X", z->slotaddr) ||
add_uevent_var(env, "MODALIAS=" ZORRO_DEVICE_MODALIAS_FMT, z->id))
return -ENOMEM;
return 0;
#else /* !CONFIG_HOTPLUG */
return -ENODEV;
#endif /* !CONFIG_HOTPLUG */
}
struct bus_type zorro_bus_type = { struct bus_type zorro_bus_type = {
.name = "zorro", .name = "zorro",
.match = zorro_bus_match, .match = zorro_bus_match,
.uevent = zorro_uevent,
.probe = zorro_device_probe, .probe = zorro_device_probe,
.remove = zorro_device_remove, .remove = zorro_device_remove,
}; };
......
...@@ -77,6 +77,16 @@ static struct bin_attribute zorro_config_attr = { ...@@ -77,6 +77,16 @@ static struct bin_attribute zorro_config_attr = {
.read = zorro_read_config, .read = zorro_read_config,
}; };
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct zorro_dev *z = to_zorro_dev(dev);
return sprintf(buf, ZORRO_DEVICE_MODALIAS_FMT "\n", z->id);
}
static DEVICE_ATTR(modalias, S_IRUGO, modalias_show, NULL);
int zorro_create_sysfs_dev_files(struct zorro_dev *z) int zorro_create_sysfs_dev_files(struct zorro_dev *z)
{ {
struct device *dev = &z->dev; struct device *dev = &z->dev;
...@@ -89,6 +99,7 @@ int zorro_create_sysfs_dev_files(struct zorro_dev *z) ...@@ -89,6 +99,7 @@ int zorro_create_sysfs_dev_files(struct zorro_dev *z)
(error = device_create_file(dev, &dev_attr_slotaddr)) || (error = device_create_file(dev, &dev_attr_slotaddr)) ||
(error = device_create_file(dev, &dev_attr_slotsize)) || (error = device_create_file(dev, &dev_attr_slotsize)) ||
(error = device_create_file(dev, &dev_attr_resource)) || (error = device_create_file(dev, &dev_attr_resource)) ||
(error = device_create_file(dev, &dev_attr_modalias)) ||
(error = sysfs_create_bin_file(&dev->kobj, &zorro_config_attr))) (error = sysfs_create_bin_file(&dev->kobj, &zorro_config_attr)))
return error; return error;
......
...@@ -474,4 +474,13 @@ struct platform_device_id { ...@@ -474,4 +474,13 @@ struct platform_device_id {
__attribute__((aligned(sizeof(kernel_ulong_t)))); __attribute__((aligned(sizeof(kernel_ulong_t))));
}; };
struct zorro_device_id {
__u32 id; /* Device ID or ZORRO_WILDCARD */
kernel_ulong_t driver_data; /* Data private to the driver */
};
#define ZORRO_WILDCARD (0xffffffff) /* not official */
#define ZORRO_DEVICE_MODALIAS_FMT "zorro:i%08X"
#endif /* LINUX_MOD_DEVICETABLE_H */ #endif /* LINUX_MOD_DEVICETABLE_H */
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
typedef __u32 zorro_id; typedef __u32 zorro_id;
#define ZORRO_WILDCARD (0xffffffff) /* not official */
/* Include the ID list */ /* Include the ID list */
#include <linux/zorro_ids.h> #include <linux/zorro_ids.h>
...@@ -116,6 +114,7 @@ struct ConfigDev { ...@@ -116,6 +114,7 @@ struct ConfigDev {
#include <linux/init.h> #include <linux/init.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/mod_devicetable.h>
#include <asm/zorro.h> #include <asm/zorro.h>
...@@ -154,16 +153,6 @@ extern struct zorro_bus zorro_bus; /* single Zorro bus */ ...@@ -154,16 +153,6 @@ extern struct zorro_bus zorro_bus; /* single Zorro bus */
extern struct bus_type zorro_bus_type; extern struct bus_type zorro_bus_type;
/*
* Zorro device IDs
*/
struct zorro_device_id {
zorro_id id; /* Device ID or ZORRO_WILDCARD */
unsigned long driver_data; /* Data private to the driver */
};
/* /*
* Zorro device drivers * Zorro device drivers
*/ */
......
...@@ -796,6 +796,16 @@ static int do_platform_entry(const char *filename, ...@@ -796,6 +796,16 @@ static int do_platform_entry(const char *filename,
return 1; return 1;
} }
/* Looks like: zorro:iN. */
static int do_zorro_entry(const char *filename, struct zorro_device_id *id,
char *alias)
{
id->id = TO_NATIVE(id->id);
strcpy(alias, "zorro:");
ADD(alias, "i", id->id != ZORRO_WILDCARD, id->id);
return 1;
}
/* Ignore any prefix, eg. some architectures prepend _ */ /* Ignore any prefix, eg. some architectures prepend _ */
static inline int sym_is(const char *symbol, const char *name) static inline int sym_is(const char *symbol, const char *name)
{ {
...@@ -943,6 +953,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, ...@@ -943,6 +953,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
do_table(symval, sym->st_size, do_table(symval, sym->st_size,
sizeof(struct platform_device_id), "platform", sizeof(struct platform_device_id), "platform",
do_platform_entry, mod); do_platform_entry, mod);
else if (sym_is(symname, "__mod_zorro_device_table"))
do_table(symval, sym->st_size,
sizeof(struct zorro_device_id), "zorro",
do_zorro_entry, mod);
free(zeros); free(zeros);
} }
......
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