lkml.org 
[lkml]   [2011]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[44/80] firmware: Sigma: Fix endianess issues
    3.0-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Lars-Peter Clausen <lars@metafoo.de>

    commit bda63586bc5929e97288cdb371bb6456504867ed upstream.

    Currently the SigmaDSP firmware loader only works correctly on little-endian
    systems. Fix this by using the proper endianess conversion functions.

    Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
    Acked-by: Mike Frysinger <vapier@gentoo.org>
    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    drivers/firmware/sigma.c | 2 +-
    include/linux/sigma.h | 8 ++++----
    2 files changed, 5 insertions(+), 5 deletions(-)

    --- a/drivers/firmware/sigma.c
    +++ b/drivers/firmware/sigma.c
    @@ -133,7 +133,7 @@ int process_sigma_firmware(struct i2c_cl
    crc = crc32(0, fw->data + sizeof(*ssfw_head),
    fw->size - sizeof(*ssfw_head));
    pr_debug("%s: crc=%x\n", __func__, crc);
    - if (crc != ssfw_head->crc)
    + if (crc != le32_to_cpu(ssfw_head->crc))
    goto done;

    ssfw.pos = sizeof(*ssfw_head);
    --- a/include/linux/sigma.h
    +++ b/include/linux/sigma.h
    @@ -24,7 +24,7 @@ struct sigma_firmware {
    struct sigma_firmware_header {
    unsigned char magic[7];
    u8 version;
    - u32 crc;
    + __le32 crc;
    };

    enum {
    @@ -40,14 +40,14 @@ enum {
    struct sigma_action {
    u8 instr;
    u8 len_hi;
    - u16 len;
    - u16 addr;
    + __le16 len;
    + __be16 addr;
    unsigned char payload[];
    };

    static inline u32 sigma_action_len(struct sigma_action *sa)
    {
    - return (sa->len_hi << 16) | sa->len;
    + return (sa->len_hi << 16) | le16_to_cpu(sa->len);
    }

    extern int process_sigma_firmware(struct i2c_client *client, const char *name);



    \
     
     \ /
      Last update: 2011-12-07 18:01    [W:0.020 / U:2.064 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site