Changeset 679 for GPL/trunk/alsa-kernel/drivers/serial-u16550.c
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/drivers/serial-u16550.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * serial.c … … 8 9 * This code is based on the code from ALSA 0.5.9, but heavily rewritten. 9 10 * 10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 *24 11 * Sat Mar 31 17:27:57 PST 2001 tim.mann@compaq.com 25 12 * Added support for the Midiator MS-124T and for the MS-124W in … … 37 24 #include <linux/slab.h> 38 25 #include <linux/ioport.h> 39 #include <linux/moduleparam.h> 26 #include <linux/module.h> 27 #include <linux/io.h> 40 28 #include <sound/core.h> 41 29 #include <sound/rawmidi.h> … … 44 32 #include <linux/serial_reg.h> 45 33 #include <linux/jiffies.h> 46 47 #include <asm/io.h>48 34 49 35 MODULE_DESCRIPTION("MIDI serial u16550"); … … 57 43 #define SNDRV_SERIAL_GENERIC 4 /* Generic Interface */ 58 44 #define SNDRV_SERIAL_MAX_ADAPTOR SNDRV_SERIAL_GENERIC 59 static c har *adaptor_names[] = {45 static const char * const adaptor_names[] = { 60 46 "Soundcanvas", 61 47 "MS-124T", … … 70 56 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 71 57 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 72 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */58 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 73 59 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x3f8,0x2f8,0x3e8,0x2e8 */ 74 60 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,4,5,7,9,10,11,14,15 */ … … 78 64 static int ins[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */ 79 65 static int adaptor[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = SNDRV_SERIAL_SOUNDCANVAS}; 80 static intdroponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF };66 static bool droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF }; 81 67 82 68 module_param_array(index, int, NULL, 0444); … … 86 72 module_param_array(enable, bool, NULL, 0444); 87 73 MODULE_PARM_DESC(enable, "Enable UART16550A chip."); 88 module_param_ array(port, long, NULL, 0444);74 module_param_hw_array(port, long, ioport, NULL, 0444); 89 75 MODULE_PARM_DESC(port, "Port # for UART16550A chip."); 90 module_param_ array(irq, int, NULL, 0444);76 module_param_hw_array(irq, int, irq, NULL, 0444); 91 77 MODULE_PARM_DESC(irq, "IRQ # for UART16550A chip."); 92 78 module_param_array(speed, int, NULL, 0444); … … 175 161 if (!uart->timer_running) { 176 162 /* timer 38600bps * 10bit * 16byte */ 177 uart->buffer_timer.expires = jiffies + (HZ+255)/256;163 mod_timer(&uart->buffer_timer, jiffies + (HZ + 255) / 256); 178 164 uart->timer_running = 1; 179 add_timer(&uart->buffer_timer);180 165 } 181 166 } … … 312 297 313 298 /* When the polling mode, this function calls snd_uart16550_io_loop. */ 314 static void snd_uart16550_buffer_timer( unsigned long data)299 static void snd_uart16550_buffer_timer(struct timer_list *t) 315 300 { 316 301 unsigned long flags; 317 302 struct snd_uart16550 *uart; 318 303 319 uart = (struct snd_uart16550 *)data;304 uart = from_timer(uart, t, buffer_timer); 320 305 spin_lock_irqsave(&uart->open_lock, flags); 321 306 snd_uart16550_del_timer(uart); … … 329 314 * return negative error if not found 330 315 */ 331 static int __devinitsnd_uart16550_detect(struct snd_uart16550 *uart)316 static int snd_uart16550_detect(struct snd_uart16550 *uart) 332 317 { 333 318 unsigned long io_base = uart->base; … … 755 740 } 756 741 757 static struct snd_rawmidi_ops snd_uart16550_output =742 static const struct snd_rawmidi_ops snd_uart16550_output = 758 743 { 759 744 .open = snd_uart16550_output_open, … … 762 747 }; 763 748 764 static struct snd_rawmidi_ops snd_uart16550_input =749 static const struct snd_rawmidi_ops snd_uart16550_input = 765 750 { 766 751 .open = snd_uart16550_input_open, … … 784 769 } 785 770 786 static int __devinitsnd_uart16550_create(struct snd_card *card,787 788 789 790 791 792 793 794 { 795 static struct snd_device_ops ops = {771 static int snd_uart16550_create(struct snd_card *card, 772 unsigned long iobase, 773 int irq, 774 unsigned int speed, 775 unsigned int base, 776 int adaptor, 777 int droponfull, 778 struct snd_uart16550 **ruart) 779 { 780 static const struct snd_device_ops ops = { 796 781 .dev_free = snd_uart16550_dev_free, 797 782 }; … … 817 802 if (irq >= 0 && irq != SNDRV_AUTO_IRQ) { 818 803 if (request_irq(irq, snd_uart16550_interrupt, 819 IRQF_DISABLED, "Serial MIDI", uart)) {804 0, "Serial MIDI", uart)) { 820 805 snd_printk(KERN_WARNING 821 806 "irq %d busy. Using Polling.\n", irq); … … 831 816 uart->rstatus = 0; 832 817 memset(uart->prev_status, 0x80, sizeof(unsigned char) * SNDRV_SERIAL_MAX_OUTS); 833 init_timer(&uart->buffer_timer); 834 uart->buffer_timer.function = snd_uart16550_buffer_timer; 835 uart->buffer_timer.data = (unsigned long)uart; 818 timer_setup(&uart->buffer_timer, snd_uart16550_buffer_timer, 0); 836 819 uart->timer_running = 0; 837 820 … … 864 847 } 865 848 866 static void __devinitsnd_uart16550_substreams(struct snd_rawmidi_str *stream)849 static void snd_uart16550_substreams(struct snd_rawmidi_str *stream) 867 850 { 868 851 struct snd_rawmidi_substream *substream; … … 873 856 } 874 857 875 static int __devinitsnd_uart16550_rmidi(struct snd_uart16550 *uart, int device,876 877 858 static int snd_uart16550_rmidi(struct snd_uart16550 *uart, int device, 859 int outs, int ins, 860 struct snd_rawmidi **rmidi) 878 861 { 879 862 struct snd_rawmidi *rrawmidi; … … 900 883 } 901 884 902 static int __devinitsnd_serial_probe(struct platform_device *devptr)885 static int snd_serial_probe(struct platform_device *devptr) 903 886 { 904 887 struct snd_card *card; … … 943 926 } 944 927 945 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); 928 err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE, 929 0, &card); 946 930 if (err < 0) 947 931 return err; … … 970 954 uart->irq); 971 955 972 snd_card_set_dev(card, &devptr->dev);973 974 956 if ((err = snd_card_register(card)) < 0) 975 957 goto _err; … … 983 965 } 984 966 985 static int __devexitsnd_serial_remove(struct platform_device *devptr)967 static int snd_serial_remove(struct platform_device *devptr) 986 968 { 987 969 snd_card_free(platform_get_drvdata(devptr)); 988 platform_set_drvdata(devptr, NULL);989 970 return 0; 990 971 } … … 994 975 static struct platform_driver snd_serial_driver = { 995 976 .probe = snd_serial_probe, 996 .remove = __devexit_p( snd_serial_remove),977 .remove = snd_serial_remove, 997 978 .driver = { 998 .name = SND_SERIAL_DRIVER 979 .name = SND_SERIAL_DRIVER, 999 980 }, 1000 981 };
Note:
See TracChangeset
for help on using the changeset viewer.