diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2012-11-27 03:47:15 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-27 04:18:04 +0400 |
commit | fd985e1def964bb3a3adf5e2760af10510fd3f58 (patch) | |
tree | d71c2b35b26e300cc178a18708b79c72ca71599a /drivers/tty | |
parent | d53c57dca2ccb540cceb0b1a228f11e1325cecde (diff) | |
download | linux-fd985e1def964bb3a3adf5e2760af10510fd3f58.tar.xz |
drivers/tty/serial/serial_core.c: clean up HIGH_BITS_OFFSET usage
serial_core.c usually does
if (HIGH_BITS_OFFSET)
expr-involving-HIGH_BITS_OFFSET()
at least to avoid generating useless code on 32-bit machines, where
HIGH_BITS_OFFSET is zero. Do that in uart_get_attr_port().
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/serial_core.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 61ba24089ef7..fb5aa42fde7e 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2370,9 +2370,13 @@ static ssize_t uart_get_attr_port(struct device *dev, { struct serial_struct tmp; struct tty_port *port = dev_get_drvdata(dev); + unsigned long ioaddr; uart_get_info(port, &tmp); - return snprintf(buf, PAGE_SIZE, "0x%lX\n", (unsigned long)(tmp.port | (((unsigned long)tmp.port_high) << HIGH_BITS_OFFSET))); + ioaddr = tmp.port; + if (HIGH_BITS_OFFSET) + ioaddr |= (unsigned long)tmp.port_high << HIGH_BITS_OFFSET; + return snprintf(buf, PAGE_SIZE, "0x%lX\n", ioaddr); } static ssize_t uart_get_attr_irq(struct device *dev, |