summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2018-07-26 20:07:28 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-27 17:09:16 +0200
commit6cefe675f12f1b53f963f6b867d40aa4237a35d9 (patch)
treee7d8892d8a78dd787d613217bbf663ffd624c1ee /drivers
parent3ceefa3ffd17daacef3e09f895f67721fb1f6b79 (diff)
staging: gasket: save struct device for a gasket device
Save the struct device pointer to a gasket device in gasket's metadata, to facilitate use of standard logging calls and in anticipation of non-PCI gasket devices in the future. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/gasket/gasket_core.c5
-rw-r--r--drivers/staging/gasket/gasket_core.h3
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 732218773c3c..e8f3b021c20d 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -450,6 +450,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_bar_data is uninitialized. */
gasket_dev->num_page_tables = driver_desc->num_page_tables;
/* max_page_table_size and *page table are uninit'ed */
@@ -925,7 +926,7 @@ static int gasket_enable_dev(
&gasket_dev->bar_data[
driver_desc->page_table_bar_index],
&driver_desc->page_table_configs[tbl_idx],
- &gasket_dev->pci_dev->dev, gasket_dev->pci_dev, true);
+ gasket_dev->dev, gasket_dev->pci_dev, true);
if (ret) {
gasket_log_error(
gasket_dev,
@@ -2028,7 +2029,7 @@ const struct gasket_driver_desc *gasket_get_driver_desc(struct gasket_dev *dev)
*/
struct device *gasket_get_device(struct gasket_dev *dev)
{
- return &dev->pci_dev->dev;
+ return dev->dev;
}
/**
diff --git a/drivers/staging/gasket/gasket_core.h b/drivers/staging/gasket/gasket_core.h
index bf4ed3769efb..8bd431ad3b58 100644
--- a/drivers/staging/gasket/gasket_core.h
+++ b/drivers/staging/gasket/gasket_core.h
@@ -263,6 +263,9 @@ struct gasket_dev {
/* Pointer to the internal driver description for this device. */
struct gasket_internal_desc *internal_desc;
+ /* Device info */
+ struct device *dev;
+
/* PCI subsystem metadata. */
struct pci_dev *pci_dev;