linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power: supply: axp20x_usb_power: fix warning on 64bit
@ 2017-01-10 17:48 Michal Suchanek
  2017-01-12  2:55 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Suchanek @ 2017-01-10 17:48 UTC (permalink / raw)
  To: Quentin Schulz, Sebastian Reichel, Chen-Yu Tsai, Lee Jones,
	linux-pm, linux-kernel
  Cc: Michal Suchanek

Casting of_device_get_match_data return value to int causes warning on 64bit
architectures.

../drivers/power/supply/axp20x_usb_power.c: In function
'axp20x_usb_power_probe':
../drivers/power/supply/axp20x_usb_power.c:297:21: warning: cast from
pointer to integer of different size [-Wpointer-to-int-cast]

Fixes: 0dcc70ca8644 ("power: supply: axp20x_usb_power: use of_device_id
    data field instead of device_is_compatible")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 drivers/power/supply/axp20x_usb_power.c | 5 +++--
 include/linux/mfd/axp20x.h              | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index 1bcb02551e02..632a33fe2d54 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -48,7 +48,7 @@ struct axp20x_usb_power {
 	struct device_node *np;
 	struct regmap *regmap;
 	struct power_supply *supply;
-	int axp20x_id;
+	enum axp20x_variants axp20x_id;
 };
 
 static irqreturn_t axp20x_usb_power_irq(int irq, void *devid)
@@ -294,7 +294,8 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 	if (!power)
 		return -ENOMEM;
 
-	power->axp20x_id = (int)of_device_get_match_data(&pdev->dev);
+	power->axp20x_id = (enum axp20x_variants)of_device_get_match_data(
+								&pdev->dev);
 
 	power->np = pdev->dev.of_node;
 	power->regmap = axp20x->regmap;
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 0aa4ef7157b8..0d9a1ff38393 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -13,7 +13,7 @@
 
 #include <linux/regmap.h>
 
-enum {
+enum axp20x_variants {
 	AXP152_ID = 0,
 	AXP202_ID,
 	AXP209_ID,
-- 
2.10.2

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

* Re: [PATCH] power: supply: axp20x_usb_power: fix warning on 64bit
  2017-01-10 17:48 [PATCH] power: supply: axp20x_usb_power: fix warning on 64bit Michal Suchanek
@ 2017-01-12  2:55 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2017-01-12  2:55 UTC (permalink / raw)
  To: Michal Suchanek
  Cc: Quentin Schulz, Chen-Yu Tsai, Lee Jones, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2055 bytes --]

Hi Michal,

On Tue, Jan 10, 2017 at 06:48:12PM +0100, Michal Suchanek wrote:
> Casting of_device_get_match_data return value to int causes warning on 64bit
> architectures.
> 
> ../drivers/power/supply/axp20x_usb_power.c: In function
> 'axp20x_usb_power_probe':
> ../drivers/power/supply/axp20x_usb_power.c:297:21: warning: cast from
> pointer to integer of different size [-Wpointer-to-int-cast]
> 
> Fixes: 0dcc70ca8644 ("power: supply: axp20x_usb_power: use of_device_id
>     data field instead of device_is_compatible")
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>  drivers/power/supply/axp20x_usb_power.c | 5 +++--
>  include/linux/mfd/axp20x.h              | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
> index 1bcb02551e02..632a33fe2d54 100644
> --- a/drivers/power/supply/axp20x_usb_power.c
> +++ b/drivers/power/supply/axp20x_usb_power.c
> @@ -48,7 +48,7 @@ struct axp20x_usb_power {
>  	struct device_node *np;
>  	struct regmap *regmap;
>  	struct power_supply *supply;
> -	int axp20x_id;
> +	enum axp20x_variants axp20x_id;
>  };
>  
>  static irqreturn_t axp20x_usb_power_irq(int irq, void *devid)
> @@ -294,7 +294,8 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
>  	if (!power)
>  		return -ENOMEM;
>  
> -	power->axp20x_id = (int)of_device_get_match_data(&pdev->dev);
> +	power->axp20x_id = (enum axp20x_variants)of_device_get_match_data(
> +								&pdev->dev);
>  
>  	power->np = pdev->dev.of_node;
>  	power->regmap = axp20x->regmap;
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index 0aa4ef7157b8..0d9a1ff38393 100644
> --- a/include/linux/mfd/axp20x.h
> +++ b/include/linux/mfd/axp20x.h
> @@ -13,7 +13,7 @@
>  
>  #include <linux/regmap.h>
>  
> -enum {
> +enum axp20x_variants {
>  	AXP152_ID = 0,
>  	AXP202_ID,
>  	AXP209_ID,

Thanks, queued into power-supply's for-next branch.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-01-12  2:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 17:48 [PATCH] power: supply: axp20x_usb_power: fix warning on 64bit Michal Suchanek
2017-01-12  2:55 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).