]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mtd: spi-nor: swp: Rename a mask
authorMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 26 May 2026 14:56:36 +0000 (16:56 +0200)
committerPratyush Yadav <pratyush@kernel.org>
Tue, 26 May 2026 15:21:04 +0000 (17:21 +0200)
"mask" is not very descriptive when we already manipulate two masks, and
soon will manipulate three. Rename it "bp_mask" to align with the
existing "tb_mask" and soon "cmp_mask".

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
drivers/mtd/spi-nor/swp.c

index 61830f18a1474631ce55175059a35a45ba787f4d..07269e09370ac70250dd0bfd44fee199485f77ab 100644 (file)
@@ -59,9 +59,9 @@ static void spi_nor_get_locked_range_sr(struct spi_nor *nor, const u8 *sr, loff_
                                        u64 *len)
 {
        u64 min_prot_len;
-       u8 mask = spi_nor_get_sr_bp_mask(nor);
+       u8 bp_mask = spi_nor_get_sr_bp_mask(nor);
        u8 tb_mask = spi_nor_get_sr_tb_mask(nor);
-       u8 bp, val = sr[0] & mask;
+       u8 bp, val = sr[0] & bp_mask;
 
        if (nor->flags & SNOR_F_HAS_SR_BP3_BIT6 && val & SR_BP3_BIT6)
                val = (val & ~SR_BP3_BIT6) | SR_BP3;
@@ -162,7 +162,7 @@ static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, u64 len)
        u64 min_prot_len;
        int ret;
        u8 status_old[1] = {}, status_new[1] = {};
-       u8 mask = spi_nor_get_sr_bp_mask(nor);
+       u8 bp_mask = spi_nor_get_sr_bp_mask(nor);
        u8 tb_mask = spi_nor_get_sr_tb_mask(nor);
        u8 pow, val;
        loff_t lock_len;
@@ -201,7 +201,7 @@ static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, u64 len)
                lock_len = ofs + len;
 
        if (lock_len == nor->params->size) {
-               val = mask;
+               val = bp_mask;
        } else {
                min_prot_len = spi_nor_get_min_prot_length_sr(nor);
                pow = ilog2(lock_len) - ilog2(min_prot_len) + 1;
@@ -210,15 +210,15 @@ static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, u64 len)
                if (nor->flags & SNOR_F_HAS_SR_BP3_BIT6 && val & SR_BP3)
                        val = (val & ~SR_BP3) | SR_BP3_BIT6;
 
-               if (val & ~mask)
+               if (val & ~bp_mask)
                        return -EINVAL;
 
                /* Don't "lock" with no region! */
-               if (!(val & mask))
+               if (!(val & bp_mask))
                        return -EINVAL;
        }
 
-       status_new[0] = (status_old[0] & ~mask & ~tb_mask) | val;
+       status_new[0] = (status_old[0] & ~bp_mask & ~tb_mask) | val;
 
        /*
         * Disallow further writes if WP# pin is neither left floating nor
@@ -236,7 +236,7 @@ static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, u64 len)
                return 0;
 
        /* Only modify protection if it will not unlock other areas */
-       if ((status_new[0] & mask) < (status_old[0] & mask))
+       if ((status_new[0] & bp_mask) < (status_old[0] & bp_mask))
                return -EINVAL;
 
        return spi_nor_write_sr_and_check(nor, status_new[0]);
@@ -252,7 +252,7 @@ static int spi_nor_sr_unlock(struct spi_nor *nor, loff_t ofs, u64 len)
        u64 min_prot_len;
        int ret;
        u8 status_old[1], status_new[1];
-       u8 mask = spi_nor_get_sr_bp_mask(nor);
+       u8 bp_mask = spi_nor_get_sr_bp_mask(nor);
        u8 tb_mask = spi_nor_get_sr_tb_mask(nor);
        u8 pow, val;
        loff_t lock_len;
@@ -308,11 +308,11 @@ static int spi_nor_sr_unlock(struct spi_nor *nor, loff_t ofs, u64 len)
                        val = (val & ~SR_BP3) | SR_BP3_BIT6;
 
                /* Some power-of-two sizes may not be supported */
-               if (val & ~mask)
+               if (val & ~bp_mask)
                        return -EINVAL;
        }
 
-       status_new[0] = (status_old[0] & ~mask & ~tb_mask) | val;
+       status_new[0] = (status_old[0] & ~bp_mask & ~tb_mask) | val;
 
        /* Don't protect status register if we're fully unlocked */
        if (lock_len == 0)
@@ -326,7 +326,7 @@ static int spi_nor_sr_unlock(struct spi_nor *nor, loff_t ofs, u64 len)
                return 0;
 
        /* Only modify protection if it will not lock other areas */
-       if ((status_new[0] & mask) > (status_old[0] & mask))
+       if ((status_new[0] & bp_mask) > (status_old[0] & bp_mask))
                return -EINVAL;
 
        return spi_nor_write_sr_and_check(nor, status_new[0]);