From 00caa7f508f37327f7d4f6ca08ffdec09e411c10 Mon Sep 17 00:00:00 2001 From: Kim Phillips Date: Mon, 29 Oct 2012 13:34:40 +0000 Subject: [PATCH] drivers/block/: sparse fixes sata_sil.c:371:7: warning: symbol 'sil_sata_rw_lba28' was not declared. Should it be static? sata_sil.c:399:7: warning: symbol 'sil_sata_rw_lba48' was not declared. Should it be static? sata_sil.c:429:6: warning: symbol 'sil_sata_cmd_flush_cache' was not declared. Should it be static? sata_sil.c:441:6: warning: symbol 'sil_sata_cmd_flush_cache_ext' was not declared. Should it be static? sata_sil.c:489:7: warning: symbol 'sata_read' was not declared. Should it be static? sata_sil.c:505:7: warning: symbol 'sata_write' was not declared. Should it be static? sata_sil.c:526:5: warning: symbol 'init_sata' was not declared. Should it be static? sata_sil.c:588:5: warning: symbol 'scan_sata' was not declared. Should it be static? fsl_sata.c:59:6: warning: symbol 'dprint_buffer' was not declared. Should it be static? fsl_sata.c:187:42: warning: incorrect type in assignment (different base types) fsl_sata.c:187:42: expected unsigned int [unsigned] [usertype] cda fsl_sata.c:187:42: got restricted __le32 [usertype] fsl_sata.c:291:6: warning: symbol 'fsl_sata_hardware_reset' was not declared. Should it be static? fsl_sata.c:418:27: warning: incorrect type in assignment (different base types) fsl_sata.c:418:27: expected unsigned int [unsigned] [usertype] dba fsl_sata.c:418:27: got restricted __le32 [usertype] fsl_sata.c:424:41: warning: incorrect type in assignment (different base types) fsl_sata.c:424:41: expected unsigned int [unsigned] [usertype] ext_c_ddc fsl_sata.c:424:41: got restricted __le32 [usertype] fsl_sata.c:431:41: warning: incorrect type in assignment (different base types) fsl_sata.c:431:41: expected unsigned int [unsigned] [usertype] ext_c_ddc fsl_sata.c:431:41: got restricted __le32 [usertype] fsl_sata.c:442:22: warning: incorrect type in assignment (different base types) fsl_sata.c:442:22: expected unsigned int [unsigned] [usertype] cda fsl_sata.c:442:22: got restricted __le32 [usertype] fsl_sata.c:446:31: warning: incorrect type in assignment (different base types) fsl_sata.c:446:31: expected unsigned int [unsigned] [usertype] prde_fis_len fsl_sata.c:446:31: got restricted __le32 [usertype] fsl_sata.c:448:22: warning: incorrect type in assignment (different base types) fsl_sata.c:448:22: expected unsigned int [unsigned] [usertype] ttl fsl_sata.c:448:22: got restricted __le32 [usertype] fsl_sata.c:460:28: warning: incorrect type in assignment (different base types) fsl_sata.c:460:28: expected unsigned int [unsigned] [usertype] attribute fsl_sata.c:460:28: got restricted __le32 [usertype] fsl_sata.c:623:6: warning: symbol 'fsl_sata_flush_cache' was not declared. Should it be static? fsl_sata.c:667:5: warning: symbol 'fsl_sata_rw_ncq_cmd' was not declared. Should it be static? fsl_sata.c:710:6: warning: symbol 'fsl_sata_flush_cache_ext' was not declared. Should it be static? fsl_sata.c:725:6: warning: symbol 'fsl_sata_software_reset' was not declared. Should it be static? fsl_sata.c:760:5: warning: symbol 'ata_low_level_rw_lba48' was not declared. Should it be static? fsl_sata.c:795:5: warning: symbol 'ata_low_level_rw_lba28' was not declared. Should it be static? the following compiler warnings show up after fixing the above, so remove those three functions: fsl_sata.c:59:13: warning: 'dprint_buffer' defined but not used [-Wunused-function] fsl_sata.c:291:13: warning: 'fsl_sata_hardware_reset' defined but not used [-Wunused-function] fsl_sata.c:726:13: warning: 'fsl_sata_software_reset' defined but not used [-Wunused-function] Other than that, the following are fixed by __iomem annotation: fsl_sata.c:84:39: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:84:39: expected unsigned int const volatile [noderef] *addr fsl_sata.c:84:39: got unsigned int volatile *addr fsl_sata.c:172:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:172:26: expected unsigned int const volatile [noderef] *addr fsl_sata.c:172:26: got unsigned int * fsl_sata.c:175:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:175:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:175:19: got unsigned int * fsl_sata.c:181:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:181:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:181:19: got unsigned int * fsl_sata.c:184:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:184:26: expected unsigned int const volatile [noderef] *addr fsl_sata.c:184:26: got unsigned int * fsl_sata.c:186:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:186:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:186:19: got unsigned int * fsl_sata.c:189:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:189:26: expected unsigned int const volatile [noderef] *addr fsl_sata.c:189:26: got unsigned int * fsl_sata.c:191:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:191:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:191:19: got unsigned int * fsl_sata.c:194:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:194:26: expected unsigned int const volatile [noderef] *addr fsl_sata.c:194:26: got unsigned int * fsl_sata.c:195:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:195:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:195:19: got unsigned int * fsl_sata.c:198:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:198:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:198:19: got unsigned int * fsl_sata.c:201:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:201:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:201:19: got unsigned int * fsl_sata.c:204:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:204:26: expected unsigned int const volatile [noderef] *addr fsl_sata.c:204:26: got unsigned int * fsl_sata.c:205:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:205:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:205:19: got unsigned int * fsl_sata.c:208:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:208:26: expected unsigned int const volatile [noderef] *addr fsl_sata.c:208:26: got unsigned int * fsl_sata.c:209:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:209:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:209:19: got unsigned int * fsl_sata.c:212:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:212:26: expected unsigned int const volatile [noderef] *addr fsl_sata.c:212:26: got unsigned int * fsl_sata.c:213:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:213:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:213:19: got unsigned int * fsl_sata.c:216:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:216:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:216:19: got unsigned int * fsl_sata.c:219:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:219:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:219:19: got unsigned int * fsl_sata.c:222:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:222:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:222:19: got unsigned int * fsl_sata.c:225:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:225:26: expected unsigned int const volatile [noderef] *addr fsl_sata.c:225:26: got unsigned int * fsl_sata.c:227:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:227:19: expected unsigned int volatile [noderef] *addr fsl_sata.c:227:19: got unsigned int * fsl_sata.c:242:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:242:26: expected unsigned int const volatile [noderef] *addr fsl_sata.c:242:26: got unsigned int * fsl_sata.c:256:32: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:256:32: expected unsigned int const volatile [noderef] *addr fsl_sata.c:256:32: got unsigned int * fsl_sata.c:262:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:262:26: expected unsigned int const volatile [noderef] *addr fsl_sata.c:262:26: got unsigned int * fsl_sata.c:274:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:274:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:274:53: got unsigned int * fsl_sata.c:275:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:275:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:275:53: got unsigned int * fsl_sata.c:276:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:276:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:276:53: got unsigned int * fsl_sata.c:277:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:277:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:277:53: got unsigned int * fsl_sata.c:278:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:278:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:278:53: got unsigned int * fsl_sata.c:279:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:279:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:279:53: got unsigned int * fsl_sata.c:280:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:280:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:280:53: got unsigned int * fsl_sata.c:281:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:281:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:281:53: got unsigned int * fsl_sata.c:282:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:282:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:282:53: got unsigned int * fsl_sata.c:283:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:283:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:283:53: got unsigned int * fsl_sata.c:284:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:284:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:284:53: got unsigned int * fsl_sata.c:285:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:285:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:285:53: got unsigned int * fsl_sata.c:286:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:286:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:286:53: got unsigned int * fsl_sata.c:287:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:287:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:287:53: got unsigned int * fsl_sata.c:288:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:288:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:288:53: got unsigned int * fsl_sata.c:289:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:289:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:289:53: got unsigned int * fsl_sata.c:290:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:290:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:290:53: got unsigned int * fsl_sata.c:291:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:291:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:291:53: got unsigned int * fsl_sata.c:292:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:292:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:292:53: got unsigned int * fsl_sata.c:293:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:293:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:293:53: got unsigned int * fsl_sata.c:294:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:294:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:294:53: got unsigned int * fsl_sata.c:295:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:295:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:295:53: got unsigned int * fsl_sata.c:296:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:296:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:296:53: got unsigned int * fsl_sata.c:297:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:297:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:297:53: got unsigned int * fsl_sata.c:298:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:298:53: expected unsigned int const volatile [noderef] *addr fsl_sata.c:298:53: got unsigned int * Signed-off-by: Kim Phillips --- drivers/block/fsl_sata.c | 81 ++++++---------------------------------- drivers/block/fsl_sata.h | 13 ++++--- drivers/block/sata_sil.c | 13 ++++--- 3 files changed, 25 insertions(+), 82 deletions(-) diff --git a/drivers/block/fsl_sata.c b/drivers/block/fsl_sata.c index fda3389e8b..1f9d7b097c 100644 --- a/drivers/block/fsl_sata.c +++ b/drivers/block/fsl_sata.c @@ -56,25 +56,6 @@ static inline void sdelay(unsigned long sec) mdelay(1000); } -void dprint_buffer(unsigned char *buf, int len) -{ - int i, j; - - i = 0; - j = 0; - printf("\n\r"); - - for (i = 0; i < len; i++) { - printf("%02x ", *buf++); - j++; - if (j == 16) { - printf("\n\r"); - j = 0; - } - } - printf("\n\r"); -} - static void fsl_sata_dump_sfis(struct sata_fis_d2h *s) { printf("Status FIS dump:\n\r"); @@ -94,7 +75,7 @@ static void fsl_sata_dump_sfis(struct sata_fis_d2h *s) printf("sector_count_exp: %02x\n\r", s->sector_count_exp); } -static int ata_wait_register(volatile unsigned *addr, u32 mask, +static int ata_wait_register(unsigned __iomem *addr, u32 mask, u32 val, u32 timeout_msec) { int i; @@ -112,7 +93,7 @@ int init_sata(int dev) cmd_hdr_tbl_t *cmd_hdr; u32 cda; u32 val32; - fsl_sata_reg_t *reg; + fsl_sata_reg_t __iomem *reg; u32 sig; int i; fsl_sata_t *sata; @@ -287,42 +268,7 @@ int init_sata(int dev) return 0; } -/* Hardware reset, like Power-on and COMRESET */ -void fsl_sata_hardware_reset(u32 reg_base) -{ - fsl_sata_reg_t *reg = (fsl_sata_reg_t *)reg_base; - u32 scontrol; - - /* Disable the SATA interface and put PHY offline */ - scontrol = in_le32(®->scontrol); - scontrol = (scontrol & 0x0f0) | 0x304; - out_le32(®->scontrol, scontrol); - - /* No speed strict */ - scontrol = in_le32(®->scontrol); - scontrol = scontrol & ~0x0f0; - out_le32(®->scontrol, scontrol); - - /* Issue PHY wake/reset, Hardware_reset_asserted */ - scontrol = in_le32(®->scontrol); - scontrol = (scontrol & 0x0f0) | 0x301; - out_le32(®->scontrol, scontrol); - - mdelay(100); - - /* Resume PHY, COMRESET negated, the device initialize hardware - * and execute diagnostics, send good status-signature to host, - * which is D2H register FIS, and then the device enter idle state. - */ - scontrol = in_le32(®->scontrol); - scontrol = (scontrol & 0x0f0) | 0x300; - out_le32(®->scontrol, scontrol); - - mdelay(100); - return; -} - -static void fsl_sata_dump_regs(fsl_sata_reg_t *reg) +static void fsl_sata_dump_regs(fsl_sata_reg_t __iomem *reg) { printf("\n\rSATA: %08x\n\r", (u32)reg); printf("CQR: %08x\n\r", in_le32(®->cqr)); @@ -363,7 +309,7 @@ static int fsl_ata_exec_ata_cmd(struct fsl_sata *sata, struct sata_fis_h2d *cfis u32 prde_count; u32 val32; u32 ttl; - fsl_sata_reg_t *reg = sata->reg_base; + fsl_sata_reg_t __iomem *reg = sata->reg_base; int i; /* Check xfer length */ @@ -620,7 +566,7 @@ static u32 fsl_sata_rw_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_wr return blkcnt; } -void fsl_sata_flush_cache(int dev) +static void fsl_sata_flush_cache(int dev) { fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; struct sata_fis_h2d h2d, *cfis = &h2d; @@ -664,7 +610,8 @@ static u32 fsl_sata_rw_cmd_ext(int dev, u32 start, u32 blkcnt, u8 *buffer, int i return blkcnt; } -u32 fsl_sata_rw_ncq_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write) +static u32 fsl_sata_rw_ncq_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, + int is_write) { fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; struct sata_fis_h2d h2d, *cfis = &h2d; @@ -707,7 +654,7 @@ u32 fsl_sata_rw_ncq_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write return blkcnt; } -void fsl_sata_flush_cache_ext(int dev) +static void fsl_sata_flush_cache_ext(int dev) { fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; struct sata_fis_h2d h2d, *cfis = &h2d; @@ -721,12 +668,6 @@ void fsl_sata_flush_cache_ext(int dev) fsl_sata_exec_cmd(sata, cfis, CMD_ATA, 0, NULL, 0); } -/* Software reset, set SRST of the Device Control register */ -void fsl_sata_software_reset(int dev) -{ - return; -} - static void fsl_sata_init_wcache(int dev, u16 *id) { fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv; @@ -757,7 +698,7 @@ static int fsl_sata_get_flush_ext(int dev) return sata->flush_ext; } -u32 ata_low_level_rw_lba48(int dev, u32 blknr, lbaint_t blkcnt, +static u32 ata_low_level_rw_lba48(int dev, u32 blknr, lbaint_t blkcnt, const void *buffer, int is_write) { u32 start, blks; @@ -792,8 +733,8 @@ u32 ata_low_level_rw_lba48(int dev, u32 blknr, lbaint_t blkcnt, return blkcnt; } -u32 ata_low_level_rw_lba28(int dev, u32 blknr, u32 blkcnt, const void *buffer, - int is_write) +static u32 ata_low_level_rw_lba28(int dev, u32 blknr, u32 blkcnt, + const void *buffer, int is_write) { u32 start, blks; u8 *addr; diff --git a/drivers/block/fsl_sata.h b/drivers/block/fsl_sata.h index cecff68da3..a9c27bc868 100644 --- a/drivers/block/fsl_sata.h +++ b/drivers/block/fsl_sata.h @@ -176,10 +176,11 @@ typedef struct fsl_sata_reg { * Command Header Entry */ typedef struct cmd_hdr_entry { - u32 cda; /* Command Descriptor Address, 4 bytes aligned */ - u32 prde_fis_len; /* Number of PRD entries and FIS length */ - u32 ttl; /* Total transfer length */ - u32 attribute; /* the attribute of command */ + __le32 cda; /* Command Descriptor Address, + 4 bytes aligned */ + __le32 prde_fis_len; /* Number of PRD entries and FIS length */ + __le32 ttl; /* Total transfer length */ + __le32 attribute; /* the attribute of command */ } __attribute__ ((packed)) cmd_hdr_entry_t; #define SATA_HC_CMD_HDR_ENTRY_SIZE sizeof(struct cmd_hdr_entry) @@ -230,10 +231,10 @@ typedef struct cmd_hdr_tbl { * PRD entry - Physical Region Descriptor entry */ typedef struct prd_entry { - u32 dba; /* Data base address, 4 bytes aligned */ + __le32 dba; /* Data base address, 4 bytes aligned */ u32 res1; u32 res2; - u32 ext_c_ddc; /* Indirect PRD flags, snoop and data word count */ + __le32 ext_c_ddc; /* Indirect PRD flags, snoop and data word count */ } __attribute__ ((packed)) prd_entry_t; #define SATA_HC_CMD_DESC_PRD_SIZE sizeof(struct prd_entry) diff --git a/drivers/block/sata_sil.c b/drivers/block/sata_sil.c index 245b872f99..b70f04de8b 100644 --- a/drivers/block/sata_sil.c +++ b/drivers/block/sata_sil.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "sata_sil.h" /* Convert sectorsize to wordsize */ @@ -369,8 +370,8 @@ static ulong sil_sata_rw_cmd_ext(int dev, ulong start, ulong blkcnt, return blkcnt; } -ulong sil_sata_rw_lba28(int dev, ulong blknr, lbaint_t blkcnt, - const void *buffer, int is_write) +static ulong sil_sata_rw_lba28(int dev, ulong blknr, lbaint_t blkcnt, + const void *buffer, int is_write) { ulong start, blks, max_blks; u8 *addr; @@ -397,8 +398,8 @@ ulong sil_sata_rw_lba28(int dev, ulong blknr, lbaint_t blkcnt, return blkcnt; } -ulong sil_sata_rw_lba48(int dev, ulong blknr, lbaint_t blkcnt, - const void *buffer, int is_write) +static ulong sil_sata_rw_lba48(int dev, ulong blknr, lbaint_t blkcnt, + const void *buffer, int is_write) { ulong start, blks, max_blks; u8 *addr; @@ -427,7 +428,7 @@ ulong sil_sata_rw_lba48(int dev, ulong blknr, lbaint_t blkcnt, return blkcnt; } -void sil_sata_cmd_flush_cache(int dev) +static void sil_sata_cmd_flush_cache(int dev) { struct sil_cmd_block cmdb, *pcmd = &cmdb; @@ -439,7 +440,7 @@ void sil_sata_cmd_flush_cache(int dev) sil_exec_cmd(dev, pcmd, 0); } -void sil_sata_cmd_flush_cache_ext(int dev) +static void sil_sata_cmd_flush_cache_ext(int dev) { struct sil_cmd_block cmdb, *pcmd = &cmdb;