Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1718361 > unrolled thread

[PATCH] phy: ralink: fix 64-bit build warning

Started byArnd Bergmann <arnd@arndb.de>
First post2017-08-23 15:50 +0200
Last post2017-08-24 10:00 +0200
Articles 7 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] phy: ralink: fix 64-bit build warning Arnd Bergmann <arnd@arndb.de> - 2017-08-23 15:50 +0200
    Re: [PATCH] phy: ralink: fix 64-bit build warning John Crispin <john@phrozen.org> - 2017-08-23 16:00 +0200
    Re: [PATCH] phy: ralink: fix 64-bit build warning Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-23 16:00 +0200
    Re: [PATCH] phy: ralink: fix 64-bit build warning Harvey Hunt <Harvey.Hunt@imgtec.com> - 2017-08-23 16:00 +0200
    Re: [PATCH] phy: ralink: fix 64-bit build warning Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-23 16:30 +0200
      Re: [PATCH] phy: ralink: fix 64-bit build warning Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-24 01:40 +0200
        Re: [PATCH] phy: ralink: fix 64-bit build warning Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-24 10:00 +0200

#1718361 — [PATCH] phy: ralink: fix 64-bit build warning

FromArnd Bergmann <arnd@arndb.de>
Date2017-08-23 15:50 +0200
Subject[PATCH] phy: ralink: fix 64-bit build warning
Message-ID<uhEcG-1bd-11@gated-at.bofh.it>
Casting between an 'int' and a pointer causes a warning on
64-bit architectures in compile-testing this driver:

drivers/phy/ralink/phy-ralink-usb.c: In function 'ralink_usb_phy_probe':
drivers/phy/ralink/phy-ralink-usb.c:195:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]

This changes the code to cast to uintptr_t instead. This is
guaranteed to do what we want on all architectures and avoids
the warning.

Fixes: 2411a736ff09 ("phy: ralink-usb: add driver for Mediatek/Ralink")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/phy/ralink/phy-ralink-usb.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/phy/ralink/phy-ralink-usb.c b/drivers/phy/ralink/phy-ralink-usb.c
index d19088c0ce5c..4fea31f8ac1c 100644
--- a/drivers/phy/ralink/phy-ralink-usb.c
+++ b/drivers/phy/ralink/phy-ralink-usb.c
@@ -160,18 +160,18 @@ static struct phy_ops ralink_usb_phy_ops = {
 static const struct of_device_id ralink_usb_phy_of_match[] = {
 	{
 		.compatible = "ralink,rt3352-usbphy",
-		.data = (void *) (RT_CLKCFG1_UPHY1_CLK_EN |
-				  RT_CLKCFG1_UPHY0_CLK_EN)
+		.data = (void *)(uintptr_t)(RT_CLKCFG1_UPHY1_CLK_EN |
+					    RT_CLKCFG1_UPHY0_CLK_EN)
 	},
 	{
 		.compatible = "mediatek,mt7620-usbphy",
-		.data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN |
-				  MT7620_CLKCFG1_UPHY0_CLK_EN)
+		.data = (void *)(uintptr_t)(MT7620_CLKCFG1_UPHY1_CLK_EN |
+					    MT7620_CLKCFG1_UPHY0_CLK_EN)
 	},
 	{
 		.compatible = "mediatek,mt7628-usbphy",
-		.data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN |
-				  MT7620_CLKCFG1_UPHY0_CLK_EN) },
+		.data = (void *)(uintptr_t)(MT7620_CLKCFG1_UPHY1_CLK_EN |
+					    MT7620_CLKCFG1_UPHY0_CLK_EN) },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, ralink_usb_phy_of_match);
@@ -192,7 +192,7 @@ static int ralink_usb_phy_probe(struct platform_device *pdev)
 	if (!phy)
 		return -ENOMEM;
 
-	phy->clk = (u32) match->data;
+	phy->clk = (uintptr_t)match->data;
 	phy->base = NULL;
 
 	phy->sysctl = syscon_regmap_lookup_by_phandle(dev->of_node, "ralink,sysctl");
-- 
2.9.0

[toc] | [next] | [standalone]


#1718380

FromJohn Crispin <john@phrozen.org>
Date2017-08-23 16:00 +0200
Message-ID<uhEmm-1ex-27@gated-at.bofh.it>
In reply to#1718361

On 23/08/17 15:39, Arnd Bergmann wrote:
> Casting between an 'int' and a pointer causes a warning on
> 64-bit architectures in compile-testing this driver:
>
> drivers/phy/ralink/phy-ralink-usb.c: In function 'ralink_usb_phy_probe':
> drivers/phy/ralink/phy-ralink-usb.c:195:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>
> This changes the code to cast to uintptr_t instead. This is
> guaranteed to do what we want on all architectures and avoids
> the warning.
>
> Fixes: 2411a736ff09 ("phy: ralink-usb: add driver for Mediatek/Ralink")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: John Crispin <john@phrozen.org>

gregkh: can you fold this into the commit sitting inside usb-next ?



> ---
>   drivers/phy/ralink/phy-ralink-usb.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/phy/ralink/phy-ralink-usb.c b/drivers/phy/ralink/phy-ralink-usb.c
> index d19088c0ce5c..4fea31f8ac1c 100644
> --- a/drivers/phy/ralink/phy-ralink-usb.c
> +++ b/drivers/phy/ralink/phy-ralink-usb.c
> @@ -160,18 +160,18 @@ static struct phy_ops ralink_usb_phy_ops = {
>   static const struct of_device_id ralink_usb_phy_of_match[] = {
>   	{
>   		.compatible = "ralink,rt3352-usbphy",
> -		.data = (void *) (RT_CLKCFG1_UPHY1_CLK_EN |
> -				  RT_CLKCFG1_UPHY0_CLK_EN)
> +		.data = (void *)(uintptr_t)(RT_CLKCFG1_UPHY1_CLK_EN |
> +					    RT_CLKCFG1_UPHY0_CLK_EN)
>   	},
>   	{
>   		.compatible = "mediatek,mt7620-usbphy",
> -		.data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN |
> -				  MT7620_CLKCFG1_UPHY0_CLK_EN)
> +		.data = (void *)(uintptr_t)(MT7620_CLKCFG1_UPHY1_CLK_EN |
> +					    MT7620_CLKCFG1_UPHY0_CLK_EN)
>   	},
>   	{
>   		.compatible = "mediatek,mt7628-usbphy",
> -		.data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN |
> -				  MT7620_CLKCFG1_UPHY0_CLK_EN) },
> +		.data = (void *)(uintptr_t)(MT7620_CLKCFG1_UPHY1_CLK_EN |
> +					    MT7620_CLKCFG1_UPHY0_CLK_EN) },
>   	{ },
>   };
>   MODULE_DEVICE_TABLE(of, ralink_usb_phy_of_match);
> @@ -192,7 +192,7 @@ static int ralink_usb_phy_probe(struct platform_device *pdev)
>   	if (!phy)
>   		return -ENOMEM;
>   
> -	phy->clk = (u32) match->data;
> +	phy->clk = (uintptr_t)match->data;
>   	phy->base = NULL;
>   
>   	phy->sysctl = syscon_regmap_lookup_by_phandle(dev->of_node, "ralink,sysctl");

[toc] | [prev] | [next] | [standalone]


#1718381

FromKishon Vijay Abraham I <kishon@ti.com>
Date2017-08-23 16:00 +0200
Message-ID<uhEmm-1ex-29@gated-at.bofh.it>
In reply to#1718361

On Wednesday 23 August 2017 07:09 PM, Arnd Bergmann wrote:
> Casting between an 'int' and a pointer causes a warning on
> 64-bit architectures in compile-testing this driver:
> 
> drivers/phy/ralink/phy-ralink-usb.c: In function 'ralink_usb_phy_probe':
> drivers/phy/ralink/phy-ralink-usb.c:195:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> 
> This changes the code to cast to uintptr_t instead. This is
> guaranteed to do what we want on all architectures and avoids
> the warning.
> 
> Fixes: 2411a736ff09 ("phy: ralink-usb: add driver for Mediatek/Ralink")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/phy/ralink/phy-ralink-usb.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/phy/ralink/phy-ralink-usb.c b/drivers/phy/ralink/phy-ralink-usb.c
> index d19088c0ce5c..4fea31f8ac1c 100644
> --- a/drivers/phy/ralink/phy-ralink-usb.c
> +++ b/drivers/phy/ralink/phy-ralink-usb.c
> @@ -160,18 +160,18 @@ static struct phy_ops ralink_usb_phy_ops = {
>  static const struct of_device_id ralink_usb_phy_of_match[] = {
>  	{
>  		.compatible = "ralink,rt3352-usbphy",
> -		.data = (void *) (RT_CLKCFG1_UPHY1_CLK_EN |
> -				  RT_CLKCFG1_UPHY0_CLK_EN)
> +		.data = (void *)(uintptr_t)(RT_CLKCFG1_UPHY1_CLK_EN |
> +					    RT_CLKCFG1_UPHY0_CLK_EN)
>  	},
>  	{
>  		.compatible = "mediatek,mt7620-usbphy",
> -		.data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN |
> -				  MT7620_CLKCFG1_UPHY0_CLK_EN)
> +		.data = (void *)(uintptr_t)(MT7620_CLKCFG1_UPHY1_CLK_EN |
> +					    MT7620_CLKCFG1_UPHY0_CLK_EN)
>  	},
>  	{
>  		.compatible = "mediatek,mt7628-usbphy",
> -		.data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN |
> -				  MT7620_CLKCFG1_UPHY0_CLK_EN) },
> +		.data = (void *)(uintptr_t)(MT7620_CLKCFG1_UPHY1_CLK_EN |
> +					    MT7620_CLKCFG1_UPHY0_CLK_EN) },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, ralink_usb_phy_of_match);
> @@ -192,7 +192,7 @@ static int ralink_usb_phy_probe(struct platform_device *pdev)
>  	if (!phy)
>  		return -ENOMEM;
>  
> -	phy->clk = (u32) match->data;
> +	phy->clk = (uintptr_t)match->data;
>  	phy->base = NULL;
>  
>  	phy->sysctl = syscon_regmap_lookup_by_phandle(dev->of_node, "ralink,sysctl");
> 

[toc] | [prev] | [next] | [standalone]


#1718382

FromHarvey Hunt <Harvey.Hunt@imgtec.com>
Date2017-08-23 16:00 +0200
Message-ID<uhEmn-1ex-31@gated-at.bofh.it>
In reply to#1718361
Hi Arnd,

On 23/08/17 14:39, Arnd Bergmann wrote:
> Casting between an 'int' and a pointer causes a warning on
> 64-bit architectures in compile-testing this driver:
> 
> drivers/phy/ralink/phy-ralink-usb.c: In function 'ralink_usb_phy_probe':
> drivers/phy/ralink/phy-ralink-usb.c:195:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> 
> This changes the code to cast to uintptr_t instead. This is
> guaranteed to do what we want on all architectures and avoids
> the warning.
> 
> Fixes: 2411a736ff09 ("phy: ralink-usb: add driver for Mediatek/Ralink")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/phy/ralink/phy-ralink-usb.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
[...]

Thanks for fixing this - it was on my TODO list.

Tested-by Harvey Hunt <harvey.hunt@imgtec.com>
Reviewed-by Harvey Hunt <harvey.hunt@imgtec.com>

Thanks,

Harvey

[toc] | [prev] | [next] | [standalone]


#1718401

FromKishon Vijay Abraham I <kishon@ti.com>
Date2017-08-23 16:30 +0200
Message-ID<uhEPn-1DV-7@gated-at.bofh.it>
In reply to#1718361
Greg,

On Wednesday 23 August 2017 07:09 PM, Arnd Bergmann wrote:
> Casting between an 'int' and a pointer causes a warning on
> 64-bit architectures in compile-testing this driver:
> 
> drivers/phy/ralink/phy-ralink-usb.c: In function 'ralink_usb_phy_probe':
> drivers/phy/ralink/phy-ralink-usb.c:195:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> 
> This changes the code to cast to uintptr_t instead. This is
> guaranteed to do what we want on all architectures and avoids
> the warning.
> 
> Fixes: 2411a736ff09 ("phy: ralink-usb: add driver for Mediatek/Ralink")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Can you pick this patch to fix the compiler warning.

Thanks
Kishon
> ---
>  drivers/phy/ralink/phy-ralink-usb.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/phy/ralink/phy-ralink-usb.c b/drivers/phy/ralink/phy-ralink-usb.c
> index d19088c0ce5c..4fea31f8ac1c 100644
> --- a/drivers/phy/ralink/phy-ralink-usb.c
> +++ b/drivers/phy/ralink/phy-ralink-usb.c
> @@ -160,18 +160,18 @@ static struct phy_ops ralink_usb_phy_ops = {
>  static const struct of_device_id ralink_usb_phy_of_match[] = {
>  	{
>  		.compatible = "ralink,rt3352-usbphy",
> -		.data = (void *) (RT_CLKCFG1_UPHY1_CLK_EN |
> -				  RT_CLKCFG1_UPHY0_CLK_EN)
> +		.data = (void *)(uintptr_t)(RT_CLKCFG1_UPHY1_CLK_EN |
> +					    RT_CLKCFG1_UPHY0_CLK_EN)
>  	},
>  	{
>  		.compatible = "mediatek,mt7620-usbphy",
> -		.data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN |
> -				  MT7620_CLKCFG1_UPHY0_CLK_EN)
> +		.data = (void *)(uintptr_t)(MT7620_CLKCFG1_UPHY1_CLK_EN |
> +					    MT7620_CLKCFG1_UPHY0_CLK_EN)
>  	},
>  	{
>  		.compatible = "mediatek,mt7628-usbphy",
> -		.data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN |
> -				  MT7620_CLKCFG1_UPHY0_CLK_EN) },
> +		.data = (void *)(uintptr_t)(MT7620_CLKCFG1_UPHY1_CLK_EN |
> +					    MT7620_CLKCFG1_UPHY0_CLK_EN) },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, ralink_usb_phy_of_match);
> @@ -192,7 +192,7 @@ static int ralink_usb_phy_probe(struct platform_device *pdev)
>  	if (!phy)
>  		return -ENOMEM;
>  
> -	phy->clk = (u32) match->data;
> +	phy->clk = (uintptr_t)match->data;
>  	phy->base = NULL;
>  
>  	phy->sysctl = syscon_regmap_lookup_by_phandle(dev->of_node, "ralink,sysctl");
> 

[toc] | [prev] | [next] | [standalone]


#1718720

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-08-24 01:40 +0200
Message-ID<uhNpD-71X-5@gated-at.bofh.it>
In reply to#1718401
On Wed, Aug 23, 2017 at 07:50:46PM +0530, Kishon Vijay Abraham I wrote:
> Greg,
> 
> On Wednesday 23 August 2017 07:09 PM, Arnd Bergmann wrote:
> > Casting between an 'int' and a pointer causes a warning on
> > 64-bit architectures in compile-testing this driver:
> > 
> > drivers/phy/ralink/phy-ralink-usb.c: In function 'ralink_usb_phy_probe':
> > drivers/phy/ralink/phy-ralink-usb.c:195:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> > 
> > This changes the code to cast to uintptr_t instead. This is
> > guaranteed to do what we want on all architectures and avoids
> > the warning.
> > 
> > Fixes: 2411a736ff09 ("phy: ralink-usb: add driver for Mediatek/Ralink")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Can you pick this patch to fix the compiler warning.

Can you resend it to me in a format that I can apply it in?

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1718938

FromKishon Vijay Abraham I <kishon@ti.com>
Date2017-08-24 10:00 +0200
Message-ID<uhVdw-3Ah-15@gated-at.bofh.it>
In reply to#1718720
Greg,

On Thursday 24 August 2017 05:00 AM, Greg Kroah-Hartman wrote:
> On Wed, Aug 23, 2017 at 07:50:46PM +0530, Kishon Vijay Abraham I wrote:
>> Greg,
>>
>> On Wednesday 23 August 2017 07:09 PM, Arnd Bergmann wrote:
>>> Casting between an 'int' and a pointer causes a warning on
>>> 64-bit architectures in compile-testing this driver:
>>>
>>> drivers/phy/ralink/phy-ralink-usb.c: In function 'ralink_usb_phy_probe':
>>> drivers/phy/ralink/phy-ralink-usb.c:195:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>>>
>>> This changes the code to cast to uintptr_t instead. This is
>>> guaranteed to do what we want on all architectures and avoids
>>> the warning.
>>>
>>> Fixes: 2411a736ff09 ("phy: ralink-usb: add driver for Mediatek/Ralink")
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>
>> Can you pick this patch to fix the compiler warning.
> 
> Can you resend it to me in a format that I can apply it in?

sent them now.

Thanks
Kishon

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web