]> err.no Git - linux-2.6/blobdiff - sound/drivers/serial-u16550.c
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[linux-2.6] / sound / drivers / serial-u16550.c
index 964b97e70c846350d804abd29d0c91e4f6ab414a..1ed58df42671c61d61a45281eb753ba3c3fdacea 100644 (file)
@@ -168,7 +168,7 @@ typedef struct _snd_uart16550 {
 
 static snd_card_t *snd_serial_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
-inline static void snd_uart16550_add_timer(snd_uart16550_t *uart)
+static inline void snd_uart16550_add_timer(snd_uart16550_t *uart)
 {
        if (! uart->timer_running) {
                /* timer 38600bps * 10bit * 16byte */
@@ -178,7 +178,7 @@ inline static void snd_uart16550_add_timer(snd_uart16550_t *uart)
        }
 }
 
-inline static void snd_uart16550_del_timer(snd_uart16550_t *uart)
+static inline void snd_uart16550_del_timer(snd_uart16550_t *uart)
 {
        if (uart->timer_running) {
                del_timer(&uart->buffer_timer);
@@ -187,7 +187,7 @@ inline static void snd_uart16550_del_timer(snd_uart16550_t *uart)
 }
 
 /* This macro is only used in snd_uart16550_io_loop */
-inline static void snd_uart16550_buffer_output(snd_uart16550_t *uart)
+static inline void snd_uart16550_buffer_output(snd_uart16550_t *uart)
 {
        unsigned short buff_out = uart->buff_out;
        if( uart->buff_in_count > 0 ) {
@@ -579,7 +579,7 @@ static int snd_uart16550_output_close(snd_rawmidi_substream_t * substream)
        return 0;
 };
 
-inline static int snd_uart16550_buffer_can_write( snd_uart16550_t *uart, int Num )
+static inline int snd_uart16550_buffer_can_write( snd_uart16550_t *uart, int Num )
 {
        if( uart->buff_in_count + Num < TX_BUFF_SIZE )
                return 1;
@@ -587,7 +587,7 @@ inline static int snd_uart16550_buffer_can_write( snd_uart16550_t *uart, int Num
                return 0;
 }
 
-inline static int snd_uart16550_write_buffer(snd_uart16550_t *uart, unsigned char byte)
+static inline int snd_uart16550_write_buffer(snd_uart16550_t *uart, unsigned char byte)
 {
        unsigned short buff_in = uart->buff_in;
        if( uart->buff_in_count < TX_BUFF_SIZE ) {
@@ -749,10 +749,7 @@ static int snd_uart16550_free(snd_uart16550_t *uart)
 {
        if (uart->irq >= 0)
                free_irq(uart->irq, (void *)uart);
-       if (uart->res_base) {
-               release_resource(uart->res_base);
-               kfree_nocheck(uart->res_base);
-       }
+       release_and_free_resource(uart->res_base);
        kfree(uart);
        return 0;
 };
@@ -779,7 +776,7 @@ static int __init snd_uart16550_create(snd_card_t * card,
        int err;
 
 
-       if ((uart = kcalloc(1, sizeof(*uart), GFP_KERNEL)) == NULL)
+       if ((uart = kzalloc(sizeof(*uart), GFP_KERNEL)) == NULL)
                return -ENOMEM;
        uart->adaptor = adaptor;
        uart->card = card;
@@ -928,15 +925,11 @@ static int __init snd_serial_probe(int dev)
                                        base[dev],
                                        adaptor[dev],
                                        droponfull[dev],
-                                       &uart)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                       &uart)) < 0)
+               goto _err;
 
-       if ((err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi)) < 0)
+               goto _err;
 
        sprintf(card->longname, "%s at 0x%lx, irq %d speed %d div %d outs %d ins %d adaptor %s droponfull %d",
                card->shortname,
@@ -949,12 +942,18 @@ static int __init snd_serial_probe(int dev)
                adaptor_names[uart->adaptor],
                uart->drop_on_full);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_serial_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init alsa_card_serial_init(void)