diff options
author | Andrew Morton | 2012-11-26 15:47:15 -0800 |
---|---|---|
committer | Greg Kroah-Hartman | 2012-11-26 16:18:04 -0800 |
commit | fd985e1def964bb3a3adf5e2760af10510fd3f58 (patch) | |
tree | d71c2b35b26e300cc178a18708b79c72ca71599a /drivers/tty | |
parent | d53c57dca2ccb540cceb0b1a228f11e1325cecde (diff) |
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, |