linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] drivers: i2c: silence a compile warning in i2c-s3c2410.c
@ 2014-01-10  3:03 Pankaj Dubey
  2014-01-14 19:09 ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Pankaj Dubey @ 2014-01-10  3:03 UTC (permalink / raw)
  To: linux-samsung-soc, linux-arm-kernel
  Cc: Pankaj Dubey, Kukjin Kim, Wolfram Sang, linux-i2c

If used 64 bit compiler GCC warns that:

drivers/i2c/busses/i2c-s3c2410.c: In function ‘s3c24xx_get_device_quirks’:
drivers/i2c/busses/i2c-s3c2410.c:168:10: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]

This patch fixes this by converting "unsigned int" to "unsigned long".

CC: Kukjin Kim <kgene.kim@samsung.com>
CC: Wolfram Sang <wsa@the-dreams.de>
CC: linux-i2c@vger.kernel.org
Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
---
 drivers/i2c/busses/i2c-s3c2410.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index bf8fb94..447dd98 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -101,7 +101,7 @@ enum s3c24xx_i2c_state {
 
 struct s3c24xx_i2c {
 	wait_queue_head_t	wait;
-	unsigned int            quirks;
+	unsigned long            quirks;
 	unsigned int		suspended:1;
 
 	struct i2c_msg		*msg;
@@ -160,12 +160,13 @@ MODULE_DEVICE_TABLE(of, s3c24xx_i2c_match);
  * Get controller type either from device tree or platform device variant.
 */
 
-static inline unsigned int s3c24xx_get_device_quirks(struct platform_device *pdev)
+static inline unsigned long
+	s3c24xx_get_device_quirks(struct platform_device *pdev)
 {
 	if (pdev->dev.of_node) {
 		const struct of_device_id *match;
 		match = of_match_node(s3c24xx_i2c_match, pdev->dev.of_node);
-		return (unsigned int)match->data;
+		return (unsigned long)match->data;
 	}
 
 	return platform_get_device_id(pdev)->driver_data;
-- 
1.7.10.4

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

* Re: [PATCH 1/1] drivers: i2c: silence a compile warning in i2c-s3c2410.c
  2014-01-10  3:03 [PATCH 1/1] drivers: i2c: silence a compile warning in i2c-s3c2410.c Pankaj Dubey
@ 2014-01-14 19:09 ` Wolfram Sang
  2014-01-15  1:42   ` [PATCH v2] " y
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2014-01-14 19:09 UTC (permalink / raw)
  To: Pankaj Dubey; +Cc: linux-samsung-soc, linux-arm-kernel, Kukjin Kim, linux-i2c

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

On Fri, Jan 10, 2014 at 12:03:45PM +0900, Pankaj Dubey wrote:
> If used 64 bit compiler GCC warns that:
> 
> drivers/i2c/busses/i2c-s3c2410.c: In function ‘s3c24xx_get_device_quirks’:
> drivers/i2c/busses/i2c-s3c2410.c:168:10: warning: cast from pointer to integer
> of different size [-Wpointer-to-int-cast]
> 
> This patch fixes this by converting "unsigned int" to "unsigned long".

Maybe switch to kernel_ulong_t? Since this is used in mod_devicetable.h
all over.

> 
> CC: Kukjin Kim <kgene.kim@samsung.com>
> CC: Wolfram Sang <wsa@the-dreams.de>
> CC: linux-i2c@vger.kernel.org
> Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
> ---
>  drivers/i2c/busses/i2c-s3c2410.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index bf8fb94..447dd98 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -101,7 +101,7 @@ enum s3c24xx_i2c_state {
>  
>  struct s3c24xx_i2c {
>  	wait_queue_head_t	wait;
> -	unsigned int            quirks;
> +	unsigned long            quirks;

The indentation is corrupted.

>  	unsigned int		suspended:1;
>  
>  	struct i2c_msg		*msg;
> @@ -160,12 +160,13 @@ MODULE_DEVICE_TABLE(of, s3c24xx_i2c_match);
>   * Get controller type either from device tree or platform device variant.
>  */
>  
> -static inline unsigned int s3c24xx_get_device_quirks(struct platform_device *pdev)
> +static inline unsigned long
> +	s3c24xx_get_device_quirks(struct platform_device *pdev)

Keep it one line please, ignoring the 80 char thing.

>  {
>  	if (pdev->dev.of_node) {
>  		const struct of_device_id *match;
>  		match = of_match_node(s3c24xx_i2c_match, pdev->dev.of_node);
> -		return (unsigned int)match->data;
> +		return (unsigned long)match->data;
>  	}
>  
>  	return platform_get_device_id(pdev)->driver_data;

The last line also returns kernel_ulong_t. No real difference, but using
it is a little more consistent.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH v2] drivers: i2c: silence a compile warning in i2c-s3c2410.c
  2014-01-14 19:09 ` Wolfram Sang
@ 2014-01-15  1:42   ` y
       [not found]     ` <1389750162-5765-1-git-send-email-y-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: y @ 2014-01-15  1:42 UTC (permalink / raw)
  To: linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Pankaj Dubey, Kukjin Kim, Wolfram Sang,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

From: Pankaj Dubey <pankaj.dubey-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

If used 64 bit compiler GCC warns that:

drivers/i2c/busses/i2c-s3c2410.c: In function ‘s3c24xx_get_device_quirks’:
drivers/i2c/busses/i2c-s3c2410.c:168:10: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]

This patch fixes this by converting "unsigned int" to "kernel_ulong_t".

CC: Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
CC: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
CC: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Pankaj Dubey <pankaj.dubey-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---

Changes since v1:
    - using "kernel_ulong_t" instead of "unsigned long" for consistency.
    - take care of formatting issues as pointed by Wolfram Sang.

 drivers/i2c/busses/i2c-s3c2410.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index bf8fb94..168de17 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -101,7 +101,7 @@ enum s3c24xx_i2c_state {
 
 struct s3c24xx_i2c {
 	wait_queue_head_t	wait;
-	unsigned int            quirks;
+	kernel_ulong_t		quirks;
 	unsigned int		suspended:1;
 
 	struct i2c_msg		*msg;
@@ -160,12 +160,12 @@ MODULE_DEVICE_TABLE(of, s3c24xx_i2c_match);
  * Get controller type either from device tree or platform device variant.
 */
 
-static inline unsigned int s3c24xx_get_device_quirks(struct platform_device *pdev)
+static inline kernel_ulong_t s3c24xx_get_device_quirks(struct platform_device *pdev)
 {
 	if (pdev->dev.of_node) {
 		const struct of_device_id *match;
 		match = of_match_node(s3c24xx_i2c_match, pdev->dev.of_node);
-		return (unsigned int)match->data;
+		return (kernel_ulong_t)match->data;
 	}
 
 	return platform_get_device_id(pdev)->driver_data;
-- 
1.7.10.4

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

* Re: [PATCH v2] drivers: i2c: silence a compile warning in i2c-s3c2410.c
       [not found]     ` <1389750162-5765-1-git-send-email-y-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2014-01-16 10:21       ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2014-01-16 10:21 UTC (permalink / raw)
  To: y
  Cc: linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Pankaj Dubey,
	Kukjin Kim, linux-i2c-u79uwXL29TY76Z2rM5mHXA

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

On Wed, Jan 15, 2014 at 10:42:42AM +0900, y@samsung.com wrote:

Note that your email address is wrong here. I also fixed the description
to "i2c: s3c2410: fix quirk usage for 64-bit" which is more apropriate.

Other than that: Applied to for-next, thanks!


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2014-01-16 10:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-10  3:03 [PATCH 1/1] drivers: i2c: silence a compile warning in i2c-s3c2410.c Pankaj Dubey
2014-01-14 19:09 ` Wolfram Sang
2014-01-15  1:42   ` [PATCH v2] " y
     [not found]     ` <1389750162-5765-1-git-send-email-y-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-01-16 10:21       ` Wolfram Sang

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).