ALSA: Proper endian notations
Subsystems (2)
cover ALSA: Proper endian notations
Hi,
this is a patchset for correcting the integer types to the endian-wise ones, as caught by sparse. Just cosmetic fixes for catching future bugs, no functional change by itself.
Takashi
===
Takashi Iwai (14):
ALSA: ymfpci: Proper endian notations
ALSA: trident: Proper endian notations
ALSA: hda: Proper endian notations for BDL pointers
ALSA: riptide: Properly endian notations
ALSA: mixart: Proper endian notations
ALSA: lola: Proper endian notations
ALSA: intel8x0: Proper endian notations
ALSA: intel8x0m: Proper endian notations
ALSA: maestro3: Proper endian notations
ALSA: echoaudio: Proper endian notations
ALSA: bt87x: Proper endian notations
ALSA: atiixp: Proper endian notations
ALSA: atiixp_modem: Proper endian notations
ALSA: sb: Proper endian notations
sound/hda/hdac_stream.c | 4 +- sound/isa/sb/sb16_csp.c | 30 +++++------ sound/pci/atiixp.c | 4 +- sound/pci/atiixp_modem.c | 4 +- sound/pci/bt87x.c | 4 +- sound/pci/echoaudio/echoaudio.h | 2 +- sound/pci/echoaudio/echoaudio_3g.c | 14 +++--- sound/pci/echoaudio/echoaudio_dsp.c | 6 +-- sound/pci/echoaudio/echoaudio_dsp.h | 50 +++++++++--------- sound/pci/echoaudio/echoaudio_gml.c | 8 +-- sound/pci/intel8x0.c | 6 +-- sound/pci/intel8x0m.c | 6 +-- sound/pci/lola/lola.c | 4 +- sound/pci/lola/lola.h | 4 +- sound/pci/lola/lola_pcm.c | 8 +-- sound/pci/maestro3.c | 6 +-- sound/pci/mixart/mixart_core.c | 4 +- sound/pci/mixart/mixart_hwdep.c | 42 ++++++++-------- sound/pci/mixart/mixart_hwdep.h | 8 +-- sound/pci/riptide/riptide.c | 8 +-- sound/pci/trident/trident.h | 2 +- sound/pci/trident/trident_main.c | 2 +- sound/pci/ymfpci/ymfpci.h | 78 ++++++++++++++--------------- sound/pci/ymfpci/ymfpci_main.c | 6 +-- 24 files changed, 157 insertions(+), 153 deletions(-)
Signature · 1 line
2.18.0
PATCH 1/14 ALSA: ymfpci: Proper endian notations
The bank values are all little-endians, so they should be defined with__le32. This fixes lots of sparse warnings like:
sound/pci/ymfpci/ymfpci_main.c:315:23: warning: cast to restricted __le32 sound/pci/ymfpci/ymfpci_main.c:342:32: warning: incorrect type in assignment (different base types)
--- sound/pci/ymfpci/ymfpci.h | 78 +++++++++++++++++----------------- sound/pci/ymfpci/ymfpci_main.c | 6 +-- 2 files changed, 42 insertions(+), 42 deletions(-)
sound/pci/ymfpci/ymfpci.h +39 -39
@@ -185,50 +185,50 @@*/ struct snd_ymfpci_playback_bank { -u32 format; -u32 loop_default; -u32 base;/* 32-bit address */ -u32 loop_start;/* 32-bit offset */ -u32 loop_end;/* 32-bit offset */ -u32 loop_frac;/* 8-bit fraction - loop_start */ -u32 delta_end;/* pitch delta end */ -u32 lpfK_end; -u32 eg_gain_end; -u32 left_gain_end; -u32 right_gain_end; -u32 eff1_gain_end; -u32 eff2_gain_end; -u32 eff3_gain_end; -u32 lpfQ; -u32 status; -u32 num_of_frames; -u32 loop_count; -u32 start; -u32 start_frac; -u32 delta; -u32 lpfK; -u32 eg_gain; -u32 left_gain; -u32 right_gain; -u32 eff1_gain; -u32 eff2_gain; -u32 eff3_gain; -u32 lpfD1; -u32 lpfD2; +__le32 format; +__le32 loop_default; +__le32 base;/* 32-bit address */ +__le32 loop_start;/* 32-bit offset */ +__le32 loop_end;/* 32-bit offset */ +__le32 loop_frac;/* 8-bit fraction - loop_start */ +__le32 delta_end;/* pitch delta end */ +__le32 lpfK_end; +__le32 eg_gain_end; +__le32 left_gain_end; +__le32 right_gain_end; +__le32 eff1_gain_end; +__le32 eff2_gain_end; +__le32 eff3_gain_end; +__le32 lpfQ; +__le32 status; +__le32 num_of_frames; +__le32 loop_count; +__le32 start; +__le32 start_frac; +__le32 delta; +__le32 lpfK; +__le32 eg_gain; +__le32 left_gain; +__le32 right_gain; +__le32 eff1_gain; +__le32 eff2_gain; +__le32 eff3_gain; +__le32 lpfD1; +__le32 lpfD2; };struct snd_ymfpci_capture_bank { -u32 base;/* 32-bit address */ -u32 loop_end;/* 32-bit offset */ -u32 start;/* 32-bit offset */ -u32 num_of_loops;/* counter */ +__le32 base;/* 32-bit address */ +__le32 loop_end;/* 32-bit offset */ +__le32 start;/* 32-bit offset */ +__le32 num_of_loops;/* counter */ };struct snd_ymfpci_effect_bank { -u32 base;/* 32-bit address */ -u32 loop_end;/* 32-bit offset */ -u32 start;/* 32-bit offset */ -u32 temp; +__le32 base;/* 32-bit address */ +__le32 loop_end;/* 32-bit offset */ +__le32 start;/* 32-bit offset */ +__le32 temp; };struct snd_ymfpci_pcm ;
@@ -316,7 +316,7 @@ struct snd_ymfpci {dma_addr_t work_base_addr;struct snd_dma_buffer ac3_tmp_base; -u32 *ctrl_playback; +__le32 *ctrl_playback;struct snd_ymfpci_playback_bank *bank_playback[YDSXG_PLAYBACK_VOICES ][2 ];struct snd_ymfpci_capture_bank *bank_capture[YDSXG_CAPTURE_VOICES ][2 ];struct snd_ymfpci_effect_bank *bank_effect[YDSXG_EFFECT_VOICES ][2 ];
sound/pci/ymfpci/ymfpci_main.c +3 -3
@@ -336,7 +336,7 @@ static void snd_ymfpci_pcm_interrupt(struct snd_ymfpci *chip, struct snd_ymfpci_unsigned int subs = ypcm->substream->number;unsigned int next_bank =1 - chip->active_bank;struct snd_ymfpci_playback_bank *bank; -u32 volume; +__le32 volume; bank = &voice->bank[next_bank]; volume =cpu_to_le32 (chip->pcm_mixer[subs].left <<15 );
@@ -505,7 +505,7 @@ static void snd_ymfpci_pcm_init_voice(struct snd_ymfpci_pcm *ypcm, unsigned intu32 lpfK =snd_ymfpci_calc_lpfK (runtime->rate);struct snd_ymfpci_playback_bank *bank;unsigned int nbank; -u32 vol_left, vol_right; +__le32 vol_left, vol_right;u8 use_left, use_right;unsigned long flags;
@@ -2135,7 +2135,7 @@ static int snd_ymfpci_memalloc(struct snd_ymfpci *chip) chip->bank_base_playback = ptr; chip->bank_base_playback_addr = ptr_addr; - chip->ctrl_playback = (u32 *)ptr; + chip->ctrl_playback = (__le32 *)ptr; chip->ctrl_playback[0 ] =cpu_to_le32 (YDSXG_PLAYBACK_VOICES ); ptr +=ALIGN (playback_ctrl_size,0x100 ); ptr_addr +=ALIGN (playback_ctrl_size,0x100 );
Signature · 1 line
2.18.0
PATCH 2/14 ALSA: trident: Proper endian notations
In reply to Takashi IwaiThe TLB entries in Trident driver are represented in little-endian, hence they should be declared as __le32.
This patch fixes the sparse warnings like:
sound/pci/trident/trident_memory.c:226:17: warning: incorrect type in assignment (different base types)
--- sound/pci/trident/trident.h | 2 +- sound/pci/trident/trident_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/trident/trident.h +1 -1
@@ -264,7 +264,7 @@ struct snd_trident_memblk_arg { };struct snd_trident_tlb { -unsigned int * entries;/* 16k-aligned TLB table */ +__le32 *entries;/* 16k-aligned TLB table */ dma_addr_t entries_dmaaddr;/* 16k-aligned PCI address to TLB table */ unsigned long * shadow_entries;/* shadow entries with virtual addresses */ struct snd_dma_buffer buffer;
sound/pci/trident/trident_main.c +1 -1
@@ -3359,7 +3359,7 @@ static int snd_trident_tlb_alloc(struct snd_trident *trident)dev_err (trident->card->dev,"unable to allocate TLB buffer\n" );return -ENOMEM ; } - trident->tlb.entries = (unsigned int *)ALIGN ((unsigned long )trident->tlb.buffer.area,SNDRV_TRIDENT_MAX_PAGES *4 ); + trident->tlb.entries = (__le32 *)ALIGN ((unsigned long )trident->tlb.buffer.area,SNDRV_TRIDENT_MAX_PAGES *4 ); trident->tlb.entries_dmaaddr =ALIGN (trident->tlb.buffer.addr,SNDRV_TRIDENT_MAX_PAGES *4 );/* allocate shadow TLB page table (virtual addresses) */ trident->tlb.shadow_entries =
Signature · 1 line
2.18.0
PATCH 3/14 ALSA: hda: Proper endian notations for BDL pointers
In reply to Takashi IwaiThe BDL pointer used in snd_hdac_dsp_prepare() should be declared as__le32, as warned by sparse:
sound/hda/hdac_stream.c:655:47: warning: incorrect type in argument 4 (different base types)
sound/hda/hdac_stream.c:655:47: expected restricted __le32 [usertype] **bdlp
sound/hda/hdac_stream.c:655:47: got unsigned int [usertype] **<noident>
--- sound/hda/hdac_stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/hda/hdac_stream.c +2 -2
@@ -621,7 +621,7 @@ int snd_hdac_dsp_prepare(struct hdac_stream *azx_dev, unsigned int format, unsigned int byte_size, struct snd_dma_buffer *bufp) { struct hdac_bus *bus = azx_dev->bus; -u32 *bdl; +__le32 *bdl;int err;snd_hdac_dsp_lock (azx_dev);
@@ -651,7 +651,7 @@ int snd_hdac_dsp_prepare(struct hdac_stream *azx_dev, unsigned int format,snd_hdac_stream_writel (azx_dev,SD_BDLPU ,0 ); azx_dev->frags =0 ; - bdl = (u32 *)azx_dev->bdl.area; + bdl = (__le32 *)azx_dev->bdl.area; err =setup_bdle (bus, bufp, azx_dev, &bdl,0 , byte_size,0 );if (err <0 ) goto error;
Signature · 1 line
2.18.0
PATCH 4/14 ALSA: riptide: Properly endian notations
In reply to Takashi IwaiThe SG descriptor of Riptide contains the little-endian values, hence we need to define with __le32 properly. This fixes sparse warnings like:
sound/pci/riptide/riptide.c:1112:40: warning: cast to restricted __le32
--- sound/pci/riptide/riptide.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/pci/riptide/riptide.c +4 -4
@@ -470,10 +470,10 @@ struct snd_riptide { };struct sgd {/* scatter gather desriptor */ -u32 dwNextLink; -u32 dwSegPtrPhys; -u32 dwSegLen; -u32 dwStat_Ctl; +__le32 dwNextLink; +__le32 dwSegPtrPhys; +__le32 dwSegLen; +__le32 dwStat_Ctl; };struct pcmhw {/* pcm descriptor */
Signature · 1 line
2.18.0
PATCH 5/14 ALSA: mixart: Proper endian notations
In reply to Takashi IwaiThe miXart driver deals with big-endian values as raw data, while it declares most of variables as u32. This leads to sparse warnings like
sound/pci/mixart/mixart.c:1203:23: warning: cast to restricted __be32
Fix them by properly defining the structs and add the explicit cast to macros.
--- sound/pci/mixart/mixart_core.c | 4 ++-- sound/pci/mixart/mixart_hwdep.c | 42 ++++++++++++++++----------------- sound/pci/mixart/mixart_hwdep.h | 8 +++---- 3 files changed, 27 insertions(+), 27 deletions(-)
sound/pci/mixart/mixart_core.c +2 -2
@@ -107,7 +107,7 @@ static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp,#ifndef __BIG_ENDIAN size /=4 ;/* u32 size */ for (i=0 ; i < size; i++) { - ((u32 *)resp->data)[i] =be32_to_cpu (((u32 *)resp->data)[i]); + ((u32 *)resp->data)[i] =be32_to_cpu (((__be32 *)resp->data)[i]); }#endif
@@ -519,7 +519,7 @@ irqreturn_t snd_mixart_threaded_irq(int irq, void *dev_id)/* Traces are text: the swapped msg_data has to be swapped back ! */ int i;for (i=0 ; i<(resp.size/4 ); i++) { - (mixart_msg_data)[i] =cpu_to_be32 ((mixart_msg_data)[i]); + ((__be32 *)mixart_msg_data)[i] =cpu_to_be32 ((mixart_msg_data)[i]); }#endif ((char *)mixart_msg_data)[resp.size -1 ] =0 ;
sound/pci/mixart/mixart_hwdep.c +21 -21
51 lines not on this page · raw message
sound/pci/mixart/mixart_hwdep.h +4 -4
@@ -26,19 +26,19 @@#include <sound/hwdep.h> #ifndef readl_be -#define readl_be (x) be32_to_cpu(__raw_readl(x)) +#define readl_be (x) be32_to_cpu((__force __be32)__raw_readl(x))#endif #ifndef writel_be -#define writel_be (data,addr) __raw_writel(cpu_to_be32(data),addr) +#define writel_be (data,addr) __raw_writel((__force u32)cpu_to_be32(data),addr)#endif #ifndef readl_le -#define readl_le (x) le32_to_cpu(__raw_readl(x)) +#define readl_le (x) le32_to_cpu((__force __le32)__raw_readl(x))#endif #ifndef writel_le -#define writel_le (data,addr) __raw_writel(cpu_to_le32(data),addr) +#define writel_le (data,addr) __raw_writel((__force u32)cpu_to_le32(data),addr)#endif #define MIXART_MEM (mgr,x) ((mgr)->mem[0].virt + (x))
Signature · 1 line
2.18.0
PATCH 6/14 ALSA: lola: Proper endian notations
In reply to Takashi IwaiThe BDL entries in lola driver are little-endian while we code them as
u32. This leads to sparse warnings like:
sound/pci/lola/lola.c:105:40: warning: incorrect type in assignment (different base types)
sound/pci/lola/lola.c:105:40: expected unsigned int [unsigned] [usertype] <noident>
sound/pci/lola/lola.c:105:40: got restricted __le32 [usertype] <noident>
This patch fixes the declarations to the proper __le32 type.
Also, there was a typo in the original code, where __user was used
that was intended as __iomem. This was caused also by sparse:
sound/pci/lola/lola_mixer.c:132:27: warning: incorrect type in assignment (different address spaces)
Fixed in this patch as well.
--- sound/pci/lola/lola.c | 4 ++-- sound/pci/lola/lola.h | 4 ++-- sound/pci/lola/lola_pcm.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-)
sound/pci/lola/lola.c +2 -2
@@ -369,9 +369,9 @@ static int setup_corb_rirb(struct lola *chip)return err; chip->corb.addr = chip->rb.addr; - chip->corb.buf = (u32 *)chip->rb.area; + chip->corb.buf = (__le32 *)chip->rb.area; chip->rirb.addr = chip->rb.addr +2048 ; - chip->rirb.buf = (u32 *)(chip->rb.area +2048 ); + chip->rirb.buf = (__le32 *)(chip->rb.area +2048 );/* disable ringbuffer DMAs */ lola_writeb (chip,BAR0 ,RIRBCTL ,0 );
sound/pci/lola/lola.h +2 -2
@@ -220,7 +220,7 @@ struct lola_bar {/* CORB/RIRB */ struct lola_rb { -u32 *buf;/* CORB/RIRB buffer, 8 byte per each entry */ +__le32 *buf;/* CORB/RIRB buffer, 8 byte per each entry */ dma_addr_t addr;/* physical address of CORB/RIRB buffer */ unsigned short rp, wp;/* read/write pointers */ int cmds;/* number of pending requests */
@@ -275,7 +275,7 @@ struct lola_mixer_array {struct lola_mixer_widget {unsigned int nid;unsigned int caps; -struct lola_mixer_array __user *array; +struct lola_mixer_array __iomem *array;struct lola_mixer_array *array_saved;unsigned int src_stream_outs;unsigned int src_phys_ins;
sound/pci/lola/lola_pcm.c +4 -4
@@ -316,10 +316,10 @@ static int lola_pcm_hw_free(struct snd_pcm_substream *substream)* set up a BDL entry */ static int setup_bdle (struct snd_pcm_substream *substream, -struct lola_stream *str,u32 **bdlp, +struct lola_stream *str,__le32 **bdlp,int ofs,int size) { -u32 *bdl = *bdlp; +__le32 *bdl = *bdlp;while (size >0 ) {dma_addr_t addr;
@@ -355,14 +355,14 @@ static int lola_setup_periods(struct lola *chip, struct lola_pcm *pcm,struct snd_pcm_substream *substream, struct lola_stream *str) { - u32 *bdl; + __le32 *bdl;int i, ofs, periods, period_bytes; period_bytes = str->period_bytes; periods = str->bufsize / period_bytes;/* program the initial BDL entries */ - bdl = (u32 *)(pcm->bdl.area +LOLA_BDL_ENTRY_SIZE * str->index); + bdl = (__le32 *)(pcm->bdl.area +LOLA_BDL_ENTRY_SIZE * str->index); ofs =0 ; str->frags =0 ;for (i =0 ; i < periods; i++) {
Signature · 1 line
2.18.0
PATCH 7/14 ALSA: intel8x0: Proper endian notations
In reply to Takashi IwaiThe BD address tables in intel8x0 driver are in little-endian, hence they should be represented as __le32 instead u32.
Spotted by sparse, warnings like:
sound/pci/intel8x0.c:688:40: warning: incorrect type in assignment (different base types)
--- sound/pci/intel8x0.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/pci/intel8x0.c +3 -3
@@ -351,7 +351,7 @@ enum {struct ichdev {unsigned int ichd;/* ich device number */ unsigned long reg_offset;/* offset to bmaddr */ -u32 *bdbar;/* CPU address (32bit) */ +__le32 *bdbar;/* CPU address (32bit) */ unsigned int bdbar_addr;/* PCI bus address (32bit) */ struct snd_pcm_substream *substream;unsigned int physbuf;/* physical address (32bit) */
@@ -677,7 +677,7 @@ static void snd_intel8x0_ali_codec_write(struct snd_ac97 *ac97, unsigned short rstatic void snd_intel8x0_setup_periods (struct intel8x0 *chip,struct ichdev *ichdev) {int idx; -u32 *bdbar = ichdev->bdbar; +__le32 *bdbar = ichdev->bdbar;unsigned long port = ichdev->reg_offset;iputdword (chip, port +ICH_REG_OFF_BDBAR , ichdev->bdbar_addr);
@@ -3143,7 +3143,7 @@ static int snd_intel8x0_create(struct snd_card *card, int_sta_masks =0 ;for (i =0 ; i < chip->bdbars_count; i++) { ichdev = &chip->ichd[i]; - ichdev->bdbar = ((u32 *)chip->bdbars.area) + + ichdev->bdbar = ((__le32 *)chip->bdbars.area) + (i *ICH_MAX_FRAGS *2 ); ichdev->bdbar_addr = chip->bdbars.addr + (i *sizeof (u32) *ICH_MAX_FRAGS *2 );
Signature · 1 line
2.18.0
PATCH 8/14 ALSA: intel8x0m: Proper endian notations
In reply to Takashi IwaiThe BD address tables in intel8x0m driver are in little-endian, hence they should be represented as __le32 instead u32.
Spotted by sparse, warnings like:
sound/pci/intel8x0m.c:406:40: warning: incorrect type in assignment (different base types)
--- sound/pci/intel8x0m.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/pci/intel8x0m.c +3 -3
@@ -168,7 +168,7 @@ enum { ALID_MDMIN, ALID_MDMOUT, ALID_MDMLAST = ALID_MDMOUT };struct ichdev {unsigned int ichd;/* ich device number */ unsigned long reg_offset;/* offset to bmaddr */ -u32 *bdbar;/* CPU address (32bit) */ +__le32 *bdbar;/* CPU address (32bit) */ unsigned int bdbar_addr;/* PCI bus address (32bit) */ struct snd_pcm_substream *substream;unsigned int physbuf;/* physical address (32bit) */
@@ -395,7 +395,7 @@ static unsigned short snd_intel8x0m_codec_read(struct snd_ac97 *ac97,static void snd_intel8x0m_setup_periods (struct intel8x0m *chip,struct ichdev *ichdev) {int idx; -u32 *bdbar = ichdev->bdbar; +__le32 *bdbar = ichdev->bdbar;unsigned long port = ichdev->reg_offset;iputdword (chip, port +ICH_REG_OFF_BDBAR , ichdev->bdbar_addr);
@@ -1217,7 +1217,7 @@ static int snd_intel8x0m_create(struct snd_card *card, int_sta_masks =0 ;for (i =0 ; i < chip->bdbars_count; i++) { ichdev = &chip->ichd[i]; - ichdev->bdbar = ((u32 *)chip->bdbars.area) + (i *ICH_MAX_FRAGS *2 ); + ichdev->bdbar = ((__le32 *)chip->bdbars.area) + (i *ICH_MAX_FRAGS *2 ); ichdev->bdbar_addr = chip->bdbars.addr + (i *sizeof (u32) *ICH_MAX_FRAGS *2 ); int_sta_masks |= ichdev->int_sta_mask; }
Signature · 1 line
2.18.0
PATCH 9/14 ALSA: maestro3: Proper endian notations
In reply to Takashi IwaiThe ASSP data passed to maestro3 driver is in little-endian format, hence the data pointer should be with __le16.
Spotted by sparse, warnings like:
sound/pci/maestro3.c:2128:35: warning: cast to restricted __le16
--- sound/pci/maestro3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/pci/maestro3.c +3 -3
@@ -2103,7 +2103,7 @@ static const u16 minisrc_lpf[MINISRC_LPF_LEN] = {static void snd_m3_assp_init (struct snd_m3 *chip) {unsigned int i; -const u16 *data; +const __le16 *data;/* zero kernel data */ for (i =0 ; i < (REV_B_DATA_MEMORY_UNIT_LENGTH *NUM_UNITS_KERNEL_DATA ) /2 ; i++)
@@ -2121,7 +2121,7 @@ static void snd_m3_assp_init(struct snd_m3 *chip) KDATA_DMA_XFER0);/* write kernel into code memory.. */ - data = (const u16 *)chip->assp_kernel_image->data; + data = (const __le16 *)chip->assp_kernel_image->data;for (i =0 ; i *2 < chip->assp_kernel_image->size; i++) { snd_m3_assp_write(chip, MEMTYPE_INTERNAL_CODE, REV_B_CODE_MEMORY_BEGIN + i,
@@ -2134,7 +2134,7 @@ static void snd_m3_assp_init(struct snd_m3 *chip)* drop it there. It seems that the minisrc doesn't * need vectors, so we won't bother with them.. */ - data = (const u16 *)chip->assp_minisrc_image->data; + data = (const __le16 *)chip->assp_minisrc_image->data;for (i =0 ; i *2 < chip->assp_minisrc_image->size; i++) {snd_m3_assp_write (chip,MEMTYPE_INTERNAL_CODE ,0x400 + i,le16_to_cpu (data[i]));
Signature · 1 line
2.18.0
PATCH 10/14 ALSA: echoaudio: Proper endian notations
In reply to Takashi IwaiMany data fields defined in echoaudio drivers are in little-endian, hence they should be defined with __le16 or __le32. This makes it easier to catch the forgotten conversions.
Spotted by sparse, a warning like:
sound/pci/echoaudio/echoaudio_dsp.c:990:36: warning: incorrect type in assignment (different base types)
--- sound/pci/echoaudio/echoaudio.h | 2 +- sound/pci/echoaudio/echoaudio_3g.c | 14 ++++---- sound/pci/echoaudio/echoaudio_dsp.c | 6 ++-- sound/pci/echoaudio/echoaudio_dsp.h | 50 ++++++++++++++--------------- sound/pci/echoaudio/echoaudio_gml.c | 8 +++-- 5 files changed, 42 insertions(+), 38 deletions(-)
sound/pci/echoaudio/echoaudio.h +1 -1
@@ -294,7 +294,7 @@struct audiopipe { -volatile u32 *dma_counter;/* Commpage register that contains +volatile __le32 *dma_counter;/* Commpage register that contains * the current dma position * (lower 32 bits only) */
sound/pci/echoaudio/echoaudio_3g.c +8 -6
@@ -73,19 +73,21 @@ register. write_control_reg sends the new control register value to the DSP. */static int write_control_reg (struct echoaudio *chip,u32 ctl,u32 frq,char force) { +__le32 ctl_reg, frq_reg; +if (wait_handshake (chip))return -EIO ;dev_dbg (chip->card->dev,"WriteControlReg: Setting 0x%x, 0x%x\n" , ctl, frq); - ctl =cpu_to_le32 (ctl); - frq =cpu_to_le32 (frq); + ctl_reg =cpu_to_le32 (ctl); + frq_reg =cpu_to_le32 (frq); -if (ctl != chip->comm_page->control_register || - frq != chip->comm_page->e3g_frq_register || force) { - chip->comm_page->e3g_frq_register = frq; - chip->comm_page->control_register = ctl; +if (ctl_reg != chip->comm_page->control_register || + frq_reg != chip->comm_page->e3g_frq_register || force) { + chip->comm_page->e3g_frq_register = frq_reg; + chip->comm_page->control_register = ctl_reg;clear_handshake (chip);return send_vector (chip,DSP_VC_WRITE_CONTROL_REG ); }
sound/pci/echoaudio/echoaudio_dsp.c +3 -3
@@ -679,7 +679,7 @@ static int restore_dsp_rettings(struct echoaudio *chip)/* Gina20/Darla20 only. Should be harmless for other cards. */ chip->comm_page->gd_clock_state =GD_CLOCK_UNDEF ; chip->comm_page->gd_spdif_status =GD_SPDIF_STATUS_UNDEF ; - chip->comm_page->handshake =0xffffffff ; + chip->comm_page->handshake =cpu_to_le32 (0xffffffff );/* Restore output busses */ for (i =0 ; i <num_busses_out (chip); i++) {
@@ -989,7 +989,7 @@ static int init_dsp_comm_page(struct echoaudio *chip)/* Init the comm page */ chip->comm_page->comm_size =cpu_to_le32 (sizeof (struct comm_page )); - chip->comm_page->handshake =0xffffffff ; + chip->comm_page->handshake =cpu_to_le32 (0xffffffff ); chip->comm_page->midi_out_free_count =cpu_to_le32 (DSP_MIDI_OUT_FIFO_SIZE ); chip->comm_page->sample_rate =cpu_to_le32 (44100 );
@@ -1087,7 +1087,7 @@ static int allocate_pipes(struct echoaudio *chip, struct audiopipe *pipe,/* The counter register is where the DSP writes the 32 bit DMA position for a pipe. The DSP is constantly updating this value as it moves data. The DMA counter is in units of bytes, not samples. */ - pipe->dma_counter = &chip->comm_page->position[pipe_index]; + pipe->dma_counter = (__le32 *)&chip->comm_page->position[pipe_index]; *pipe->dma_counter =0 ;return pipe_index; }
sound/pci/echoaudio/echoaudio_dsp.h +25 -25
79 lines not on this page · raw message
sound/pci/echoaudio/echoaudio_gml.c +5 -3
@@ -63,6 +63,8 @@ the control register. write_control_reg sends the new control registervalue to the DSP. */ static int write_control_reg (struct echoaudio *chip,u32 value,char force) { +__le32 reg_value; +/* Handle the digital input auto-mute */ if (chip->digital_in_automute) value |=GML_DIGITAL_IN_AUTO_MUTE ;
@@ -72,11 +74,11 @@ static int write_control_reg(struct echoaudio *chip, u32 value, char force)dev_dbg (chip->card->dev,"write_control_reg: 0x%x\n" , value);/* Write the control register */ - value =cpu_to_le32 (value); -if (value != chip->comm_page->control_register || force) { + reg_value =cpu_to_le32 (value); +if (reg_value != chip->comm_page->control_register || force) {if (wait_handshake (chip))return -EIO ; - chip->comm_page->control_register = value; + chip->comm_page->control_register = reg_value;clear_handshake (chip);return send_vector (chip,DSP_VC_WRITE_CONTROL_REG ); }
Signature · 1 line
2.18.0
PATCH 11/14 ALSA: bt87x: Proper endian notations
In reply to Takashi IwaiThe RISC data in bt87x is in little-endian, hence we should define it with __le32 properly.
Spotted by sparse, a warning like:
sound/pci/bt87x.c:240:17: warning: incorrect type in assignment (different base types)
--- sound/pci/bt87x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/bt87x.c +2 -2
@@ -228,14 +228,14 @@ static int snd_bt87x_create_risc(struct snd_bt87x *chip, struct snd_pcm_substrea unsigned int periods, unsigned int period_bytes) { unsigned int i, offset; -u32 *risc; +__le32 *risc;if (chip->dma_risc.area ==NULL ) {if (snd_dma_alloc_pages (SNDRV_DMA_TYPE_DEV ,snd_dma_pci_data (chip->pci),PAGE_ALIGN (MAX_RISC_SIZE ), &chip->dma_risc) <0 )return -ENOMEM ; } - risc = (u32 *)chip->dma_risc.area; + risc = (__le32 *)chip->dma_risc.area; offset =0 ; *risc++ =cpu_to_le32 (RISC_SYNC |RISC_SYNC_FM1 ); *risc++ =cpu_to_le32 (0 );
Signature · 1 line
2.18.0
PATCH 12/14 ALSA: atiixp: Proper endian notations
In reply to Takashi IwaiThe DMA address table in atiixp driver is in little-endian, hence we should define it with __le32 properly.
Spotted by sparse, a warning like:
sound/pci/atiixp.c:393:28: warning: incorrect type in assignment (different base types)
--- sound/pci/atiixp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/atiixp.c +2 -2
@@ -207,10 +207,10 @@ struct atiixp;*/ struct atiixp_dma_desc { -u32 addr;/* DMA buffer address */ +__le32 addr;/* DMA buffer address */ u16 status;/* status bits */ u16 size;/* size of the packet in dwords */ -u32 next;/* address of the next packet descriptor */ +__le32 next;/* address of the next packet descriptor */ };/*
Signature · 1 line
2.18.0
PATCH 13/14 ALSA: atiixp_modem: Proper endian notations
In reply to Takashi IwaiThe DMA address table in atiixp modem driver is in little-endian, hence we should define it with __le32 properly.
Spotted by sparse, a warning like:
sound/pci/atiixp_modem.c:360:28: warning: incorrect type in assignment (different base types)
--- sound/pci/atiixp_modem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/atiixp_modem.c +2 -2
@@ -183,10 +183,10 @@ struct atiixp_modem;*/ struct atiixp_dma_desc { -u32 addr;/* DMA buffer address */ +__le32 addr;/* DMA buffer address */ u16 status;/* status bits */ u16 size;/* size of the packet in dwords */ -u32 next;/* address of the next packet descriptor */ +__le32 next;/* address of the next packet descriptor */ };/*
Signature · 1 line
2.18.0
PATCH 14/14 ALSA: sb: Proper endian notations
In reply to Takashi IwaiThe data types defined in SB CSP driver code are all in little-endian, hence the proper type like __le32 should be used.
Spotted by sparse, a warning like:
sound/isa/sb/sb16_csp.c:330:14: warning: cast to restricted __le32
--- sound/isa/sb/sb16_csp.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
sound/isa/sb/sb16_csp.c +15 -15
@@ -60,18 +60,18 @@ MODULE_FIRMWARE("sb16/ima_adpcm_capture.csp");* RIFF data format */ struct riff_header { -__u32 name; -__u32 len; +__le32 name; +__le32 len; };struct desc_header {struct riff_header info; -__u16 func_nr; -__u16 VOC_type; -__u16 flags_play_rec; -__u16 flags_16bit_8bit; -__u16 flags_stereo_mono; -__u16 flags_rates; +__le16 func_nr; +__le16 VOC_type; +__le16 flags_play_rec; +__le16 flags_16bit_8bit; +__le16 flags_stereo_mono; +__le16 flags_rates; };/*
@@ -314,7 +314,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,unsigned short func_nr =0 ;struct riff_header file_h, item_h, code_h; -__u32 item_type; +__le32 item_type;struct desc_header funcdesc_h;unsigned long flags;
@@ -326,7 +326,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,if (copy_from_user (&file_h, data_ptr,sizeof (file_h)))return -EFAULT ; -if ((file_h.name !=RIFF_HEADER ) || +if ((le32_to_cpu (file_h.name) !=RIFF_HEADER ) || (le32_to_cpu (file_h.len) >=SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE -sizeof (file_h))) {snd_printd ("%s: Invalid RIFF header\n" , __func__);return -EINVAL ;
@@ -336,7 +336,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,if (copy_from_user (&item_type, data_ptr,sizeof (item_type)))return -EFAULT ; -if (item_type !=CSP__HEADER ) { +if (le32_to_cpu (item_type) !=CSP__HEADER ) {snd_printd ("%s: Invalid RIFF file type\n" , __func__);return -EINVAL ; }
@@ -346,12 +346,12 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,if (copy_from_user (&item_h, data_ptr,sizeof (item_h)))return -EFAULT ; data_ptr +=sizeof (item_h); -if (item_h.name !=LIST_HEADER ) +if (le32_to_cpu (item_h.name) !=LIST_HEADER )continue ;if (copy_from_user (&item_type, data_ptr,sizeof (item_type)))return -EFAULT ; -switch (item_type) { +switch (le32_to_cpu (item_type)) {case FUNC_HEADER :if (copy_from_user (&funcdesc_h, data_ptr +sizeof (item_type),sizeof (funcdesc_h)))return -EFAULT ;
@@ -378,7 +378,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,return -EFAULT ;/* init microcode blocks */ -if (code_h.name !=INIT_HEADER ) +if (le32_to_cpu (code_h.name) !=INIT_HEADER )break ; data_ptr +=sizeof (code_h); err = snd_sb_csp_load_user(p, data_ptr, le32_to_cpu(code_h.len),
@@ -391,7 +391,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,if (copy_from_user (&code_h, data_ptr,sizeof (code_h)))return -EFAULT ; -if (code_h.name !=MAIN_HEADER ) { +if (le32_to_cpu (code_h.name) !=MAIN_HEADER ) {snd_printd ("%s: Missing 'main' microcode\n" , __func__);return -EINVAL ; }
Signature · 1 line
2.18.0