mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
mtd: spi-nor: use kernel sized types instead of c99 types
The kernel offers and prefers the kernel sized types instead of the c99 types when not in the uapi directory, use them. Link: https://lore.kernel.org/r/20231101145853.524045-2-tudor.ambarus@linaro.org Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
This commit is contained in:
parent
b85ea95d08
commit
075ede8d20
@ -16,12 +16,12 @@
|
||||
* is to unlock the whole flash array on startup. Therefore, we have to support
|
||||
* exactly this operation.
|
||||
*/
|
||||
static int at25fs_nor_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
static int at25fs_nor_lock(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static int at25fs_nor_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
static int at25fs_nor_unlock(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -37,7 +37,7 @@ static int at25fs_nor_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int at25fs_nor_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
static int at25fs_nor_is_locked(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
@ -69,7 +69,7 @@ static const struct spi_nor_fixups at25fs_nor_fixups = {
|
||||
* Return: 0 on success, -error otherwise.
|
||||
*/
|
||||
static int atmel_nor_set_global_protection(struct spi_nor *nor, loff_t ofs,
|
||||
uint64_t len, bool is_protect)
|
||||
u64 len, bool is_protect)
|
||||
{
|
||||
int ret;
|
||||
u8 sr;
|
||||
@ -118,20 +118,18 @@ static int atmel_nor_set_global_protection(struct spi_nor *nor, loff_t ofs,
|
||||
return spi_nor_write_sr(nor, nor->bouncebuf, 1);
|
||||
}
|
||||
|
||||
static int atmel_nor_global_protect(struct spi_nor *nor, loff_t ofs,
|
||||
uint64_t len)
|
||||
static int atmel_nor_global_protect(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
return atmel_nor_set_global_protection(nor, ofs, len, true);
|
||||
}
|
||||
|
||||
static int atmel_nor_global_unprotect(struct spi_nor *nor, loff_t ofs,
|
||||
uint64_t len)
|
||||
static int atmel_nor_global_unprotect(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
return atmel_nor_set_global_protection(nor, ofs, len, false);
|
||||
}
|
||||
|
||||
static int atmel_nor_is_global_protected(struct spi_nor *nor, loff_t ofs,
|
||||
uint64_t len)
|
||||
u64 len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -1799,8 +1799,7 @@ destroy_erase_cmd_list:
|
||||
static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
|
||||
{
|
||||
struct spi_nor *nor = mtd_to_spi_nor(mtd);
|
||||
u32 addr, len;
|
||||
uint32_t rem;
|
||||
u32 addr, len, rem;
|
||||
int ret;
|
||||
|
||||
dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr,
|
||||
@ -2146,7 +2145,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
if (is_power_of_2(page_size)) {
|
||||
page_offset = addr & (page_size - 1);
|
||||
} else {
|
||||
uint64_t aux = addr;
|
||||
u64 aux = addr;
|
||||
|
||||
page_offset = do_div(aux, page_size);
|
||||
}
|
||||
|
@ -293,9 +293,9 @@ struct spi_nor_erase_map {
|
||||
* @is_locked: check if a region of the SPI NOR is completely locked
|
||||
*/
|
||||
struct spi_nor_locking_ops {
|
||||
int (*lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
|
||||
int (*unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
|
||||
int (*is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len);
|
||||
int (*lock)(struct spi_nor *nor, loff_t ofs, u64 len);
|
||||
int (*unlock)(struct spi_nor *nor, loff_t ofs, u64 len);
|
||||
int (*is_locked)(struct spi_nor *nor, loff_t ofs, u64 len);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -13,12 +13,12 @@
|
||||
|
||||
#define SST26VF_CR_BPNV BIT(3)
|
||||
|
||||
static int sst26vf_nor_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
static int sst26vf_nor_lock(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static int sst26vf_nor_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
static int sst26vf_nor_unlock(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -38,7 +38,7 @@ static int sst26vf_nor_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
return spi_nor_global_block_unlock(nor);
|
||||
}
|
||||
|
||||
static int sst26vf_nor_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
static int sst26vf_nor_is_locked(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ static u64 spi_nor_get_min_prot_length_sr(struct spi_nor *nor)
|
||||
}
|
||||
|
||||
static void spi_nor_get_locked_range_sr(struct spi_nor *nor, u8 sr, loff_t *ofs,
|
||||
uint64_t *len)
|
||||
u64 *len)
|
||||
{
|
||||
struct mtd_info *mtd = &nor->mtd;
|
||||
u64 min_prot_len;
|
||||
@ -90,10 +90,10 @@ static void spi_nor_get_locked_range_sr(struct spi_nor *nor, u8 sr, loff_t *ofs,
|
||||
* (if @locked is false); false otherwise.
|
||||
*/
|
||||
static bool spi_nor_check_lock_status_sr(struct spi_nor *nor, loff_t ofs,
|
||||
uint64_t len, u8 sr, bool locked)
|
||||
u64 len, u8 sr, bool locked)
|
||||
{
|
||||
loff_t lock_offs, lock_offs_max, offs_max;
|
||||
uint64_t lock_len;
|
||||
u64 lock_len;
|
||||
|
||||
if (!len)
|
||||
return true;
|
||||
@ -111,14 +111,13 @@ static bool spi_nor_check_lock_status_sr(struct spi_nor *nor, loff_t ofs,
|
||||
return (ofs >= lock_offs_max) || (offs_max <= lock_offs);
|
||||
}
|
||||
|
||||
static bool spi_nor_is_locked_sr(struct spi_nor *nor, loff_t ofs, uint64_t len,
|
||||
u8 sr)
|
||||
static bool spi_nor_is_locked_sr(struct spi_nor *nor, loff_t ofs, u64 len, u8 sr)
|
||||
{
|
||||
return spi_nor_check_lock_status_sr(nor, ofs, len, sr, true);
|
||||
}
|
||||
|
||||
static bool spi_nor_is_unlocked_sr(struct spi_nor *nor, loff_t ofs,
|
||||
uint64_t len, u8 sr)
|
||||
static bool spi_nor_is_unlocked_sr(struct spi_nor *nor, loff_t ofs, u64 len,
|
||||
u8 sr)
|
||||
{
|
||||
return spi_nor_check_lock_status_sr(nor, ofs, len, sr, false);
|
||||
}
|
||||
@ -156,7 +155,7 @@ static bool spi_nor_is_unlocked_sr(struct spi_nor *nor, loff_t ofs,
|
||||
*
|
||||
* Returns negative on errors, 0 on success.
|
||||
*/
|
||||
static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
struct mtd_info *mtd = &nor->mtd;
|
||||
u64 min_prot_len;
|
||||
@ -246,7 +245,7 @@ static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
*
|
||||
* Returns negative on errors, 0 on success.
|
||||
*/
|
||||
static int spi_nor_sr_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
static int spi_nor_sr_unlock(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
struct mtd_info *mtd = &nor->mtd;
|
||||
u64 min_prot_len;
|
||||
@ -331,7 +330,7 @@ static int spi_nor_sr_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
* Returns 1 if entire region is locked, 0 if any portion is unlocked, and
|
||||
* negative on errors.
|
||||
*/
|
||||
static int spi_nor_sr_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
static int spi_nor_sr_is_locked(struct spi_nor *nor, loff_t ofs, u64 len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -353,7 +352,7 @@ void spi_nor_init_default_locking_ops(struct spi_nor *nor)
|
||||
nor->params->locking_ops = &spi_nor_sr_locking_ops;
|
||||
}
|
||||
|
||||
static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, u64 len)
|
||||
{
|
||||
struct spi_nor *nor = mtd_to_spi_nor(mtd);
|
||||
int ret;
|
||||
@ -368,7 +367,7 @@ static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, u64 len)
|
||||
{
|
||||
struct spi_nor *nor = mtd_to_spi_nor(mtd);
|
||||
int ret;
|
||||
@ -383,7 +382,7 @@ static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, u64 len)
|
||||
{
|
||||
struct spi_nor *nor = mtd_to_spi_nor(mtd);
|
||||
int ret;
|
||||
|
Loading…
Reference in New Issue
Block a user