Commit c5bb0867 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: via82xx: Fix endianness annotations

The internal page tables are in little endian, hence they should be
__le32 type.  This fixes the relevant sparse warnings:
  sound/pci/via82xx.c:454:60: warning: incorrect type in assignment (different base types)
  sound/pci/via82xx.c:454:60:    expected unsigned int [usertype]
  sound/pci/via82xx.c:454:60:    got restricted __le32 [usertype]
  ....

No functional changes, just sparse warning fixes.

Link: https://lore.kernel.org/r/20200206163152.6073-2-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent adf615a6
...@@ -414,6 +414,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre ...@@ -414,6 +414,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
{ {
unsigned int i, idx, ofs, rest; unsigned int i, idx, ofs, rest;
struct via82xx *chip = snd_pcm_substream_chip(substream); struct via82xx *chip = snd_pcm_substream_chip(substream);
__le32 *pgtbl;
if (dev->table.area == NULL) { if (dev->table.area == NULL) {
/* the start of each lists must be aligned to 8 bytes, /* the start of each lists must be aligned to 8 bytes,
...@@ -435,6 +436,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre ...@@ -435,6 +436,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
/* fill the entries */ /* fill the entries */
idx = 0; idx = 0;
ofs = 0; ofs = 0;
pgtbl = (__le32 *)dev->table.area;
for (i = 0; i < periods; i++) { for (i = 0; i < periods; i++) {
rest = fragsize; rest = fragsize;
/* fill descriptors for a period. /* fill descriptors for a period.
...@@ -451,7 +453,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre ...@@ -451,7 +453,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
return -EINVAL; return -EINVAL;
} }
addr = snd_pcm_sgbuf_get_addr(substream, ofs); addr = snd_pcm_sgbuf_get_addr(substream, ofs);
((u32 *)dev->table.area)[idx << 1] = cpu_to_le32(addr); pgtbl[idx << 1] = cpu_to_le32(addr);
r = snd_pcm_sgbuf_get_chunk_size(substream, ofs, rest); r = snd_pcm_sgbuf_get_chunk_size(substream, ofs, rest);
rest -= r; rest -= r;
if (! rest) { if (! rest) {
...@@ -466,7 +468,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre ...@@ -466,7 +468,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
"tbl %d: at %d size %d (rest %d)\n", "tbl %d: at %d size %d (rest %d)\n",
idx, ofs, r, rest); idx, ofs, r, rest);
*/ */
((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); pgtbl[(idx<<1) + 1] = cpu_to_le32(r | flag);
dev->idx_table[idx].offset = ofs; dev->idx_table[idx].offset = ofs;
dev->idx_table[idx].size = r; dev->idx_table[idx].size = r;
ofs += r; ofs += r;
......
...@@ -267,6 +267,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre ...@@ -267,6 +267,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
{ {
unsigned int i, idx, ofs, rest; unsigned int i, idx, ofs, rest;
struct via82xx_modem *chip = snd_pcm_substream_chip(substream); struct via82xx_modem *chip = snd_pcm_substream_chip(substream);
__le32 *pgtbl;
if (dev->table.area == NULL) { if (dev->table.area == NULL) {
/* the start of each lists must be aligned to 8 bytes, /* the start of each lists must be aligned to 8 bytes,
...@@ -288,6 +289,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre ...@@ -288,6 +289,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
/* fill the entries */ /* fill the entries */
idx = 0; idx = 0;
ofs = 0; ofs = 0;
pgtbl = (__le32 *)dev->table.area;
for (i = 0; i < periods; i++) { for (i = 0; i < periods; i++) {
rest = fragsize; rest = fragsize;
/* fill descriptors for a period. /* fill descriptors for a period.
...@@ -304,7 +306,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre ...@@ -304,7 +306,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
return -EINVAL; return -EINVAL;
} }
addr = snd_pcm_sgbuf_get_addr(substream, ofs); addr = snd_pcm_sgbuf_get_addr(substream, ofs);
((u32 *)dev->table.area)[idx << 1] = cpu_to_le32(addr); pgtbl[idx << 1] = cpu_to_le32(addr);
r = PAGE_SIZE - (ofs % PAGE_SIZE); r = PAGE_SIZE - (ofs % PAGE_SIZE);
if (rest < r) if (rest < r)
r = rest; r = rest;
...@@ -321,7 +323,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre ...@@ -321,7 +323,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
"tbl %d: at %d size %d (rest %d)\n", "tbl %d: at %d size %d (rest %d)\n",
idx, ofs, r, rest); idx, ofs, r, rest);
*/ */
((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); pgtbl[(idx<<1) + 1] = cpu_to_le32(r | flag);
dev->idx_table[idx].offset = ofs; dev->idx_table[idx].offset = ofs;
dev->idx_table[idx].size = r; dev->idx_table[idx].size = r;
ofs += r; ofs += r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment