.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * ALSA Driver for Ego Systems Inc. (ESI) Miditerminal 4140 |
---|
3 | 4 | * 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 | | - * |
---|
19 | 5 | */ |
---|
20 | 6 | |
---|
21 | 7 | #include <linux/init.h> |
---|
.. | .. |
---|
275 | 261 | */ |
---|
276 | 262 | static u8 mts64_map_midi_input(u8 c) |
---|
277 | 263 | { |
---|
278 | | - static u8 map[] = { 0, 1, 4, 2, 3 }; |
---|
| 264 | + static const u8 map[] = { 0, 1, 4, 2, 3 }; |
---|
279 | 265 | |
---|
280 | 266 | return map[c]; |
---|
281 | 267 | } |
---|
.. | .. |
---|
367 | 353 | u8 seconds, u8 frames, |
---|
368 | 354 | u8 idx) |
---|
369 | 355 | { |
---|
370 | | - static u8 fps[5] = { MTS64_CMD_SMPTE_FPS_24, |
---|
| 356 | + static const u8 fps[5] = { MTS64_CMD_SMPTE_FPS_24, |
---|
371 | 357 | MTS64_CMD_SMPTE_FPS_25, |
---|
372 | 358 | MTS64_CMD_SMPTE_FPS_2997, |
---|
373 | 359 | MTS64_CMD_SMPTE_FPS_30D, |
---|
.. | .. |
---|
481 | 467 | return changed; |
---|
482 | 468 | } |
---|
483 | 469 | |
---|
484 | | -static struct snd_kcontrol_new mts64_ctl_smpte_switch = { |
---|
| 470 | +static const struct snd_kcontrol_new mts64_ctl_smpte_switch = { |
---|
485 | 471 | .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, |
---|
486 | 472 | .name = "SMPTE Playback Switch", |
---|
487 | 473 | .index = 0, |
---|
.. | .. |
---|
554 | 540 | return changed; |
---|
555 | 541 | } |
---|
556 | 542 | |
---|
557 | | -static struct snd_kcontrol_new mts64_ctl_smpte_time_hours = { |
---|
| 543 | +static const struct snd_kcontrol_new mts64_ctl_smpte_time_hours = { |
---|
558 | 544 | .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, |
---|
559 | 545 | .name = "SMPTE Time Hours", |
---|
560 | 546 | .index = 0, |
---|
.. | .. |
---|
565 | 551 | .put = snd_mts64_ctl_smpte_time_put |
---|
566 | 552 | }; |
---|
567 | 553 | |
---|
568 | | -static struct snd_kcontrol_new mts64_ctl_smpte_time_minutes = { |
---|
| 554 | +static const struct snd_kcontrol_new mts64_ctl_smpte_time_minutes = { |
---|
569 | 555 | .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, |
---|
570 | 556 | .name = "SMPTE Time Minutes", |
---|
571 | 557 | .index = 0, |
---|
.. | .. |
---|
576 | 562 | .put = snd_mts64_ctl_smpte_time_put |
---|
577 | 563 | }; |
---|
578 | 564 | |
---|
579 | | -static struct snd_kcontrol_new mts64_ctl_smpte_time_seconds = { |
---|
| 565 | +static const struct snd_kcontrol_new mts64_ctl_smpte_time_seconds = { |
---|
580 | 566 | .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, |
---|
581 | 567 | .name = "SMPTE Time Seconds", |
---|
582 | 568 | .index = 0, |
---|
.. | .. |
---|
587 | 573 | .put = snd_mts64_ctl_smpte_time_put |
---|
588 | 574 | }; |
---|
589 | 575 | |
---|
590 | | -static struct snd_kcontrol_new mts64_ctl_smpte_time_frames = { |
---|
| 576 | +static const struct snd_kcontrol_new mts64_ctl_smpte_time_frames = { |
---|
591 | 577 | .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, |
---|
592 | 578 | .name = "SMPTE Time Frames", |
---|
593 | 579 | .index = 0, |
---|
.. | .. |
---|
639 | 625 | return changed; |
---|
640 | 626 | } |
---|
641 | 627 | |
---|
642 | | -static struct snd_kcontrol_new mts64_ctl_smpte_fps = { |
---|
| 628 | +static const struct snd_kcontrol_new mts64_ctl_smpte_fps = { |
---|
643 | 629 | .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, |
---|
644 | 630 | .name = "SMPTE Fps", |
---|
645 | 631 | .index = 0, |
---|
.. | .. |
---|
655 | 641 | struct mts64 *mts) |
---|
656 | 642 | { |
---|
657 | 643 | int err, i; |
---|
658 | | - static struct snd_kcontrol_new *control[] = { |
---|
| 644 | + static const struct snd_kcontrol_new *control[] = { |
---|
659 | 645 | &mts64_ctl_smpte_switch, |
---|
660 | 646 | &mts64_ctl_smpte_time_hours, |
---|
661 | 647 | &mts64_ctl_smpte_time_minutes, |
---|
.. | .. |
---|
830 | 816 | u8 status, data; |
---|
831 | 817 | struct snd_rawmidi_substream *substream; |
---|
832 | 818 | |
---|
| 819 | + if (!mts) |
---|
| 820 | + return; |
---|
| 821 | + |
---|
833 | 822 | spin_lock(&mts->lock); |
---|
834 | 823 | ret = mts64_read(mts->pardev->port); |
---|
835 | 824 | data = ret & 0x00ff; |
---|