linux_mtd: drop 'mtd_' prefix from variable/field names

Change-Id: I2503c98e9111d1fecd911473f65eeea7031cfdc3
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/53953
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72178
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/linux_mtd.c b/linux_mtd.c
index 4cf7721..125de6b 100644
--- a/linux_mtd.c
+++ b/linux_mtd.c
@@ -33,13 +33,13 @@
 
 struct linux_mtd_data {
 	FILE *dev_fp;
-	int mtd_device_is_writeable;
-	int mtd_no_erase;
+	int device_is_writeable;
+	int no_erase;
 	/* Size info is presented in bytes in sysfs. */
-	unsigned long int mtd_total_size;
-	unsigned long int mtd_numeraseregions;
+	unsigned long int total_size;
+	unsigned long int numeraseregions;
 	/* only valid if numeraseregions is 0 */
-	unsigned long int mtd_erasesize;
+	unsigned long int erasesize;
 };
 
 /* read a string from a sysfs file and sanitize it */
@@ -123,51 +123,51 @@
 static int get_mtd_info(const char *sysfs_path, struct linux_mtd_data *data)
 {
 	unsigned long int tmp;
-	char mtd_device_name[32];
+	char device_name[32];
 
 	/* Flags */
 	if (read_sysfs_int(sysfs_path, "flags", &tmp))
 		return 1;
 	if (tmp & MTD_WRITEABLE) {
 		/* cache for later use by write function */
-		data->mtd_device_is_writeable = 1;
+		data->device_is_writeable = 1;
 	}
 	if (tmp & MTD_NO_ERASE) {
-		data->mtd_no_erase = 1;
+		data->no_erase = 1;
 	}
 
 	/* Device name */
-	if (read_sysfs_string(sysfs_path, "name", mtd_device_name, sizeof(mtd_device_name)))
+	if (read_sysfs_string(sysfs_path, "name", device_name, sizeof(device_name)))
 		return 1;
 
 	/* Total size */
-	if (read_sysfs_int(sysfs_path, "size", &data->mtd_total_size))
+	if (read_sysfs_int(sysfs_path, "size", &data->total_size))
 		return 1;
-	if (popcnt(data->mtd_total_size) != 1) {
+	if (popcnt(data->total_size) != 1) {
 		msg_perr("MTD size is not a power of 2\n");
 		return 1;
 	}
 
 	/* Erase size */
-	if (read_sysfs_int(sysfs_path, "erasesize", &data->mtd_erasesize))
+	if (read_sysfs_int(sysfs_path, "erasesize", &data->erasesize))
 		return 1;
-	if (popcnt(data->mtd_erasesize) != 1) {
+	if (popcnt(data->erasesize) != 1) {
 		msg_perr("MTD erase size is not a power of 2\n");
 		return 1;
 	}
 
 	/* Erase regions */
-	if (read_sysfs_int(sysfs_path, "numeraseregions", &data->mtd_numeraseregions))
+	if (read_sysfs_int(sysfs_path, "numeraseregions", &data->numeraseregions))
 		return 1;
-	if (data->mtd_numeraseregions != 0) {
+	if (data->numeraseregions != 0) {
 		msg_perr("Non-uniform eraseblock size is unsupported.\n");
 		return 1;
 	}
 
 	msg_pdbg("%s: device_name: \"%s\", is_writeable: %d, "
 		"numeraseregions: %lu, total_size: %lu, erasesize: %lu\n",
-		__func__, mtd_device_name, data->mtd_device_is_writeable,
-		data->mtd_numeraseregions, data->mtd_total_size, data->mtd_erasesize);
+		__func__, device_name, data->device_is_writeable,
+		data->numeraseregions, data->total_size, data->erasesize);
 
 	return 0;
 }
@@ -176,13 +176,13 @@
 {
 	struct linux_mtd_data *data = flash->mst->opaque.data;
 
-	if (data->mtd_no_erase)
+	if (data->no_erase)
 		flash->chip->feature_bits |= FEATURE_NO_ERASE;
 	flash->chip->tested = TEST_OK_PREW;
-	flash->chip->total_size = data->mtd_total_size / 1024;	/* bytes -> kB */
-	flash->chip->block_erasers[0].eraseblocks[0].size = data->mtd_erasesize;
+	flash->chip->total_size = data->total_size / 1024;	/* bytes -> kB */
+	flash->chip->block_erasers[0].eraseblocks[0].size = data->erasesize;
 	flash->chip->block_erasers[0].eraseblocks[0].count =
-		data->mtd_total_size / data->mtd_erasesize;
+		data->total_size / data->erasesize;
 	return 1;
 }
 
@@ -227,7 +227,7 @@
 	unsigned int chunksize = flash->chip->block_erasers[0].eraseblocks[0].size;
 	unsigned int i;
 
-	if (!data->mtd_device_is_writeable)
+	if (!data->device_is_writeable)
 		return 1;
 
 	if (fseek(data->dev_fp, start, SEEK_SET) != 0) {
@@ -267,24 +267,24 @@
 	struct linux_mtd_data *data = flash->mst->opaque.data;
 	uint32_t u;
 
-	if (data->mtd_no_erase) {
+	if (data->no_erase) {
 		msg_perr("%s: device does not support erasing.\n"
 			 "Please file a bug report at flashrom-stable@flashrom.org\n",
 			 __func__);
 		return 1;
 	}
 
-	if (data->mtd_numeraseregions != 0) {
+	if (data->numeraseregions != 0) {
 		/* TODO: Support non-uniform eraseblock size using
 		   use MEMGETREGIONCOUNT/MEMGETREGIONINFO ioctls */
-		msg_perr("%s: mtd_numeraseregions must be 0\n", __func__);
+		msg_perr("%s: numeraseregions must be 0\n", __func__);
 		return 1;
 	}
 
-	for (u = 0; u < len; u += data->mtd_erasesize) {
+	for (u = 0; u < len; u += data->erasesize) {
 		struct erase_info_user erase_info = {
 			.start = start + u,
-			.length = data->mtd_erasesize,
+			.length = data->erasesize,
 		};
 
 		int ret = ioctl(fileno(data->dev_fp), MEMERASE, &erase_info);