Skip to content

Commit

Permalink
[PATCH] Make MODULE_DEVICE_TABLE work for vio devices
Browse files Browse the repository at this point in the history
Make MODULE_DEVICE_TABLE work for vio devices.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Stephen Rothwell authored and Paul Mackerras committed Aug 30, 2005
1 parent 71d276d commit fb120da
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 15 deletions.
2 changes: 1 addition & 1 deletion arch/ppc64/kernel/vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ EXPORT_SYMBOL(vio_unregister_driver);
static const struct vio_device_id *vio_match_device(
const struct vio_device_id *ids, const struct vio_dev *dev)
{
while (ids->type) {
while (ids->type[0] != '\0') {
if (vio_bus_ops.match(ids, dev))
return ids;
ids++;
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/viodasd.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ static int viodasd_remove(struct vio_dev *vdev)
*/
static struct vio_device_id viodasd_device_table[] __devinitdata = {
{ "viodasd", "" },
{ 0, }
{ "", "" }
};

MODULE_DEVICE_TABLE(vio, viodasd_device_table);
Expand Down
2 changes: 1 addition & 1 deletion drivers/cdrom/viocd.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ static int viocd_remove(struct vio_dev *vdev)
*/
static struct vio_device_id viocd_device_table[] __devinitdata = {
{ "viocd", "" },
{ 0, }
{ "", "" }
};

MODULE_DEVICE_TABLE(vio, viocd_device_table);
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/hvc_vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ char hvc_driver_name[] = "hvc_console";

static struct vio_device_id hvc_driver_table[] __devinitdata = {
{"serial", "hvterm1"},
{ NULL, }
{ "", "" }
};
MODULE_DEVICE_TABLE(vio, hvc_driver_table);

Expand Down
2 changes: 1 addition & 1 deletion drivers/char/hvcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ static int khvcsd(void *unused)

static struct vio_device_id hvcs_driver_table[] __devinitdata= {
{"serial-server", "hvterm2"},
{ NULL, }
{ "", "" }
};
MODULE_DEVICE_TABLE(vio, hvcs_driver_table);

Expand Down
2 changes: 1 addition & 1 deletion drivers/char/viotape.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ static int viotape_remove(struct vio_dev *vdev)
*/
static struct vio_device_id viotape_device_table[] __devinitdata = {
{ "viotape", "" },
{ 0, }
{ "", "" }
};

MODULE_DEVICE_TABLE(vio, viotape_device_table);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ibmveth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ static void ibmveth_proc_unregister_driver(void)

static struct vio_device_id ibmveth_device_table[] __devinitdata= {
{ "network", "IBM,l-lan"},
{ 0,}
{ "", "" }
};

MODULE_DEVICE_TABLE(vio, ibmveth_device_table);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/iseries_veth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ static int veth_probe(struct vio_dev *vdev, const struct vio_device_id *id)
*/
static struct vio_device_id veth_device_table[] __devinitdata = {
{ "vlan", "" },
{ NULL, NULL }
{ "", "" }
};
MODULE_DEVICE_TABLE(vio, veth_device_table);

Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/ibmvscsi/ibmvscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ static int ibmvscsi_remove(struct vio_dev *vdev)
*/
static struct vio_device_id ibmvscsi_device_table[] __devinitdata = {
{"vscsi", "IBM,v-scsi"},
{0,}
{ "", "" }
};

MODULE_DEVICE_TABLE(vio, ibmvscsi_device_table);
Expand Down
6 changes: 1 addition & 5 deletions include/asm-ppc64/vio.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/errno.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/mod_devicetable.h>

#include <asm/hvcall.h>
#include <asm/scatterlist.h>
Expand Down Expand Up @@ -52,11 +53,6 @@ struct vio_dev {
struct device dev;
};

struct vio_device_id {
char *type;
char *compat;
};

struct vio_driver {
struct list_head node;
char *name;
Expand Down
7 changes: 6 additions & 1 deletion include/linux/mod_devicetable.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Device tables which are exported to userspace via
* scripts/table2alias.c. You must keep that file in sync with this
* scripts/mod/file2alias.c. You must keep that file in sync with this
* header.
*/

Expand Down Expand Up @@ -190,6 +190,11 @@ struct of_device_id
#endif
};

/* VIO */
struct vio_device_id {
char type[32];
char compat[32];
};

/* PCMCIA */

Expand Down
19 changes: 19 additions & 0 deletions scripts/mod/file2alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,22 @@ static int do_of_entry (const char *filename, struct of_device_id *of, char *ali
return 1;
}

static int do_vio_entry(const char *filename, struct vio_device_id *vio,
char *alias)
{
char *tmp;

sprintf(alias, "vio:T%sS%s", vio->type[0] ? vio->type : "*",
vio->compat[0] ? vio->compat : "*");

/* Replace all whitespace with underscores */
for (tmp = alias; tmp && *tmp; tmp++)
if (isspace (*tmp))
*tmp = '_';

return 1;
}

/* Ignore any prefix, eg. v850 prepends _ */
static inline int sym_is(const char *symbol, const char *name)
{
Expand Down Expand Up @@ -422,6 +438,9 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
else if (sym_is(symname, "__mod_of_device_table"))
do_table(symval, sym->st_size, sizeof(struct of_device_id),
do_of_entry, mod);
else if (sym_is(symname, "__mod_vio_device_table"))
do_table(symval, sym->st_size, sizeof(struct vio_device_id),
do_vio_entry, mod);

}

Expand Down

0 comments on commit fb120da

Please sign in to comment.