Such a pointer can be stored in the drvdata
field (which has been cleverly hidden so that you will not see it if you look at the definition of struct device
).
Initialize it through the fourth parameter of device_create
, and read it with dev_get_drvdata
:
mydev = device_create(myclass, NULL, dev, &mymod, "mydev");
...
struct mymodule *mymodp = dev_get_drvdata(dev);