All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: rockchip: Remove redundant "valid device" check
@ 2017-12-15 20:29 Bjorn Helgaas
  2018-09-17 14:47   ` Lorenzo Pieralisi
  0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2017-12-15 20:29 UTC (permalink / raw)
  To: Lorenzo Pieralisi; +Cc: linux-pci, Shawn Lin, linux-rockchip

From: Bjorn Helgaas <bhelgaas@google.com>

In rockchip_pcie_valid_device(), we do the exact same test twice:

  if (bus->number == rockchip->root_bus_nr && dev > 0)
    return 0;
  if (bus->number == rockchip->root_bus_nr && dev > 0)
    return 0;

We only need to do it once, so remove one of them.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pcie-rockchip.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index 9051c6c8fea4..dd9c7ea69e0b 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -293,10 +293,6 @@ static void rockchip_pcie_update_txcredit_mui(struct rockchip_pcie *rockchip)
 static int rockchip_pcie_valid_device(struct rockchip_pcie *rockchip,
 				      struct pci_bus *bus, int dev)
 {
-	/* access only one slot on each root port */
-	if (bus->number == rockchip->root_bus_nr && dev > 0)
-		return 0;
-
 	/*
 	 * do not read more than one device on the bus directly attached
 	 * to RC's downstream side.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] PCI: rockchip: Remove redundant "valid device" check
@ 2018-09-17 14:47   ` Lorenzo Pieralisi
  0 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2018-09-17 14:47 UTC (permalink / raw)
  To: Bjorn Helgaas, Shawn Lin; +Cc: linux-pci, linux-rockchip

On Fri, Dec 15, 2017 at 02:29:35PM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> In rockchip_pcie_valid_device(), we do the exact same test twice:
> 
>   if (bus->number == rockchip->root_bus_nr && dev > 0)
>     return 0;
>   if (bus->number == rockchip->root_bus_nr && dev > 0)
>     return 0;
> 
> We only need to do it once, so remove one of them.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/pci/host/pcie-rockchip.c |    4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
> index 9051c6c8fea4..dd9c7ea69e0b 100644
> --- a/drivers/pci/host/pcie-rockchip.c
> +++ b/drivers/pci/host/pcie-rockchip.c
> @@ -293,10 +293,6 @@ static void rockchip_pcie_update_txcredit_mui(struct rockchip_pcie *rockchip)
>  static int rockchip_pcie_valid_device(struct rockchip_pcie *rockchip,
>  				      struct pci_bus *bus, int dev)
>  {
> -	/* access only one slot on each root port */
> -	if (bus->number == rockchip->root_bus_nr && dev > 0)
> -		return 0;
> -
>  	/*
>  	 * do not read more than one device on the bus directly attached
>  	 * to RC's downstream side.
> 

Hi Bjorn,

this patch slipped through the cracks but I do not think it is right.

The point here is filtering both the host bridge access side (ie check
for dev > 0) AND the RC downstream side, it is two different busses.

Perhaps the check can be written in a more concise way (squash them in
one single conditional) but I think the current logic is correct,
AFAICS.

I would drop it from the PCI patch queue.

Thanks,
Lorenzo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PCI: rockchip: Remove redundant "valid device" check
@ 2018-09-17 14:47   ` Lorenzo Pieralisi
  0 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2018-09-17 14:47 UTC (permalink / raw)
  To: Bjorn Helgaas, Shawn Lin
  Cc: linux-pci-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Fri, Dec 15, 2017 at 02:29:35PM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> 
> In rockchip_pcie_valid_device(), we do the exact same test twice:
> 
>   if (bus->number == rockchip->root_bus_nr && dev > 0)
>     return 0;
>   if (bus->number == rockchip->root_bus_nr && dev > 0)
>     return 0;
> 
> We only need to do it once, so remove one of them.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/pci/host/pcie-rockchip.c |    4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
> index 9051c6c8fea4..dd9c7ea69e0b 100644
> --- a/drivers/pci/host/pcie-rockchip.c
> +++ b/drivers/pci/host/pcie-rockchip.c
> @@ -293,10 +293,6 @@ static void rockchip_pcie_update_txcredit_mui(struct rockchip_pcie *rockchip)
>  static int rockchip_pcie_valid_device(struct rockchip_pcie *rockchip,
>  				      struct pci_bus *bus, int dev)
>  {
> -	/* access only one slot on each root port */
> -	if (bus->number == rockchip->root_bus_nr && dev > 0)
> -		return 0;
> -
>  	/*
>  	 * do not read more than one device on the bus directly attached
>  	 * to RC's downstream side.
> 

Hi Bjorn,

this patch slipped through the cracks but I do not think it is right.

The point here is filtering both the host bridge access side (ie check
for dev > 0) AND the RC downstream side, it is two different busses.

Perhaps the check can be written in a more concise way (squash them in
one single conditional) but I think the current logic is correct,
AFAICS.

I would drop it from the PCI patch queue.

Thanks,
Lorenzo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PCI: rockchip: Remove redundant "valid device" check
@ 2018-09-17 17:12     ` Bjorn Helgaas
  0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2018-09-17 17:12 UTC (permalink / raw)
  To: Lorenzo Pieralisi; +Cc: Bjorn Helgaas, Shawn Lin, linux-pci, linux-rockchip

On Mon, Sep 17, 2018 at 9:47 AM Lorenzo Pieralisi
<lorenzo.pieralisi@arm.com> wrote:
>
> On Fri, Dec 15, 2017 at 02:29:35PM -0600, Bjorn Helgaas wrote:
> > From: Bjorn Helgaas <bhelgaas@google.com>
> >
> > In rockchip_pcie_valid_device(), we do the exact same test twice:
> >
> >   if (bus->number == rockchip->root_bus_nr && dev > 0)
> >     return 0;
> >   if (bus->number == rockchip->root_bus_nr && dev > 0)
> >     return 0;
> >
> > We only need to do it once, so remove one of them.
> >
> > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> > ---
> >  drivers/pci/host/pcie-rockchip.c |    4 ----
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
> > index 9051c6c8fea4..dd9c7ea69e0b 100644
> > --- a/drivers/pci/host/pcie-rockchip.c
> > +++ b/drivers/pci/host/pcie-rockchip.c
> > @@ -293,10 +293,6 @@ static void rockchip_pcie_update_txcredit_mui(struct rockchip_pcie *rockchip)
> >  static int rockchip_pcie_valid_device(struct rockchip_pcie *rockchip,
> >                                     struct pci_bus *bus, int dev)
> >  {
> > -     /* access only one slot on each root port */
> > -     if (bus->number == rockchip->root_bus_nr && dev > 0)
> > -             return 0;
> > -
> >       /*
> >        * do not read more than one device on the bus directly attached
> >        * to RC's downstream side.
> >
>
> Hi Bjorn,
>
> this patch slipped through the cracks but I do not think it is right.
>
> The point here is filtering both the host bridge access side (ie check
> for dev > 0) AND the RC downstream side, it is two different busses.
>
> Perhaps the check can be written in a more concise way (squash them in
> one single conditional) but I think the current logic is correct,
> AFAICS.
>
> I would drop it from the PCI patch queue.

Definitely should be dropped from patchwork.  I can't find a posting
that had the duplicate check in it, so I don't know what I was looking
at, but the initial commit (e77f847df54c) doesn't seem to have any
duplication there.

Bjorn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PCI: rockchip: Remove redundant "valid device" check
@ 2018-09-17 17:12     ` Bjorn Helgaas
  0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2018-09-17 17:12 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: linux-pci-u79uwXL29TY76Z2rM5mHXA, Shawn Lin, Bjorn Helgaas,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Mon, Sep 17, 2018 at 9:47 AM Lorenzo Pieralisi
<lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org> wrote:
>
> On Fri, Dec 15, 2017 at 02:29:35PM -0600, Bjorn Helgaas wrote:
> > From: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> >
> > In rockchip_pcie_valid_device(), we do the exact same test twice:
> >
> >   if (bus->number == rockchip->root_bus_nr && dev > 0)
> >     return 0;
> >   if (bus->number == rockchip->root_bus_nr && dev > 0)
> >     return 0;
> >
> > We only need to do it once, so remove one of them.
> >
> > Signed-off-by: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> > ---
> >  drivers/pci/host/pcie-rockchip.c |    4 ----
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
> > index 9051c6c8fea4..dd9c7ea69e0b 100644
> > --- a/drivers/pci/host/pcie-rockchip.c
> > +++ b/drivers/pci/host/pcie-rockchip.c
> > @@ -293,10 +293,6 @@ static void rockchip_pcie_update_txcredit_mui(struct rockchip_pcie *rockchip)
> >  static int rockchip_pcie_valid_device(struct rockchip_pcie *rockchip,
> >                                     struct pci_bus *bus, int dev)
> >  {
> > -     /* access only one slot on each root port */
> > -     if (bus->number == rockchip->root_bus_nr && dev > 0)
> > -             return 0;
> > -
> >       /*
> >        * do not read more than one device on the bus directly attached
> >        * to RC's downstream side.
> >
>
> Hi Bjorn,
>
> this patch slipped through the cracks but I do not think it is right.
>
> The point here is filtering both the host bridge access side (ie check
> for dev > 0) AND the RC downstream side, it is two different busses.
>
> Perhaps the check can be written in a more concise way (squash them in
> one single conditional) but I think the current logic is correct,
> AFAICS.
>
> I would drop it from the PCI patch queue.

Definitely should be dropped from patchwork.  I can't find a posting
that had the duplicate check in it, so I don't know what I was looking
at, but the initial commit (e77f847df54c) doesn't seem to have any
duplication there.

Bjorn

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-09-17 17:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-15 20:29 [PATCH] PCI: rockchip: Remove redundant "valid device" check Bjorn Helgaas
2018-09-17 14:47 ` Lorenzo Pieralisi
2018-09-17 14:47   ` Lorenzo Pieralisi
2018-09-17 17:12   ` Bjorn Helgaas
2018-09-17 17:12     ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.