Skip to content

scx200_gpio: use 1 cdev for N minors, not N for N

Jim Cromie lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2scx200_gpio: 1 cdev for N minors - cleanup, prepdrivers/char/scx200_gpio.c+0 -10 replies
2/2scx200_gpio: use 1 cdev for N minors, not N for Ndrivers/char/scx200_gpio.c+0 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [ patch -mm1 00/02 ] scx200_gpio: use 1 cdev for N minors, not N for N

this pair of patches switches the driver to share 1 cdev across N pins, thus decreasing memory usage, and simplifying code ( no kzalloc, or its undo ).

Q: For some reason I havent figured, the cdev_put below breaks:

static void __exit scx200_gpio_cleanup(void)
{
cdev_del(&scx200_gpio_cdev);
cdev_put(&scx200_gpio_cdev); <<<<<<<< HERE

unregister_chrdev_region(MKDEV(major, 0), MAX_PINS); platform_device_unregister(pdev);
}

CC [M] drivers/char/scx200_gpio.o
Kernel: arch/i386/boot/bzImage is ready (#6)
Building modules, stage 2.
MODPOST
WARNING: "cdev_put" [drivers/char/scx200_gpio.ko] undefined!
LD [M] drivers/char/scx200_gpio.ko

It seems odd that it isnt available, esp since cdev_init() is also used wo errors ( in -mm1 currently ), and its defined in same
source-file: fs/char_dev.c

At any rate, I commented out the call in the 2nd patch and it works. I left it to mark the question.

thanks
Jim Cromie