diff mbox series

[V2,3/6] PCI: rcar: Replace various variable types with unsigned ones for register values

Message ID 20190322023844.18574-3-marek.vasut@gmail.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series [V2,1/6] PCI: rcar: Clean up remaining macros defining bits | expand

Commit Message

Marek Vasut March 22, 2019, 2:38 a.m. UTC
From: Marek Vasut <marek.vasut+renesas@gmail.com>

Replace various variable types with u32 or unsigned int type for
variables holding register values, since the registers are 32bit.
Note that rcar_pcie_msi_irq() still uses various variable types
because both find_first_bit() and __fls() require various variable
types as an argument.

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
---
V2: - s@unsigned long@various variable types@ in the commit message
    - Replace int with unsigned int for the $shift variable
    - Replace int with unsigned int / u32 in rcar_pcie_config_access()
---
 drivers/pci/controller/pcie-rcar.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Comments

Wolfram Sang March 22, 2019, 8:22 a.m. UTC | #1
> -	int shift, ret;
> -	u32 data;
> +	int ret;
> +	u32 shift, data;

This 'shift' is u32 instead of 'unsigned int'.

Rest looks good.
Wolfram Sang March 22, 2019, 8:41 a.m. UTC | #2
> @@ -508,7 +509,7 @@ static void phy_write_reg(struct rcar_pcie *pcie,
>  				 unsigned int rate, unsigned int addr,
>  				 unsigned int lane, unsigned int data)

What about converting 'addr' and 'data' here? Other than those, I didn't
find other candidates in this driver.
Marek Vasut March 23, 2019, 1:28 a.m. UTC | #3
On 3/22/19 9:41 AM, Wolfram Sang wrote:
> 
>> @@ -508,7 +509,7 @@ static void phy_write_reg(struct rcar_pcie *pcie,
>>  				 unsigned int rate, unsigned int addr,
>>  				 unsigned int lane, unsigned int data)
> 
> What about converting 'addr' and 'data' here? Other than those, I didn't
> find other candidates in this driver.

Sure, fixed.
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
index 1408c8aa758b..66599e0c4bb4 100644
--- a/drivers/pci/controller/pcie-rcar.c
+++ b/drivers/pci/controller/pcie-rcar.c
@@ -169,7 +169,7 @@  enum {
 
 static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data)
 {
-	int shift = 8 * (where & 3);
+	unsigned int shift = 8 * (where & 3);
 	u32 val = rcar_pci_read_reg(pcie, where & ~3);
 
 	val &= ~(mask << shift);
@@ -179,7 +179,7 @@  static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data)
 
 static u32 rcar_read_conf(struct rcar_pcie *pcie, int where)
 {
-	int shift = 8 * (where & 3);
+	unsigned int shift = 8 * (where & 3);
 	u32 val = rcar_pci_read_reg(pcie, where & ~3);
 
 	return val >> shift;
@@ -190,7 +190,8 @@  static int rcar_pcie_config_access(struct rcar_pcie *pcie,
 		unsigned char access_type, struct pci_bus *bus,
 		unsigned int devfn, int where, u32 *data)
 {
-	int dev, func, reg, index;
+	unsigned int dev, func, index;
+	u32 reg;
 
 	dev = PCI_SLOT(devfn);
 	func = PCI_FUNC(devfn);
@@ -294,8 +295,8 @@  static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
 				int where, int size, u32 val)
 {
 	struct rcar_pcie *pcie = bus->sysdata;
-	int shift, ret;
-	u32 data;
+	int ret;
+	u32 shift, data;
 
 	ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_READ,
 				      bus, devfn, where, &data);
@@ -508,7 +509,7 @@  static void phy_write_reg(struct rcar_pcie *pcie,
 				 unsigned int rate, unsigned int addr,
 				 unsigned int lane, unsigned int data)
 {
-	unsigned long phyaddr;
+	u32 phyaddr;
 
 	phyaddr = WRITE_CMD |
 		((rate & 1) << RATE_POS) |
@@ -1116,7 +1117,7 @@  static int rcar_pcie_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct rcar_pcie *pcie;
-	unsigned int data;
+	u32 data;
 	int err;
 	int (*phy_init_fn)(struct rcar_pcie *);
 	struct pci_host_bridge *bridge;