Skip to content

Commit cb639a4

Browse files
committed
ALSA: pcm: Fix sparse warnings wrt snd_pcm_state_t
Since we have a bitwise definition of snd_pcm_state_t and use it for certain struct fields, a few new (and years old) sparse warnings came up. This patch is an attempt to cover them. - The state fields in snd_pcm_mmap_status* and co are all defined as snd_pcm_state_t type now - The PCM action callbacks take snd_pcm_state_t argument as well; some actions taking special values got the explicit cast and comments - For the PCM action that doesn't need an extra argument receives ACTION_ARG_IGNORE instead of ambiguous 0 While we're at it, the boolean argument is also properly changed to bool and true/false, as well as a slight refactoring of PCM pause helper function to make easier to read. No functional changes, just shutting up chatty sparse. Fixes: 46b770f ("ALSA: uapi: Fix sparse warning") Reported-by: kbuild test robot <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 66f2d19 commit cb639a4

File tree

3 files changed

+127
-72
lines changed

3 files changed

+127
-72
lines changed

include/sound/pcm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ struct snd_pcm_status64 {
14501450
#define SNDRV_PCM_IOCTL_STATUS_EXT64 _IOWR('A', 0x24, struct snd_pcm_status64)
14511451

14521452
struct snd_pcm_status32 {
1453-
s32 state; /* stream state */
1453+
snd_pcm_state_t state; /* stream state */
14541454
s32 trigger_tstamp_sec; /* time when stream was started/stopped/paused */
14551455
s32 trigger_tstamp_nsec;
14561456
s32 tstamp_sec; /* reference timestamp */
@@ -1461,7 +1461,7 @@ struct snd_pcm_status32 {
14611461
u32 avail; /* number of frames available */
14621462
u32 avail_max; /* max frames available on hw since last status */
14631463
u32 overrange; /* count of ADC (capture) overrange detections from last status */
1464-
s32 suspended_state; /* suspended stream state */
1464+
snd_pcm_state_t suspended_state; /* suspended stream state */
14651465
u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */
14661466
s32 audio_tstamp_sec; /* sample counter, wall clock, PHC or on-demand sync'ed */
14671467
s32 audio_tstamp_nsec;

sound/core/pcm_compat.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream,
156156
#endif /* CONFIG_X86_X32 */
157157

158158
struct compat_snd_pcm_status64 {
159-
s32 state;
159+
snd_pcm_state_t state;
160160
u8 rsvd[4]; /* alignment */
161161
s64 trigger_tstamp_sec;
162162
s64 trigger_tstamp_nsec;
@@ -168,7 +168,7 @@ struct compat_snd_pcm_status64 {
168168
u32 avail;
169169
u32 avail_max;
170170
u32 overrange;
171-
s32 suspended_state;
171+
snd_pcm_state_t suspended_state;
172172
u32 audio_tstamp_data;
173173
s64 audio_tstamp_sec;
174174
s64 audio_tstamp_nsec;
@@ -376,13 +376,13 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
376376
#ifdef CONFIG_X86_X32
377377
/* X32 ABI has 64bit timespec and 64bit alignment */
378378
struct snd_pcm_mmap_status_x32 {
379-
s32 state;
379+
snd_pcm_state_t state;
380380
s32 pad1;
381381
u32 hw_ptr;
382382
u32 pad2; /* alignment */
383383
s64 tstamp_sec;
384384
s64 tstamp_nsec;
385-
s32 suspended_state;
385+
snd_pcm_state_t suspended_state;
386386
s32 pad3;
387387
s64 audio_tstamp_sec;
388388
s64 audio_tstamp_nsec;

0 commit comments

Comments
 (0)