Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1414704 > unrolled thread

[PATCH 2/3] PCI: Use device_match_always()

Started byThierry Reding <thierry.reding@gmail.com>
First post2016-06-06 09:40 +0200
Last post2016-06-10 18:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] PCI: Use device_match_always() Thierry Reding <thierry.reding@gmail.com> - 2016-06-06 09:40 +0200
    Re: [PATCH 2/3] PCI: Use device_match_always() Bjorn Helgaas <helgaas@kernel.org> - 2016-06-10 18:20 +0200
      Re: [PATCH 2/3] PCI: Use device_match_always() Thierry Reding <thierry.reding@gmail.com> - 2016-06-10 18:40 +0200

#1414704 — [PATCH 2/3] PCI: Use device_match_always()

FromThierry Reding <thierry.reding@gmail.com>
Date2016-06-06 09:40 +0200
Subject[PATCH 2/3] PCI: Use device_match_always()
Message-ID<rGXiG-1OJ-7@gated-at.bofh.it>
From: Thierry Reding <treding@nvidia.com>

There is now a common implementation for a match function that will
always match, so the PCI-specific implementation can be removed.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/pci/probe.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8e3ef720997d..3db06d8d6497 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -62,11 +62,6 @@ static struct resource *get_pci_domain_busn_res(int domain_nr)
 	return &r->res;
 }
 
-static int find_anything(struct device *dev, void *data)
-{
-	return 1;
-}
-
 /*
  * Some device drivers need know if pci is initiated.
  * Basically, we think pci is not initiated when there
@@ -77,7 +72,7 @@ int no_pci_devices(void)
 	struct device *dev;
 	int no_devices;
 
-	dev = bus_find_device(&pci_bus_type, NULL, NULL, find_anything);
+	dev = bus_find_device(&pci_bus_type, NULL, NULL, device_match_always);
 	no_devices = (dev == NULL);
 	put_device(dev);
 	return no_devices;
-- 
2.8.3

[toc] | [next] | [standalone]


#1419562

FromBjorn Helgaas <helgaas@kernel.org>
Date2016-06-10 18:20 +0200
Message-ID<rIxk5-6Qd-21@gated-at.bofh.it>
In reply to#1414704
On Mon, Jun 06, 2016 at 09:32:37AM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> There is now a common implementation for a match function that will
> always match, so the PCI-specific implementation can be removed.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

I'm sort of OK with this.  It's clearly not going to break anything.

But I would far rather figure out a way to remove no_pci_devices()
completely.  There's only one in-tree caller, and it's sort of
dubious, although the idea was added by Linus (2bff5e94f1bf).

I suppose nowadays we would use ACPI or DMI to do this.  But I guess
this is OK as-is.  It'd be pretty hard to find a PC110 to test any
real driver changes.

I assume all three of these patches would get merged together by
somebody else.

> ---
>  drivers/pci/probe.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 8e3ef720997d..3db06d8d6497 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -62,11 +62,6 @@ static struct resource *get_pci_domain_busn_res(int domain_nr)
>  	return &r->res;
>  }
>  
> -static int find_anything(struct device *dev, void *data)
> -{
> -	return 1;
> -}
> -
>  /*
>   * Some device drivers need know if pci is initiated.
>   * Basically, we think pci is not initiated when there
> @@ -77,7 +72,7 @@ int no_pci_devices(void)
>  	struct device *dev;
>  	int no_devices;
>  
> -	dev = bus_find_device(&pci_bus_type, NULL, NULL, find_anything);
> +	dev = bus_find_device(&pci_bus_type, NULL, NULL, device_match_always);
>  	no_devices = (dev == NULL);
>  	put_device(dev);
>  	return no_devices;
> -- 
> 2.8.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1419580

FromThierry Reding <thierry.reding@gmail.com>
Date2016-06-10 18:40 +0200
Message-ID<rIxDs-6XO-39@gated-at.bofh.it>
In reply to#1419562

[Multipart message — attachments visible in raw view] — view raw

On Fri, Jun 10, 2016 at 11:13:43AM -0500, Bjorn Helgaas wrote:
> On Mon, Jun 06, 2016 at 09:32:37AM +0200, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > There is now a common implementation for a match function that will
> > always match, so the PCI-specific implementation can be removed.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> I'm sort of OK with this.  It's clearly not going to break anything.
> 
> But I would far rather figure out a way to remove no_pci_devices()
> completely.  There's only one in-tree caller, and it's sort of
> dubious, although the idea was added by Linus (2bff5e94f1bf).

This is sort of a spin-off from another series that I sent out, which
introduced a common function that was used in far more places and has
a more clearly legitimate use. While working on that other series the
duplication here occurred to me, so I thought I'd remove it while at
it, even if there are only two occurrences.

> I suppose nowadays we would use ACPI or DMI to do this.  But I guess
> this is OK as-is.  It'd be pretty hard to find a PC110 to test any
> real driver changes.
> 
> I assume all three of these patches would get merged together by
> somebody else.

I was thinking Greg could take them through the driver core tree.

Thierry

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web