linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	kernel@pengutronix.de,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-pci@vger.kernel.org
Subject: [PATCH v1 3/5] PCI: Provide wrapper to access a pci_dev's bound driver
Date: Thu, 29 Jul 2021 22:37:38 +0200	[thread overview]
Message-ID: <20210729203740.1377045-4-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20210729203740.1377045-1-u.kleine-koenig@pengutronix.de>

Which driver a device is bound to is available twice: In struct
pci_dev::dev->driver and in struct pci_dev::driver. To get rid of the
duplication introduce a wrapper to access struct pci_dev's driver
member. Once all users are converted the wrapper can be changed to
calculate the driver using pci_dev::dev->driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 include/linux/pci.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 540b377ca8f6..778f3b5e6f23 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -887,6 +887,7 @@ struct pci_driver {
 };
 
 #define	to_pci_driver(drv) container_of(drv, struct pci_driver, driver)
+#define pci_driver_of_dev(pdev) ((pdev)->driver)
 
 /**
  * PCI_DEVICE - macro used to describe a specific PCI device
-- 
2.30.2


  parent reply	other threads:[~2021-07-29 20:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 20:37 [PATCH v1 0/5] PCI: Drop duplicated tracking of a pci_dev's bound driver Uwe Kleine-König
2021-07-29 20:37 ` [PATCH v1 1/5] PCI: Simplify pci_device_remove() Uwe Kleine-König
2021-07-29 20:37 ` [PATCH v1 2/5] PCI: Drop useless check from pci_device_probe() Uwe Kleine-König
2021-07-29 20:37 ` Uwe Kleine-König [this message]
2021-07-29 20:37 ` [PATCH v1 4/5] PCI: Adapt all code locations to not use struct pci_dev::driver directly Uwe Kleine-König
2021-07-30 20:37   ` Boris Ostrovsky
2021-07-31 12:08     ` Uwe Kleine-König
2021-08-02 13:06       ` Boris Ostrovsky
2021-07-29 20:37 ` [PATCH v1 5/5] PCI: Drop duplicated tracking of a pci_dev's bound driver Uwe Kleine-König
2021-07-30  5:14   ` Greg Kroah-Hartman
2021-07-30  5:24     ` Uwe Kleine-König
2021-07-30  5:14 ` [PATCH v1 0/5] " Greg Kroah-Hartman
2021-07-30  8:06 ` Andy Shevchenko
2021-07-30 17:48   ` Uwe Kleine-König

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=20210729203740.1377045-4-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=bhelgaas@google.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-pci@vger.kernel.org \
    /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).