Am 03.03.2012 14:48 schrieb Stefan Tauner:
> Previously we relied on a correctly set up state.
>
> Also, we start to rely on the shutdown function for cleanup after
> registering it, i.e. we no longer explicitly call close(fd) after
> register_shutdown().
>
> Signed-off-by: Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>
Thanks for reworking this patch!
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Regards,
Carl-Daniel
--
http://www.hailfinger.org/
for
- chipsets
---
i noticed that the chipset columns were not uniformly divided at all
and looked at the code in more detail... out came this series of
patches that changes all three major sections of the wiki page
similarly (hopefully to the better) and it split respectively for
easier reviewing. getting this right is not trivial due to the
possible corner cases... and it makes one cry when aware of real
programming languages ;)
Signed-off-by: Stefan Tauner <stefan.tauner(a)student.…
[View More]tuwien.ac.at>
---
print_wiki.c | 36 +++++++++++++++++++++++-------------
1 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/print_wiki.c b/print_wiki.c
index 756f8d4..e0b5ff3 100644
--- a/print_wiki.c
+++ b/print_wiki.c
@@ -91,18 +91,26 @@ wrong (a working backup flash chip and/or good soldering skills).\n</div>\n";
static void print_supported_chipsets_wiki(int cols)
{
- int i, j, enablescount = 0, color = 1;
+ int enablescount = 0, color = 1;
+ int i;
+ unsigned int lines_per_col;
const struct penable *e;
for (e = chipset_enables; e->vendor_name != NULL; e++)
enablescount++;
+ /* +1 to force the resulting number of columns to be < cols */
+ lines_per_col = enablescount / cols + ((enablescount%cols) > 0 ? 1 : 0);
+
printf("\n== Supported chipsets ==\n\nTotal amount of supported "
- "chipsets: '''%d'''\n\n{| border=\"0\" valign=\"top\"\n| "
- "valign=\"top\"|\n\n%s", enablescount, chipset_th);
+ "chipsets: '''%d'''\n\n{| border=\"0\" valign=\"top\"\n",
+ enablescount);
e = chipset_enables;
- for (i = 0, j = 0; e[i].vendor_name != NULL; i++, j++) {
+ for (i = 0; e[i].vendor_name != NULL; i++) {
+ if ((i % lines_per_col) == 0)
+ printf("| valign=\"top\"|\n\n%s", chipset_th);
+
/* Alternate colors if the vendor changes. */
if (i > 0 && strcmp(e[i].vendor_name, e[i - 1].vendor_name))
color = !color;
@@ -113,30 +121,32 @@ static void print_supported_chipsets_wiki(int cols)
e[i].vendor_id, e[i].device_id,
(e[i].status == OK) ? "{{OK}}" : "{{?3}}");
- /* Split table in 'cols' columns. */
- if (j >= (enablescount / cols + 1)) {
- printf("\n|}\n\n| valign=\"top\"|\n\n%s", chipset_th);
- j = 0;
- }
+ if (((i % lines_per_col) + 1) == lines_per_col)
+ printf("\n|}\n\n");
}
- printf("\n|}\n\n|}\n");
+ /* end inner table if it did not fill the last column fully */
+ if (((i % lines_per_col)) > 0)
+ printf("\n|}\n\n");
+ printf("\n\n|}\n");
}
static void print_supported_boards_wiki_helper(const char *devicetype, int cols,
const struct board_info boards[])
{
- int i, j, k = 0, boardcount_good = 0, boardcount_bad = 0, color = 1;
+ int i, j, k = 0, color = 1;
int num_notes = 0;
char *notes = calloc(1, 1);
- char tmp[900 + 1];
const struct board_match *b = board_matches;
+ unsigned int boardcount = 0, boardcount_good = 0, boardcount_bad = 0;
+ char tmp[900 + 1];
for (i = 0; boards[i].vendor != NULL; i++) {
if (boards[i].working == OK)
boardcount_good++;
if (boards[i].working == BAD)
boardcount_bad++;
+ boardcount++;
}
printf("\n\nTotal amount of supported %s: '''%d'''. "
@@ -181,7 +191,7 @@ static void print_supported_boards_wiki_helper(const char *devicetype, int cols,
}
/* Split table in 'cols' columns. */
- if (j >= ((boardcount_good + boardcount_bad) / cols + 1)) {
+ if (j >= (boardcount / cols + 1)) {
printf("\n|}\n\n| valign=\"top\"|\n\n%s", board_th);
j = 0;
}
--
1.7.1
[View Less]
6/7 and 7/7 are new, the rest is unchanged(?) but rebased to current HEAD.
7/7 should be discussed before reviewing 2/7 in detail because id merge them
if 7/7's concept is accepted in general.
Stefan Tauner (7):
Introduce and use enum test_state
Refactor PCI and USB device status printing
print_wiki.c fix columns calculations
squash! print_wiki.c fix columns calculations
squash! print_wiki.c fix columns calculations
print_wiki.c: add a programmer column to the PCI and USB devices
…
[View More] lists
[RFC] Unify usbdev_status and pcidev_status into dev_status.
drkaiser.c | 2 +-
flash.h | 7 +-
flashrom.c | 43 +++
ft2232_spi.c | 15 +-
gfxnvidia.c | 2 +-
nic3com.c | 2 +-
nicintel.c | 2 +-
nicintel_spi.c | 2 +-
nicrealtek.c | 2 +-
ogp_spi.c | 2 +-
pcidev.c | 7 +-
print.c | 989 ++++++++++++++++++++++++++------------------------------
print_wiki.c | 216 ++++++++-----
programmer.h | 66 ++--
satamv.c | 2 +-
satasii.c | 2 +-
16 files changed, 686 insertions(+), 675 deletions(-)
dont fear the difflog... it's not that bad actually :)
[View Less]