mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] block: convert ata_port_for_each_link to use a while loop to reduce code size
@ 2008-10-21 20:24 Richard Kennedy
  2008-10-22  6:17 ` Alexander van Heukelum
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Kennedy @ 2008-10-21 20:24 UTC (permalink / raw)
  To: jgarzik; +Cc: lkml

convert a for loop to a while loop in the ata_port_for_each_link macros
to reduce code size.

on x86_64 size reports reduction of text size in
	libata.ko : -272 bytes
	ahci.ko   : -44 bytes

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>

----
This patch is against 2.6.27 git head.

I've been running this patch on my AMD64 desktop machine for several
days & have not seen any problems.
regards
Richard


diff --git a/include/linux/libata.h b/include/linux/libata.h
index 947cf84..bbe3b9d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1283,12 +1283,12 @@ extern struct ata_link *__ata_port_next_link(struct ata_port *ap,
 					     bool dev_only);
 
 #define __ata_port_for_each_link(link, ap) \
-	for ((link) = __ata_port_next_link((ap), NULL, false); (link); \
-	     (link) = __ata_port_next_link((ap), (link), false))
+	(link) = NULL; \
+	while (((link) = __ata_port_next_link((ap), (link), false)))
 
 #define ata_port_for_each_link(link, ap) \
-	for ((link) = __ata_port_next_link((ap), NULL, true); (link); \
-	     (link) = __ata_port_next_link((ap), (link), true))
+	(link) = NULL; \
+	while (((link) = __ata_port_next_link((ap), (link), true)))
 
 #define ata_link_for_each_dev(dev, link) \
 	for ((dev) = (link)->device; \



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-22  8:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-21 20:24 [PATCH] block: convert ata_port_for_each_link to use a while loop to reduce code size Richard Kennedy
2008-10-22  6:17 ` Alexander van Heukelum
2008-10-22  8:02   ` Richard Kennedy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome