LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 11-25-2009, 02:39 PM   #1
AustinMarton
Member
 
Registered: May 2007
Location: New Zealand
Distribution: Ubuntu
Posts: 88

Rep: Reputation: 16
net_device priv pointer is missing in newer kernel


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 */
	...
}

Last edited by AustinMarton; 11-25-2009 at 03:53 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling cisco-vpn gives "error: struct net_device has no..." under kernel 2.6.31 jadi19 Linux - Networking 3 10-04-2009 12:40 AM
TTY0 missing in newer kernels theNbomr Linux - Kernel 8 01-14-2009 09:34 AM
how to access private pointer of struct net_device??? raklo Linux - Kernel 1 02-24-2007 12:34 AM
Newer distributions and the "X" pointer Thaidog Linux - Newbie 2 02-18-2004 09:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration