All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Vivek Unune" <npcomplete13@gmail.com>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-kernel@vger.kernel.org,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Rafał Miłecki" <rafal@milecki.pl>
Subject: [PATCH  mips/linux.git 4/5] firmware: bcm47xx_nvram: look for NVRAM with for instead of while
Date: Mon,  8 Mar 2021 10:03:19 +0100	[thread overview]
Message-ID: <20210308090320.9765-5-zajec5@gmail.com> (raw)
In-Reply-To: <20210308090320.9765-1-zajec5@gmail.com>

From: Rafał Miłecki <rafal@milecki.pl>

This loop requires variable initialization, stop condition and post
iteration increment. It's pretty much a for loop definition.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/firmware/broadcom/bcm47xx_nvram.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c
index 09f51b95849e..1d2271b1e07a 100644
--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
@@ -93,15 +93,13 @@ static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_siz
 	}
 
 	/* TODO: when nvram is on nand flash check for bad blocks first. */
-	flash_size = FLASH_MIN;
-	while (flash_size <= res_size) {
+	for (flash_size = FLASH_MIN; flash_size <= res_size; flash_size <<= 1) {
 		/* Windowed flash access */
 		size = find_nvram_size(flash_start + flash_size);
 		if (size) {
 			offset = flash_size - size;
 			goto found;
 		}
-		flash_size <<= 1;
 	}
 
 	/* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
-- 
2.26.2


  parent reply	other threads:[~2021-03-08  9:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08  9:03 [PATCH mips/linux.git 0/5] firmware: bcm47xx_nvram: refactor finding & reading NVRAM Rafał Miłecki
2021-03-08  9:03 ` [PATCH mips/linux.git 1/5] firmware: bcm47xx_nvram: rename finding function and its variables Rafał Miłecki
2021-03-08  9:03 ` [PATCH mips/linux.git 2/5] firmware: bcm47xx_nvram: add helper checking for NVRAM Rafał Miłecki
2021-03-08  9:03 ` [PATCH mips/linux.git 3/5] firmware: bcm47xx_nvram: extract code copying NVRAM Rafał Miłecki
2021-03-08  9:03 ` Rafał Miłecki [this message]
2021-03-08  9:03 ` [PATCH mips/linux.git 5/5] firmware: bcm47xx_nvram: inline code checking NVRAM size Rafał Miłecki
2021-03-12 15:00 ` [PATCH mips/linux.git 0/5] firmware: bcm47xx_nvram: refactor finding & reading NVRAM Thomas Bogendoerfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210308090320.9765-5-zajec5@gmail.com \
    --to=zajec5@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=npcomplete13@gmail.com \
    --cc=rafal@milecki.pl \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.