diff options
Diffstat (limited to 'sound/i2c')
-rw-r--r-- | sound/i2c/cs8427.c | 15 | ||||
-rw-r--r-- | sound/i2c/i2c.c | 6 | ||||
-rw-r--r-- | sound/i2c/l3/uda1341.c | 3 | ||||
-rw-r--r-- | sound/i2c/other/ak4114.c | 3 | ||||
-rw-r--r-- | sound/i2c/other/ak4117.c | 3 | ||||
-rw-r--r-- | sound/i2c/other/ak4xxx-adda.c | 4 | ||||
-rw-r--r-- | sound/i2c/other/tea575x-tuner.c | 23 |
7 files changed, 41 insertions, 16 deletions
diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c index 9c3d361accfb..020a5d512472 100644 --- a/sound/i2c/cs8427.c +++ b/sound/i2c/cs8427.c | |||
@@ -314,7 +314,8 @@ static void snd_cs8427_reset(struct snd_i2c_device *cs8427) | |||
314 | unsigned long end_time; | 314 | unsigned long end_time; |
315 | int data, aes3input = 0; | 315 | int data, aes3input = 0; |
316 | 316 | ||
317 | snd_assert(cs8427, return); | 317 | if (snd_BUG_ON(!cs8427)) |
318 | return; | ||
318 | chip = cs8427->private_data; | 319 | chip = cs8427->private_data; |
319 | snd_i2c_lock(cs8427->bus); | 320 | snd_i2c_lock(cs8427->bus); |
320 | if ((chip->regmap[CS8427_REG_CLOCKSOURCE] & CS8427_RXDAES3INPUT) == | 321 | if ((chip->regmap[CS8427_REG_CLOCKSOURCE] & CS8427_RXDAES3INPUT) == |
@@ -526,7 +527,8 @@ int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427, | |||
526 | unsigned int idx; | 527 | unsigned int idx; |
527 | int err; | 528 | int err; |
528 | 529 | ||
529 | snd_assert(play_substream && cap_substream, return -EINVAL); | 530 | if (snd_BUG_ON(!play_substream || !cap_substream)) |
531 | return -EINVAL; | ||
530 | for (idx = 0; idx < ARRAY_SIZE(snd_cs8427_iec958_controls); idx++) { | 532 | for (idx = 0; idx < ARRAY_SIZE(snd_cs8427_iec958_controls); idx++) { |
531 | kctl = snd_ctl_new1(&snd_cs8427_iec958_controls[idx], cs8427); | 533 | kctl = snd_ctl_new1(&snd_cs8427_iec958_controls[idx], cs8427); |
532 | if (kctl == NULL) | 534 | if (kctl == NULL) |
@@ -543,7 +545,8 @@ int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427, | |||
543 | 545 | ||
544 | chip->playback.substream = play_substream; | 546 | chip->playback.substream = play_substream; |
545 | chip->capture.substream = cap_substream; | 547 | chip->capture.substream = cap_substream; |
546 | snd_assert(chip->playback.pcm_ctl, return -EIO); | 548 | if (snd_BUG_ON(!chip->playback.pcm_ctl)) |
549 | return -EIO; | ||
547 | return 0; | 550 | return 0; |
548 | } | 551 | } |
549 | 552 | ||
@@ -553,7 +556,8 @@ int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active) | |||
553 | { | 556 | { |
554 | struct cs8427 *chip; | 557 | struct cs8427 *chip; |
555 | 558 | ||
556 | snd_assert(cs8427, return -ENXIO); | 559 | if (snd_BUG_ON(!cs8427)) |
560 | return -ENXIO; | ||
557 | chip = cs8427->private_data; | 561 | chip = cs8427->private_data; |
558 | if (active) | 562 | if (active) |
559 | memcpy(chip->playback.pcm_status, | 563 | memcpy(chip->playback.pcm_status, |
@@ -573,7 +577,8 @@ int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate) | |||
573 | char *status; | 577 | char *status; |
574 | int err, reset; | 578 | int err, reset; |
575 | 579 | ||
576 | snd_assert(cs8427, return -ENXIO); | 580 | if (snd_BUG_ON(!cs8427)) |
581 | return -ENXIO; | ||
577 | chip = cs8427->private_data; | 582 | chip = cs8427->private_data; |
578 | status = chip->playback.pcm_status; | 583 | status = chip->playback.pcm_status; |
579 | snd_i2c_lock(cs8427->bus); | 584 | snd_i2c_lock(cs8427->bus); |
diff --git a/sound/i2c/i2c.c b/sound/i2c/i2c.c index b1e74e40cba0..5c0c77dd01c3 100644 --- a/sound/i2c/i2c.c +++ b/sound/i2c/i2c.c | |||
@@ -49,7 +49,8 @@ static int snd_i2c_bus_free(struct snd_i2c_bus *bus) | |||
49 | struct snd_i2c_bus *slave; | 49 | struct snd_i2c_bus *slave; |
50 | struct snd_i2c_device *device; | 50 | struct snd_i2c_device *device; |
51 | 51 | ||
52 | snd_assert(bus != NULL, return -EINVAL); | 52 | if (snd_BUG_ON(!bus)) |
53 | return -EINVAL; | ||
53 | while (!list_empty(&bus->devices)) { | 54 | while (!list_empty(&bus->devices)) { |
54 | device = snd_i2c_device(bus->devices.next); | 55 | device = snd_i2c_device(bus->devices.next); |
55 | snd_i2c_device_free(device); | 56 | snd_i2c_device_free(device); |
@@ -113,7 +114,8 @@ int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name, | |||
113 | struct snd_i2c_device *device; | 114 | struct snd_i2c_device *device; |
114 | 115 | ||
115 | *rdevice = NULL; | 116 | *rdevice = NULL; |
116 | snd_assert(bus != NULL, return -EINVAL); | 117 | if (snd_BUG_ON(!bus)) |
118 | return -EINVAL; | ||
117 | device = kzalloc(sizeof(*device), GFP_KERNEL); | 119 | device = kzalloc(sizeof(*device), GFP_KERNEL); |
118 | if (device == NULL) | 120 | if (device == NULL) |
119 | return -ENOMEM; | 121 | return -ENOMEM; |
diff --git a/sound/i2c/l3/uda1341.c b/sound/i2c/l3/uda1341.c index 1f4942ea1414..9840eb43648d 100644 --- a/sound/i2c/l3/uda1341.c +++ b/sound/i2c/l3/uda1341.c | |||
@@ -771,7 +771,8 @@ int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client ** | |||
771 | struct l3_client *clnt; | 771 | struct l3_client *clnt; |
772 | int idx, err; | 772 | int idx, err; |
773 | 773 | ||
774 | snd_assert(card != NULL, return -EINVAL); | 774 | if (snd_BUG_ON(!card)) |
775 | return -EINVAL; | ||
775 | 776 | ||
776 | clnt = kzalloc(sizeof(*clnt), GFP_KERNEL); | 777 | clnt = kzalloc(sizeof(*clnt), GFP_KERNEL); |
777 | if (clnt == NULL) | 778 | if (clnt == NULL) |
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index d20d893b3b60..0341451f814c 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c | |||
@@ -475,7 +475,8 @@ int snd_ak4114_build(struct ak4114 *ak4114, | |||
475 | unsigned int idx; | 475 | unsigned int idx; |
476 | int err; | 476 | int err; |
477 | 477 | ||
478 | snd_assert(cap_substream, return -EINVAL); | 478 | if (snd_BUG_ON(!cap_substream)) |
479 | return -EINVAL; | ||
479 | ak4114->playback_substream = ply_substream; | 480 | ak4114->playback_substream = ply_substream; |
480 | ak4114->capture_substream = cap_substream; | 481 | ak4114->capture_substream = cap_substream; |
481 | for (idx = 0; idx < AK4114_CONTROLS; idx++) { | 482 | for (idx = 0; idx < AK4114_CONTROLS; idx++) { |
diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c index f350835ade96..2cad2d612518 100644 --- a/sound/i2c/other/ak4117.c +++ b/sound/i2c/other/ak4117.c | |||
@@ -431,7 +431,8 @@ int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *cap_substr | |||
431 | unsigned int idx; | 431 | unsigned int idx; |
432 | int err; | 432 | int err; |
433 | 433 | ||
434 | snd_assert(cap_substream, return -EINVAL); | 434 | if (snd_BUG_ON(!cap_substream)) |
435 | return -EINVAL; | ||
435 | ak4117->substream = cap_substream; | 436 | ak4117->substream = cap_substream; |
436 | for (idx = 0; idx < AK4117_CONTROLS; idx++) { | 437 | for (idx = 0; idx < AK4117_CONTROLS; idx++) { |
437 | kctl = snd_ctl_new1(&snd_ak4117_iec958_controls[idx], ak4117); | 438 | kctl = snd_ctl_new1(&snd_ak4117_iec958_controls[idx], ak4117); |
diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c index 288926d2e205..ee47abab764e 100644 --- a/sound/i2c/other/ak4xxx-adda.c +++ b/sound/i2c/other/ak4xxx-adda.c | |||
@@ -233,8 +233,8 @@ void snd_akm4xxx_init(struct snd_akm4xxx *ak) | |||
233 | 0x01, 0x02, /* 1: reset and soft-mute */ | 233 | 0x01, 0x02, /* 1: reset and soft-mute */ |
234 | 0x00, 0x06, /* 0: mode3(i2s), disable auto-clock detect, | 234 | 0x00, 0x06, /* 0: mode3(i2s), disable auto-clock detect, |
235 | * disable DZF, sharp roll-off, RSTN#=0 */ | 235 | * disable DZF, sharp roll-off, RSTN#=0 */ |
236 | 0x02, 0x0e, /* 2: DA's power up, normal speed, RSTN#=0 */ | 236 | 0x02, 0x4e, /* 2: DA's power up, normal speed, RSTN#=0 */ |
237 | // 0x02, 0x2e, /* quad speed */ | 237 | /* 0x02, 0x6e,*/ /* quad speed */ |
238 | 0x03, 0x01, /* 3: de-emphasis off */ | 238 | 0x03, 0x01, /* 3: de-emphasis off */ |
239 | 0x04, 0x00, /* 4: LOUT1 volume muted */ | 239 | 0x04, 0x00, /* 4: LOUT1 volume muted */ |
240 | 0x05, 0x00, /* 5: ROUT1 volume muted */ | 240 | 0x05, 0x00, /* 5: ROUT1 volume muted */ |
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 83e90057270e..c13a178383ba 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c | |||
@@ -87,8 +87,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea) | |||
87 | static int snd_tea575x_ioctl(struct inode *inode, struct file *file, | 87 | static int snd_tea575x_ioctl(struct inode *inode, struct file *file, |
88 | unsigned int cmd, unsigned long data) | 88 | unsigned int cmd, unsigned long data) |
89 | { | 89 | { |
90 | struct video_device *dev = video_devdata(file); | 90 | struct snd_tea575x *tea = video_drvdata(file); |
91 | struct snd_tea575x *tea = video_get_drvdata(dev); | ||
92 | void __user *arg = (void __user *)data; | 91 | void __user *arg = (void __user *)data; |
93 | 92 | ||
94 | switch(cmd) { | 93 | switch(cmd) { |
@@ -175,6 +174,21 @@ static void snd_tea575x_release(struct video_device *vfd) | |||
175 | { | 174 | { |
176 | } | 175 | } |
177 | 176 | ||
177 | static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) | ||
178 | { | ||
179 | struct snd_tea575x *tea = video_drvdata(file); | ||
180 | |||
181 | return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; | ||
182 | } | ||
183 | |||
184 | static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file) | ||
185 | { | ||
186 | struct snd_tea575x *tea = video_drvdata(file); | ||
187 | |||
188 | clear_bit(0, &tea->in_use); | ||
189 | return 0; | ||
190 | } | ||
191 | |||
178 | /* | 192 | /* |
179 | * initialize all the tea575x chips | 193 | * initialize all the tea575x chips |
180 | */ | 194 | */ |
@@ -193,9 +207,10 @@ void snd_tea575x_init(struct snd_tea575x *tea) | |||
193 | tea->vd.release = snd_tea575x_release; | 207 | tea->vd.release = snd_tea575x_release; |
194 | video_set_drvdata(&tea->vd, tea); | 208 | video_set_drvdata(&tea->vd, tea); |
195 | tea->vd.fops = &tea->fops; | 209 | tea->vd.fops = &tea->fops; |
210 | tea->in_use = 0; | ||
196 | tea->fops.owner = tea->card->module; | 211 | tea->fops.owner = tea->card->module; |
197 | tea->fops.open = video_exclusive_open; | 212 | tea->fops.open = snd_tea575x_exclusive_open; |
198 | tea->fops.release = video_exclusive_release; | 213 | tea->fops.release = snd_tea575x_exclusive_release; |
199 | tea->fops.ioctl = snd_tea575x_ioctl; | 214 | tea->fops.ioctl = snd_tea575x_ioctl; |
200 | if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) { | 215 | if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) { |
201 | snd_printk(KERN_ERR "unable to register tea575x tuner\n"); | 216 | snd_printk(KERN_ERR "unable to register tea575x tuner\n"); |