EmbLogic's Blog

character_driver

local_scull_dev_ptr=container_of(pointer,container type,cdev);

anyone plz tell me the internal functioning of the this macro…

1.what i mean to say is- how the control moves…

2.we directly take the third argument as ‘cdev’…

but we know cdev resides in struct scull_dev

so we should take ‘local_scull_dev_ptr->cdev’ as a third argument…

One Response to character_driver

  1. container_of is just a API used to shifts the pointer which pointing the current structure to the structure which contains the current structure
    Here is the prototype of Container_of

    container_of(pointer variable,type of container structure,current structure type);

Leave a Reply to Vaibhav Singh Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>