Hello,
We have been using "Nios II Linux/uClinux Community Release 20080619" (kernel version 2.6.27) to write a network device driver. We have just updated to release 20090730 (kernel version 2.6.30).
When we compile on the newer release we are getting errors about the "priv" element not existing in the "net_device" struct. I have searched for some code and found the function "netdev_priv()" which seems to return this priv pointer, but I am unsure if this is a replacement or if this is an older function etc. Could someone please tell me how one would set the net_device private data in a newer kernel?
This is how I was doing things in the older kernel...
Code:
int zl_probe(struct platform_device *pdev)
{
...
struct zlxx_dev *zldev;
struct net_device *ndev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
return -ENXIO;
}
/* this is where my zldev is created */
zldev = kzalloc(sizeof(struct zlxx_dev), GFP_KERNEL);
if (!zldev) {
return -ENOMEM;
}
zldev->irq = platform_get_irq(pdev, 0);
if (zldev->irq < 0) {
result = -ENXIO;
goto fail_getirq;
}
zldev->size = res->end - res->start + 1;
zldev->base = ioremap_nocache(res->start, zldev->size);
zldev->pdev = pdev;
if (!zldev->base) {
result = -ENOMEM;
goto fail_map;
}
ndev = zldev->ndev;
...
}
...
static int zlnet_init(struct zlxx_dev *zldev)
{
struct net_device *ndev;
spin_lock_init(&zldev->net.lock);
/* allocate net dev */
zldev->ndev = alloc_etherdev(0);
if (!zldev->ndev) {
dev_err(&zldev->pdev->dev, "could not allocate device.\n");
return -ENOMEM;
}
ndev = zldev->ndev;
ndev->priv = zldev; /* priv is gone! what do I do instead?? */
/* Populate net_device struct */
...
}