OSDN Git Service

ALSA: sb: Fix sparse warning wrt PCM format type
authorTakashi Iwai <tiwai@suse.de>
Wed, 25 Jul 2018 21:19:44 +0000 (23:19 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 27 Jul 2018 07:05:33 +0000 (09:05 +0200)
The PCM format type is with __bitwise, and it can't be converted from
integer implicitly.  Instead of an ugly cast, declare the function
argument of snd_sb_csp_autoload() with the proper snd_pcm_format_t
type.

This fixes the sparse warnings like:
  sound/isa/sb/sb16_csp.c:743:22: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/sb16_csp.h
sound/isa/sb/sb16_csp.c

index c7c7788..7817e88 100644 (file)
@@ -46,7 +46,7 @@ enum {
 struct snd_sb_csp_ops {
        int (*csp_use) (struct snd_sb_csp * p);
        int (*csp_unuse) (struct snd_sb_csp * p);
-       int (*csp_autoload) (struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode);
+       int (*csp_autoload) (struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode);
        int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels);
        int (*csp_stop) (struct snd_sb_csp * p);
        int (*csp_qsound_transfer) (struct snd_sb_csp * p);
index fa5780b..2210e7c 100644 (file)
@@ -93,7 +93,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
                                struct snd_sb_csp_microcode __user * code);
 static int snd_sb_csp_unload(struct snd_sb_csp * p);
 static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags);
-static int snd_sb_csp_autoload(struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode);
+static int snd_sb_csp_autoload(struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode);
 static int snd_sb_csp_check_version(struct snd_sb_csp * p);
 
 static int snd_sb_csp_use(struct snd_sb_csp * p);
@@ -726,7 +726,7 @@ static int snd_sb_csp_firmware_load(struct snd_sb_csp *p, int index, int flags)
  * autoload hardware codec if necessary
  * return 0 if CSP is loaded and ready to run (p->running != 0)
  */
-static int snd_sb_csp_autoload(struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode)
+static int snd_sb_csp_autoload(struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode)
 {
        unsigned long flags;
        int err = 0;
@@ -736,7 +736,7 @@ static int snd_sb_csp_autoload(struct snd_sb_csp * p, int pcm_sfmt, int play_rec
                return -EBUSY;
 
        /* autoload microcode only if requested hardware codec is not already loaded */
-       if (((1 << pcm_sfmt) & p->acc_format) && (play_rec_mode & p->mode)) {
+       if (((1U << (__force int)pcm_sfmt) & p->acc_format) && (play_rec_mode & p->mode)) {
                p->running = SNDRV_SB_CSP_ST_AUTO;
        } else {
                switch (pcm_sfmt) {