Skip to contentSkip to conversation

staging: gasket: fixes and cleanups

PATCH New Todd Poynor 1 participant 2 messages Jul 28, 2018 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging: gasket: fixes and cleanups

From: Todd Poynor <[email protected]>

The fun continues with gasket+apex: remove dead code and unnecessary stuff, fixup apex PCI class for devices that advertise class 0 (undefined), and make sure the struct device doesn't go away on us. Most of these from review comments of previous patch series.

Changed patches in v2:
staging: gasket: core: hold reference on device kobj while in use
Renamed: staging: gasket: core: hold reference on device while in use Use device get/put functions.

Removed patches in v2 already merged from v1:
staging: gasket: sysfs: remove check for refcount already zero
staging: gasket: apex: fixup undefined PCI class
staging: gasket: sysfs: remove unnecessary NULL check on device ptr
staging: gasket: page table: remove code for "no dma_ops"

Todd Poynor (1):
staging: gasket: core: hold reference on device while in use

 drivers/staging/gasket/gasket_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.18.0.345.g5c9ce644c3-goog
#1 lore raw

PATCH v2 1/1 staging: gasket: core: hold reference on device while in use

From: Todd Poynor <[email protected]>

Hold a reference on the struct device while a pointer to that device is in use by gasket.

---
 drivers/staging/gasket/gasket_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/gasket/gasket_core.c +2 -2
index 859a6df9e12df..2b484d067c38a 100644
@@ -448,7 +448,7 @@ static int gasket_alloc_dev(
 	gasket_dev->internal_desc = internal_desc;
 	gasket_dev->dev_idx = dev_idx;
 	snprintf(gasket_dev->kobj_name, GASKET_NAME_MAX, "%s", kobj_name);
-	gasket_dev->dev = parent;
+	gasket_dev->dev = get_device(parent);
 	/* gasket_bar_data is uninitialized. */
 	gasket_dev->num_page_tables = driver_desc->num_page_tables;
 	/* max_page_table_size and *page table are uninit'ed */
@@ -487,7 +487,7 @@ static void gasket_free_dev(struct gasket_dev *gasket_dev)
 	mutex_lock(&internal_desc->mutex);
 	internal_desc->devs[gasket_dev->dev_idx] = NULL;
 	mutex_unlock(&internal_desc->mutex);
-
+	put_device(gasket_dev->dev);
 	kfree(gasket_dev);
 }
 
Signature · 1 line
2.18.0.345.g5c9ce644c3-goog