Skip to contentSkip to conversation

drivers: i2c: silence a compile warning in i2c-s3c2410.c

PATCH New Pankaj Dubey 3 participants 4 messages Jan 10, 2014 – Jan 16, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: i2c: silence a compile warning in i2c-s3c2410.c

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

---
 drivers/i2c/busses/i2c-s3c2410.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-s3c2410.c +4 -3
index bf8fb94..447dd98 100644
@@ -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;
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 drivers: i2c: silence a compile warning in i2c-s3c2410.c

Quoted 7 lines · Pankaj Dubey

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.

Quoted 14 lines
CC Kukjin Kim <[email protected]>
CC Wolfram Sang <[email protected]>
CC linux-i2c at vger.kernel.org
---
 drivers/i2c/busses/i2c-s3c2410.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-s3c2410.c +0 -0
index bf8fb94..447dd98 100644

drivers/i2c/busses/i2c-s3c2410.c enum s3c24xx_i2c_state { · line 104

Quoted 5 lines
drivers/i2c/busses/i2c-s3c2410.c +1 -1
@@ -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.

drivers/i2c/busses/i2c-s3c2410.c MODULE_DEVICE_TABLE(of, s3c24xx_i2c_match); · line 164

Quoted 10 lines
drivers/i2c/busses/i2c-s3c2410.c +2 -1
 	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.

drivers/i2c/busses/i2c-s3c2410.c MODULE_DEVICE_TABLE(of, s3c24xx_i2c_match); · line 172

Quoted 9 lines
drivers/i2c/busses/i2c-s3c2410.c +1 -1
 {
 	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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140114/e480c926/attachment-0001.sig>

#2 lore raw

PATCH v2 1/1 drivers: i2c: silence a compile warning in i2c-s3c2410.c

From: Pankaj Dubey <[email protected]>

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 <[email protected]>
CC Wolfram Sang <wsa-z923LK4zBo2bacvFa/[email protected]>

---

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(-)
drivers/i2c/busses/i2c-s3c2410.c +3 -3
index bf8fb94..168de17 100644
@@ -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;
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH v2 1/1 drivers: i2c: silence a compile warning in i2c-s3c2410.c

On Wed, Jan 15, 2014 at 10:42:42AM +0900, y at 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!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140116/fc1231d3/attachment-0001.sig>