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,
Todd Poynor <toddpoynor@google.com>
Subject: [PATCH 04/16] staging: gasket: core: remove kobj_name param from gasket_alloc_dev
Date: Thu, 9 Aug 2018 20:20:59 -0700 [thread overview]
Message-ID: <20180810032111.197743-5-toddpoynor@gmail.com> (raw)
In-Reply-To: <20180810032111.197743-1-toddpoynor@gmail.com>
From: Todd Poynor <toddpoynor@google.com>
gasket_alloc_dev can retrieve the device name from the parent parameter,
a separate parameter isn't needed for this. Rename the variable to
better reflect its meaning, as the name of the parent device for which a
gasket device is being allocated.
Signed-off-by: Todd Poynor <toddpoynor@google.com>
---
drivers/staging/gasket/gasket_core.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 3fb805204d700..5f54b3615f67c 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -189,26 +189,26 @@ static int gasket_find_dev_slot(struct gasket_internal_desc *internal_desc,
* Returns 0 if successful, a negative error code otherwise.
*/
static int gasket_alloc_dev(struct gasket_internal_desc *internal_desc,
- struct device *parent, struct gasket_dev **pdev,
- const char *kobj_name)
+ struct device *parent, struct gasket_dev **pdev)
{
int dev_idx;
const struct gasket_driver_desc *driver_desc =
internal_desc->driver_desc;
struct gasket_dev *gasket_dev;
struct gasket_cdev_info *dev_info;
+ const char *parent_name = dev_name(parent);
- pr_debug("Allocating a Gasket device %s.\n", kobj_name);
+ pr_debug("Allocating a Gasket device, parent %s.\n", parent_name);
*pdev = NULL;
- dev_idx = gasket_find_dev_slot(internal_desc, kobj_name);
+ dev_idx = gasket_find_dev_slot(internal_desc, parent_name);
if (dev_idx < 0)
return dev_idx;
gasket_dev = *pdev = kzalloc(sizeof(*gasket_dev), GFP_KERNEL);
if (!gasket_dev) {
- pr_err("no memory for device %s\n", kobj_name);
+ pr_err("no memory for device, parent %s\n", parent_name);
return -ENOMEM;
}
internal_desc->devs[dev_idx] = gasket_dev;
@@ -217,7 +217,7 @@ static int gasket_alloc_dev(struct gasket_internal_desc *internal_desc,
gasket_dev->internal_desc = internal_desc;
gasket_dev->dev_idx = dev_idx;
- snprintf(gasket_dev->kobj_name, GASKET_NAME_MAX, "%s", kobj_name);
+ snprintf(gasket_dev->kobj_name, GASKET_NAME_MAX, "%s", parent_name);
gasket_dev->dev = get_device(parent);
/* gasket_bar_data is uninitialized. */
gasket_dev->num_page_tables = driver_desc->num_page_tables;
@@ -1431,13 +1431,12 @@ int gasket_pci_add_device(struct pci_dev *pci_dev,
struct gasket_dev **gasket_devp)
{
int ret;
- const char *kobj_name = dev_name(&pci_dev->dev);
struct gasket_internal_desc *internal_desc;
struct gasket_dev *gasket_dev;
const struct gasket_driver_desc *driver_desc;
struct device *parent;
- pr_debug("add PCI device %s\n", kobj_name);
+ dev_dbg(&pci_dev->dev, "add PCI gasket device\n");
mutex_lock(&g_mutex);
internal_desc = lookup_internal_desc(pci_dev);
@@ -1451,7 +1450,7 @@ int gasket_pci_add_device(struct pci_dev *pci_dev,
driver_desc = internal_desc->driver_desc;
parent = &pci_dev->dev;
- ret = gasket_alloc_dev(internal_desc, parent, &gasket_dev, kobj_name);
+ ret = gasket_alloc_dev(internal_desc, parent, &gasket_dev);
if (ret)
return ret;
gasket_dev->pci_dev = pci_dev;
--
2.18.0.597.ga71716f1ad-goog
next prev parent reply other threads:[~2018-08-10 3:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-10 3:20 [PATCH 00/16] staging: gasket: return of the son of cleanups Todd Poynor
2018-08-10 3:20 ` [PATCH 01/16] MAINTAINERS: Switch a maintainer for drivers/staging/gasket Todd Poynor
2018-08-10 3:40 ` John Joseph
2018-08-10 6:14 ` Greg Kroah-Hartman
2018-08-10 10:28 ` Todd Poynor
2018-08-10 3:20 ` [PATCH 02/16] staging: gasket: core: remove debug log that could crash Todd Poynor
[not found] ` <CALTjKEM2q=pGh+nz6O7mQerkcnZ+=B6t+viu7dwfMHjZMQRXGg@mail.gmail.com>
2018-08-10 16:57 ` Rob Springer
2018-08-10 3:20 ` [PATCH 03/16] staging: gasket: core: fix line continuation indent in gasket_alloc_dev Todd Poynor
2018-08-10 3:20 ` Todd Poynor [this message]
2018-08-10 3:21 ` [PATCH 05/16] staging: gasket: core: remove ftrace-style debug logs Todd Poynor
2018-08-10 3:21 ` [PATCH 06/16] staging: gasket: remove gasket_exit() Todd Poynor
2018-08-10 3:21 ` [PATCH 07/16] staging: gasket: page table: remove unnecessary NULL check Todd Poynor
2018-08-10 3:21 ` [PATCH 08/16] staging: gasket: page table: use dma_mapping_error for error detection Todd Poynor
2018-08-10 3:21 ` [PATCH 09/16] staging: gasket: core: switch to relaxed memory-mapped I/O Todd Poynor
2018-08-10 3:21 ` [PATCH 10/16] staging: gasket: page table: remove extraneous memory barriers Todd Poynor
2018-08-10 3:21 ` [PATCH 11/16] staging: gasket: core: factor out generic device add code from PCI code Todd Poynor
2018-08-10 3:21 ` [PATCH 12/16] staging: gasket: core: factor out generic device remove code from PCI Todd Poynor
2018-08-10 3:21 ` [PATCH 13/16] staging: gasket: core: rename lookup_internal_desc to be PCI-specific Todd Poynor
2018-08-10 3:21 ` [PATCH 14/16] staging: gasket: interrupt: refactor PCI MSIX-specific handler code Todd Poynor
2018-08-10 3:21 ` [PATCH 15/16] staging: gasket: interrupt: simplify interrupt init parameters Todd Poynor
2018-08-10 3:21 ` [PATCH 16/16] staging: gasket: interrupt: remove unimplemented interrupt types Todd Poynor
2018-08-13 6:51 ` [PATCH 00/16] staging: gasket: return of the son of cleanups Christoph Hellwig
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=20180810032111.197743-5-toddpoynor@gmail.com \
--to=toddpoynor@gmail.com \
--cc=benchan@chromium.org \
--cc=devel@driverdev.osuosl.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;
as well as URLs for NNTP newsgroup(s).