LT4000 PCMCIA device driver CardServices undefined problem

mail mail towergeebulk at gmail.com
Sat Jul 23 23:38:23 EDT 2005


http://lwn.net/ is a good website which I visit frequently. And the
kernel Documentation contains rich infomation. But in my 2.6.11 kernel
Documentation there is no kref.txt. After I search using google, I
find that in 2.6.12 kernel tree there is kref.txt. It seems that I
should upgrade my Documentation now. :)

To Mr. Dominik, 
I don't know whether I should use kref in pcmcia driver. When I read
LDD3, Chapter 13 USB drivers, I learn that in kernel 2.6 kref is used
to increase or decrease the reference counter of USB structure. Also
in the original source code of LT4000 there is MOD_DEC_USE_COUNT and
MOD_INC_USE_COUNT. So I want to use kref to implement these two
macros. Am I right?

Although it has been approximately 8 years since I first used
Slackware in 1997, I haven't take part in kernel hacking. I am
exciting if I can contribute to linux kernel. Thanks for your
encourage.

On 7/24/05, randy_dunlap <rdunlap at xenotime.net> wrote:
> On Sat, 23 Jul 2005 18:21:16 +0800 mail mail wrote:
> 
> > Thanks for randy's detail replying.
> >
> > I don't know why LT4000 device driver does not appear in the kernel
> > tree. And I will be very happy if the LT4000 device driver appear in
> > the 2.6 kernel tree.
> >
> > Can you tell me what the Coding Style I should use in pcmcia driver
> > source code? Now I will read some pcmcia driver in kernel 2.6 and hope
> > to learn some coding style.
> 
> Primary references are in the kernel source tree:
> linux/Documentation/CodingStyle
> linux/Documentation/SubmittingPatches
> linux/Documentation/SubmittingDrivers
> 
> 
> > I have read the patch file you provied. It does not mention how to use
> > kref. Can you give me some tips or give me some url so that I can
> > learn from it?
> 
> The only one that I know about is in the kernel source tree:
> linux/Documentaion/kref.txt .
> 
> http://lwn.net/Articles/driver-porting/ has some good examples
> of 2.4 to 2.6 driver porting, but I don't see kref there.
> 
> 
> > Thank you again.
> >
> > On 7/22/05, randy_dunlap <rdunlap at xenotime.net> wrote:
> > > On Thu, 21 Jul 2005 22:51:48 +0800 mail mail wrote:
> > >
> > > > Hi,
> > > > I downloaded the source code of LT4000 from http://www.linuxnet.com/
> > > > and I found that it can only run on kernel 2.4. It doesn't work in
> > > > kernel 2.6. I do some modification in order to run in kernel 2.6. Here
> > > > is some of my work.
> > >
> > > Any idea why this driver isn't in the kernel tree?
> > >
> > > > 1. add kref instead of MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT (not
> > > > finished yet.) In fact, I don't know how to add kref support yet. Can
> > > > you help me?
> > > > 2. use pcmcia_register_driver instead of register_pccard_driver. I
> > > > find some useful tips in http://linux.bkbits.com/. There is some diff
> > > > files in the chargelog of pcmcia.
> > > > 3. use pcmcia_unregister_driver instead of unregister_pccard_driver.
> > > > The same as the former one.
> > > > 4. use new Makefile. I learn this from LDD3.
> > >
> > > Even simpler one below.
> > >
> > > > 5. add struct pcmcia_driver.
> > > >
> > > > Now I compile the source code and it said "*** Warning: "CardServices"
> > > > [/root/lt4000-1.0.0.2/kernel/LT4000_cs.ko] undefined!". My environment
> > > > is "Linux 2.6.11-1.14_FC3 i686 i386 GNU/Linux" on NEC VERSA NOTE VXi
> > > > laptop.
> > > >
> > > > I have spent quite some time to search using Google but found nothing
> > > > userful. Is anybody available to help me out? Why CardServices is not
> > > > support by kernel 2.6?
> > >
> > > CardServices() in 2.4 is just a big switch statement to call various
> > > services.  In 2.6, all of those entry points are exported and called
> > > directly (except for pcmcia_report_error(), just use cs_error() instead).
> > >
> > > Dominik, can we get this added to Doc/pcmcia/driver-changes.txt?
> > >
> > > I'm attaching a patch to your posted source file.  It fixes most of
> > > the CardServices() calls except for the one to pccard_validate_cis()
> > > and these 2 usages:
> > >
> > > #define CS_CHECK(fn, args...) \
> > > while ((last_ret=CardServices(last_fn=(fn),args))!=0) goto cs_failed
> > >
> > > #define CFG_CHECK(fn, args...) \
> > > if (CardServices(fn, args) != 0) goto next_entry
> > >
> > > The call to pccard_validate_cis() wants a socket, which I
> > > didnt' declare or initialize (i.e., syntax error there is on purpose).
> > >
> > >
> > >
> > > There's still a ton of CodingStyle work to be done to the driver,
> > > but I didn't address that for the most part.
> > >
> > > ---
> > > ~Randy
> 
> ---
> ~Randy
>



More information about the linux-pcmcia mailing list