mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Vicente Bergas <vicencb@gmail.com>
To: barebox@lists.infradead.org
Cc: Vicente Bergas <vicencb@gmail.com>
Subject: [PATCH 2/6] ArchosG9: zero all features before setting them
Date: Sat, 16 Mar 2013 23:59:38 +0100	[thread overview]
Message-ID: <1363474782-21973-3-git-send-email-vicencb@gmail.com> (raw)
In-Reply-To: <1363474782-21973-1-git-send-email-vicencb@gmail.com>


Signed-off-by: Vicente Bergas <vicencb@gmail.com>
---
 arch/arm/boards/archosg9/archos_features.c | 58 +++++++++---------------------
 1 file changed, 16 insertions(+), 42 deletions(-)

diff --git a/arch/arm/boards/archosg9/archos_features.c b/arch/arm/boards/archosg9/archos_features.c
index 5d93403..b396734 100644
--- a/arch/arm/boards/archosg9/archos_features.c
+++ b/arch/arm/boards/archosg9/archos_features.c
@@ -27,9 +27,9 @@ static void setup_feature_core(void)
 	features->hdr.tag = FTAG_CORE;
 	features->hdr.size = feature_tag_size(feature_tag_core);
 
+	memset(&features->u.core, 0, sizeof(features->u.core));
 	features->u.core.magic = FEATURE_LIST_MAGIC;
 	features->u.core.list_revision = FEATURE_LIST_REV;
-	features->u.core.flags = 0;
 
 	features = feature_tag_next(features);
 }
@@ -38,8 +38,7 @@ static void setup_feature_product_name(void)
 	features->hdr.tag = FTAG_PRODUCT_NAME;
 	features->hdr.size = feature_tag_size(feature_tag_product_name);
 
-	memset(features->u.product_name.name, 0,
-		sizeof(features->u.product_name.name));
+	memset(&features->u.product_name, 0, sizeof(features->u.product_name));
 	sprintf(features->u.product_name.name, "A80S");
 	features->u.product_name.id = 0x13A8;
 
@@ -50,10 +49,8 @@ static void setup_feature_product_serial_number(void)
 	features->hdr.tag = FTAG_PRODUCT_SERIAL_NUMBER;
 	features->hdr.size = feature_tag_size(feature_tag_product_serial);
 
-	features->u.product_serial.serial[0] = 0;
-	features->u.product_serial.serial[1] = 0;
-	features->u.product_serial.serial[2] = 0;
-	features->u.product_serial.serial[3] = 0;
+	memset(&features->u.product_serial, 0,
+		sizeof(features->u.product_serial));
 
 	features = feature_tag_next(features);
 }
@@ -62,14 +59,7 @@ static void setup_feature_product_mac_address(void)
 	features->hdr.tag = FTAG_PRODUCT_MAC_ADDRESS;
 	features->hdr.size = feature_tag_size(feature_tag_product_mac_address);
 
-	features->u.mac_address.addr[0] = 0;
-	features->u.mac_address.addr[1] = 0;
-	features->u.mac_address.addr[2] = 0;
-	features->u.mac_address.addr[3] = 0;
-	features->u.mac_address.addr[4] = 0;
-	features->u.mac_address.addr[5] = 0;
-	features->u.mac_address.reserved1 = 0;
-	features->u.mac_address.reserved2 = 0;
+	memset(&features->u.mac_address, 0, sizeof(features->u.mac_address));
 
 	features = feature_tag_next(features);
 }
@@ -78,6 +68,8 @@ static void setup_feature_board_pcb_revision(void)
 	features->hdr.tag = FTAG_BOARD_PCB_REVISION;
 	features->hdr.size = feature_tag_size(feature_tag_board_revision);
 
+	memset(&features->u.board_revision, 0,
+		sizeof(features->u.board_revision));
 	features->u.board_revision.revision = 5;
 
 	features = feature_tag_next(features);
@@ -87,23 +79,10 @@ static void setup_feature_sdram(void)
 	features->hdr.tag = FTAG_SDRAM;
 	features->hdr.size = feature_tag_size(feature_tag_sdram);
 
-	memset(features->u.sdram.vendor, 0, sizeof(features->u.sdram.vendor));
-	memset(features->u.sdram.product, 0,
-		sizeof(features->u.sdram.product));
+	memset(&features->u.sdram, 0, sizeof(features->u.sdram));
 	sprintf(features->u.sdram.vendor , "elpida");
-	sprintf(features->u.sdram.product, "EDB8064B1PB"/*"EDB4064B2PB"*/);
-	features->u.sdram.type     = 0;
-	features->u.sdram.revision = 0;
-	features->u.sdram.flags    = 0;
-	features->u.sdram.clock    = 400;
-	features->u.sdram.param_0  = 0;
-	features->u.sdram.param_1  = 0;
-	features->u.sdram.param_2  = 0;
-	features->u.sdram.param_3  = 0;
-	features->u.sdram.param_4  = 0;
-	features->u.sdram.param_5  = 0;
-	features->u.sdram.param_6  = 0;
-	features->u.sdram.param_7  = 0;
+	sprintf(features->u.sdram.product, "EDB8064B1PB");
+	features->u.sdram.clock = 400;
 
 	features = feature_tag_next(features);
 }
@@ -112,6 +91,7 @@ static void setup_feature_pmic(void)
 	features->hdr.tag = FTAG_PMIC;
 	features->hdr.size = feature_tag_size(feature_tag_pmic);
 
+	memset(&features->u.pmic, 0, sizeof(features->u.pmic));
 	features->u.pmic.flags = FTAG_PMIC_TPS62361;
 
 	features = feature_tag_next(features);
@@ -121,6 +101,7 @@ static void setup_feature_serial_port(void)
 	features->hdr.tag = FTAG_SERIAL_PORT;
 	features->hdr.size = feature_tag_size(feature_tag_serial_port);
 
+	memset(&features->u.serial_port, 0, sizeof(features->u.serial_port));
 	features->u.serial_port.uart_id = 1;
 	features->u.serial_port.speed = 115200;
 
@@ -131,9 +112,10 @@ static void setup_feature_has_gpio_volume_keys(void)
 	features->hdr.tag = FTAG_HAS_GPIO_VOLUME_KEYS;
 	features->hdr.size = feature_tag_size(feature_tag_gpio_volume_keys);
 
+	memset(&features->u.gpio_volume_keys, 0,
+		sizeof(features->u.gpio_volume_keys));
 	features->u.gpio_volume_keys.gpio_vol_up   = 0x2B;
 	features->u.gpio_volume_keys.gpio_vol_down = 0x2C;
-	features->u.gpio_volume_keys.flags = 0;
 
 	features = feature_tag_next(features);
 }
@@ -142,18 +124,9 @@ static void setup_feature_screen(void)
 	features->hdr.tag = FTAG_SCREEN;
 	features->hdr.size = feature_tag_size(feature_tag_screen);
 
-	memset(features->u.screen.vendor, 0,
-		sizeof(features->u.screen.vendor));
+	memset(&features->u.screen, 0, sizeof(features->u.screen));
 	sprintf(features->u.screen.vendor, "CMI");
-	features->u.screen.type = 0;
-	features->u.screen.revision = 0;
-	features->u.screen.vcom = 0;
 	features->u.screen.backlight = 0xC8;
-	features->u.screen.reserved[0] = 0;
-	features->u.screen.reserved[1] = 0;
-	features->u.screen.reserved[2] = 0;
-	features->u.screen.reserved[3] = 0;
-	features->u.screen.reserved[4] = 0;
 
 	features = feature_tag_next(features);
 }
@@ -162,6 +135,7 @@ static void setup_feature_turbo(void)
 	features->hdr.tag = FTAG_TURBO;
 	features->hdr.size = feature_tag_size(feature_tag_turbo);
 
+	memset(&features->u.turbo, 0, sizeof(features->u.turbo));
 	features->u.turbo.flag = 1;
 
 	features = feature_tag_next(features);
-- 
1.8.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-03-16 23:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-16 22:59 [PATCH 0/6] ArchosG9: add keyboard input and new reset menu entries (v2) Vicente Bergas
2013-03-16 22:59 ` [PATCH 1/6] OMAP4: check for usb availability at device registration Vicente Bergas
2013-03-16 22:59 ` Vicente Bergas [this message]
2013-03-16 22:59 ` [PATCH 3/6] gpio_keys: detect keys pressed before booting Vicente Bergas
2013-03-16 22:59 ` [PATCH 4/6] OMAP4: add command to select next boot device priority Vicente Bergas
2013-03-25  9:36   ` Sascha Hauer
2013-03-16 22:59 ` [PATCH 5/6] ArchosG9: add keyboard input and new reset menu entries Vicente Bergas
2013-03-16 22:59 ` [PATCH 6/6] menu: avoid errors when building submenus Vicente Bergas
2013-03-25  9:39 ` [PATCH 0/6] ArchosG9: add keyboard input and new reset menu entries (v2) Sascha Hauer
2013-03-25 13:56   ` vj

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=1363474782-21973-3-git-send-email-vicencb@gmail.com \
    --to=vicencb@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox