LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 02-22-2013, 08:35 AM   #1
micha1
LQ Newbie
 
Registered: Feb 2013
Posts: 6

Rep: Reputation: Disabled
" error unknown field 'ioctl' " while compiling a driver for Kernel 2.6.38.8


Hello,

I try to compile a driver module of a PCI/VME adapter card (Model 616 from GE-IP/formerly SBS) for Kernel Version 2.38.8. This driver was developed for Kernel 2.6.32 and worked fine with this kernel version. Now, if I try to compile for version 2.6.38.8 (which I need for specific reasons) it does not compile anymore. There is an error "unknown field 'ioctl' ".

I already googled a bit an found out, that is has to do with the remove of the Big Kernel Lock (BKL) and the field ioctl in Kernel >= 2.6.37. One should use unlocked_ioctl and remove locking kernel code from the driver. If it is not really necessary, I want to avoid trying to port the driver, because I am not an experienced driver hacker.

Is there a possibility to use older drivers (with BKL and ioctl) in Kernel 2.6.38?
I have seen, that in Kernel 2.6.38 there is still a kernel config option for BKL, which can be set to YES to enable BKL for older drivers. Is there a possibility to configure the kernel, so that the field ioctl is available? Then I could still use my older driver for kernel 2.6.38.8.

Thanks and best regards
michael
 
Old 02-23-2013, 03:22 AM   #2
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
The ioctl has been changed for a reason and it would be best if you follow the kernel changes in your driver too.
You can not use drivers compiled for one version in another.
The change is not too difficult one.

In the fops structure change

ioctl to
unlocked_ioctl

and in the ioctl function in your driver, do not pass the inode pointer. That is all, the rest of the code can remain the same.

See if the post helps
http://tuxthink.blogspot.in/2012/12/...or-kernel.html
 
Old 02-25-2013, 02:25 AM   #3
micha1
LQ Newbie
 
Registered: Feb 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks for the link. I think it helps and I try it.

>You can not use drivers compiled for one version in another.
This is clear. I meant, if it is possible, to compile an older driver (with ioctl) for kernel 2.6.38, if this kernel is specially configured.

regards
michael
 
Old 02-26-2013, 08:11 AM   #4
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
I don't think that would be possible. ioctls are used in so many places in the kernel, you will have to modify all the codes of ioctl to suit just one use in your driver.
 
Old 02-28-2013, 08:37 AM   #5
micha1
LQ Newbie
 
Registered: Feb 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks again for your help, the driver works now. Fortunately the driver didn't use lock_kernel() anymore, so that the only change I had to do, was really the fops structure and ioctl-header change.
 
  


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
What i s this error pop-up: "On line 3: unknown type "evolution""?? kline Linux - Desktop 0 11-25-2011 04:12 PM
[SOLVED] "missing kernel .config file" error while compiling linux source code for android preetb123 Linux - Mobile 3 03-19-2011 07:46 AM
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
static struct pci_driver unknown field 'name' "has initializer but incomplete type" ddeeks Programming 0 05-27-2009 12:09 PM
Compiling the kernel: error with "make mrproper" dominik81 Linux - Newbie 1 06-10-2004 02:06 PM

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

All times are GMT -5. The time now is 01:44 AM.

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