FSI warning fixes
Subsystems (2)
cover FSI warning fixes
Hi Eddie and Ben,
I've fixed a bunch of printf warnings (that only occur when the kernel is being built for a 64 bit machine) and sparse warnings.
Where appropraite please fold these fixes into your work in progress code.
(This is with the work in progress 4.17 tree, which contains all of the posted fixes, plus a mega-patch that I created with all of the OCC HWMON work).
Joel Stanley (5):
fsi-occ: Fix size_t printf
hwmon (occ): Fix printf warning
fsi: sbefifo: Fix sparse warnings
fsi: master-hub: Fix sparse warnings
fsi: core: Fix sparse warnings
drivers/fsi/fsi-core.c | 23 +++++++++++++---------- drivers/fsi/fsi-master-hub.c | 5 +++-- drivers/fsi/fsi-occ.c | 2 +- drivers/fsi/fsi-sbefifo.c | 5 +++-- drivers/hwmon/occ/common.c | 2 +- 5 files changed, 21 insertions(+), 16 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/5 fsi-occ: Fix size_t printf
drivers/fsi/fsi-occ.c:414:16: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t {aka long unsigned int}' [-Wformat=]
dev_dbg(dev, "Bad resplen %d\n", *resp_len);
^ ~~--- drivers/fsi/fsi-occ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fsi/fsi-occ.c +1 -1
@@ -411,7 +411,7 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len,if (!occ)return -ENODEV ;if (*resp_len <7 ) { -dev_dbg (dev,"Bad resplen %d\n" , *resp_len); +dev_dbg (dev,"Bad resplen %zd\n" , *resp_len);return -EINVAL ; }
Signature · 1 line
2.17.1
Re: [PATCH 1/5] fsi-occ: Fix size_t printf
Quoted 5 lines · Joel Stanley
drivers/fsi/fsi-occ.c:414:16: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t{aka long unsigned int}' [-Wformat=]dev_dbg(dev, "Bad resplen %d\n", *resp_len); ^ ~~
Thanks, I've already pushed an equivalent fix in my branch, I'll let Eddie pick it up for the next upstream submission.
Quoted 18 lines
Signed-off-by Joel Stanley <[email protected]>--- drivers/fsi/fsi-occ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/fsi/fsi-occ.c +1
-1@@ -411,7 +411,7 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len,if (!occ)return -ENODEV ;if (*resp_len <7 ) { -dev_dbg (dev,"Bad resplen %d\n" , *resp_len); +dev_dbg (dev,"Bad resplen %zd\n" , *resp_len);return -EINVAL ; }
PATCH 2/5 hwmon (occ): Fix printf warning
In reply to Joel Stanley drivers/hwmon/occ/common.c:1351:24: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
dev_dbg(occ->bus_dev, "Max resp size: %d+%d=%d\n",
drivers/hwmon/occ/common.c:1351:24: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]
dev_dbg(occ->bus_dev, "Max resp size: %u+%zd=%d\n",
--- drivers/hwmon/occ/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/occ/common.c +1 -1
@@ -1348,7 +1348,7 @@ static void occ_parse_poll_response(struct occ *occ) sensor->version = block->header.sensor_format; sensor->data = &block->data; } -dev_dbg (occ->bus_dev,"Max resp size: %d+%d=%d\n" , +dev_dbg (occ->bus_dev,"Max resp size: %u+%zd=%zd\n" , size,sizeof (*header), size +sizeof (*header)); }
Signature · 1 line
2.17.1
PATCH 3/5 fsi: sbefifo: Fix sparse warnings
In reply to Joel Stanleyfsi-sbefifo.c:547:58: warning: incorrect type in argument 2 (different base types)
fsi-sbefifo.c:547:58: expected restricted __be32 [usertype] *word
fsi-sbefifo.c:547:58: got unsigned int *<noident>
fsi-sbefifo.c:635:16: warning: incorrect type in assignment (different base types)
fsi-sbefifo.c:635:16: expected unsigned int [unsigned] <noident>
fsi-sbefifo.c:635:16: got restricted __be32 [usertype] <noident>
fsi-sbefifo.c:636:16: warning: incorrect type in assignment (different base types)
fsi-sbefifo.c:636:16: expected unsigned int [unsigned] <noident>
fsi-sbefifo.c:636:16: got restricted __be32 [usertype] <noident>
--- drivers/fsi/fsi-sbefifo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/fsi/fsi-sbefifo.c +3 -2
@@ -519,9 +519,10 @@ static int sbefifo_send_command(struct sbefifo *sbefifo,static int sbefifo_read_response (struct sbefifo *sbefifo,struct iov_iter *response) {struct device *dev = &sbefifo->fsi_dev->dev; -u32 data, status, eot_set; +u32 status, eot_set;unsigned long timeout;bool overflow = false; +__be32 data;size_t len;int rc;
@@ -619,7 +620,7 @@ static void sbefifo_collect_async_ffdc(struct sbefifo *sbefifo)struct kvec ffdc_iov;__be32 *ffdc;size_t ffdc_sz; -u32 cmd[2 ]; +__be32 cmd[2 ];int rc; sbefifo->async_ffdc = false;
Signature · 1 line
2.17.1
PATCH 4/5 fsi: master-hub: Fix sparse warnings
In reply to Joel Stanleyfsi-master-hub.c:128:13: warning: incorrect type in assignment (different base types)
fsi-master-hub.c:128:13: expected unsigned int [unsigned] [usertype] cmd
fsi-master-hub.c:128:13: got restricted __be32 [usertype] <noident>
fsi-master-hub.c:208:13: warning: incorrect type in assignment (different base types)
fsi-master-hub.c:208:13: expected restricted __be32 [addressable] [assigned] [usertype] reg
fsi-master-hub.c:208:13: got int
--- drivers/fsi/fsi-master-hub.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/fsi/fsi-master-hub.c +3 -2
@@ -122,7 +122,8 @@ static int hub_master_write(struct fsi_master *master, int link,static int hub_master_break (struct fsi_master *master,int link) { -uint32_t addr, cmd; +uint32_t addr; +__be32 cmd; addr =0x4 ; cmd =cpu_to_be32 (0xc0de0000 );
@@ -205,7 +206,7 @@ static int hub_master_init(struct fsi_master_hub *hub)if (rc)return rc; - reg = ~0 ; + reg =cpu_to_be32 (~0 ); rc =fsi_device_write (dev,FSI_MSENP0 , ®,sizeof (reg));if (rc)return rc;
Signature · 1 line
2.17.1
PATCH 5/5 fsi: core: Fix sparse warnings
In reply to Joel Stanleyfsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:210:9: warning: cast to restricted __be32 fsi-core.c:606:15: warning: incorrect type in assignment (different base types)
fsi-core.c:606:15: expected unsigned int [unsigned] [assigned] [usertype] smode
fsi-core.c:606:15: got restricted __be32 [usertype] <noident>
fsi-core.c:492:28: warning: expression using sizeof(void) fsi-core.c:520:29: warning: expression using sizeof(void) fsi-core.c:682:19: warning: cast to restricted __be32 fsi-core.c:682:19: warning: cast to restricted __be32 fsi-core.c:682:19: warning: cast to restricted __be32 fsi-core.c:682:19: warning: cast to restricted __be32 fsi-core.c:682:19: warning: cast to restricted __be32 fsi-core.c:682:19: warning: cast to restricted __be32 fsi-core.c:706:24: warning: incorrect type in assignment (different base types)
fsi-core.c:706:24: expected unsigned int [unsigned] [usertype] llmode
fsi-core.c:706:24: got restricted __be32 [usertype] <noident>
--- drivers/fsi/fsi-core.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/fsi/fsi-core.c +13 -10
@@ -190,7 +190,7 @@ static int fsi_slave_calc_addr(struct fsi_slave *slave, uint32_t *addrp,static int fsi_slave_report_and_clear_errors (struct fsi_slave *slave) {struct fsi_master *master = slave->master; -uint32_t irq, stat; +__be32 irq, stat;int rc, link;uint8_t id;
@@ -390,7 +390,6 @@ static struct device_node *fsi_device_find_of_node(struct fsi_device *dev)static int fsi_slave_scan (struct fsi_slave *slave) {uint32_t engine_addr; -uint32_t conf;int rc, i;/*
@@ -404,15 +403,17 @@ static int fsi_slave_scan(struct fsi_slave *slave)for (i =2 ; i < engine_page_size /sizeof (uint32_t ); i++) {uint8_t slots, version, type, crc;struct fsi_device *dev; +uint32_t conf; +__be32 data; - rc =fsi_slave_read (slave, (i +1 ) *sizeof (conf), - &conf,sizeof (conf)); + rc =fsi_slave_read (slave, (i +1 ) *sizeof (data), + &data,sizeof (data));if (rc) {dev_warn (&slave->dev,"error reading slave registers\n" );return -1 ; } - conf =be32_to_cpu (conf); + conf =be32_to_cpu (data); crc =crc4 (0 , conf,32 );if (crc) {
@@ -597,15 +598,16 @@ static uint32_t fsi_slave_smode(int id)static int fsi_slave_set_smode (struct fsi_master *master,int link,int id) {uint32_t smode; +__be32 data;/* set our smode register with the slave ID field to 0; this enables * extended slave addressing */ smode =fsi_slave_smode (id); - smode =cpu_to_be32 (smode); + data =cpu_to_be32 (smode);return fsi_master_write (master, link, id,FSI_SLAVE_BASE +FSI_SMODE , - &smode,sizeof (smode)); + &data,sizeof (data)); }static void fsi_slave_release (struct device *dev)
@@ -661,9 +663,10 @@ static struct device_node *fsi_slave_find_of_node(struct fsi_master *master,static int fsi_slave_init (struct fsi_master *master,int link,uint8_t id) { -uint32_t chip_id, llmode; +uint32_t chip_id;struct fsi_slave *slave;uint8_t crc; +__be32 data, llmode;int rc;/* Currently, we only support single slaves on a link, and use the
@@ -672,13 +675,13 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)if (id !=0 )return -EINVAL ; - rc =fsi_master_read (master, link, id,0 , &chip_id,sizeof (chip_id)); + rc =fsi_master_read (master, link, id,0 , &data,sizeof (data));if (rc) {dev_dbg (&master->dev,"can't read slave %02x:%02x %d\n" , link, id, rc);return -ENODEV ; } - chip_id =be32_to_cpu (chip_id); + chip_id =be32_to_cpu (data); crc =crc4 (0 , chip_id,32 );if (crc) {
Signature · 1 line
2.17.1
Quoted 11 lines · Joel Stanley
Hi Eddie and Ben,
I've fixed a bunch of printf warnings (that only occur when the kernel is being built for a 64 bit machine) and sparse warnings.
Where appropraite please fold these fixes into your work in progress code.
(This is with the work in progress 4.17 tree, which contains all of the posted fixes, plus a mega-patch that I created with all of the OCC HWMON work).
So those:
Quoted 3 lines
fsi: sbefifo: Fix sparse warnings
fsi: master-hub: Fix sparse warnings
fsi: core: Fix sparse warnings
Fix stuff that is either already upstream or already in a tagged pull request. I'll add those 3 fixes on top of them in k.org for my next pull request to Greg.
Cheers,
Ben.