All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 5/9] Remove typedefs from bmp_layout.h
Date: Wed, 13 May 2015 07:02:27 -0600	[thread overview]
Message-ID: <1431522151-20245-6-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1431522151-20245-1-git-send-email-sjg@chromium.org>

We try to avoid typedefs and these ones are easy enough to remove. Before
changing this header in the next patch, remove the typedefs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Joe Hershberger <joe.hershberger@gmail.com>
---

Changes in v2:
- Add new patch to remove typedefs from bmp_layout.h

 common/cmd_bmp.c            | 16 ++++++++--------
 common/lcd.c                | 10 +++++-----
 drivers/video/atmel_lcdfb.c |  4 ++--
 drivers/video/bus_vcxk.c    |  4 ++--
 drivers/video/cfb_console.c | 10 +++++-----
 include/bmp_layout.h        | 17 ++++++++---------
 6 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index cc904c2..cb1f071 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -34,12 +34,12 @@ static int bmp_info (ulong addr);
  * didn't contain a valid BMP signature.
  */
 #ifdef CONFIG_VIDEO_BMP_GZIP
-bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp,
-			void **alloc_addr)
+struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
+			     void **alloc_addr)
 {
 	void *dst;
 	unsigned long len;
-	bmp_image_t *bmp;
+	struct bmp_image *bmp;
 
 	/*
 	 * Decompress bmp image
@@ -55,7 +55,7 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp,
 	bmp = dst;
 
 	/* align to 32-bit-aligned-address + 2 */
-	bmp = (bmp_image_t *)((((unsigned int)dst + 1) & ~3) + 2);
+	bmp = (struct bmp_image *)((((unsigned int)dst + 1) & ~3) + 2);
 
 	if (gunzip(bmp, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, (uchar *)addr, &len) != 0) {
 		free(dst);
@@ -80,8 +80,8 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp,
 	return bmp;
 }
 #else
-bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp,
-			void **alloc_addr)
+struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
+			     void **alloc_addr)
 {
 	return NULL;
 }
@@ -187,7 +187,7 @@ U_BOOT_CMD(
  */
 static int bmp_info(ulong addr)
 {
-	bmp_image_t *bmp=(bmp_image_t *)addr;
+	struct bmp_image *bmp = (struct bmp_image *)addr;
 	void *bmp_alloc_addr = NULL;
 	unsigned long len;
 
@@ -224,7 +224,7 @@ static int bmp_info(ulong addr)
 int bmp_display(ulong addr, int x, int y)
 {
 	int ret;
-	bmp_image_t *bmp = (bmp_image_t *)addr;
+	struct bmp_image *bmp = (struct bmp_image *)addr;
 	void *bmp_alloc_addr = NULL;
 	unsigned long len;
 
diff --git a/common/lcd.c b/common/lcd.c
index 055c366..c7f2830 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -448,8 +448,8 @@ static void draw_encoded_bitmap(ushort **fbp, ushort c, int cnt)
 /*
  * Do not call this function directly, must be called from lcd_display_bitmap.
  */
-static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
-				    int x_off, int y_off)
+static void lcd_display_rle8_bitmap(struct bmp_image *bmp, ushort *cmap,
+				    uchar *fb, int x_off, int y_off)
 {
 	uchar *bmap;
 	ulong width, height;
@@ -548,10 +548,10 @@ __weak void fb_put_word(uchar **fb, uchar **from)
 }
 #endif /* CONFIG_BMP_16BPP */
 
-__weak void lcd_set_cmap(bmp_image_t *bmp, unsigned colors)
+__weak void lcd_set_cmap(struct bmp_image *bmp, unsigned colors)
 {
 	int i;
-	bmp_color_table_entry_t cte;
+	struct bmp_color_table_entry cte;
 	ushort *cmap = configuration_get_cmap();
 
 	for (i = 0; i < colors; ++i) {
@@ -572,7 +572,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	ushort *cmap_base = NULL;
 	ushort i, j;
 	uchar *fb;
-	bmp_image_t *bmp = (bmp_image_t *)map_sysmem(bmp_image, 0);
+	struct bmp_image *bmp = (struct bmp_image *)map_sysmem(bmp_image, 0);
 	uchar *bmap;
 	ushort padded_width;
 	unsigned long width, height, byte_width;
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 4ed3a49..d43d8a5 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -81,12 +81,12 @@ void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
 #endif
 }
 
-void lcd_set_cmap(bmp_image_t *bmp, unsigned colors)
+void lcd_set_cmap(struct bmp_image *bmp, unsigned colors)
 {
 	int i;
 
 	for (i = 0; i < colors; ++i) {
-		bmp_color_table_entry_t cte = bmp->color_table[i];
+		struct bmp_color_table_entry cte = bmp->color_table[i];
 		lcd_setcolreg(i, cte.red, cte.green, cte.blue);
 	}
 }
diff --git a/drivers/video/bus_vcxk.c b/drivers/video/bus_vcxk.c
index 60a5cc5..2f54d3d 100644
--- a/drivers/video/bus_vcxk.c
+++ b/drivers/video/bus_vcxk.c
@@ -358,7 +358,7 @@ void vcxk_draw_mono(unsigned char *dataptr, unsigned long linewidth,
 
 int vcxk_display_bitmap(ulong addr, int x, int y)
 {
-	bmp_image_t *bmp;
+	struct bmp_image *bmp;
 	unsigned long width;
 	unsigned long height;
 	unsigned long bpp;
@@ -369,7 +369,7 @@ int vcxk_display_bitmap(ulong addr, int x, int y)
 	unsigned long c_height;
 	unsigned char *dataptr;
 
-	bmp = (bmp_image_t *) addr;
+	bmp = (struct bmp_image *)addr;
 	if ((bmp->header.signature[0] == 'B') &&
 	    (bmp->header.signature[1] == 'M')) {
 		width        = le32_to_cpu(bmp->header.width);
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index f4231b8..7f2ddc1 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1295,7 +1295,7 @@ static void draw_bitmap(uchar **fb, uchar *bm, struct palette *p,
 	*fb = (uchar *) addr;	/* return modified address */
 }
 
-static int display_rle8_bitmap(bmp_image_t *img, int xoff, int yoff,
+static int display_rle8_bitmap(struct bmp_image *img, int xoff, int yoff,
 			       int width, int height)
 {
 	unsigned char *bm;
@@ -1304,7 +1304,7 @@ static int display_rle8_bitmap(bmp_image_t *img, int xoff, int yoff,
 	int decode = 1;
 	int x, y, bpp, i, ncolors;
 	struct palette p[256];
-	bmp_color_table_entry_t cte;
+	struct bmp_color_table_entry cte;
 	int green_shift, red_off;
 	int limit = VIDEO_COLS * VIDEO_ROWS;
 	int pixels = 0;
@@ -1447,13 +1447,13 @@ int video_display_bitmap(ulong bmp_image, int x, int y)
 {
 	ushort xcount, ycount;
 	uchar *fb;
-	bmp_image_t *bmp = (bmp_image_t *) bmp_image;
+	struct bmp_image *bmp = (struct bmp_image *)bmp_image;
 	uchar *bmap;
 	ushort padded_line;
 	unsigned long width, height, bpp;
 	unsigned colors;
 	unsigned long compression;
-	bmp_color_table_entry_t cte;
+	struct bmp_color_table_entry cte;
 
 #ifdef CONFIG_VIDEO_BMP_GZIP
 	unsigned char *dst = NULL;
@@ -1495,7 +1495,7 @@ int video_display_bitmap(ulong bmp_image, int x, int y)
 		/*
 		 * Set addr to decompressed image
 		 */
-		bmp = (bmp_image_t *)(dst+2);
+		bmp = (struct bmp_image *)(dst+2);
 
 		if (!((bmp->header.signature[0] == 'B') &&
 		      (bmp->header.signature[1] == 'M'))) {
diff --git a/include/bmp_layout.h b/include/bmp_layout.h
index 22b1fbc..55db8b8 100644
--- a/include/bmp_layout.h
+++ b/include/bmp_layout.h
@@ -11,17 +11,17 @@
 #ifndef _BMP_H_
 #define _BMP_H_
 
-typedef struct bmp_color_table_entry {
+struct __packed bmp_color_table_entry {
 	__u8	blue;
 	__u8	green;
 	__u8	red;
 	__u8	reserved;
-} __attribute__ ((packed)) bmp_color_table_entry_t;
+};
 
 /* When accessing these fields, remember that they are stored in little
    endian format, so use linux macros, e.g. le32_to_cpu(width)          */
 
-typedef struct bmp_header {
+struct __packed bmp_header {
 	/* Header */
 	char signature[2];
 	__u32	file_size;
@@ -40,15 +40,14 @@ typedef struct bmp_header {
 	__u32	colors_used;
 	__u32	colors_important;
 	/* ColorTable */
+};
 
-} __attribute__ ((packed)) bmp_header_t;
-
-typedef struct bmp_image {
-	bmp_header_t header;
+struct bmp_image {
+	struct bmp_header header;
 	/* We use a zero sized array just as a placeholder for variable
 	   sized array */
-	bmp_color_table_entry_t color_table[0];
-} bmp_image_t;
+	struct bmp_color_table_entry color_table[0];
+};
 
 /* Data in the bmp_image is aligned to this length */
 #define BMP_DATA_ALIGN	4
-- 
2.2.0.rc0.207.ga3a616c

  parent reply	other threads:[~2015-05-13 13:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 13:02 [U-Boot] [PATCH v2 0/9] Collected fixes and improvements Simon Glass
2015-05-13 13:02 ` [U-Boot] [PATCH v2 1/9] dm: usb: Implement usb_detect_change() for driver model Simon Glass
2015-06-11 20:18   ` Simon Glass
2015-05-13 13:02 ` [U-Boot] [PATCH v2 2/9] arm: spl: Add an API to detect when U-Boot is started from SPL Simon Glass
2015-06-11 20:18   ` Simon Glass
2015-05-13 13:02 ` [U-Boot] [PATCH v2 3/9] arm: Allow cleanup_before_linux() without disabling caches Simon Glass
2015-06-11 20:18   ` Simon Glass
2015-05-13 13:02 ` [U-Boot] [PATCH v2 4/9] sandbox: Add an implementation for cleanup_before_linux_select() Simon Glass
2015-06-11 20:19   ` Simon Glass
2015-05-13 13:02 ` Simon Glass [this message]
2015-05-13 15:38   ` [U-Boot] [PATCH v2 5/9] Remove typedefs from bmp_layout.h Joe Hershberger
2015-06-11 20:19     ` Simon Glass
2015-05-13 13:02 ` [U-Boot] [PATCH v2 6/9] lcd: Support colour lookup table on 16bpp display in BMP images Simon Glass
2015-06-11 20:19   ` Simon Glass
2015-05-13 13:02 ` [U-Boot] [PATCH v2 7/9] tegra124: Implement spl_was_boot_source() Simon Glass
2015-05-13 13:02 ` [U-Boot] [PATCH v2 8/9] tegra: nyan-big: Allow TPM on I2C Simon Glass
2015-05-13 13:53   ` Stephen Warren
2015-05-13 13:57     ` Simon Glass
2015-05-13 14:33       ` Stephen Warren
2015-07-03 23:14         ` Simon Glass
2015-05-13 13:02 ` [U-Boot] [PATCH v2 9/9] tegra124: Expand SPL space by 8KB Simon Glass

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=1431522151-20245-6-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.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.