Hi, On 22/12/2014 18:48, j.glisse@xxxxxxxxx wrote: > +/* hmm_device_register() - register a device with HMM. > + * > + * @device: The hmm_device struct. > + * Returns: 0 on success or -EINVAL otherwise. > + * > + * > + * Call when device driver want to register itself with HMM. Device driver can > + * only register once. It will return a reference on the device thus to release > + * a device the driver must unreference the device. I see that the code doesn't actually have a reference count on the hmm_device, but just registers and unregisters it through the hmm_device_register/hmm_device_unregister functions. Perhaps you should update the comment here to tell that. > + */ > +int hmm_device_register(struct hmm_device *device) > +{ > + /* sanity check */ > + BUG_ON(!device); > + BUG_ON(!device->name); > + BUG_ON(!device->ops); > + BUG_ON(!device->ops->release); > + > + mutex_init(&device->mutex); > + INIT_LIST_HEAD(&device->mirrors); > + > + return 0; > +} > +EXPORT_SYMBOL(hmm_device_register); Regards, Haggai -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>