mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] i2c: Use correct format specifier
@ 2015-05-14 10:21 Sascha Hauer
  2015-05-14 10:21 ` [PATCH 2/4] mem: Fix memcpy_sz variable types Sascha Hauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-05-14 10:21 UTC (permalink / raw)
  To: Barebox List

'count' is of type u16, not size_t.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/i2c/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
index 7a6bde0..5d0fa06 100644
--- a/drivers/i2c/i2c.c
+++ b/drivers/i2c/i2c.c
@@ -183,7 +183,7 @@ int i2c_read_reg(struct i2c_client *client, u32 addr, u8 *buf, u16 count)
 	msg->len = i;
 
 	status = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
-	dev_dbg(&client->dev, "%s: %zu@%u --> %d\n", __func__,
+	dev_dbg(&client->dev, "%s: %u@%u --> %d\n", __func__,
 		count, addr, status);
 
 	if (status == ARRAY_SIZE(msg))
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/4] mem: Fix memcpy_sz variable types
  2015-05-14 10:21 [PATCH 1/4] i2c: Use correct format specifier Sascha Hauer
@ 2015-05-14 10:21 ` Sascha Hauer
  2015-05-14 10:21 ` [PATCH 3/4] mtd: Fix function prototype Sascha Hauer
  2015-05-14 10:21 ` [PATCH 4/4] mtd: nand: Fix format specifier Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-05-14 10:21 UTC (permalink / raw)
  To: Barebox List

- Drop usage of 'ulong', use unsigned long
- remove unnecessary intermediate casting to unsigned long
- Use proper u8/u16/u32 types. Fixes 64bit systems on which ulong is 64bit

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/fs.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 779f264..a056d83 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1564,14 +1564,11 @@ out:
 }
 EXPORT_SYMBOL(rmdir);
 
-static void memcpy_sz(void *_dst, const void *_src, ulong count, ulong rwsize)
+static void memcpy_sz(void *dst, const void *src, size_t count, int rwsize)
 {
-	ulong dst = (ulong)_dst;
-	ulong src = (ulong)_src;
-
 	/* no rwsize specification given. Do whatever memcpy likes best */
 	if (!rwsize) {
-		memcpy(_dst, _src, count);
+		memcpy(dst, src, count);
 		return;
 	}
 
@@ -1582,13 +1579,13 @@ static void memcpy_sz(void *_dst, const void *_src, ulong count, ulong rwsize)
 	while (count-- > 0) {
 		switch (rwsize) {
 		case 1:
-			*((u_char *)dst) = *((u_char *)src);
+			*((u8 *)dst) = *((u8 *)src);
 			break;
 		case 2:
-			*((ushort *)dst) = *((ushort *)src);
+			*((u16 *)dst) = *((u16 *)src);
 			break;
 		case 4:
-			*((ulong  *)dst) = *((ulong  *)src);
+			*((u32  *)dst) = *((u32  *)src);
 			break;
 		}
 		dst += rwsize;
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/4] mtd: Fix function prototype
  2015-05-14 10:21 [PATCH 1/4] i2c: Use correct format specifier Sascha Hauer
  2015-05-14 10:21 ` [PATCH 2/4] mem: Fix memcpy_sz variable types Sascha Hauer
@ 2015-05-14 10:21 ` Sascha Hauer
  2015-05-14 10:21 ` [PATCH 4/4] mtd: nand: Fix format specifier Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-05-14 10:21 UTC (permalink / raw)
  To: Barebox List

mtd_op_protect must return int instead of size_t.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 1755e76..681dc93 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -191,7 +191,7 @@ static int mtd_op_erase(struct cdev *cdev, size_t count, loff_t offset)
 	return 0;
 }
 
-static ssize_t mtd_op_protect(struct cdev *cdev, size_t count, loff_t offset, int prot)
+static int mtd_op_protect(struct cdev *cdev, size_t count, loff_t offset, int prot)
 {
 	struct mtd_info *mtd = cdev->priv;
 
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/4] mtd: nand: Fix format specifier
  2015-05-14 10:21 [PATCH 1/4] i2c: Use correct format specifier Sascha Hauer
  2015-05-14 10:21 ` [PATCH 2/4] mem: Fix memcpy_sz variable types Sascha Hauer
  2015-05-14 10:21 ` [PATCH 3/4] mtd: Fix function prototype Sascha Hauer
@ 2015-05-14 10:21 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-05-14 10:21 UTC (permalink / raw)
  To: Barebox List

'count' is of type size_t, so use %zx.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/nand-bb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
index 539c685..8e4600a 100644
--- a/drivers/mtd/nand/nand-bb.c
+++ b/drivers/mtd/nand/nand-bb.c
@@ -54,7 +54,7 @@ static ssize_t nand_bb_read(struct cdev *cdev, void *buf, size_t count,
 	size_t retlen;
 	int ret, bytes = 0, now;
 
-	debug("%s offset: 0x%08llx (raw: 0x%08llx) count: 0x%08x\n",
+	debug("%s offset: 0x%08llx (raw: 0x%08llx) count: 0x%08zx\n",
 			__func__, offset, bb->offset, count);
 
 	while (count) {
@@ -132,7 +132,7 @@ static ssize_t nand_bb_write(struct cdev *cdev, const void *buf, size_t count,
 	struct nand_bb *bb = cdev->priv;
 	int bytes = count, now, wroffs, ret;
 
-	debug("%s offset: 0x%08llx (raw: 0x%08llx) count: 0x%08x\n",
+	debug("%s offset: 0x%08llx (raw: 0x%08llx) count: 0x%08zx\n",
 			__func__, offset, bb->offset, count);
 
 	while (count) {
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2015-05-14 10:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14 10:21 [PATCH 1/4] i2c: Use correct format specifier Sascha Hauer
2015-05-14 10:21 ` [PATCH 2/4] mem: Fix memcpy_sz variable types Sascha Hauer
2015-05-14 10:21 ` [PATCH 3/4] mtd: Fix function prototype Sascha Hauer
2015-05-14 10:21 ` [PATCH 4/4] mtd: nand: Fix format specifier Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox