PCI: rcar: Clean up remaining macros defining bits
Subsystems (4)
PATCH 1/2 PCI: rcar: Clean up remaining macros defining bits
From: Marek Vasut <[email protected]>
Replace macros using constants with BIT()s instead, no functional change.
--- drivers/pci/controller/pcie-rcar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/controller/pcie-rcar.c +3 -3
@@ -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
Signature · 1 line
2.20.1
PATCH 2/2 PCI: rcar: Replace unsigned long with u32 in register accessors
From: Marek Vasut <[email protected]>
Replace unsigned long with u32 in register accessor functions, since they access 32bit registers.
--- drivers/pci/controller/pcie-rcar.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pci/controller/pcie-rcar.c +2 -4
@@ -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); }
Signature · 1 line
2.20.1
Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
Hi Marek,
Thanks for your work.
Quoted 5 lines · Marek Vasut
From: Marek Vasut <[email protected]>
Replace unsigned long with u32 in register accessor functions, since they access 32bit registers.
Quoted 7 lines
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>
Quoted 28 lines
--- drivers/pci/controller/pcie-rcar.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/pci/controller/pcie-rcar.c +2
-4@@ -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); }Signature · 1 line
2.20.1
Signature · 2 lines
Regards, Niklas Söderlund
Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
In reply to [email protected]Hi Marek,
Quoted 6 lines · On Sat, Mar 9, 2019 at 1:56 AM <[email protected]> wrote:
From: Marek Vasut <[email protected]>
Replace unsigned long with u32 in register accessor functions, since they access 32bit registers.
Signed-off-by Marek Vasut <[email protected]>
Thanks for your patch!
Minor nit below.
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!
drivers/pci/controller/pcie-rcar.c struct rcar_pcie { · line 155
Quoted 9 lines
drivers/pci/controller/pcie-rcar.c +1
-2@@ -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?
drivers/pci/controller/pcie-rcar.c struct rcar_pcie { · line 160
Quoted 7 lines
drivers/pci/controller/pcie-rcar.c +1
-2{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
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
Quoted 12 lines · Geert Uytterhoeven
Hi Marek,
Quoted 6 lines · On Sat, Mar 9, 2019 at 1:56 AM <[email protected]> wrote:
From: Marek Vasut <[email protected]>
Replace unsigned long with u32 in register accessor functions, since they access 32bit registers.
Signed-off-by Marek Vasut <[email protected]>Thanks for your patch!
Quoted 8 lines
Minor nit below.
Reviewed-by Geert Uytterhoeven <[email protected]>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.
Quoted 8 lines
Thanks!
Quoted 6 lines
drivers/pci/controller/pcie-rcar.c +0
-0@@ -152,14 +152,12 @@ struct rcar_pcie {struct rcar_msi msi; };
Quoted 5 lines
drivers/pci/controller/pcie-rcar.c struct rcar_pcie { · line 155
Quoted 3 lines
drivers/pci/controller/pcie-rcar.c +1
-2-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 ?
Signature · 2 lines
Best regards, Marek Vasut
Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
Hi Marek,
Quoted 8 lines · Marek Vasut
Quoted 7 lines · Geert Uytterhoeven
Quoted 6 lines · On Sat, Mar 9, 2019 at 1:56 AM <[email protected]> wrote:
drivers/pci/controller/pcie-rcar.c +0
-0@@ -152,14 +152,12 @@ struct rcar_pcie {struct rcar_msi msi; };
Quoted 7 lines
Quoted 5 lines
drivers/pci/controller/pcie-rcar.c struct rcar_pcie { · line 155
Quoted 3 lines
drivers/pci/controller/pcie-rcar.c +1
-2-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
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
Quoted 1 line · Geert Uytterhoeven
Hi Marek,
Hi,
Quoted 15 lines · Marek Vasut
Quoted 14 lines · Geert Uytterhoeven
Quoted 12 lines · On Sat, Mar 9, 2019 at 1:56 AM <[email protected]> wrote:
drivers/pci/controller/pcie-rcar.c struct rcar_pcie { · line 155
Quoted 9 lines
drivers/pci/controller/pcie-rcar.c +1
-2@@ -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?
Quoted 3 lines
Quoted 1 line
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 ?
Signature · 2 lines
Best regards, Marek Vasut
Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
Hi Marek,
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Geert Uytterhoeven
Quoted 14 lines · Marek Vasut
Quoted 12 lines · Geert Uytterhoeven
drivers/pci/controller/pcie-rcar.c struct rcar_pcie { · line 155
Quoted 9 lines · On Sat, Mar 9, 2019 at 1:56 AM <[email protected]> wrote:
drivers/pci/controller/pcie-rcar.c +1
-2@@ -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?
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
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).
Quoted 2 lines
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?
Quoted 1 line
how's unsigned int better ?
Basic rule "If you don't care about the size, use (unsigned) int"?
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
Quoted 19 lines · Geert Uytterhoeven
Hi Marek,
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Geert Uytterhoeven
Quoted 14 lines · Marek Vasut
Quoted 12 lines · Geert Uytterhoeven
drivers/pci/controller/pcie-rcar.c struct rcar_pcie { · line 155
Quoted 9 lines · On Sat, Mar 9, 2019 at 1:56 AM <[email protected]> wrote:
drivers/pci/controller/pcie-rcar.c +1
-2@@ -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?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
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.
Quoted 8 lines
Quoted 2 lines
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?
Quoted 1 line
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.
Signature · 2 lines
Best regards, Marek Vasut
Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
Hi Marek,
Quoted 32 lines · Marek Vasut
Quoted 17 lines · Geert Uytterhoeven
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Geert Uytterhoeven
Quoted 14 lines · Marek Vasut
Quoted 12 lines · Geert Uytterhoeven
drivers/pci/controller/pcie-rcar.c struct rcar_pcie { · line 155
Quoted 9 lines · On Sat, Mar 9, 2019 at 1:56 AM <[email protected]> wrote:
drivers/pci/controller/pcie-rcar.c +1
-2@@ -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?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
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.
Quoted 3 lines
Quoted 2 lines
However, Bjorn's concern was that using unsigned long for registers was not recommended ;
Quoted 8 lines
Quoted 5 lines
Wasn't that comment meant for the size of the register values?
Quoted 1 line
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
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Re: [PATCH 2/2] PCI: rcar: Replace unsigned long with u32 in register accessors
Quoted 39 lines · Geert Uytterhoeven
Hi Marek,
Quoted 36 lines · Marek Vasut
Quoted 17 lines · Geert Uytterhoeven
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Geert Uytterhoeven
Quoted 14 lines · Marek Vasut
Quoted 12 lines · Geert Uytterhoeven
drivers/pci/controller/pcie-rcar.c struct rcar_pcie { · line 155
Quoted 9 lines · On Sat, Mar 9, 2019 at 1:56 AM <[email protected]> wrote:
drivers/pci/controller/pcie-rcar.c +1
-2@@ -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?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
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.
Quoted 7 lines
Quoted 2 lines
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?
Quoted 1 line
how's unsigned int better ?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
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
Signature · 2 lines
Best regards, Marek Vasut
Hi Marek,
Thanks for your patch.
Quoted 11 lines · Marek Vasut
From: Marek Vasut <[email protected]>
Replace macros using constants with BIT()s instead, no functional change.
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Phil Edworthy <[email protected]>Cc Simon Horman <[email protected]>Cc Wolfram Sang <[email protected]>
Quoted 29 lines
--- drivers/pci/controller/pcie-rcar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/pci/controller/pcie-rcar.c +3
-3@@ -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 0x02050Signature · 1 line
2.20.1
Signature · 2 lines
Regards, Niklas Söderlund
Quoted 5 lines · On Sat, Mar 9, 2019 at 1:56 AM <[email protected]> wrote:
From: Marek Vasut <[email protected]>
Replace macros using constants with BIT()s instead, no functional change.
Signed-off-by Marek Vasut <[email protected]>
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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