• Fabio Estevam's avatar
    serial: imx: Fix the reporting of interrupts · c0d1c6b0
    Fabio Estevam authored
    On a imx system with ttymxc0, ttymxc1 and ttymxc4 registered we see the
    following output from 'cat /proc/interrupts':
    
    $ cat /proc/interrupts
               CPU0
    ...
     58:         39       GIC  58  2020000.serial
     67:        115       GIC  67  21f8000.i2c
    
    The only uart irq that appears is ttymxc0, which is the console.
    
    As ttymxc1 and ttymxc4 will only have their irq registered at imx_startup(),
    they are not shown right after probe.
    
    Transmitting to ttymxc1 and ttymxc4 will cause their irqs to be registered, but
    the output shows:
    
    $ echo "111111" > /dev/ttymxc1
    $ echo "444444" > /dev/ttymxc4
    $ cat /proc/interrupts
               CPU0
    ...
     58:        150       GIC  58  2020000.serial
     59:          1       GIC  59
     62:          1       GIC  62
     67:        115       GIC  67  21f8000.i2c
    
    ,which misses printing the associated device address.
    
    In order to fix this, register all the irqs inside the probe function via
    devm_request_irq(), which will correctly report the serial interrupts associated
    with their correspondent serial device and also helps simplyfing the code by
    avoiding the calls to free_irq().
    
    $ echo "111111" > /dev/ttymxc1
    $ echo "444444" > /dev/ttymxc4
    $ cat /proc/interrupts
    
    	   CPU0
    ....
     58:        202       GIC  58  2020000.serial
     59:          1       GIC  59  21e8000.serial
     62:          1       GIC  62  21f4000.serial
     67:        115       GIC  67  21f8000.i2c
    Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    c0d1c6b0
imx.c 50.7 KB