* [alsa-devel] [PATCH 0/3] ALSA: Minor sparse warning fixes
@ 2020-02-06 16:31 Takashi Iwai
2020-02-06 16:31 ` [alsa-devel] [PATCH 1/3] ALSA: via82xx: Fix endianness annotations Takashi Iwai
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-02-06 16:31 UTC (permalink / raw)
To: alsa-devel
Hi,
this is a series of a few trivial fixes mostly for annotations that
caused sparse warnings.
Takashi
===
Takashi Iwai (3):
ALSA: via82xx: Fix endianness annotations
ALSA: emu10k1: Fix endianness annotations
ALSA: emu8000: Fix the cast to __user pointer
sound/isa/sb/emu8000_pcm.c | 4 ++--
sound/pci/emu10k1/emu10k1_main.c | 4 +++-
sound/pci/via82xx.c | 6 ++++--
sound/pci/via82xx_modem.c | 6 ++++--
4 files changed, 13 insertions(+), 7 deletions(-)
--
2.16.4
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [alsa-devel] [PATCH 1/3] ALSA: via82xx: Fix endianness annotations
2020-02-06 16:31 [alsa-devel] [PATCH 0/3] ALSA: Minor sparse warning fixes Takashi Iwai
@ 2020-02-06 16:31 ` Takashi Iwai
2020-02-06 16:31 ` [alsa-devel] [PATCH 2/3] ALSA: emu10k1: " Takashi Iwai
2020-02-06 16:31 ` [alsa-devel] [PATCH 3/3] ALSA: emu8000: Fix the cast to __user pointer Takashi Iwai
2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-02-06 16:31 UTC (permalink / raw)
To: alsa-devel
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.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/via82xx.c | 6 ++++--
sound/pci/via82xx_modem.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 799789c8eea9..8b03e2dc503f 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -414,6 +414,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
{
unsigned int i, idx, ofs, rest;
struct via82xx *chip = snd_pcm_substream_chip(substream);
+ __le32 *pgtbl;
if (dev->table.area == NULL) {
/* 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
/* fill the entries */
idx = 0;
ofs = 0;
+ pgtbl = (__le32 *)dev->table.area;
for (i = 0; i < periods; i++) {
rest = fragsize;
/* fill descriptors for a period.
@@ -451,7 +453,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
return -EINVAL;
}
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);
rest -= r;
if (! rest) {
@@ -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",
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].size = r;
ofs += r;
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 84e589803e2e..607b7100db1c 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -267,6 +267,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
{
unsigned int i, idx, ofs, rest;
struct via82xx_modem *chip = snd_pcm_substream_chip(substream);
+ __le32 *pgtbl;
if (dev->table.area == NULL) {
/* 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
/* fill the entries */
idx = 0;
ofs = 0;
+ pgtbl = (__le32 *)dev->table.area;
for (i = 0; i < periods; i++) {
rest = fragsize;
/* fill descriptors for a period.
@@ -304,7 +306,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
return -EINVAL;
}
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);
if (rest < r)
r = rest;
@@ -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",
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].size = r;
ofs += r;
--
2.16.4
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [alsa-devel] [PATCH 2/3] ALSA: emu10k1: Fix endianness annotations
2020-02-06 16:31 [alsa-devel] [PATCH 0/3] ALSA: Minor sparse warning fixes Takashi Iwai
2020-02-06 16:31 ` [alsa-devel] [PATCH 1/3] ALSA: via82xx: Fix endianness annotations Takashi Iwai
@ 2020-02-06 16:31 ` Takashi Iwai
2020-02-06 16:31 ` [alsa-devel] [PATCH 3/3] ALSA: emu8000: Fix the cast to __user pointer Takashi Iwai
2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-02-06 16:31 UTC (permalink / raw)
To: alsa-devel
The internal page tables are little endian, hence they should be
__le32 type. This fixes the relevant sparse warning:
sound/pci/emu10k1/emu10k1_main.c:2013:51: warning: incorrect type in assignment (different base types)
sound/pci/emu10k1/emu10k1_main.c:2013:51: expected unsigned int [usertype]
sound/pci/emu10k1/emu10k1_main.c:2013:51: got restricted __le32 [usertype]
No functional changes, just sparse warning fixes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/emu10k1/emu10k1_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index a89a7e603ca8..6ff581733a19 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1789,6 +1789,7 @@ int snd_emu10k1_create(struct snd_card *card,
int idx, err;
int is_audigy;
size_t page_table_size;
+ __le32 *pgtbl;
unsigned int silent_page;
const struct snd_emu_chip_details *c;
static const struct snd_device_ops ops = {
@@ -2009,8 +2010,9 @@ int snd_emu10k1_create(struct snd_card *card,
/* Clear silent pages and set up pointers */
memset(emu->silent_page.area, 0, emu->silent_page.bytes);
silent_page = emu->silent_page.addr << emu->address_mode;
+ pgtbl = (__le32 *)emu->ptb_pages.area;
for (idx = 0; idx < (emu->address_mode ? MAXPAGES1 : MAXPAGES0); idx++)
- ((u32 *)emu->ptb_pages.area)[idx] = cpu_to_le32(silent_page | idx);
+ pgtbl[idx] = cpu_to_le32(silent_page | idx);
/* set up voice indices */
for (idx = 0; idx < NUM_G; idx++) {
--
2.16.4
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [alsa-devel] [PATCH 3/3] ALSA: emu8000: Fix the cast to __user pointer
2020-02-06 16:31 [alsa-devel] [PATCH 0/3] ALSA: Minor sparse warning fixes Takashi Iwai
2020-02-06 16:31 ` [alsa-devel] [PATCH 1/3] ALSA: via82xx: Fix endianness annotations Takashi Iwai
2020-02-06 16:31 ` [alsa-devel] [PATCH 2/3] ALSA: emu10k1: " Takashi Iwai
@ 2020-02-06 16:31 ` Takashi Iwai
2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-02-06 16:31 UTC (permalink / raw)
To: alsa-devel
Fixes the sparse warnings. The cast to __user pointer needs __force:
sound/isa/sb/emu8000_pcm.c:528:9: warning: cast removes address space '<asn:1>' of expression
No functional changes, just sparse warning fixes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/isa/sb/emu8000_pcm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c
index e377ac93f37f..8e8257c574b0 100644
--- a/sound/isa/sb/emu8000_pcm.c
+++ b/sound/isa/sb/emu8000_pcm.c
@@ -435,7 +435,7 @@ enum {
#define LOOP_WRITE(rec, offset, _buf, count, mode) \
do { \
struct snd_emu8000 *emu = (rec)->emu; \
- unsigned short *buf = (unsigned short *)(_buf); \
+ unsigned short *buf = (__force unsigned short *)(_buf); \
snd_emu8000_write_wait(emu, 1); \
EMU8000_SMALW_WRITE(emu, offset); \
while (count > 0) { \
@@ -492,7 +492,7 @@ static int emu8k_pcm_silence(struct snd_pcm_substream *subs,
#define LOOP_WRITE(rec, pos, _buf, count, mode) \
do { \
struct snd_emu8000 *emu = rec->emu; \
- unsigned short *buf = (unsigned short *)(_buf); \
+ unsigned short *buf = (__force unsigned short *)(_buf); \
snd_emu8000_write_wait(emu, 1); \
EMU8000_SMALW_WRITE(emu, pos + rec->loop_start[0]); \
if (rec->voices > 1) \
--
2.16.4
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-06 16:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 16:31 [alsa-devel] [PATCH 0/3] ALSA: Minor sparse warning fixes Takashi Iwai
2020-02-06 16:31 ` [alsa-devel] [PATCH 1/3] ALSA: via82xx: Fix endianness annotations Takashi Iwai
2020-02-06 16:31 ` [alsa-devel] [PATCH 2/3] ALSA: emu10k1: " Takashi Iwai
2020-02-06 16:31 ` [alsa-devel] [PATCH 3/3] ALSA: emu8000: Fix the cast to __user pointer Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).