Moving from Binary Drivers to Open Source?
GerryGilmore asks: "We are a division, specializing in telecommunications equipment, of a very large hardware manufacturer. Our equipment, DSP and PSTN boards, has been supported under Linux through a set of binary driver modules and binary libraries implementing our API set. We are in the process of migrating to a completely open source-based software infrastructure to be more in sync with the rest of the Linux industry. However, not having any real experience with moving from proprietary to an open source model, we wanted to see if the Slashdot crowd has any similar experiences to share: The Good; The Bad; The Ugly; and how best to avoid the most common pitfalls."
Read the codingstyle document and look at what others are putting into the kernel!
The biggest mistake is some idiot using unusual function names, spreading his driver over atleast ten files and using 2 character indents or no indentation at all.
Especially if your source is ported from windows (or the programmer has only windows experience) make sure you do this right.
Jeroen
Secure messaging: http://quickmsg.vreeken.net/
This may be really useful for sales, but it may also lead to a serious amount of bug finding!
Are you really sure you want your device drivers debugged?
Sent from my ASR33 using ASCII
Thank you for your interest in finally removing your head from your posterior.
I would like to suggest the following:
- Communicate with your application developers openly. You rob yourself of invaluable feedback when the forums you sponsor are not as free as the source.
- Particiapte. While it's not neccessary to feed the trolls, your guidance and expertise are critical to the success of the project.
- Take a resolute approach. An insistance on silly extra clauses added to otherwise good licenses only curtails adoption. Be free, or don't bother.
I am the CTO for a telecom company that once used hardware from this "very large supplier". Having worked with their products, I would be very surprised if the code for their drivers is not a train wreck. We struggled for over a year to get their PSTN boards to work with a generic ISDN PRI network.
We switched from this company to a smaller vendor that shipped PSTN and VoIP boards with stable drivers. We've never had a problem since, and will never go back to the previous vendor.
As for open source, if I am paying ten or twenty grand for telecom hardware, I expect the vendor to have developed and debugged their drivers. I am a customer. I am not their development team. So I could care less if the drivers are OSS or not if they work. If they don't work, I am going to buy hardware from another vendor.
Maybe I am cynical, but I suspect this company is looking at OSS as a way to dump more work on their customers.
Interesting, a study we did showed that in terms of productivity and readability 2 space tab indents was optimimum. "Why?" I hear you ask - any developer that's worked on a project of any size above "tiny" will know that large indents don't aid readibility, unless your code is very 'squished'. Which brings us onto one of the most important aspects of any project - white space.
Let's look at the following chunks of code;
Many would write a simple for-loop like this (using standard 8-space unexpanded tabs);
for(int l=0;l10;++l){
printf("%d\n",l);
}
versus the more experienced coder (using 2 space expanded tabs);
for ( int l = 0; l 10; ++l )
{
printf ( "%d\n", l );
}
Maybe it's just my opinion (and many others on projects I've worked on), but the second is far more readable and when a new coder comes along to maintain the code she/he would have a much easier job going through the code to figure out how it works. You may not believe me, but take any large chunk of code you may have and take the time to space it out and re-indent it - I guarantee that any decent coder will see my argument is correct.
Get into the official kernel. If a driver isn't in Linus's tree, it doesn't matter, so you will be on an endless treadmill of API breakage. Once your driver is in the official kernel tree, the kernel hackers will take responsibility for most of the API refactoring.
Know the politics. Most Linux kernel developers aren't accountable to anyone and don't negotiate. You will have to put up with whatever requirements they give you if you want your code to be part of the kernel.
Know the effort. You will probably be asked to rewrite your drivers, possibly more than once. This will take months. If you don't do it, then open-sourcing the drivers was mostly wasted effort.
As others mentioned, coding style is important. Also, wrappers are not allowed in the kernel, so call kernel APIs directly instead of wrapping them. The result is a totally Linux-specific driver, but the rules are the rules (see above).
As a developer of binary drivers you are used to having complete control over your code, and "pushing" all updates down-stream. But once your code goes in the kernel (which I highly recommend - don't let it languish outside Linus' tree), you'll have to consider how to deal with code changes coming TO you FROM the kernel developers.
This is both a good thing and a bad thing. It's good because you'll get fixes from people testing your code on all sorts of weird platforms you've never heard of. It's bad because you can wake up one morning and discover the kernel API for your type of driver has changed overnight, and your code won't even compile until you re-write half of it (there go your plans for the weekend). A certain amount of lag is acceptable, and you can restrict support to the stable kernel series only if you want, but expect to hear a lot of whining from users who will demand that you keep up with the cutting-edge development code.