lkml.org 
[lkml]   [2001]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
Subject[PATCH] MODULE_DEVICE_TABLE for Moxa serial card drivers
From
Hi,

these two patches add MODULE_DEVICE_TABLE into Moxa serial card drivers (moxa.c and mxser.c).
Untested, but compiles and should work :)

Best regards.

--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.ascdiff -ur -X /usr/dontdiff /linux.vanilla/drivers/char/moxa.c /linux/drivers/char/moxa.c
--- /linux.vanilla/drivers/char/moxa.c Wed Oct 17 11:25:43 2001
+++ /linux/drivers/char/moxa.c Thu Oct 18 12:15:14 2001
@@ -105,18 +105,16 @@
"CP-204J series",
};

-typedef struct {
- unsigned short vendor_id;
- unsigned short device_id;
- unsigned short board_type;
-} moxa_pciinfo;
-
-static moxa_pciinfo moxa_pcibrds[] =
-{
- {PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C218, MOXA_BOARD_C218_PCI},
- {PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C320, MOXA_BOARD_C320_PCI},
- {PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_CP204J, MOXA_BOARD_CP204J},
+static struct pci_device_id moxa_pcibrds[] = {
+ { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C218, PCI_ANY_ID, PCI_ANY_ID,
+ 0, 0, MOXA_BOARD_C218_PCI },
+ { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C320, PCI_ANY_ID, PCI_ANY_ID,
+ 0, 0, MOXA_BOARD_C320_PCI },
+ { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_CP204J, PCI_ANY_ID, PCI_ANY_ID,
+ 0, 0, MOXA_BOARD_CP204J },
+ { 0 }
};
+MODULE_DEVICE_TABLE(pci, moxa_pcibrds);

typedef struct _moxa_isa_board_conf {
int boardType;
@@ -487,10 +485,10 @@
#ifdef CONFIG_PCI
{
struct pci_dev *p = NULL;
- n = sizeof(moxa_pcibrds) / sizeof(moxa_pciinfo);
+ n = (sizeof(moxa_pcibrds) / sizeof(moxa_pcibrds[0])) - 1;
i = 0;
while (i < n) {
- while((p = pci_find_device(moxa_pcibrds[i].vendor_id, moxa_pcibrds[i].device_id, p))!=NULL)
+ while ((p = pci_find_device(moxa_pcibrds[i].vendor, moxa_pcibrds[i].device, p))!=NULL)
{
if (pci_enable_device(p))
continue;
@@ -498,7 +496,7 @@
if (verbose)
printk("More than %d MOXA Intellio family boards found. Board is ignored.", MAX_BOARDS);
} else {
- moxa_get_PCI_conf(p, moxa_pcibrds[i].board_type,
+ moxa_get_PCI_conf(p, moxa_pcibrds[i].driver_data,
&moxa_boards[numBoards]);
numBoards++;
}diff -ur -X /usr/dontdiff /linux.vanilla/drivers/char/mxser.c /linux/drivers/char/mxser.c
--- /linux.vanilla/drivers/char/mxser.c Wed Oct 17 11:25:41 2001
+++ /linux/drivers/char/mxser.c Thu Oct 18 12:14:04 2001
@@ -159,17 +159,14 @@
#define MOXA_GET_CUMAJOR (MOXA + 64)
#define MOXA_GETMSTATUS (MOXA + 65)

-typedef struct {
- unsigned short vendor_id;
- unsigned short device_id;
- unsigned short board_type;
-} mxser_pciinfo;
-
-static mxser_pciinfo mxser_pcibrds[] =
-{
- {PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C168, MXSER_BOARD_C168_PCI},
- {PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C104, MXSER_BOARD_C104_PCI},
+static struct pci_device_id mxser_pcibrds[] = {
+ { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C168, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+ MXSER_BOARD_C168_PCI },
+ { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C104, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+ MXSER_BOARD_C104_PCI },
+ { 0 }
};
+MODULE_DEVICE_TABLE(pci, mxser_pcibrds);

static int ioaddr[MXSER_BOARDS];
static int ttymajor = MXSERMAJOR;
@@ -614,22 +611,22 @@
{
struct pci_dev *pdev = NULL;

- n = sizeof(mxser_pcibrds) / sizeof(mxser_pciinfo);
+ n = (sizeof(mxser_pcibrds) / sizeof(mxser_pcibrds[0])) - 1;
index = 0;
for (b = 0; b < n; b++) {
- pdev = pci_find_device(mxser_pcibrds[b].vendor_id,
- mxser_pcibrds[b].device_id, pdev);
+ pdev = pci_find_device(mxser_pcibrds[b].vendor,
+ mxser_pcibrds[b].device, pdev);
if (!pdev || pci_enable_device(pdev))
continue;
hwconf.pdev = pdev;
printk("Found MOXA %s board(BusNo=%d,DevNo=%d)\n",
- mxser_brdname[mxser_pcibrds[b].board_type],
+ mxser_brdname[mxser_pcibrds[b].driver_data],
pdev->bus->number, PCI_SLOT(pdev->devfn));
if (m >= MXSER_BOARDS) {
printk("Too many Smartio family boards found (maximum %d),board not configured\n", MXSER_BOARDS);
} else {
retval = mxser_get_PCI_conf(pdev,
- mxser_pcibrds[b].board_type, &hwconf);
+ mxser_pcibrds[b].driver_data, &hwconf);
if (retval < 0) {
if (retval == MXSER_ERR_IRQ)
printk("Invalid interrupt number,board not configured\n");[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:08    [W:0.084 / U:2.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site