upgrading a char-driver to 2.6 cdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



folks,

Im trying to update an existing kernel char-driver to use 2.6 cdev api,
thus far Ive failed..

Ive cut my patch down to a single, fairly bare version of scullc example from LDD-3, which applies to drivers/char/scx200_gpio. It compiles ok, but does this when I
access one of the pins.

Badness in kref_get at lib/kref.c:32
[<c01b918a>] kref_get+0x2a/0x30
[<c01b88f2>] kobject_get+0x12/0x20
[<c014bc80>] cdev_get+0x20/0x50
[<c014bd01>] chrdev_open+0x21/0x120
[<c0143674>] dentry_open+0x154/0x1c0
[<c0143510>] filp_open+0x50/0x60
[<c0143805>] sys_open+0x35/0x70
[<c01026f9>] syscall_call+0x7/0xb

    30 void kref_get(struct kref *kref)
    31 {
    32         WARN_ON(!atomic_read(&kref->refcount));
    33         atomic_inc(&kref->refcount);
    34 }

the object-dump tells me nothing.
00000010 <kref_get>:
 10:   53                      push   %ebx
 11:   8b 5c 24 08             mov    0x8(%esp),%ebx
 15:   8b 03                   mov    (%ebx),%eax
 17:   85 c0                   test   %eax,%eax
 19:   74 04                   je     1f <kref_get+0xf>
 1b:   ff 03                   incl   (%ebx)
 1d:   5b                      pop    %ebx
 1e:   c3                      ret
 1f:   6a 20                   push   $0x20
 21:   68 00 00 00 00          push   $0x0
 26:   68 00 00 00 00          push   $0x0
 2b:   68 0b 00 00 00          push   $0xb
 30:   e8 fc ff ff ff          call   31 <kref_get+0x21>
 35:   e8 fc ff ff ff          call   36 <kref_get+0x26>
 3a:   83 c4 10                add    $0x10,%esp
 3d:   eb dc                   jmp    1b <kref_get+0xb>
 3f:   90                      nop


(btw is there a way to get objdump to give offsets relative to the labels,
the way theyre given above ?  Its a pin to do hex arithmetic to go from
file-offset to label offset)


One thing that gave me pause was the the fact that this driver is dependent
upon another module, (scx200) thats a pci-device.  But since I dont know any
better/different, I figured Id try it.

Presuming that the pci-device driver is not updated either (a safe bet),
is that a potential (or definite?) source of problems like the one above ?

tia
jimc

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux