Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 388abdac authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

staging: cxt1e1: cleanup mfg_template[] a bit



1) Make it static.
2) Change it to u8 data instead of short.
3) This means we can memcpy() it to the correct location instead of
   using a for loop.
4) With memcpy() we can use the union member we want directly instead of
   copying to the generic .bytes union member.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 91eef3e2
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -90,7 +90,7 @@ static int ByteReverseBuilt = FALSE;
 *------------------------------------------------------------------------
 *------------------------------------------------------------------------
 */
 */


short       mfg_template[sizeof (FLD_TYPE2)] =
static u8 mfg_template[sizeof(FLD_TYPE2)] =
{
{
    PROM_FORMAT_TYPE2,          /* type; */
    PROM_FORMAT_TYPE2,          /* type; */
    0x00, 0x1A,                 /* length[2]; */
    0x00, 0x1A,                 /* length[2]; */
@@ -491,13 +491,11 @@ pmc_init_seeprom (u_int32_t addr, u_int32_t serialNum)
    PROMFORMAT  buffer;         /* Memory image of structure */
    PROMFORMAT  buffer;         /* Memory image of structure */
    u_int32_t   crc;            /* CRC of structure */
    u_int32_t   crc;            /* CRC of structure */
    time_t      createTime;
    time_t      createTime;
    int         i;


    createTime = get_seconds ();
    createTime = get_seconds ();


    /* use template data */
    /* use template data */
    for (i = 0; i < sizeof (FLD_TYPE2); ++i)
    memcpy(&buffer.fldType2, mfg_template, sizeof(buffer.fldType2));
        buffer.bytes[i] = mfg_template[i];


    /* Update serial number field in buffer */
    /* Update serial number field in buffer */
    pmcSetBuffValue (&buffer.fldType2.Serial[3], serialNum, 3);
    pmcSetBuffValue (&buffer.fldType2.Serial[3], serialNum, 3);