From 42a0b31827e4c555efebda7d347cf4ea6b82913a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 5 Jun 2009 09:29:22 +0200 Subject: [PATCH] ALSA: ctxfi - Fix endian-dependent codes The UAA-mode check in hwct20k1.c is implemented with the endian-dependent codes. Fix to be more portable (and readable). Signed-off-by: Takashi Iwai --- sound/pci/ctxfi/cthw20k1.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c index 1da1f82fe81..fd5f454c404 100644 --- a/sound/pci/ctxfi/cthw20k1.c +++ b/sound/pci/ctxfi/cthw20k1.c @@ -1785,6 +1785,8 @@ static int hw_have_digit_io_switch(struct hw *hw) || ((subsys_id & 0xf000) == 0x6000)); } +#define CTLBITS(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) + #define UAA_CFG_PWRSTATUS 0x44 #define UAA_CFG_SPACE_FLAG 0xA0 #define UAA_CORE_CHANGE 0x3FFC @@ -1792,12 +1794,18 @@ static int uaa_to_xfi(struct pci_dev *pci) { unsigned int bar0, bar1, bar2, bar3, bar4, bar5; unsigned int cmd, irq, cl_size, l_timer, pwr; - unsigned int CTLA, CTLZ, CTLL, CTLX, CTL_, CTLF, CTLi; unsigned int is_uaa = 0; unsigned int data[4] = {0}; unsigned int io_base; void *mem_base; int i = 0; + const u32 CTLX = CTLBITS('C', 'T', 'L', 'X'); + const u32 CTL_ = CTLBITS('C', 'T', 'L', '-'); + const u32 CTLF = CTLBITS('C', 'T', 'L', 'F'); + const u32 CTLi = CTLBITS('C', 'T', 'L', 'i'); + const u32 CTLA = CTLBITS('C', 'T', 'L', 'A'); + const u32 CTLZ = CTLBITS('C', 'T', 'L', 'Z'); + const u32 CTLL = CTLBITS('C', 'T', 'L', 'L'); /* By default, Hendrix card UAA Bar0 should be using memory... */ io_base = pci_resource_start(pci, 0); @@ -1805,14 +1813,6 @@ static int uaa_to_xfi(struct pci_dev *pci) if (NULL == mem_base) return -ENOENT; - CTLX = ___constant_swab32(*((unsigned int *)"CTLX")); - CTL_ = ___constant_swab32(*((unsigned int *)"CTL-")); - CTLF = ___constant_swab32(*((unsigned int *)"CTLF")); - CTLi = ___constant_swab32(*((unsigned int *)"CTLi")); - CTLA = ___constant_swab32(*((unsigned int *)"CTLA")); - CTLZ = ___constant_swab32(*((unsigned int *)"CTLZ")); - CTLL = ___constant_swab32(*((unsigned int *)"CTLL")); - /* Read current mode from Mode Change Register */ for (i = 0; i < 4; i++) data[i] = readl(mem_base + UAA_CORE_CHANGE); -- 2.20.1