diff mbox series

[v5,06/11] ssb: Simplify determination of driver name

Message ID 20210929085306.2203850-7-u.kleine-koenig@pengutronix.de (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show
Series PCI: Drop duplicated tracking of a pci_dev's bound driver | expand

Commit Message

Uwe Kleine-König Sept. 29, 2021, 8:53 a.m. UTC
For all drivers that make use of ssb_pcihost_probe() (i.e.
b43_pci_bridge_driver and b44_pci_driver) the driver name is set.
As at the time for the function is called __pci_register_driver() already
assigned drv->driver.name to hold the same value, use
dev_driver_string() with the same result.

This has the upside of not requiring the driver member of struct pci_dev
which is about to be removed and being simpler.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/ssb/pcihost_wrapper.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Michael Büsch Sept. 29, 2021, 11:13 a.m. UTC | #1
On Wed, 29 Sep 2021 10:53:01 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> For all drivers that make use of ssb_pcihost_probe() (i.e.
> b43_pci_bridge_driver and b44_pci_driver) the driver name is set.
> As at the time for the function is called __pci_register_driver() already
> assigned drv->driver.name to hold the same value, use
> dev_driver_string() with the same result.
> 
> This has the upside of not requiring the driver member of struct pci_dev
> which is about to be removed and being simpler.

>  	struct ssb_bus *ssb;
>  	int err = -ENOMEM;
> -	const char *name;
>  	u32 val;
>  
>  	ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
> @@ -78,10 +77,7 @@ static int ssb_pcihost_probe(struct pci_dev *dev,
>  	err = pci_enable_device(dev);
>  	if (err)
>  		goto err_kfree_ssb;
> -	name = dev_name(&dev->dev);
> -	if (dev->driver && dev->driver->name)
> -		name = dev->driver->name;
> -	err = pci_request_regions(dev, name);
> +	err = pci_request_regions(dev, dev_driver_string(&dev->dev));
>  	if (err)
>  		goto err_pci_disable;
>  	pci_set_master(dev);

Makes sense.

Acked-by: Michael Büsch <m@bues.ch>
diff mbox series

Patch

diff --git a/drivers/ssb/pcihost_wrapper.c b/drivers/ssb/pcihost_wrapper.c
index 410215c16920..dd70fd41c77d 100644
--- a/drivers/ssb/pcihost_wrapper.c
+++ b/drivers/ssb/pcihost_wrapper.c
@@ -69,7 +69,6 @@  static int ssb_pcihost_probe(struct pci_dev *dev,
 {
 	struct ssb_bus *ssb;
 	int err = -ENOMEM;
-	const char *name;
 	u32 val;
 
 	ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
@@ -78,10 +77,7 @@  static int ssb_pcihost_probe(struct pci_dev *dev,
 	err = pci_enable_device(dev);
 	if (err)
 		goto err_kfree_ssb;
-	name = dev_name(&dev->dev);
-	if (dev->driver && dev->driver->name)
-		name = dev->driver->name;
-	err = pci_request_regions(dev, name);
+	err = pci_request_regions(dev, dev_driver_string(&dev->dev));
 	if (err)
 		goto err_pci_disable;
 	pci_set_master(dev);