Messages in this thread | | | Date | Wed, 31 Dec 2014 17:46:44 +0200 | From | Haggai Eran <> | Subject | Re: [PATCH 3/7] HMM: introduce heterogeneous memory management. |
| |
Hi,
On 22/12/2014 18:48, j.glisse@gmail.com 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
| |