linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1 v2] staging: gasket: fixes and cleanups
@ 2018-07-28 19:33 Todd Poynor
  2018-07-28 19:33 ` [PATCH 1/1] staging: gasket: core: hold reference on device while in use Todd Poynor
  0 siblings, 1 reply; 2+ messages in thread
From: Todd Poynor @ 2018-07-28 19:33 UTC (permalink / raw)
  To: Rob Springer, John Joseph, Ben Chan, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Todd Poynor

From: Todd Poynor <toddpoynor@google.com>

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(-)

-- 
2.18.0.345.g5c9ce644c3-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] staging: gasket: core: hold reference on device while in use
  2018-07-28 19:33 [PATCH 0/1 v2] staging: gasket: fixes and cleanups Todd Poynor
@ 2018-07-28 19:33 ` Todd Poynor
  0 siblings, 0 replies; 2+ messages in thread
From: Todd Poynor @ 2018-07-28 19:33 UTC (permalink / raw)
  To: Rob Springer, John Joseph, Ben Chan, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Todd Poynor

From: Todd Poynor <toddpoynor@google.com>

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

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
---
 drivers/staging/gasket/gasket_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 859a6df9e12df..2b484d067c38a 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -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);
 }
 
-- 
2.18.0.345.g5c9ce644c3-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-28 19:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-28 19:33 [PATCH 0/1 v2] staging: gasket: fixes and cleanups Todd Poynor
2018-07-28 19:33 ` [PATCH 1/1] staging: gasket: core: hold reference on device while in use Todd Poynor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).