I am comparing usage of struct cdev in 2 bits of kernel code: - LDD3 way, which Ive imitated in scx200_gpio.c, is: for (i <http://www.linux-m32r.org/lxr/http/ident?i=i> = 0; i <http://www.linux-m32r.org/lxr/http/ident?i=i> < num_pins <http://www.linux-m32r.org/lxr/http/ident?i=num_pins>; i <http://www.linux-m32r.org/lxr/http/ident?i=i>++) { 115 <http://www.linux-m32r.org/lxr/http/source/drivers/char/scx200_gpio.c#L115> struct cdev <http://www.linux-m32r.org/lxr/http/ident?i=cdev> *cdev <http://www.linux-m32r.org/lxr/http/ident?i=cdev> = &scx200_devices <http://www.linux-m32r.org/lxr/http/ident?i=scx200_devices>[i <http://www.linux-m32r.org/lxr/http/ident?i=i>]; 116 <http://www.linux-m32r.org/lxr/http/source/drivers/char/scx200_gpio.c#L116> cdev_init <http://www.linux-m32r.org/lxr/http/ident?i=cdev_init>(cdev <http://www.linux-m32r.org/lxr/http/ident?i=cdev>, &scx200_gpio_fops <http://www.linux-m32r.org/lxr/http/ident?i=scx200_gpio_fops>); 117 <http://www.linux-m32r.org/lxr/http/source/drivers/char/scx200_gpio.c#L117> cdev <http://www.linux-m32r.org/lxr/http/ident?i=cdev>->owner = THIS_MODULE <http://www.linux-m32r.org/lxr/http/ident?i=THIS_MODULE>; 118 <http://www.linux-m32r.org/lxr/http/source/drivers/char/scx200_gpio.c#L118> rc <http://www.linux-m32r.org/lxr/http/ident?i=rc> = cdev_add <http://www.linux-m32r.org/lxr/http/ident?i=cdev_add>(cdev <http://www.linux-m32r.org/lxr/http/ident?i=cdev>, MKDEV <http://www.linux-m32r.org/lxr/http/ident?i=MKDEV>(major <http://www.linux-m32r.org/lxr/http/ident?i=major>, i <http://www.linux-m32r.org/lxr/http/ident?i=i>), 1); 119 <http://www.linux-m32r.org/lxr/http/source/drivers/char/scx200_gpio.c#L119> *//* tolerate 'minor' errors *//* 120 <http://www.linux-m32r.org/lxr/http/source/drivers/char/scx200_gpio.c#L120> if (rc <http://www.linux-m32r.org/lxr/http/ident?i=rc>) 121 <http://www.linux-m32r.org/lxr/http/source/drivers/char/scx200_gpio.c#L121> dev_err <http://www.linux-m32r.org/lxr/http/ident?i=dev_err>(&pdev <http://www.linux-m32r.org/lxr/http/ident?i=pdev>->dev <http://www.linux-m32r.org/lxr/http/ident?i=dev>, /"Error %d on minor %d"/, rc <http://www.linux-m32r.org/lxr/http/ident?i=rc>, i <http://www.linux-m32r.org/lxr/http/ident?i=i>); 122 <http://www.linux-m32r.org/lxr/http/source/drivers/char/scx200_gpio.c#L122> } - in contrast, the CS-5535_gpio.c uses a single cdev struct for all the minor devices: 235 <http://www.linux-m32r.org/lxr/http/source/drivers/char/cs5535_gpio.c#L235> cdev_init <http://www.linux-m32r.org/lxr/http/ident?i=cdev_init>(&cs5535_gpio_cdev <http://www.linux-m32r.org/lxr/http/ident?i=cs5535_gpio_cdev>, &cs5535_gpio_fops <http://www.linux-m32r.org/lxr/http/ident?i=cs5535_gpio_fops>); 236 <http://www.linux-m32r.org/lxr/http/source/drivers/char/cs5535_gpio.c#L236> cdev_add <http://www.linux-m32r.org/lxr/http/ident?i=cdev_add>(&cs5535_gpio_cdev <http://www.linux-m32r.org/lxr/http/ident?i=cs5535_gpio_cdev>, dev_id <http://www.linux-m32r.org/lxr/http/ident?i=dev_id>, CS5535_GPIO_COUNT <http://www.linux-m32r.org/lxr/http/ident?i=CS5535_GPIO_COUNT>); Are there reasons to prefer one over the other ? Obviously, latter needs less memory, so I assume its the better approach, unless its otherwize insufficient. IE latter over former, unless X, Y, Z. So, what (if any) are conditions X Y Z ? -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/