mm, hmm: use devm semantics for hmm_devmem_{add, remove}
[email protected]
maintainerPATCH 88/167 mm, hmm: use devm semantics for hmm_devmem_{add, remove}
From: Dan Williams <[email protected]>
Subject: mm, hmm: use devm semantics for hmm_devmem_{add, remove}
devm semantics arrange for resources to be torn down when device-driver-probe fails or when device-driver-release completes. Similar to devm_memremap_pages() there is no need to support an explicit remove operation when the users properly adhere to devm semantics.
Note that devm_kzalloc() automatically handles allocating node-local memory.
Link http://lkml.kernel.org/r/154275559545.76910.9186690723515469051.stgit@dwillia2-desk3.amr.corp.intel.com open here
Signed-off-by Dan Williams <[email protected]>
Reviewed-by Christoph Hellwig <[email protected]>
Reviewed-by Jérôme Glisse <[email protected]>
Cc "Jérôme Glisse" <[email protected]>
Cc Logan Gunthorpe <[email protected]>
Cc Balbir Singh <[email protected]>
Cc Michal Hocko <[email protected]>
Cc <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
include/linux/hmm.h renamed from include/linux/hmm.h~mm-hmm-use-devm-semantics-for-hmm_devmem_add-remove +1 -3
@@ -512,8 +512,7 @@ struct hmm_devmem {* enough and allocate struct page for it. * * The device driver can wrap the hmm_devmem struct inside a private device -* driver struct. The device driver must call hmm_devmem_remove() before the -* device goes away and before freeing the hmm_devmem struct memory. +* driver struct. */ struct hmm_devmem *hmm_devmem_add(const struct hmm_devmem_ops *ops, struct device *device,
@@ -521,7 +520,6 @@ struct hmm_devmem *hmm_devmem_add(conststruct hmm_devmem *hmm_devmem_add_resource (const struct hmm_devmem_ops *ops,struct device *device,struct resource *res); -void hmm_devmem_remove (struct hmm_devmem *devmem);/* * hmm_devmem_page_set_drvdata - set per-page driver data field
mm/hmm.c renamed from mm/hmm.c~mm-hmm-use-devm-semantics-for-hmm_devmem_add-remove +24 -103
218 lines not on this page · raw message
_