hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/sound/drivers/mts64.c
....@@ -1,21 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ALSA Driver for Ego Systems Inc. (ESI) Miditerminal 4140
34 * Copyright (c) 2006 by Matthias König <mk@phasorlab.de>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
- *
195 */
206
217 #include <linux/init.h>
....@@ -275,7 +261,7 @@
275261 */
276262 static u8 mts64_map_midi_input(u8 c)
277263 {
278
- static u8 map[] = { 0, 1, 4, 2, 3 };
264
+ static const u8 map[] = { 0, 1, 4, 2, 3 };
279265
280266 return map[c];
281267 }
....@@ -367,7 +353,7 @@
367353 u8 seconds, u8 frames,
368354 u8 idx)
369355 {
370
- static u8 fps[5] = { MTS64_CMD_SMPTE_FPS_24,
356
+ static const u8 fps[5] = { MTS64_CMD_SMPTE_FPS_24,
371357 MTS64_CMD_SMPTE_FPS_25,
372358 MTS64_CMD_SMPTE_FPS_2997,
373359 MTS64_CMD_SMPTE_FPS_30D,
....@@ -481,7 +467,7 @@
481467 return changed;
482468 }
483469
484
-static struct snd_kcontrol_new mts64_ctl_smpte_switch = {
470
+static const struct snd_kcontrol_new mts64_ctl_smpte_switch = {
485471 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
486472 .name = "SMPTE Playback Switch",
487473 .index = 0,
....@@ -554,7 +540,7 @@
554540 return changed;
555541 }
556542
557
-static struct snd_kcontrol_new mts64_ctl_smpte_time_hours = {
543
+static const struct snd_kcontrol_new mts64_ctl_smpte_time_hours = {
558544 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
559545 .name = "SMPTE Time Hours",
560546 .index = 0,
....@@ -565,7 +551,7 @@
565551 .put = snd_mts64_ctl_smpte_time_put
566552 };
567553
568
-static struct snd_kcontrol_new mts64_ctl_smpte_time_minutes = {
554
+static const struct snd_kcontrol_new mts64_ctl_smpte_time_minutes = {
569555 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
570556 .name = "SMPTE Time Minutes",
571557 .index = 0,
....@@ -576,7 +562,7 @@
576562 .put = snd_mts64_ctl_smpte_time_put
577563 };
578564
579
-static struct snd_kcontrol_new mts64_ctl_smpte_time_seconds = {
565
+static const struct snd_kcontrol_new mts64_ctl_smpte_time_seconds = {
580566 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
581567 .name = "SMPTE Time Seconds",
582568 .index = 0,
....@@ -587,7 +573,7 @@
587573 .put = snd_mts64_ctl_smpte_time_put
588574 };
589575
590
-static struct snd_kcontrol_new mts64_ctl_smpte_time_frames = {
576
+static const struct snd_kcontrol_new mts64_ctl_smpte_time_frames = {
591577 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
592578 .name = "SMPTE Time Frames",
593579 .index = 0,
....@@ -639,7 +625,7 @@
639625 return changed;
640626 }
641627
642
-static struct snd_kcontrol_new mts64_ctl_smpte_fps = {
628
+static const struct snd_kcontrol_new mts64_ctl_smpte_fps = {
643629 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
644630 .name = "SMPTE Fps",
645631 .index = 0,
....@@ -655,7 +641,7 @@
655641 struct mts64 *mts)
656642 {
657643 int err, i;
658
- static struct snd_kcontrol_new *control[] = {
644
+ static const struct snd_kcontrol_new *control[] = {
659645 &mts64_ctl_smpte_switch,
660646 &mts64_ctl_smpte_time_hours,
661647 &mts64_ctl_smpte_time_minutes,
....@@ -830,6 +816,9 @@
830816 u8 status, data;
831817 struct snd_rawmidi_substream *substream;
832818
819
+ if (!mts)
820
+ return;
821
+
833822 spin_lock(&mts->lock);
834823 ret = mts64_read(mts->pardev->port);
835824 data = ret & 0x00ff;