2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-24 21:24:00 +08:00

ALSA: lola: Proper endian notations

The 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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2018-07-25 23:24:06 +02:00
parent 0e7ca66a97
commit 0d9a26fc74
3 changed files with 8 additions and 8 deletions

View File

@ -369,9 +369,9 @@ static int setup_corb_rirb(struct lola *chip)
return err; return err;
chip->corb.addr = chip->rb.addr; 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.addr = chip->rb.addr + 2048;
chip->rirb.buf = (u32 *)(chip->rb.area + 2048); chip->rirb.buf = (__le32 *)(chip->rb.area + 2048);
/* disable ringbuffer DMAs */ /* disable ringbuffer DMAs */
lola_writeb(chip, BAR0, RIRBCTL, 0); lola_writeb(chip, BAR0, RIRBCTL, 0);

View File

@ -220,7 +220,7 @@ struct lola_bar {
/* CORB/RIRB */ /* CORB/RIRB */
struct lola_rb { 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 */ dma_addr_t addr; /* physical address of CORB/RIRB buffer */
unsigned short rp, wp; /* read/write pointers */ unsigned short rp, wp; /* read/write pointers */
int cmds; /* number of pending requests */ int cmds; /* number of pending requests */
@ -275,7 +275,7 @@ struct lola_mixer_array {
struct lola_mixer_widget { struct lola_mixer_widget {
unsigned int nid; unsigned int nid;
unsigned int caps; unsigned int caps;
struct lola_mixer_array __user *array; struct lola_mixer_array __iomem *array;
struct lola_mixer_array *array_saved; struct lola_mixer_array *array_saved;
unsigned int src_stream_outs; unsigned int src_stream_outs;
unsigned int src_phys_ins; unsigned int src_phys_ins;

View File

@ -316,10 +316,10 @@ static int lola_pcm_hw_free(struct snd_pcm_substream *substream)
* set up a BDL entry * set up a BDL entry
*/ */
static int setup_bdle(struct snd_pcm_substream *substream, 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) int ofs, int size)
{ {
u32 *bdl = *bdlp; __le32 *bdl = *bdlp;
while (size > 0) { while (size > 0) {
dma_addr_t addr; 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 snd_pcm_substream *substream,
struct lola_stream *str) struct lola_stream *str)
{ {
u32 *bdl; __le32 *bdl;
int i, ofs, periods, period_bytes; int i, ofs, periods, period_bytes;
period_bytes = str->period_bytes; period_bytes = str->period_bytes;
periods = str->bufsize / period_bytes; periods = str->bufsize / period_bytes;
/* program the initial BDL entries */ /* 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; ofs = 0;
str->frags = 0; str->frags = 0;
for (i = 0; i < periods; i++) { for (i = 0; i < periods; i++) {