static int __init hello_2_init (void)
{
int result;

dev = MKDEV (hello_major, hello_minor);
result = register_chrdev_region (dev, number_of_devices, "hello");
if (result<0) {
printk (KERN_WARNING "hello: can't get major number %d\n", hello_major);
return result;
}

/* dynamic allocation */
cdev = cdev_alloc();
cdev_init (cdev, &hello_fops);
cdev->owner = THIS_MODULE;
cdev->ops = &hello_fops;
result = cdev_add (cdev, dev, 1);
if (result)
printk (KERN_INFO "Error %d adding char_device", result);


printk (KERN_INFO "Char device registered ...\n");
return 0;
}


I am new and i am trying some examples and I did not understood the usage of heiglighted code segment and how this will effect in the module and how can I see the effect of this code segment