Skip to content

Commit 50895a5

Browse files
zx2c4tiwai
authored andcommitted
ALSA: rme9652: use explicitly signed char
With char becoming unsigned by default, and with `char` alone being ambiguous and based on architecture, signed chars need to be marked explicitly as such. This fixes warnings like: sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)' sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned Signed-off-by: Jason A. Donenfeld <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent ee03c0f commit 50895a5

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

sound/pci/rme9652/hdsp.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ struct hdsp_midi {
433433
struct snd_rawmidi *rmidi;
434434
struct snd_rawmidi_substream *input;
435435
struct snd_rawmidi_substream *output;
436-
char istimer; /* timer in use */
436+
signed char istimer; /* timer in use */
437437
struct timer_list timer;
438438
spinlock_t lock;
439439
int pending;
@@ -480,7 +480,7 @@ struct hdsp {
480480
pid_t playback_pid;
481481
int running;
482482
int system_sample_rate;
483-
const char *channel_map;
483+
const signed char *channel_map;
484484
int dev;
485485
int irq;
486486
unsigned long port;
@@ -502,7 +502,7 @@ struct hdsp {
502502
where the data for that channel can be read/written from/to.
503503
*/
504504

505-
static const char channel_map_df_ss[HDSP_MAX_CHANNELS] = {
505+
static const signed char channel_map_df_ss[HDSP_MAX_CHANNELS] = {
506506
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
507507
18, 19, 20, 21, 22, 23, 24, 25
508508
};
@@ -517,7 +517,7 @@ static const char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */
517517
-1, -1, -1, -1, -1, -1, -1, -1
518518
};
519519

520-
static const char channel_map_ds[HDSP_MAX_CHANNELS] = {
520+
static const signed char channel_map_ds[HDSP_MAX_CHANNELS] = {
521521
/* ADAT channels are remapped */
522522
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23,
523523
/* channels 12 and 13 are S/PDIF */
@@ -526,7 +526,7 @@ static const char channel_map_ds[HDSP_MAX_CHANNELS] = {
526526
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
527527
};
528528

529-
static const char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = {
529+
static const signed char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = {
530530
/* ADAT channels */
531531
0, 1, 2, 3, 4, 5, 6, 7,
532532
/* SPDIF */
@@ -540,7 +540,7 @@ static const char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = {
540540
-1, -1
541541
};
542542

543-
static const char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = {
543+
static const signed char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = {
544544
/* ADAT */
545545
1, 3, 5, 7,
546546
/* SPDIF */
@@ -554,7 +554,7 @@ static const char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = {
554554
-1, -1, -1, -1, -1, -1
555555
};
556556

557-
static const char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = {
557+
static const signed char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = {
558558
/* ADAT is disabled in this mode */
559559
/* SPDIF */
560560
8, 9,
@@ -3939,7 +3939,7 @@ static snd_pcm_uframes_t snd_hdsp_hw_pointer(struct snd_pcm_substream *substream
39393939
return hdsp_hw_pointer(hdsp);
39403940
}
39413941

3942-
static char *hdsp_channel_buffer_location(struct hdsp *hdsp,
3942+
static signed char *hdsp_channel_buffer_location(struct hdsp *hdsp,
39433943
int stream,
39443944
int channel)
39453945

@@ -3964,7 +3964,7 @@ static int snd_hdsp_playback_copy(struct snd_pcm_substream *substream,
39643964
void __user *src, unsigned long count)
39653965
{
39663966
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
3967-
char *channel_buf;
3967+
signed char *channel_buf;
39683968

39693969
if (snd_BUG_ON(pos + count > HDSP_CHANNEL_BUFFER_BYTES))
39703970
return -EINVAL;
@@ -3982,7 +3982,7 @@ static int snd_hdsp_playback_copy_kernel(struct snd_pcm_substream *substream,
39823982
void *src, unsigned long count)
39833983
{
39843984
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
3985-
char *channel_buf;
3985+
signed char *channel_buf;
39863986

39873987
channel_buf = hdsp_channel_buffer_location(hdsp, substream->pstr->stream, channel);
39883988
if (snd_BUG_ON(!channel_buf))
@@ -3996,7 +3996,7 @@ static int snd_hdsp_capture_copy(struct snd_pcm_substream *substream,
39963996
void __user *dst, unsigned long count)
39973997
{
39983998
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
3999-
char *channel_buf;
3999+
signed char *channel_buf;
40004000

40014001
if (snd_BUG_ON(pos + count > HDSP_CHANNEL_BUFFER_BYTES))
40024002
return -EINVAL;
@@ -4014,7 +4014,7 @@ static int snd_hdsp_capture_copy_kernel(struct snd_pcm_substream *substream,
40144014
void *dst, unsigned long count)
40154015
{
40164016
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
4017-
char *channel_buf;
4017+
signed char *channel_buf;
40184018

40194019
channel_buf = hdsp_channel_buffer_location(hdsp, substream->pstr->stream, channel);
40204020
if (snd_BUG_ON(!channel_buf))
@@ -4028,7 +4028,7 @@ static int snd_hdsp_hw_silence(struct snd_pcm_substream *substream,
40284028
unsigned long count)
40294029
{
40304030
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
4031-
char *channel_buf;
4031+
signed char *channel_buf;
40324032

40334033
channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel);
40344034
if (snd_BUG_ON(!channel_buf))

sound/pci/rme9652/rme9652.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ struct snd_rme9652 {
230230
int last_spdif_sample_rate; /* so that we can catch externally ... */
231231
int last_adat_sample_rate; /* ... induced rate changes */
232232

233-
const char *channel_map;
233+
const signed char *channel_map;
234234

235235
struct snd_card *card;
236236
struct snd_pcm *pcm;
@@ -247,20 +247,20 @@ struct snd_rme9652 {
247247
where the data for that channel can be read/written from/to.
248248
*/
249249

250-
static const char channel_map_9652_ss[26] = {
250+
static const signed char channel_map_9652_ss[26] = {
251251
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
252252
18, 19, 20, 21, 22, 23, 24, 25
253253
};
254254

255-
static const char channel_map_9636_ss[26] = {
255+
static const signed char channel_map_9636_ss[26] = {
256256
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
257257
/* channels 16 and 17 are S/PDIF */
258258
24, 25,
259259
/* channels 18-25 don't exist */
260260
-1, -1, -1, -1, -1, -1, -1, -1
261261
};
262262

263-
static const char channel_map_9652_ds[26] = {
263+
static const signed char channel_map_9652_ds[26] = {
264264
/* ADAT channels are remapped */
265265
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23,
266266
/* channels 12 and 13 are S/PDIF */
@@ -269,7 +269,7 @@ static const char channel_map_9652_ds[26] = {
269269
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
270270
};
271271

272-
static const char channel_map_9636_ds[26] = {
272+
static const signed char channel_map_9636_ds[26] = {
273273
/* ADAT channels are remapped */
274274
1, 3, 5, 7, 9, 11, 13, 15,
275275
/* channels 8 and 9 are S/PDIF */
@@ -1819,7 +1819,7 @@ static snd_pcm_uframes_t snd_rme9652_hw_pointer(struct snd_pcm_substream *substr
18191819
return rme9652_hw_pointer(rme9652);
18201820
}
18211821

1822-
static char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652,
1822+
static signed char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652,
18231823
int stream,
18241824
int channel)
18251825

@@ -1847,7 +1847,7 @@ static int snd_rme9652_playback_copy(struct snd_pcm_substream *substream,
18471847
void __user *src, unsigned long count)
18481848
{
18491849
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
1850-
char *channel_buf;
1850+
signed char *channel_buf;
18511851

18521852
if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES))
18531853
return -EINVAL;
@@ -1867,7 +1867,7 @@ static int snd_rme9652_playback_copy_kernel(struct snd_pcm_substream *substream,
18671867
void *src, unsigned long count)
18681868
{
18691869
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
1870-
char *channel_buf;
1870+
signed char *channel_buf;
18711871

18721872
channel_buf = rme9652_channel_buffer_location(rme9652,
18731873
substream->pstr->stream,
@@ -1883,7 +1883,7 @@ static int snd_rme9652_capture_copy(struct snd_pcm_substream *substream,
18831883
void __user *dst, unsigned long count)
18841884
{
18851885
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
1886-
char *channel_buf;
1886+
signed char *channel_buf;
18871887

18881888
if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES))
18891889
return -EINVAL;
@@ -1903,7 +1903,7 @@ static int snd_rme9652_capture_copy_kernel(struct snd_pcm_substream *substream,
19031903
void *dst, unsigned long count)
19041904
{
19051905
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
1906-
char *channel_buf;
1906+
signed char *channel_buf;
19071907

19081908
channel_buf = rme9652_channel_buffer_location(rme9652,
19091909
substream->pstr->stream,
@@ -1919,7 +1919,7 @@ static int snd_rme9652_hw_silence(struct snd_pcm_substream *substream,
19191919
unsigned long count)
19201920
{
19211921
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
1922-
char *channel_buf;
1922+
signed char *channel_buf;
19231923

19241924
channel_buf = rme9652_channel_buffer_location (rme9652,
19251925
substream->pstr->stream,

0 commit comments

Comments
 (0)