diff mbox series

[RESEND,v5,01/14] PCI: dwc: Fix erroneous version type test helper

Message ID 20230511190902.28896-2-Sergey.Semin@baikalelectronics.ru
State New
Headers show
Series PCI: dwc: Relatively simple fixes and cleanups | expand

Commit Message

Serge Semin May 11, 2023, 7:08 p.m. UTC
Due to an unfortunate mistake the macro function actually checks the
IP-core version instead of the IP-core version type which isn't what
originally implied. Fix it by introducing a new helper
__dw_pcie_ver_type_cmp() with the same semantic as the __dw_pcie_ver_cmp()
counterpart except it refers to the dw_pcie.type field in order to perform
the passed comparison operation.

Fixes: 0b0a780d52ad ("PCI: dwc: Add macros to compare Synopsys IP core versions")
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-designware.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Yoshihiro Shimoda May 12, 2023, 9:55 a.m. UTC | #1
Hi Serge,

> From: Serge Semin, Sent: Friday, May 12, 2023 4:09 AM
> 
> Due to an unfortunate mistake the macro function actually checks the
> IP-core version instead of the IP-core version type which isn't what
> originally implied. Fix it by introducing a new helper
> __dw_pcie_ver_type_cmp() with the same semantic as the __dw_pcie_ver_cmp()
> counterpart except it refers to the dw_pcie.type field in order to perform
> the passed comparison operation.
> 
> Fixes: 0b0a780d52ad ("PCI: dwc: Add macros to compare Synopsys IP core versions")
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

I'm not sure whether my review is useful or not, but anyway,

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda

> ---
>  drivers/pci/controller/dwc/pcie-designware.h | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> index 79713ce075cc..adad0ea61799 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.h
> +++ b/drivers/pci/controller/dwc/pcie-designware.h
> @@ -37,17 +37,20 @@
>  #define __dw_pcie_ver_cmp(_pci, _ver, _op) \
>  	((_pci)->version _op DW_PCIE_VER_ ## _ver)
> 
> +#define __dw_pcie_ver_type_cmp(_pci, _type, _op) \
> +	((_pci)->type _op DW_PCIE_VER_TYPE_ ## _type)
> +
>  #define dw_pcie_ver_is(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, ==)
> 
>  #define dw_pcie_ver_is_ge(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, >=)
> 
>  #define dw_pcie_ver_type_is(_pci, _ver, _type) \
>  	(__dw_pcie_ver_cmp(_pci, _ver, ==) && \
> -	 __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, ==))
> +	 __dw_pcie_ver_type_cmp(_pci, _type, ==))
> 
>  #define dw_pcie_ver_type_is_ge(_pci, _ver, _type) \
>  	(__dw_pcie_ver_cmp(_pci, _ver, ==) && \
> -	 __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, >=))
> +	 __dw_pcie_ver_type_cmp(_pci, _type, >=))
> 
>  /* DWC PCIe controller capabilities */
>  #define DW_PCIE_CAP_REQ_RES		0
> --
> 2.40.0
>
Serge Semin May 12, 2023, 10:23 a.m. UTC | #2
Hello Yoshihiro

On Fri, May 12, 2023 at 09:55:42AM +0000, Yoshihiro Shimoda wrote:
> Hi Serge,
> 
> > From: Serge Semin, Sent: Friday, May 12, 2023 4:09 AM
> > 
> > Due to an unfortunate mistake the macro function actually checks the
> > IP-core version instead of the IP-core version type which isn't what
> > originally implied. Fix it by introducing a new helper
> > __dw_pcie_ver_type_cmp() with the same semantic as the __dw_pcie_ver_cmp()
> > counterpart except it refers to the dw_pcie.type field in order to perform
> > the passed comparison operation.
> > 
> > Fixes: 0b0a780d52ad ("PCI: dwc: Add macros to compare Synopsys IP core versions")
> > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> > Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> 
> I'm not sure whether my review is useful or not, but anyway,
> 
> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

It's always useful. Thanks for looking into it.

Regards
-Serge(y)

> 
> Best regards,
> Yoshihiro Shimoda
> 
> > ---
> >  drivers/pci/controller/dwc/pcie-designware.h | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> > index 79713ce075cc..adad0ea61799 100644
> > --- a/drivers/pci/controller/dwc/pcie-designware.h
> > +++ b/drivers/pci/controller/dwc/pcie-designware.h
> > @@ -37,17 +37,20 @@
> >  #define __dw_pcie_ver_cmp(_pci, _ver, _op) \
> >  	((_pci)->version _op DW_PCIE_VER_ ## _ver)
> > 
> > +#define __dw_pcie_ver_type_cmp(_pci, _type, _op) \
> > +	((_pci)->type _op DW_PCIE_VER_TYPE_ ## _type)
> > +
> >  #define dw_pcie_ver_is(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, ==)
> > 
> >  #define dw_pcie_ver_is_ge(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, >=)
> > 
> >  #define dw_pcie_ver_type_is(_pci, _ver, _type) \
> >  	(__dw_pcie_ver_cmp(_pci, _ver, ==) && \
> > -	 __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, ==))
> > +	 __dw_pcie_ver_type_cmp(_pci, _type, ==))
> > 
> >  #define dw_pcie_ver_type_is_ge(_pci, _ver, _type) \
> >  	(__dw_pcie_ver_cmp(_pci, _ver, ==) && \
> > -	 __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, >=))
> > +	 __dw_pcie_ver_type_cmp(_pci, _type, >=))
> > 
> >  /* DWC PCIe controller capabilities */
> >  #define DW_PCIE_CAP_REQ_RES		0
> > --
> > 2.40.0
> > 
>
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index 79713ce075cc..adad0ea61799 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -37,17 +37,20 @@ 
 #define __dw_pcie_ver_cmp(_pci, _ver, _op) \
 	((_pci)->version _op DW_PCIE_VER_ ## _ver)
 
+#define __dw_pcie_ver_type_cmp(_pci, _type, _op) \
+	((_pci)->type _op DW_PCIE_VER_TYPE_ ## _type)
+
 #define dw_pcie_ver_is(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, ==)
 
 #define dw_pcie_ver_is_ge(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, >=)
 
 #define dw_pcie_ver_type_is(_pci, _ver, _type) \
 	(__dw_pcie_ver_cmp(_pci, _ver, ==) && \
-	 __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, ==))
+	 __dw_pcie_ver_type_cmp(_pci, _type, ==))
 
 #define dw_pcie_ver_type_is_ge(_pci, _ver, _type) \
 	(__dw_pcie_ver_cmp(_pci, _ver, ==) && \
-	 __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, >=))
+	 __dw_pcie_ver_type_cmp(_pci, _type, >=))
 
 /* DWC PCIe controller capabilities */
 #define DW_PCIE_CAP_REQ_RES		0