From: Todd Poynor <toddpoynor@gmail.com>
To: Rob Springer <rspringer@google.com>,
John Joseph <jnjoseph@google.com>,
Ben Chan <benchan@chromium.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Dmitry Torokhov <dtor@chromium.org>,
Todd Poynor <toddpoynor@google.com>
Subject: [PATCH 01/13] staging: gasket: core: hold reference to pci_dev while used
Date: Sun, 29 Jul 2018 12:36:34 -0700 [thread overview]
Message-ID: <20180729193646.201721-2-toddpoynor@gmail.com> (raw)
In-Reply-To: <20180729193646.201721-1-toddpoynor@gmail.com>
From: Todd Poynor <toddpoynor@google.com>
Hold a reference on the struct pci_dev while a pointer to it is held in
the gasket data structures.
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 2b484d067c38a..b832a4f529f27 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -488,6 +488,7 @@ static void gasket_free_dev(struct gasket_dev *gasket_dev)
internal_desc->devs[gasket_dev->dev_idx] = NULL;
mutex_unlock(&internal_desc->mutex);
put_device(gasket_dev->dev);
+ pci_dev_put(gasket_dev->pci_dev);
kfree(gasket_dev);
}
@@ -565,6 +566,7 @@ static int gasket_pci_probe(
ret = gasket_alloc_dev(internal_desc, parent, &gasket_dev, kobj_name);
if (ret)
return ret;
+ gasket_dev->pci_dev = pci_dev_get(pci_dev);
if (IS_ERR_OR_NULL(gasket_dev->dev_info.device)) {
pr_err("Cannot create %s device %s [ret = %ld]\n",
driver_desc->name, gasket_dev->dev_info.name,
@@ -572,7 +574,6 @@ static int gasket_pci_probe(
ret = -ENODEV;
goto fail1;
}
- gasket_dev->pci_dev = pci_dev;
ret = gasket_setup_pci(pci_dev, gasket_dev);
if (ret)
@@ -703,7 +704,6 @@ static int gasket_setup_pci(
{
int i, mapped_bars, ret;
- gasket_dev->pci_dev = pci_dev;
ret = pci_enable_device(pci_dev);
if (ret) {
dev_err(gasket_dev->dev, "cannot enable PCI device\n");
--
2.18.0.345.g5c9ce644c3-goog
next prev parent reply other threads:[~2018-07-29 19:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-29 19:36 [PATCH 00/13] staging: gasket: fixes and cleanups Todd Poynor
2018-07-29 19:36 ` Todd Poynor [this message]
2018-07-31 6:18 ` [PATCH 01/13] staging: gasket: core: hold reference to pci_dev while used Dmitry Torokhov
2018-07-31 6:29 ` Todd Poynor
2018-07-29 19:36 ` [PATCH 02/13] staging: gasket: sysfs: hold reference to device while in use Todd Poynor
2018-07-29 19:36 ` [PATCH 03/13] staging: gasket: page table: hold references to device and pci_dev Todd Poynor
2018-07-29 19:36 ` [PATCH 04/13] staging: gasket: core: allow root access based on user namespace Todd Poynor
2018-07-30 17:56 ` Dmitry Torokhov
2018-07-30 18:02 ` Todd Poynor
2018-07-29 19:36 ` [PATCH 05/13] staging: gasket: apex: simplify comments for static functions Todd Poynor
2018-07-29 19:36 ` [PATCH 06/13] staging: gasket: core: " Todd Poynor
2018-07-29 19:36 ` [PATCH 07/13] staging: gasket: ioctl: " Todd Poynor
2018-07-29 19:36 ` [PATCH 08/13] staging: gasket: page table: " Todd Poynor
2018-07-29 19:36 ` [PATCH 09/13] staging: gasket: interrupt: " Todd Poynor
2018-07-29 19:36 ` [PATCH 10/13] staging: gasket: sysfs: " Todd Poynor
2018-07-29 19:36 ` [PATCH 11/13] staging: gasket: TODO: remove entry for static function kernel docs Todd Poynor
2018-07-29 19:36 ` [PATCH 12/13] staging: gasket: apex: remove static function forward declarations Todd Poynor
2018-07-29 19:36 ` [PATCH 13/13] staging: gasket: apex: fix function param line continuation style Todd Poynor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180729193646.201721-2-toddpoynor@gmail.com \
--to=toddpoynor@gmail.com \
--cc=benchan@chromium.org \
--cc=devel@driverdev.osuosl.org \
--cc=dtor@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=jnjoseph@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rspringer@google.com \
--cc=toddpoynor@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome