Messages in this thread | | | Date | Wed, 17 Nov 1999 15:22:27 -0800 (PST) | From | Linux Lists <> | Subject | Re: Allowing WAN card driver to be built-in to the kernel |
| |
On Wed, 17 Nov 1999, Alan Cox wrote:
> > found the file drivers/net/Space.c, where all probe functions from > > configured devices are called from. However, it seems that this is > > supposed to be used only by Ethernet devices. > > Not so. Look at for example the loopback drivers, the appletalk drivers etc. > For 2.3.28 look at drivers/net/setup.,c
This is my addition to drivers/net/Space.c (the driver supports a maximum of 4 boards, 2 channels per board):
#if defined(CONFIG_PC300) && !defined(CONFIG_PC300_MODULE) extern int cpc_probe(struct device *);
static struct device cpc7_dev = {"cpc7", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, NULL}; static struct device cpc6_dev = {"cpc6", 0, 0, 0, 0, 0, 0, 0, 0, 0, &cpc7_dev, NULL}; static struct device cpc5_dev = {"cpc5", 0, 0, 0, 0, 0, 0, 0, 0, 0, &cpc6_dev, NULL}; static struct device cpc4_dev = {"cpc4", 0, 0, 0, 0, 0, 0, 0, 0, 0, &cpc5_dev, NULL}; static struct device cpc3_dev = {"cpc3", 0, 0, 0, 0, 0, 0, 0, 0, 0, &cpc4_dev, NULL}; static struct device cpc2_dev = {"cpc2", 0, 0, 0, 0, 0, 0, 0, 0, 0, &cpc3_dev, NULL}; static struct device cpc1_dev = {"cpc1", 0, 0, 0, 0, 0, 0, 0, 0, 0, &cpc2_dev, NULL}; static struct device cpc0_dev = {"cpc0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &cpc1_dev, cpc_probe};
#undef NEXT_DEV #define NEXT_DEV (&cpc0_dev) #endif
Now, the function cpc_probe, in the driver:
__initfunc(int cpc_probe(struct device *dev)) { return (cpc_init()); }
Note that the Space.c declaration is just a hook, as the 'struct device' parameter is ignored by cpc_probe. Note also that the only the first device invokes cpc_probe, which detects all devices.
The problem is that this only solves the device detection problem, but when I try to access an interface, it returns "ioctl err". I think that this happens exactly because I ignore the dev argument in cpc_probe.
However, after further investigation, I found a problem in the interface with syncppp: the structure ppp_device contains a 'struct device' structure (not a pointer), which is the device structure used in every driver that uses syncppp.
The problem is that as this is not a pointer, it can't be the same structure as the one defined in Space.c (or can it??) and, thus, I don't have how to tell the driver (and syncppp) to use the structure defined in Space.c. If I use the Space.c definition in the driver, it will not be in sync with the ppp_device structure, and that will surely cause problems.
Shouldn't pppdev.dev be a pointer to a 'struct device' structure?? How can I solve this problem???
I think this problem wasn't spotted before because all the other WAN card drivers currently available are only "compileable" as modules.
Regards, Ivan
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |