Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f3c0f16 authored by Samarth Parikh's avatar Samarth Parikh Committed by Brian Norris
Browse files

mtd: Fixed checkpatch seq_printf warnings

Fixed checkpatch warnings: "WARNING: Prefer seq_puts to seq_printf"

This patch is created with reference to the ongoing lkml thread
https://lkml.org/lkml/2014/7/15/646


where Andrew Morton wrote:

"
- puts is presumably faster

- puts doesn't go rogue if you accidentally pass it a "%".

- this patch would actually make compiled object files few bytes smaller.
  Perhaps because seq_printf() is a varargs function, forcing the
  caller to pass args on the stack instead of in registers.
"

Signed-off-by: default avatarSamarth Parikh <samarthp@ymail.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 2902330e
Loading
Loading
Loading
Loading
+13 −13
Original line number Original line Diff line number Diff line
@@ -1697,16 +1697,16 @@ static int dbg_asicmode_show(struct seq_file *s, void *p)


	switch (mode) {
	switch (mode) {
	case DOC_ASICMODE_RESET:
	case DOC_ASICMODE_RESET:
		pos += seq_printf(s, "reset");
		pos += seq_puts(s, "reset");
		break;
		break;
	case DOC_ASICMODE_NORMAL:
	case DOC_ASICMODE_NORMAL:
		pos += seq_printf(s, "normal");
		pos += seq_puts(s, "normal");
		break;
		break;
	case DOC_ASICMODE_POWERDOWN:
	case DOC_ASICMODE_POWERDOWN:
		pos += seq_printf(s, "powerdown");
		pos += seq_puts(s, "powerdown");
		break;
		break;
	}
	}
	pos += seq_printf(s, ")\n");
	pos += seq_puts(s, ")\n");
	return pos;
	return pos;
}
}
DEBUGFS_RO_ATTR(asic_mode, dbg_asicmode_show);
DEBUGFS_RO_ATTR(asic_mode, dbg_asicmode_show);
@@ -1745,22 +1745,22 @@ static int dbg_protection_show(struct seq_file *s, void *p)
	pos += seq_printf(s, "Protection = 0x%02x (",
	pos += seq_printf(s, "Protection = 0x%02x (",
			 protect);
			 protect);
	if (protect & DOC_PROTECT_FOUNDRY_OTP_LOCK)
	if (protect & DOC_PROTECT_FOUNDRY_OTP_LOCK)
		pos += seq_printf(s, "FOUNDRY_OTP_LOCK,");
		pos += seq_puts(s, "FOUNDRY_OTP_LOCK,");
	if (protect & DOC_PROTECT_CUSTOMER_OTP_LOCK)
	if (protect & DOC_PROTECT_CUSTOMER_OTP_LOCK)
		pos += seq_printf(s, "CUSTOMER_OTP_LOCK,");
		pos += seq_puts(s, "CUSTOMER_OTP_LOCK,");
	if (protect & DOC_PROTECT_LOCK_INPUT)
	if (protect & DOC_PROTECT_LOCK_INPUT)
		pos += seq_printf(s, "LOCK_INPUT,");
		pos += seq_puts(s, "LOCK_INPUT,");
	if (protect & DOC_PROTECT_STICKY_LOCK)
	if (protect & DOC_PROTECT_STICKY_LOCK)
		pos += seq_printf(s, "STICKY_LOCK,");
		pos += seq_puts(s, "STICKY_LOCK,");
	if (protect & DOC_PROTECT_PROTECTION_ENABLED)
	if (protect & DOC_PROTECT_PROTECTION_ENABLED)
		pos += seq_printf(s, "PROTECTION ON,");
		pos += seq_puts(s, "PROTECTION ON,");
	if (protect & DOC_PROTECT_IPL_DOWNLOAD_LOCK)
	if (protect & DOC_PROTECT_IPL_DOWNLOAD_LOCK)
		pos += seq_printf(s, "IPL_DOWNLOAD_LOCK,");
		pos += seq_puts(s, "IPL_DOWNLOAD_LOCK,");
	if (protect & DOC_PROTECT_PROTECTION_ERROR)
	if (protect & DOC_PROTECT_PROTECTION_ERROR)
		pos += seq_printf(s, "PROTECT_ERR,");
		pos += seq_puts(s, "PROTECT_ERR,");
	else
	else
		pos += seq_printf(s, "NO_PROTECT_ERR");
		pos += seq_puts(s, "NO_PROTECT_ERR");
	pos += seq_printf(s, ")\n");
	pos += seq_puts(s, ")\n");


	pos += seq_printf(s, "DPS0 = 0x%02x : "
	pos += seq_printf(s, "DPS0 = 0x%02x : "
			 "Protected area [0x%x - 0x%x] : OTP=%d, READ=%d, "
			 "Protected area [0x%x - 0x%x] : OTP=%d, READ=%d, "
+2 −2
Original line number Original line Diff line number Diff line
@@ -1287,7 +1287,7 @@ static int mtdswap_show(struct seq_file *s, void *data)


	seq_printf(s, "total erasures: %lu\n", sum);
	seq_printf(s, "total erasures: %lu\n", sum);


	seq_printf(s, "\n");
	seq_puts(s, "\n");


	seq_printf(s, "mtdswap_readsect count: %llu\n", d->sect_read_count);
	seq_printf(s, "mtdswap_readsect count: %llu\n", d->sect_read_count);
	seq_printf(s, "mtdswap_writesect count: %llu\n", d->sect_write_count);
	seq_printf(s, "mtdswap_writesect count: %llu\n", d->sect_write_count);
@@ -1296,7 +1296,7 @@ static int mtdswap_show(struct seq_file *s, void *data)
	seq_printf(s, "mtd write count: %llu\n", d->mtd_write_count);
	seq_printf(s, "mtd write count: %llu\n", d->mtd_write_count);
	seq_printf(s, "discarded pages count: %llu\n", d->discard_page_count);
	seq_printf(s, "discarded pages count: %llu\n", d->discard_page_count);


	seq_printf(s, "\n");
	seq_puts(s, "\n");
	seq_printf(s, "total pages: %u\n", pages);
	seq_printf(s, "total pages: %u\n", pages);
	seq_printf(s, "pages mapped: %u\n", mapped);
	seq_printf(s, "pages mapped: %u\n", mapped);