Skip to contentSkip to conversation

mm, hmm: use devm semantics for hmm_devmem_{add, remove}

PATCH New [email protected] 1 participant 1 message Dec 28, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 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.

---

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(const
 struct 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

_