On 4/9/07, anubhav rakshit <anubhavrocks@xxxxxxxxx> wrote:
On 4/9/07, pradeep singh <2500.pradeep@xxxxxxxxx> wrote: > Hi All, > > The scull code which is a sample char driver has some code snippets in > the 3rd chapter. > Under section 3.4.1 Device Registration in scull we have following > code snippet - > > static void scull_setup_cdev(struct scull_dev *dev, int index) { > int err, devno = MKDEV(scull_major, scull_minor + index); > > cdev_init(&dev->cdev, &scull_fops); > dev->cdev.owner = THIS_MODULE; > dev->cdev.ops = &scull_fops; > err = cdev_add (&dev->cdev, devno, 1); > /* Fail gracefully if need be */ > if (err) > printk(KERN_NOTICE "Error %d adding scull%d", err, index); > } > > My doubt is > though we have used cdev_init(&dev->cdev, &scull_fops) to initiaize > the fops structure for our embedded cdev, why are we again setting the > dev->cdev.ops explicity again using > dev->cdev.ops = &scull_fops; Its redundant IMHO.
Thanks for the clarification. ~psr
> > Isn't cdev_init() supposed to do the initialisation? > What am i missing here? > > Thank you > ~psr > > -- > play the game > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx > Please read the FAQ at http://kernelnewbies.org/FAQ > > -- Anubhav Rakshit
-- play the game -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ