Commit 803cd75e authored by Armando Uribe's avatar Armando Uribe Committed by Greg Kroah-Hartman

staging: tidspbridge: Remove macros used as cast

This patch removes those macros that are used to
perform casts
Signed-off-by: default avatarArmando Uribe <x0095078@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fe15ea8b
...@@ -19,13 +19,6 @@ ...@@ -19,13 +19,6 @@
#include "module_list.h" #include "module_list.h"
#define LINKER_MODULES_HEADER ("_" MODULES_HEADER) #define LINKER_MODULES_HEADER ("_" MODULES_HEADER)
/*
* we use the fact that DOFF section records are shaped just like
* ldr_section_info to reduce our section storage usage. This macro marks
* the places where that assumption is made
*/
#define DOFFSEC_IS_LDRSEC(pdoffsec) ((struct ldr_section_info *)(pdoffsec))
/* /*
* forward references * forward references
*/ */
...@@ -519,17 +512,17 @@ static void allocate_sections(struct dload_state *dlthis) ...@@ -519,17 +512,17 @@ static void allocate_sections(struct dload_state *dlthis)
#if BITS_PER_AU <= BITS_PER_BYTE #if BITS_PER_AU <= BITS_PER_BYTE
/* attempt to insert the name of this section */ /* attempt to insert the name of this section */
if (soffset < dlthis->dfile_hdr.df_strtab_size) if (soffset < dlthis->dfile_hdr.df_strtab_size)
DOFFSEC_IS_LDRSEC(shp)->name = dlthis->str_head + ((struct ldr_section_info *)shp)->name =
soffset; dlthis->str_head + soffset;
else { else {
dload_error(dlthis, "Bad name offset in section %d", dload_error(dlthis, "Bad name offset in section %d",
curr_sect); curr_sect);
DOFFSEC_IS_LDRSEC(shp)->name = NULL; ((struct ldr_section_info *)shp)->name = NULL;
} }
#endif #endif
/* allocate target storage for sections that require it */ /* allocate target storage for sections that require it */
if (ds_needs_allocation(shp)) { if (ds_needs_allocation(shp)) {
*asecs = *DOFFSEC_IS_LDRSEC(shp); *asecs = *(struct ldr_section_info *)shp;
asecs->context = 0; /* zero the context field */ asecs->context = 0; /* zero the context field */
#if BITS_PER_AU > BITS_PER_BYTE #if BITS_PER_AU > BITS_PER_BYTE
asecs->name = unpack_name(dlthis, soffset); asecs->name = unpack_name(dlthis, soffset);
...@@ -1162,7 +1155,7 @@ static void dload_data(struct dload_state *dlthis) ...@@ -1162,7 +1155,7 @@ static void dload_data(struct dload_state *dlthis)
if (curr_sect < dlthis->allocated_secn_count) if (curr_sect < dlthis->allocated_secn_count)
dlthis->delta_runaddr = sptr->ds_paddr; dlthis->delta_runaddr = sptr->ds_paddr;
else { else {
lptr = DOFFSEC_IS_LDRSEC(sptr); lptr = (struct ldr_section_info *)sptr;
dlthis->delta_runaddr = 0; dlthis->delta_runaddr = 0;
} }
dlthis->image_secn = lptr; dlthis->image_secn = lptr;
...@@ -1337,7 +1330,7 @@ static void dload_data(struct dload_state *dlthis) ...@@ -1337,7 +1330,7 @@ static void dload_data(struct dload_state *dlthis)
goto loop_cont; goto loop_cont;
if (curr_sect >= dlthis->allocated_secn_count) if (curr_sect >= dlthis->allocated_secn_count)
lptr = DOFFSEC_IS_LDRSEC(sptr); lptr = (struct ldr_section_info *)sptr;
if (cinit_processed) { if (cinit_processed) {
/*Don't clear BSS after load-time initialization */ /*Don't clear BSS after load-time initialization */
......
...@@ -24,11 +24,8 @@ ...@@ -24,11 +24,8 @@
#ifndef _DOFF_H #ifndef _DOFF_H
#define _DOFF_H #define _DOFF_H
#ifndef UINT32_C
#define UINT32_C(zzz) ((u32)zzz)
#endif
#define BYTE_RESHUFFLE_VALUE UINT32_C(0x00010203) #define BYTE_RESHUFFLE_VALUE 0x00010203
/* DOFF file header containing fields categorizing the remainder of the file */ /* DOFF file header containing fields categorizing the remainder of the file */
struct doff_filehdr_t { struct doff_filehdr_t {
...@@ -312,7 +309,7 @@ struct reloc_record_t { ...@@ -312,7 +309,7 @@ struct reloc_record_t {
/* Return the address/size >= to addr that is at a 32-bit boundary */ /* Return the address/size >= to addr that is at a 32-bit boundary */
/* This assumes that a byte is 8 bits */ /* This assumes that a byte is 8 bits */
#define DOFF_ALIGN(addr) (((addr) + 3) & ~UINT32_C(3)) #define DOFF_ALIGN(addr) (((addr) + 3) & ~3UL)
/**************************************************************************** */ /**************************************************************************** */
/* */ /* */
......
...@@ -34,14 +34,6 @@ static const char err_alloc[] = { "Syms->dload_allocate( %d ) failed" }; ...@@ -34,14 +34,6 @@ static const char err_alloc[] = { "Syms->dload_allocate( %d ) failed" };
static const char stbl[] = { "Bad string table offset " FMT_UI32 }; static const char stbl[] = { "Bad string table offset " FMT_UI32 };
#endif #endif
/*
* we use the fact that DOFF section records are shaped just like
* ldr_section_info to reduce our section storage usage. These macros
* marks the places where that assumption is made
*/
#define DOFFSEC_IS_LDRSEC(pdoffsec) ((struct ldr_section_info *)(pdoffsec))
#define LDRSEC_IS_DOFFSEC(ldrsec) ((struct doff_scnhdr_t *)(ldrsec))
/************************************************************** */ /************************************************************** */
/********************* SUPPORT FUNCTIONS ********************** */ /********************* SUPPORT FUNCTIONS ********************** */
/************************************************************** */ /************************************************************** */
...@@ -110,7 +102,7 @@ static void expand_sec_names(struct dload_state *dlthis) ...@@ -110,7 +102,7 @@ static void expand_sec_names(struct dload_state *dlthis)
/* For each sec, copy and expand its name */ /* For each sec, copy and expand its name */
curr = xstrings; curr = xstrings;
for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) { for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) {
shp = DOFFSEC_IS_LDRSEC(&dlthis->sect_hdrs[sec]); shp = (struct ldr_section_info *)&dlthis->sect_hdrs[sec];
next = unpack_sec_name(dlthis, *(u32 *) &shp->name, curr); next = unpack_sec_name(dlthis, *(u32 *) &shp->name, curr);
if (next == NULL) if (next == NULL)
break; /* error */ break; /* error */
...@@ -213,7 +205,7 @@ void *dload_module_open(struct dynamic_loader_stream *module, ...@@ -213,7 +205,7 @@ void *dload_module_open(struct dynamic_loader_stream *module,
/* to a pointer into the string table. */ /* to a pointer into the string table. */
for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) { for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) {
struct ldr_section_info *shp = struct ldr_section_info *shp =
DOFFSEC_IS_LDRSEC(&dlthis->sect_hdrs[sec]); (struct ldr_section_info *)&dlthis->sect_hdrs[sec];
shp->name = dlthis->str_head + *(u32 *) &shp->name; shp->name = dlthis->str_head + *(u32 *) &shp->name;
} }
#endif #endif
...@@ -249,7 +241,7 @@ int dload_get_section_info(void *minfo, const char *section_name, ...@@ -249,7 +241,7 @@ int dload_get_section_info(void *minfo, const char *section_name,
return false; return false;
for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) { for (sec = 0; sec < dlthis->dfile_hdr.df_no_scns; sec++) {
shp = DOFFSEC_IS_LDRSEC(&dlthis->sect_hdrs[sec]); shp = (struct ldr_section_info *)&dlthis->sect_hdrs[sec];
if (strcmp(section_name, shp->name) == 0) { if (strcmp(section_name, shp->name) == 0) {
*section_info = shp; *section_info = shp;
return true; return true;
...@@ -294,7 +286,7 @@ int dload_get_section(void *minfo, ...@@ -294,7 +286,7 @@ int dload_get_section(void *minfo,
dlthis = (struct dload_state *)minfo; dlthis = (struct dload_state *)minfo;
if (!dlthis) if (!dlthis)
return false; return false;
sptr = LDRSEC_IS_DOFFSEC(section_info); sptr = (struct doff_scnhdr_t *)section_info;
if (sptr == NULL) if (sptr == NULL)
return false; return false;
......
...@@ -107,7 +107,7 @@ int dload_repack(struct dload_state *dlthis, rvalue val, tgt_au_t * data, ...@@ -107,7 +107,7 @@ int dload_repack(struct dload_state *dlthis, rvalue val, tgt_au_t * data,
fieldsz -= 1; /* avoid nastiness with 32-bit shift of 32-bit value */ fieldsz -= 1; /* avoid nastiness with 32-bit shift of 32-bit value */
/* clip the bits */ /* clip the bits */
mask = ((UINT32_C(2) << fieldsz) - 1); mask = (2UL << fieldsz) - 1;
objval = (val & mask); objval = (val & mask);
/* * store the bits through the specified mask */ /* * store the bits through the specified mask */
if (TARGET_BIG_ENDIAN) { if (TARGET_BIG_ENDIAN) {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Tables generated for c6000 */ /* Tables generated for c6000 */
#define HASH_FUNC(zz) (((((zz) + 1) * UINT32_C(1845)) >> 11) & 63) #define HASH_FUNC(zz) (((((zz) + 1) * 1845UL) >> 11) & 63)
#define HASH_L(zz) ((zz) >> 8) #define HASH_L(zz) ((zz) >> 8)
#define HASH_I(zz) ((zz) & 0xFF) #define HASH_I(zz) ((zz) & 0xFF)
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#define C6X_TRAMP_MAX_RELOS 8 #define C6X_TRAMP_MAX_RELOS 8
/* THIS HASH FUNCTION MUST MATCH THE ONE reloc_table_c6000.c */ /* THIS HASH FUNCTION MUST MATCH THE ONE reloc_table_c6000.c */
#define HASH_FUNC(zz) (((((zz) + 1) * UINT32_C(1845)) >> 11) & 63) #define HASH_FUNC(zz) (((((zz) + 1) * 1845UL) >> 11) & 63)
/* THIS MUST MATCH reloc_record_t FOR A SYMBOL BASED RELO */ /* THIS MUST MATCH reloc_record_t FOR A SYMBOL BASED RELO */
struct c6000_relo_record { struct c6000_relo_record {
......
...@@ -41,10 +41,7 @@ ...@@ -41,10 +41,7 @@
/* Max buffer length */ /* Max buffer length */
#define MAXEXPR 128 #define MAXEXPR 128
#ifndef UINT32_C #define DOFF_ALIGN(x) (((x) + 3) & ~3UL)
#define UINT32_C(zzz) ((uint32_t)zzz)
#endif
#define DOFF_ALIGN(x) (((x) + 3) & ~UINT32_C(3))
/* /*
* ======== struct dbll_tar_obj* ======== * ======== struct dbll_tar_obj* ========
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment