linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Changes style to look more like list iteration.
@ 2018-10-23  1:20 Leonardo Brás
  0 siblings, 0 replies; only message in thread
From: Leonardo Brás @ 2018-10-23  1:20 UTC (permalink / raw)
  To: lkcamp; +Cc: Masahiro Yamada, Michal Marek, linux-kbuild, linux-kernel

Changes the code in order to make it looks more like its a list iteration.

Signed-off-by: Leonardo Brás <leobras.c@gmail.com>
---

It's a remainer from a patch from the -Wshadow patchset.
Since it doesn't really belongs to that patchset anymore, 
I decided to release it just as a code refactor for
file2alias.c

I fixed it after Koike's suggestion (&&!dup added)

IMHO it reads better this way, and no drastic change has been made.

Thanks.

---
 scripts/mod/file2alias.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 3015c0bdecb2..b957279c4117 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -650,26 +650,26 @@ static void do_pnp_card_entries(void *symval, unsigned long size,
 
 	device_id_check(mod->name, "pnp", size, id_size, symval);
 	DEF_FIELD_ADDR(symval, pnp_card_device_id, devs);
-	typeof(devs) devs_last;
+	DEF_FIELD_ADDR_VAR(symval, pnp_card_device_id, devs, devs_aux);
 
 	for (i = 0; i < count; i++) {
 		unsigned int j;
-		devs_last = devs + i * id_size;
+		devs_aux = devs + i * id_size;
 
 		for (j = 0; j < PNP_MAX_DEVICES; j++) {
-			const char *id = (char *)(*devs_last)[j].id;
+			const char *id = (char *)(*devs_aux)[j].id;
 			int j2;
 			int dup = 0;
 
 			if (!id[0])
 				break;
 
-			/* find duplicate, already added value */
-			while ((devs_last -= id_size) >= devs && !dup) {
+			/* find duplicate on previous devs*/
+			while ((devs_aux -= id_size) >= devs && !dup) {
 
 				for (j2 = 0; j2 < PNP_MAX_DEVICES; j2++) {
 					const char *id2 =
-						(char *)(*devs_last)[j2].id;
+						(char *)(*devs_aux)[j2].id;
 
 					if (!id2[0])
 						break;
-- 
2.19.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-23  1:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23  1:20 [PATCH 1/1] Changes style to look more like list iteration Leonardo Brás

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).