This is the format for alloc_chrdev_region:
int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count, const char *name)
It will store the Major/Minor number information at the address specified by dev. This ought to be a static variable, as it will be used again to unregister.
baseminor is the starting minor number (probably 0).
count is the number of potential character devices (minor numbers will be baseminor through count - 1)
name is the name of the driver that will appear in /proc/devices (not /dev/devices)
NOTE: You should make sure the return value is 0 before moving on in the driver and exit if it isn't.
To unregister, use unregister_chrdev_region:
void unregister_chrdev_region(dev_t from, unsigned count)
from should be the value stored by alloc_chrdev_region (the actual value this time, not a pointer).
count is the same count from alloc_chrdev_region.
NOTE: Regardless of what you specify for count, using:
cat /proc/devices | grep $dev_name
should always return one line (as long $dev_name isn't a substring of some other device's name).