aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/tidspbridge/dynload
diff options
context:
space:
mode:
authorArmando Uribe <x0095078@ti.com>2010-07-22 21:25:32 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-07-26 18:32:20 -0400
commit803cd75eff2d560d622da69569f0bf66a3ea4ed1 (patch)
treeaf7daa05aa38dda6b8eebb65cf5b531dd08ec8b6 /drivers/staging/tidspbridge/dynload
parentfe15ea8b86f19bf7c4d1a4ea7452f1bb04b8933a (diff)
staging: tidspbridge: Remove macros used as cast
This patch removes those macros that are used to perform casts Signed-off-by: Armando Uribe <x0095078@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/tidspbridge/dynload')
-rw-r--r--drivers/staging/tidspbridge/dynload/cload.c19
-rw-r--r--drivers/staging/tidspbridge/dynload/doff.h7
-rw-r--r--drivers/staging/tidspbridge/dynload/getsection.c16
-rw-r--r--drivers/staging/tidspbridge/dynload/reloc.c2
-rw-r--r--drivers/staging/tidspbridge/dynload/reloc_table_c6000.c2
-rw-r--r--drivers/staging/tidspbridge/dynload/tramp_table_c6000.c2
6 files changed, 15 insertions, 33 deletions
diff --git a/drivers/staging/tidspbridge/dynload/cload.c b/drivers/staging/tidspbridge/dynload/cload.c
index 32150f0c5e5..c85a5e88361 100644
--- a/drivers/staging/tidspbridge/dynload/cload.c
+++ b/drivers/staging/tidspbridge/dynload/cload.c
@@ -20,13 +20,6 @@
20#define LINKER_MODULES_HEADER ("_" MODULES_HEADER) 20#define LINKER_MODULES_HEADER ("_" MODULES_HEADER)
21 21
22/* 22/*
23 * we use the fact that DOFF section records are shaped just like
24 * ldr_section_info to reduce our section storage usage. This macro marks
25 * the places where that assumption is made
26 */
27#define DOFFSEC_IS_LDRSEC(pdoffsec) ((struct ldr_section_info *)(pdoffsec))
28
29/*
30 * forward references 23 * forward references
31 */ 24 */
32static void dload_symbols(struct dload_state *dlthis); 25static void dload_symbols(struct dload_state *dlthis);
@@ -519,17 +512,17 @@ static void allocate_sections(struct dload_state *dlthis)
519#if BITS_PER_AU <= BITS_PER_BYTE 512#if BITS_PER_AU <= BITS_PER_BYTE
520 /* attempt to insert the name of this section */ 513 /* attempt to insert the name of this section */
521 if (soffset < dlthis->dfile_hdr.df_strtab_size) 514 if (soffset < dlthis->dfile_hdr.df_strtab_size)
522 DOFFSEC_IS_LDRSEC(shp)->name = dlthis->str_head + 515 ((struct ldr_section_info *)shp)->name =
523 soffset; 516 dlthis->str_head + soffset;
524 else { 517 else {
525 dload_error(dlthis, "Bad name offset in section %d", 518 dload_error(dlthis, "Bad name offset in section %d",
526 curr_sect); 519 curr_sect);
527 DOFFSEC_IS_LDRSEC(shp)->name = NULL; 520 ((struct ldr_section_info *)shp)->name = NULL;
528 } 521 }
529#endif 522#endif
530 /* allocate target storage for sections that require it */ 523 /* allocate target storage for sections that require it */
531 if (ds_needs_allocation(shp)) { 524 if (ds_needs_allocation(shp)) {
532 *asecs = *DOFFSEC_IS_LDRSEC(shp); 525 *asecs = *(struct ldr_section_info *)shp;
533 asecs->context = 0; /* zero the context field */ 526 asecs->context = 0; /* zero the context field */
534#if BITS_PER_AU > BITS_PER_BYTE 527#if BITS_PER_AU > BITS_PER_BYTE
535 asecs->name = unpack_name(dlthis, soffset); 528 asecs->name = unpack_name(dlthis, soffset);
@@ -1162,7 +1155,7 @@ static void dload_data(struct dload_state *dlthis)
1162 if (curr_sect < dlthis->allocated_secn_count) 1155 if (curr_sect < dlthis->allocated_secn_count)
1163 dlthis->delta_runaddr = sptr->ds_paddr; 1156 dlthis->delta_runaddr = sptr->ds_paddr;
1164 else { 1157 else {
1165 lptr = DOFFSEC_IS_LDRSEC(sptr); 1158 lptr = (struct ldr_section_info *)sptr;
1166 dlthis->delta_runaddr = 0; 1159 dlthis->delta_runaddr = 0;
1167 } 1160 }
1168 dlthis->image_secn = lptr; 1161 dlthis->image_secn = lptr;
@@ -1337,7 +1330,7 @@ static void dload_data(struct dload_state *dlthis)
1337 goto loop_cont; 1330 goto loop_cont;
1338 1331
1339 if (curr_sect >= dlthis->allocated_secn_count) 1332 if (curr_sect >= dlthis->allocated_secn_count)
1340 lptr = DOFFSEC_IS_LDRSEC(sptr); 1333 lptr = (struct ldr_section_info *)sptr;
1341 1334
1342 if (cinit_processed) { 1335 if (cinit_processed) {
1343 /*Don't clear BSS after load-time initialization */ 1336 /*Don't clear BSS after load-time initialization */
diff --git a/drivers/staging/tidspbridge/dynload/doff.h b/drivers/staging/tidspbridge/dynload/doff.h
index c00d18985a7..a7c3145746e 100644
--- a/drivers/staging/tidspbridge/dynload/doff.h
+++ b/drivers/staging/tidspbridge/dynload/doff.h
@@ -24,11 +24,8 @@
24#ifndef _DOFF_H 24#ifndef _DOFF_H
25#define _DOFF_H 25#define _DOFF_H
26 26
27#ifndef UINT32_C
28#define UINT32_C(zzz) ((u32)zzz)
29#endif
30 27
31#define BYTE_RESHUFFLE_VALUE UINT32_C(0x00010203) 28#define BYTE_RESHUFFLE_VALUE 0x00010203
32 29
33/* DOFF file header containing fields categorizing the remainder of the file */ 30/* DOFF file header containing fields categorizing the remainder of the file */
34struct doff_filehdr_t { 31struct doff_filehdr_t {
@@ -312,7 +309,7 @@ struct reloc_record_t {
312 309
313/* Return the address/size >= to addr that is at a 32-bit boundary */ 310/* Return the address/size >= to addr that is at a 32-bit boundary */
314/* This assumes that a byte is 8 bits */ 311/* This assumes that a byte is 8 bits */
315#define DOFF_ALIGN(addr) (((addr) + 3) & ~UINT32_C(3)) 312#define DOFF_ALIGN(addr) (((addr) + 3) & ~3UL)
316 313
317/**************************************************************************** */ 314/**************************************************************************** */
318/* */ 315/* */
diff --git a/drivers/staging/tidspbridge/dynload/getsection.c b/drivers/staging/tidspbridge/dynload/getsection.c
index 30861189f9c..51a7167c8ec 100644
--- a/drivers/staging/tidspbridge/dynload/getsection.c
+++ b/drivers/staging/tidspbridge/dynload/getsection.c
@@ -34,14 +34,6 @@ static const char err_alloc[] = { "Syms->dload_allocate( %d ) failed" };
34static const char stbl[] = { "Bad string table offset " FMT_UI32 }; 34static const char stbl[] = { "Bad string table offset " FMT_UI32 };
35#endif 35#endif
36 36
37/*
38 * we use the fact that DOFF section records are shaped just like
39 * ldr_section_info to reduce our section storage usage. These macros
40 * marks the places where that assumption is made
41 */
42#define DOFFSEC_IS_LDRSEC(pdoffsec) ((struct ldr_section_info *)(pdoffsec))
43#define LDRSEC_IS_DOFFSEC(ldrsec) ((struct doff_scnhdr_t *)(ldrsec))
44
45/************************************************************** */ 37/************************************************************** */
46/********************* SUPPORT FUNCTIONS ********************** */ 38/********************* SUPPORT FUNCTIONS ********************** */
47/************************************************************** */ 39/************************************************************** */
@@ -110,7 +102,7 @@ static void expand_sec_names(struct dload_state *dlthis)
110 /* For each sec, copy and expand its name */ 102 /* For each sec, copy and expand its name */
111 curr = xstrings; 103 curr = xstrings;
112 for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) { 104 for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) {
113 shp = DOFFSEC_IS_LDRSEC(&dlthis->sect_hdrs[sec]); 105 shp = (struct ldr_section_info *)&dlthis->sect_hdrs[sec];
114 next = unpack_sec_name(dlthis, *(u32 *) &shp->name, curr); 106 next = unpack_sec_name(dlthis, *(u32 *) &shp->name, curr);
115 if (next == NULL) 107 if (next == NULL)
116 break; /* error */ 108 break; /* error */
@@ -213,7 +205,7 @@ void *dload_module_open(struct dynamic_loader_stream *module,
213 /* to a pointer into the string table. */ 205 /* to a pointer into the string table. */
214 for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) { 206 for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) {
215 struct ldr_section_info *shp = 207 struct ldr_section_info *shp =
216 DOFFSEC_IS_LDRSEC(&dlthis->sect_hdrs[sec]); 208 (struct ldr_section_info *)&dlthis->sect_hdrs[sec];
217 shp->name = dlthis->str_head + *(u32 *) &shp->name; 209 shp->name = dlthis->str_head + *(u32 *) &shp->name;
218 } 210 }
219#endif 211#endif
@@ -249,7 +241,7 @@ int dload_get_section_info(void *minfo, const char *section_name,
249 return false; 241 return false;
250 242
251 for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) { 243 for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) {
252 shp = DOFFSEC_IS_LDRSEC(&dlthis->sect_hdrs[sec]); 244 shp = (struct ldr_section_info *)&dlthis->sect_hdrs[sec];
253 if (strcmp(section_name, shp->name) == 0) { 245 if (strcmp(section_name, shp->name) == 0) {
254 *section_info = shp; 246 *section_info = shp;
255 return true; 247 return true;
@@ -294,7 +286,7 @@ int dload_get_section(void *minfo,
294 dlthis = (struct dload_state *)minfo; 286 dlthis = (struct dload_state *)minfo;
295 if (!dlthis) 287 if (!dlthis)
296 return false; 288 return false;
297 sptr = LDRSEC_IS_DOFFSEC(section_info); 289 sptr = (struct doff_scnhdr_t *)section_info;
298 if (sptr == NULL) 290 if (sptr == NULL)
299 return false; 291 return false;
300 292
diff --git a/drivers/staging/tidspbridge/dynload/reloc.c b/drivers/staging/tidspbridge/dynload/reloc.c
index ec59777dc06..7b28c07ed7c 100644
--- a/drivers/staging/tidspbridge/dynload/reloc.c
+++ b/drivers/staging/tidspbridge/dynload/reloc.c
@@ -107,7 +107,7 @@ int dload_repack(struct dload_state *dlthis, rvalue val, tgt_au_t * data,
107 107
108 fieldsz -= 1; /* avoid nastiness with 32-bit shift of 32-bit value */ 108 fieldsz -= 1; /* avoid nastiness with 32-bit shift of 32-bit value */
109 /* clip the bits */ 109 /* clip the bits */
110 mask = ((UINT32_C(2) << fieldsz) - 1); 110 mask = (2UL << fieldsz) - 1;
111 objval = (val & mask); 111 objval = (val & mask);
112 /* * store the bits through the specified mask */ 112 /* * store the bits through the specified mask */
113 if (TARGET_BIG_ENDIAN) { 113 if (TARGET_BIG_ENDIAN) {
diff --git a/drivers/staging/tidspbridge/dynload/reloc_table_c6000.c b/drivers/staging/tidspbridge/dynload/reloc_table_c6000.c
index 8ae3b38f398..a28bc044249 100644
--- a/drivers/staging/tidspbridge/dynload/reloc_table_c6000.c
+++ b/drivers/staging/tidspbridge/dynload/reloc_table_c6000.c
@@ -16,7 +16,7 @@
16 16
17/* Tables generated for c6000 */ 17/* Tables generated for c6000 */
18 18
19#define HASH_FUNC(zz) (((((zz) + 1) * UINT32_C(1845)) >> 11) & 63) 19#define HASH_FUNC(zz) (((((zz) + 1) * 1845UL) >> 11) & 63)
20#define HASH_L(zz) ((zz) >> 8) 20#define HASH_L(zz) ((zz) >> 8)
21#define HASH_I(zz) ((zz) & 0xFF) 21#define HASH_I(zz) ((zz) & 0xFF)
22 22
diff --git a/drivers/staging/tidspbridge/dynload/tramp_table_c6000.c b/drivers/staging/tidspbridge/dynload/tramp_table_c6000.c
index 47b7492717d..09cc64f213c 100644
--- a/drivers/staging/tidspbridge/dynload/tramp_table_c6000.c
+++ b/drivers/staging/tidspbridge/dynload/tramp_table_c6000.c
@@ -27,7 +27,7 @@
27#define C6X_TRAMP_MAX_RELOS 8 27#define C6X_TRAMP_MAX_RELOS 8
28 28
29/* THIS HASH FUNCTION MUST MATCH THE ONE reloc_table_c6000.c */ 29/* THIS HASH FUNCTION MUST MATCH THE ONE reloc_table_c6000.c */
30#define HASH_FUNC(zz) (((((zz) + 1) * UINT32_C(1845)) >> 11) & 63) 30#define HASH_FUNC(zz) (((((zz) + 1) * 1845UL) >> 11) & 63)
31 31
32/* THIS MUST MATCH reloc_record_t FOR A SYMBOL BASED RELO */ 32/* THIS MUST MATCH reloc_record_t FOR A SYMBOL BASED RELO */
33struct c6000_relo_record { 33struct c6000_relo_record {