Changeset 679 for GPL/trunk/alsa-kernel/drivers/mtpav.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/mtpav.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * MOTU Midi Timepiece ALSA Main routines … … 4 5 * mail: michael@tweakoz.com 5 6 * Thanks to John Galbraith 6 *7 * This program is free software; you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation; either version 2 of the License, or10 * (at your option) any later version.11 *12 * This program is distributed in the hope that it will be useful,13 * but WITHOUT ANY WARRANTY; without even the implied warranty of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with this program; if not, write to the Free Software19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20 *21 7 * 22 8 * This driver is for the 'Mark Of The Unicorn' (MOTU) … … 40 26 * 128 'scene' memories, recallable from MIDI program change 41 27 * 42 *43 28 * ChangeLog 44 29 * Jun 11 2001 Takashi Iwai <tiwai@suse.de> … … 48 33 * The three global ports, computer, adat and broadcast ports, are created 49 34 * always after h/w and remote ports. 50 *51 35 */ 52 36 53 37 #include <linux/init.h> 54 38 #include <linux/interrupt.h> 39 #include <linux/module.h> 55 40 #include <linux/err.h> 56 41 #include <linux/platform_device.h> 57 42 #include <linux/ioport.h> 43 #include <linux/io.h> 58 44 #include <linux/moduleparam.h> 59 45 #include <sound/core.h> … … 62 48 #include <linux/delay.h> 63 49 64 #include <asm/io.h>65 66 50 /* 67 51 * globals … … 87 71 module_param(id, charp, 0444); 88 72 MODULE_PARM_DESC(id, "ID string for MotuMTPAV MIDI."); 89 module_param (port, long, 0444);73 module_param_hw(port, long, ioport, 0444); 90 74 MODULE_PARM_DESC(port, "Parallel port # for MotuMTPAV MIDI."); 91 module_param (irq, int, 0444);75 module_param_hw(irq, int, irq, 0444); 92 76 MODULE_PARM_DESC(irq, "Parallel IRQ # for MotuMTPAV MIDI."); 93 77 module_param(hwports, int, 0444); … … 407 391 */ 408 392 409 static void snd_mtpav_output_timer( unsigned long data)410 { 411 unsigned long flags; 412 struct mtpav *chip = (struct mtpav *)data;393 static void snd_mtpav_output_timer(struct timer_list *t) 394 { 395 unsigned long flags; 396 struct mtpav *chip = from_timer(chip, t, timer); 413 397 int p; 414 398 415 399 spin_lock_irqsave(&chip->spinlock, flags); 416 400 /* reprogram timer */ 417 chip->timer.expires = 1 + jiffies; 418 add_timer(&chip->timer); 401 mod_timer(&chip->timer, 1 + jiffies); 419 402 /* process each port */ 420 403 for (p = 0; p <= chip->num_ports * 2 + MTPAV_PIDX_BROADCAST; p++) { … … 429 412 static void snd_mtpav_add_output_timer(struct mtpav *chip) 430 413 { 431 chip->timer.expires = 1 + jiffies; 432 add_timer(&chip->timer); 414 mod_timer(&chip->timer, 1 + jiffies); 433 415 } 434 416 … … 584 566 * get ISA resources 585 567 */ 586 static int __devinit snd_mtpav_get_ISA(struct mtpav *mcard)568 static int snd_mtpav_get_ISA(struct mtpav *mcard) 587 569 { 588 570 if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) { … … 591 573 } 592 574 mcard->port = port; 593 if (request_irq(irq, snd_mtpav_irqh, IRQF_DISABLED, "MOTU MTPAV", mcard)) {575 if (request_irq(irq, snd_mtpav_irqh, 0, "MOTU MTPAV", mcard)) { 594 576 snd_printk(KERN_ERR "MTVAP IRQ %d busy\n", irq); 595 577 return -EBUSY; … … 603 585 */ 604 586 605 static struct snd_rawmidi_ops snd_mtpav_output = {587 static const struct snd_rawmidi_ops snd_mtpav_output = { 606 588 .open = snd_mtpav_output_open, 607 589 .close = snd_mtpav_output_close, … … 609 591 }; 610 592 611 static struct snd_rawmidi_ops snd_mtpav_input = {593 static const struct snd_rawmidi_ops snd_mtpav_input = { 612 594 .open = snd_mtpav_input_open, 613 595 .close = snd_mtpav_input_close, … … 620 602 */ 621 603 622 static void __devinitsnd_mtpav_set_name(struct mtpav *chip,623 604 static void snd_mtpav_set_name(struct mtpav *chip, 605 struct snd_rawmidi_substream *substream) 624 606 { 625 607 if (substream->number >= 0 && substream->number < chip->num_ports) … … 635 617 } 636 618 637 static int __devinitsnd_mtpav_get_RAWMIDI(struct mtpav *mcard)619 static int snd_mtpav_get_RAWMIDI(struct mtpav *mcard) 638 620 { 639 621 int rval; … … 692 674 /* 693 675 */ 694 static int __devinitsnd_mtpav_probe(struct platform_device *dev)676 static int snd_mtpav_probe(struct platform_device *dev) 695 677 { 696 678 struct snd_card *card; … … 698 680 struct mtpav *mtp_card; 699 681 700 err = snd_card_create(index, id, THIS_MODULE, sizeof(*mtp_card), &card); 682 err = snd_card_new(&dev->dev, index, id, THIS_MODULE, 683 sizeof(*mtp_card), &card); 701 684 if (err < 0) 702 685 return err; … … 704 687 mtp_card = card->private_data; 705 688 spin_lock_init(&mtp_card->spinlock); 706 init_timer(&mtp_card->timer);707 689 mtp_card->card = card; 708 690 mtp_card->irq = -1; … … 710 692 mtp_card->inmidistate = 0; 711 693 mtp_card->outmidihwport = 0xffffffff; 712 init_timer(&mtp_card->timer); 713 mtp_card->timer.function = snd_mtpav_output_timer; 714 mtp_card->timer.data = (unsigned long) mtp_card; 694 timer_setup(&mtp_card->timer, snd_mtpav_output_timer, 0); 715 695 716 696 card->private_free = snd_mtpav_free; … … 733 713 snd_mtpav_portscan(mtp_card); 734 714 735 snd_card_set_dev(card, &dev->dev);736 715 err = snd_card_register(mtp_card->card); 737 716 if (err < 0) … … 747 726 } 748 727 749 static int __devexitsnd_mtpav_remove(struct platform_device *devptr)728 static int snd_mtpav_remove(struct platform_device *devptr) 750 729 { 751 730 snd_card_free(platform_get_drvdata(devptr)); 752 platform_set_drvdata(devptr, NULL);753 731 return 0; 754 732 } … … 758 736 static struct platform_driver snd_mtpav_driver = { 759 737 .probe = snd_mtpav_probe, 760 .remove = __devexit_p(snd_mtpav_remove),738 .remove = snd_mtpav_remove, 761 739 .driver = { 762 .name = SND_MTPAV_DRIVER 740 .name = SND_MTPAV_DRIVER, 763 741 }, 764 742 };
Note:
See TracChangeset
for help on using the changeset viewer.