Linux-PCI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/2] PCI: rcar: Clean up remaining macros defining bits
@ 2019-03-09  0:56 marek.vasut
  2019-03-09  0:56 ` [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors marek.vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: marek.vasut @ 2019-03-09  0:56 UTC (permalink / raw)
  To: linux-pci
  Cc: Marek Vasut, Geert Uytterhoeven, Phil Edworthy, Simon Horman,
	Wolfram Sang, linux-renesas-soc

From: Marek Vasut <marek.vasut+renesas@gmail.com>

Replace macros using constants with BIT()s instead, no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Phil Edworthy <phil.edworthy@renesas.com>
Cc: Simon Horman <horms+renesas@verge.net.au>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-renesas-soc@vger.kernel.org
To: linux-pci@vger.kernel.org
---
 drivers/pci/controller/pcie-rcar.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
index c8febb009454..5b8736f0cd6b 100644
--- a/drivers/pci/controller/pcie-rcar.c
+++ b/drivers/pci/controller/pcie-rcar.c
@@ -46,14 +46,14 @@
 
 /* Transfer control */
 #define PCIETCTLR		0x02000
-#define  CFINIT			1
+#define  CFINIT			BIT(0)
 #define PCIETSTR		0x02004
-#define  DATA_LINK_ACTIVE	1
+#define  DATA_LINK_ACTIVE	BIT(0)
 #define PCIEERRFR		0x02020
 #define  UNSUPPORTED_REQUEST	BIT(4)
 #define PCIEMSIFR		0x02044
 #define PCIEMSIALR		0x02048
-#define  MSIFE			1
+#define  MSIFE			BIT(0)
 #define PCIEMSIAUR		0x0204c
 #define PCIEMSIIER		0x02050
 
-- 
2.20.1


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

* [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
  2019-03-09  0:56 [PATCH 1/2] PCI: rcar: Clean up remaining macros defining bits marek.vasut
@ 2019-03-09  0:56 ` marek.vasut
  2019-03-09 11:14   ` Niklas Söderlund
  2019-03-11  9:41   ` Geert Uytterhoeven
  2019-03-09 11:10 ` [PATCH 1/2] PCI: rcar: Clean up remaining macros defining bits Niklas Söderlund
  2019-03-11  9:32 ` Geert Uytterhoeven
  2 siblings, 2 replies; 13+ messages in thread
From: marek.vasut @ 2019-03-09  0:56 UTC (permalink / raw)
  To: linux-pci
  Cc: Marek Vasut, Geert Uytterhoeven, Phil Edworthy, Simon Horman,
	Wolfram Sang, linux-renesas-soc

From: Marek Vasut <marek.vasut+renesas@gmail.com>

Replace unsigned long with u32 in register accessor functions,
since they access 32bit registers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Phil Edworthy <phil.edworthy@renesas.com>
Cc: Simon Horman <horms+renesas@verge.net.au>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-renesas-soc@vger.kernel.org
To: linux-pci@vger.kernel.org
---
 drivers/pci/controller/pcie-rcar.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
index 5b8736f0cd6b..1408c8aa758b 100644
--- a/drivers/pci/controller/pcie-rcar.c
+++ b/drivers/pci/controller/pcie-rcar.c
@@ -152,14 +152,12 @@ struct rcar_pcie {
 	struct			rcar_msi msi;
 };
 
-static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
-			       unsigned long reg)
+static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)
 {
 	writel(val, pcie->base + reg);
 }
 
-static unsigned long rcar_pci_read_reg(struct rcar_pcie *pcie,
-				       unsigned long reg)
+static u32 rcar_pci_read_reg(struct rcar_pcie *pcie, u32 reg)
 {
 	return readl(pcie->base + reg);
 }
-- 
2.20.1


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

* Re: [PATCH 1/2] PCI: rcar: Clean up remaining macros defining bits
  2019-03-09  0:56 [PATCH 1/2] PCI: rcar: Clean up remaining macros defining bits marek.vasut
  2019-03-09  0:56 ` [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors marek.vasut
@ 2019-03-09 11:10 ` Niklas Söderlund
  2019-03-11  9:32 ` Geert Uytterhoeven
  2 siblings, 0 replies; 13+ messages in thread
From: Niklas Söderlund @ 2019-03-09 11:10 UTC (permalink / raw)
  To: marek.vasut
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, linux-renesas-soc

Hi Marek,

Thanks for your patch.

On 2019-03-09 01:56:12 +0100, Marek Vasut wrote:
> From: Marek Vasut <marek.vasut+renesas@gmail.com>
> 
> Replace macros using constants with BIT()s instead, no functional change.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Phil Edworthy <phil.edworthy@renesas.com>
> Cc: Simon Horman <horms+renesas@verge.net.au>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: linux-renesas-soc@vger.kernel.org
> To: linux-pci@vger.kernel.org

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/pci/controller/pcie-rcar.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
> index c8febb009454..5b8736f0cd6b 100644
> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -46,14 +46,14 @@
>  
>  /* Transfer control */
>  #define PCIETCTLR		0x02000
> -#define  CFINIT			1
> +#define  CFINIT			BIT(0)
>  #define PCIETSTR		0x02004
> -#define  DATA_LINK_ACTIVE	1
> +#define  DATA_LINK_ACTIVE	BIT(0)
>  #define PCIEERRFR		0x02020
>  #define  UNSUPPORTED_REQUEST	BIT(4)
>  #define PCIEMSIFR		0x02044
>  #define PCIEMSIALR		0x02048
> -#define  MSIFE			1
> +#define  MSIFE			BIT(0)
>  #define PCIEMSIAUR		0x0204c
>  #define PCIEMSIIER		0x02050
>  
> -- 
> 2.20.1
> 

-- 
Regards,
Niklas Söderlund

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

* Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
  2019-03-09  0:56 ` [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors marek.vasut
@ 2019-03-09 11:14   ` Niklas Söderlund
  2019-03-11  9:41   ` Geert Uytterhoeven
  1 sibling, 0 replies; 13+ messages in thread
From: Niklas Söderlund @ 2019-03-09 11:14 UTC (permalink / raw)
  To: marek.vasut
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, linux-renesas-soc

Hi Marek,

Thanks for your work.

On 2019-03-09 01:56:13 +0100, Marek Vasut wrote:
> From: Marek Vasut <marek.vasut+renesas@gmail.com>
> 
> Replace unsigned long with u32 in register accessor functions,
> since they access 32bit registers.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Phil Edworthy <phil.edworthy@renesas.com>
> Cc: Simon Horman <horms+renesas@verge.net.au>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: linux-renesas-soc@vger.kernel.org
> To: linux-pci@vger.kernel.org

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/pci/controller/pcie-rcar.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
> index 5b8736f0cd6b..1408c8aa758b 100644
> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -152,14 +152,12 @@ struct rcar_pcie {
>  	struct			rcar_msi msi;
>  };
>  
> -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
> -			       unsigned long reg)
> +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)
>  {
>  	writel(val, pcie->base + reg);
>  }
>  
> -static unsigned long rcar_pci_read_reg(struct rcar_pcie *pcie,
> -				       unsigned long reg)
> +static u32 rcar_pci_read_reg(struct rcar_pcie *pcie, u32 reg)
>  {
>  	return readl(pcie->base + reg);
>  }
> -- 
> 2.20.1
> 

-- 
Regards,
Niklas Söderlund

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

* Re: [PATCH 1/2] PCI: rcar: Clean up remaining macros defining bits
  2019-03-09  0:56 [PATCH 1/2] PCI: rcar: Clean up remaining macros defining bits marek.vasut
  2019-03-09  0:56 ` [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors marek.vasut
  2019-03-09 11:10 ` [PATCH 1/2] PCI: rcar: Clean up remaining macros defining bits Niklas Söderlund
@ 2019-03-11  9:32 ` Geert Uytterhoeven
  2 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2019-03-11  9:32 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, Linux-Renesas

On Sat, Mar 9, 2019 at 1:56 AM <marek.vasut@gmail.com> wrote:
> From: Marek Vasut <marek.vasut+renesas@gmail.com>
>
> Replace macros using constants with BIT()s instead, no functional change.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
  2019-03-09  0:56 ` [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors marek.vasut
  2019-03-09 11:14   ` Niklas Söderlund
@ 2019-03-11  9:41   ` Geert Uytterhoeven
  2019-03-16 23:59     ` Marek Vasut
  1 sibling, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2019-03-11  9:41 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, Linux-Renesas

Hi Marek,

On Sat, Mar 9, 2019 at 1:56 AM <marek.vasut@gmail.com> wrote:
> From: Marek Vasut <marek.vasut+renesas@gmail.com>
>
> Replace unsigned long with u32 in register accessor functions,
> since they access 32bit registers.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

Thanks for your patch!

Minor nit below.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

BTW, there are a few more suspicious/incorrect uses of unsigned long:
  - incorrect debug prints on arm64,
  - more unsigned long register values,
  - phys_addr_t
Care to fix these as well?

Thanks!

> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -152,14 +152,12 @@ struct rcar_pcie {
>         struct                  rcar_msi msi;
>  };
>
> -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
> -                              unsigned long reg)
> +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)

Doesn't unsigned int make more sense for reg?

>  {
>         writel(val, pcie->base + reg);
>  }
>
> -static unsigned long rcar_pci_read_reg(struct rcar_pcie *pcie,
> -                                      unsigned long reg)
> +static u32 rcar_pci_read_reg(struct rcar_pcie *pcie, u32 reg)

Likewise.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
  2019-03-11  9:41   ` Geert Uytterhoeven
@ 2019-03-16 23:59     ` Marek Vasut
  2019-03-17 10:22       ` Geert Uytterhoeven
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2019-03-16 23:59 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, Linux-Renesas

On 3/11/19 10:41 AM, Geert Uytterhoeven wrote:
> Hi Marek,
> 
> On Sat, Mar 9, 2019 at 1:56 AM <marek.vasut@gmail.com> wrote:
>> From: Marek Vasut <marek.vasut+renesas@gmail.com>
>>
>> Replace unsigned long with u32 in register accessor functions,
>> since they access 32bit registers.
>>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> 
> Thanks for your patch!
> 
> Minor nit below.
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> BTW, there are a few more suspicious/incorrect uses of unsigned long:
>   - incorrect debug prints on arm64,
>   - more unsigned long register values,
>   - phys_addr_t
> Care to fix these as well?

I'll send those shortly, as a separate series since they don't conflict
with each other.

> Thanks!
> 
>> --- a/drivers/pci/controller/pcie-rcar.c
>> +++ b/drivers/pci/controller/pcie-rcar.c
>> @@ -152,14 +152,12 @@ struct rcar_pcie {
>>         struct                  rcar_msi msi;
>>  };
>>
>> -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
>> -                              unsigned long reg)
>> +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)
> 
> Doesn't unsigned int make more sense for reg?

Isn't u32 more explicit ?

-- 
Best regards,
Marek Vasut

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

* Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
  2019-03-16 23:59     ` Marek Vasut
@ 2019-03-17 10:22       ` Geert Uytterhoeven
  2019-03-17 22:50         ` Marek Vasut
  0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2019-03-17 10:22 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, Linux-Renesas

Hi Marek,

On Sun, Mar 17, 2019 at 1:06 AM Marek Vasut <marek.vasut@gmail.com> wrote:
> On 3/11/19 10:41 AM, Geert Uytterhoeven wrote:
> > On Sat, Mar 9, 2019 at 1:56 AM <marek.vasut@gmail.com> wrote:
> >> --- a/drivers/pci/controller/pcie-rcar.c
> >> +++ b/drivers/pci/controller/pcie-rcar.c
> >> @@ -152,14 +152,12 @@ struct rcar_pcie {
> >>         struct                  rcar_msi msi;
> >>  };
> >>
> >> -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
> >> -                              unsigned long reg)
> >> +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)
> >
> > Doesn't unsigned int make more sense for reg?
>
> Isn't u32 more explicit ?

It's just an offset in the register block, with a range much smaller than u32.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
  2019-03-17 10:22       ` Geert Uytterhoeven
@ 2019-03-17 22:50         ` Marek Vasut
  2019-03-18  8:19           ` Geert Uytterhoeven
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2019-03-17 22:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, Linux-Renesas

On 3/17/19 11:22 AM, Geert Uytterhoeven wrote:
> Hi Marek,

Hi,

> On Sun, Mar 17, 2019 at 1:06 AM Marek Vasut <marek.vasut@gmail.com> wrote:
>> On 3/11/19 10:41 AM, Geert Uytterhoeven wrote:
>>> On Sat, Mar 9, 2019 at 1:56 AM <marek.vasut@gmail.com> wrote:
>>>> --- a/drivers/pci/controller/pcie-rcar.c
>>>> +++ b/drivers/pci/controller/pcie-rcar.c
>>>> @@ -152,14 +152,12 @@ struct rcar_pcie {
>>>>         struct                  rcar_msi msi;
>>>>  };
>>>>
>>>> -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
>>>> -                              unsigned long reg)
>>>> +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)
>>>
>>> Doesn't unsigned int make more sense for reg?
>>
>> Isn't u32 more explicit ?
> 
> It's just an offset in the register block, with a range much smaller than u32.

We could use u16 ? However, Bjorn's concern was that using unsigned long
for registers was not recommended ; how's unsigned int better ?

-- 
Best regards,
Marek Vasut

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

* Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
  2019-03-17 22:50         ` Marek Vasut
@ 2019-03-18  8:19           ` Geert Uytterhoeven
  2019-03-21  3:20             ` Marek Vasut
  0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2019-03-18  8:19 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, Linux-Renesas

Hi Marek,

On Mon, Mar 18, 2019 at 12:39 AM Marek Vasut <marek.vasut@gmail.com> wrote:
> On 3/17/19 11:22 AM, Geert Uytterhoeven wrote:
> > On Sun, Mar 17, 2019 at 1:06 AM Marek Vasut <marek.vasut@gmail.com> wrote:
> >> On 3/11/19 10:41 AM, Geert Uytterhoeven wrote:
> >>> On Sat, Mar 9, 2019 at 1:56 AM <marek.vasut@gmail.com> wrote:
> >>>> --- a/drivers/pci/controller/pcie-rcar.c
> >>>> +++ b/drivers/pci/controller/pcie-rcar.c
> >>>> @@ -152,14 +152,12 @@ struct rcar_pcie {
> >>>>         struct                  rcar_msi msi;
> >>>>  };
> >>>>
> >>>> -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
> >>>> -                              unsigned long reg)
> >>>> +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)
> >>>
> >>> Doesn't unsigned int make more sense for reg?
> >>
> >> Isn't u32 more explicit ?
> >
> > It's just an offset in the register block, with a range much smaller than u32.
>
> We could use u16 ?

u16 may be more expensive on some processor architectures
(MIPS comes too mind, don't know about ARM).

> However, Bjorn's concern was that using unsigned long
> for registers was not recommended ;

Wasn't that comment meant for the size of the register values?

> how's unsigned int better ?

Basic rule "If you don't care about the size, use (unsigned) int"?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
  2019-03-18  8:19           ` Geert Uytterhoeven
@ 2019-03-21  3:20             ` Marek Vasut
  2019-03-25  8:06               ` Geert Uytterhoeven
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2019-03-21  3:20 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, Linux-Renesas

On 3/18/19 9:19 AM, Geert Uytterhoeven wrote:
> Hi Marek,
> 
> On Mon, Mar 18, 2019 at 12:39 AM Marek Vasut <marek.vasut@gmail.com> wrote:
>> On 3/17/19 11:22 AM, Geert Uytterhoeven wrote:
>>> On Sun, Mar 17, 2019 at 1:06 AM Marek Vasut <marek.vasut@gmail.com> wrote:
>>>> On 3/11/19 10:41 AM, Geert Uytterhoeven wrote:
>>>>> On Sat, Mar 9, 2019 at 1:56 AM <marek.vasut@gmail.com> wrote:
>>>>>> --- a/drivers/pci/controller/pcie-rcar.c
>>>>>> +++ b/drivers/pci/controller/pcie-rcar.c
>>>>>> @@ -152,14 +152,12 @@ struct rcar_pcie {
>>>>>>         struct                  rcar_msi msi;
>>>>>>  };
>>>>>>
>>>>>> -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
>>>>>> -                              unsigned long reg)
>>>>>> +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)
>>>>>
>>>>> Doesn't unsigned int make more sense for reg?
>>>>
>>>> Isn't u32 more explicit ?
>>>
>>> It's just an offset in the register block, with a range much smaller than u32.
>>
>> We could use u16 ?
> 
> u16 may be more expensive on some processor architectures
> (MIPS comes too mind, don't know about ARM).

On armv8a, none.

>> However, Bjorn's concern was that using unsigned long
>> for registers was not recommended ;
> 
> Wasn't that comment meant for the size of the register values?
> 
>> how's unsigned int better ?
> 
> Basic rule "If you don't care about the size, use (unsigned) int"?

This only applies to the $shift variable, yes ? The rest are u32 since
those contain actual values read/written into the registers.

-- 
Best regards,
Marek Vasut

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

* Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
  2019-03-21  3:20             ` Marek Vasut
@ 2019-03-25  8:06               ` Geert Uytterhoeven
  2019-03-25 11:36                 ` Marek Vasut
  0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2019-03-25  8:06 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, Linux-Renesas

Hi Marek,

On Thu, Mar 21, 2019 at 4:20 AM Marek Vasut <marek.vasut@gmail.com> wrote:
> On 3/18/19 9:19 AM, Geert Uytterhoeven wrote:
> > On Mon, Mar 18, 2019 at 12:39 AM Marek Vasut <marek.vasut@gmail.com> wrote:
> >> On 3/17/19 11:22 AM, Geert Uytterhoeven wrote:
> >>> On Sun, Mar 17, 2019 at 1:06 AM Marek Vasut <marek.vasut@gmail.com> wrote:
> >>>> On 3/11/19 10:41 AM, Geert Uytterhoeven wrote:
> >>>>> On Sat, Mar 9, 2019 at 1:56 AM <marek.vasut@gmail.com> wrote:
> >>>>>> --- a/drivers/pci/controller/pcie-rcar.c
> >>>>>> +++ b/drivers/pci/controller/pcie-rcar.c
> >>>>>> @@ -152,14 +152,12 @@ struct rcar_pcie {
> >>>>>>         struct                  rcar_msi msi;
> >>>>>>  };
> >>>>>>
> >>>>>> -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
> >>>>>> -                              unsigned long reg)
> >>>>>> +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)
> >>>>>
> >>>>> Doesn't unsigned int make more sense for reg?
> >>>>
> >>>> Isn't u32 more explicit ?
> >>>
> >>> It's just an offset in the register block, with a range much smaller than u32.
> >>
> >> We could use u16 ?
> >
> > u16 may be more expensive on some processor architectures
> > (MIPS comes too mind, don't know about ARM).
>
> On armv8a, none.
>
> >> However, Bjorn's concern was that using unsigned long
> >> for registers was not recommended ;
> >
> > Wasn't that comment meant for the size of the register values?
> >
> >> how's unsigned int better ?
> >
> > Basic rule "If you don't care about the size, use (unsigned) int"?
>
> This only applies to the $shift variable, yes ? The rest are u32 since
> those contain actual values read/written into the registers.

There is no "shift" variable. "reg" is a register offset, not an actual register
value.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
  2019-03-25  8:06               ` Geert Uytterhoeven
@ 2019-03-25 11:36                 ` Marek Vasut
  0 siblings, 0 replies; 13+ messages in thread
From: Marek Vasut @ 2019-03-25 11:36 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, Linux-Renesas

On 3/25/19 9:06 AM, Geert Uytterhoeven wrote:
> Hi Marek,
> 
> On Thu, Mar 21, 2019 at 4:20 AM Marek Vasut <marek.vasut@gmail.com> wrote:
>> On 3/18/19 9:19 AM, Geert Uytterhoeven wrote:
>>> On Mon, Mar 18, 2019 at 12:39 AM Marek Vasut <marek.vasut@gmail.com> wrote:
>>>> On 3/17/19 11:22 AM, Geert Uytterhoeven wrote:
>>>>> On Sun, Mar 17, 2019 at 1:06 AM Marek Vasut <marek.vasut@gmail.com> wrote:
>>>>>> On 3/11/19 10:41 AM, Geert Uytterhoeven wrote:
>>>>>>> On Sat, Mar 9, 2019 at 1:56 AM <marek.vasut@gmail.com> wrote:
>>>>>>>> --- a/drivers/pci/controller/pcie-rcar.c
>>>>>>>> +++ b/drivers/pci/controller/pcie-rcar.c
>>>>>>>> @@ -152,14 +152,12 @@ struct rcar_pcie {
>>>>>>>>         struct                  rcar_msi msi;
>>>>>>>>  };
>>>>>>>>
>>>>>>>> -static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
>>>>>>>> -                              unsigned long reg)
>>>>>>>> +static void rcar_pci_write_reg(struct rcar_pcie *pcie, u32 val, u32 reg)
>>>>>>>
>>>>>>> Doesn't unsigned int make more sense for reg?
>>>>>>
>>>>>> Isn't u32 more explicit ?
>>>>>
>>>>> It's just an offset in the register block, with a range much smaller than u32.
>>>>
>>>> We could use u16 ?
>>>
>>> u16 may be more expensive on some processor architectures
>>> (MIPS comes too mind, don't know about ARM).
>>
>> On armv8a, none.
>>
>>>> However, Bjorn's concern was that using unsigned long
>>>> for registers was not recommended ;
>>>
>>> Wasn't that comment meant for the size of the register values?
>>>
>>>> how's unsigned int better ?
>>>
>>> Basic rule "If you don't care about the size, use (unsigned) int"?
>>
>> This only applies to the $shift variable, yes ? The rest are u32 since
>> those contain actual values read/written into the registers.
> 
> There is no "shift" variable. "reg" is a register offset, not an actual register
> value.

Sure

-- 
Best regards,
Marek Vasut

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

end of thread, back to index

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09  0:56 [PATCH 1/2] PCI: rcar: Clean up remaining macros defining bits marek.vasut
2019-03-09  0:56 ` [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors marek.vasut
2019-03-09 11:14   ` Niklas Söderlund
2019-03-11  9:41   ` Geert Uytterhoeven
2019-03-16 23:59     ` Marek Vasut
2019-03-17 10:22       ` Geert Uytterhoeven
2019-03-17 22:50         ` Marek Vasut
2019-03-18  8:19           ` Geert Uytterhoeven
2019-03-21  3:20             ` Marek Vasut
2019-03-25  8:06               ` Geert Uytterhoeven
2019-03-25 11:36                 ` Marek Vasut
2019-03-09 11:10 ` [PATCH 1/2] PCI: rcar: Clean up remaining macros defining bits Niklas Söderlund
2019-03-11  9:32 ` Geert Uytterhoeven

Linux-PCI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pci/0 linux-pci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pci linux-pci/ https://lore.kernel.org/linux-pci \
		linux-pci@vger.kernel.org
	public-inbox-index linux-pci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git