From cbe2edefb93ed3ba0a4b08f72a9b208429920675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Thu, 11 Jul 2013 07:49:46 +0300 Subject: usbdebug: Cleanup dbgp_ehci_info call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9cad64796fcfb7a50d9ed9ec95c56ab855c872e3 Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/3766 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/lib/usbdebug.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c index b16e325728..b6c7f100c4 100644 --- a/src/lib/usbdebug.c +++ b/src/lib/usbdebug.c @@ -94,6 +94,11 @@ static struct device_operations *ehci_drv_ops; static struct device_operations ehci_dbg_ops; #endif +static inline struct ehci_debug_info *dbgp_ehci_info(void) +{ + return car_get_var_ptr(&glob_dbg_info); +} + static int dbgp_wait_until_complete(struct ehci_dbg_port *ehci_debug) { u32 ctrl; @@ -603,7 +608,7 @@ void usbdebug_tx_flush(struct ehci_debug_info *dbg_info) #if !defined(__PRE_RAM__) && !defined(__SMM__) static void usbdebug_re_enable(unsigned ehci_base) { - struct ehci_debug_info *dbg_info = car_get_var_ptr(&glob_dbg_info); + struct ehci_debug_info *dbg_info = dbgp_ehci_info(); unsigned diff; if (!dbg_info->ehci_debug) @@ -618,7 +623,7 @@ static void usbdebug_re_enable(unsigned ehci_base) static void usbdebug_disable(void) { - struct ehci_debug_info *dbg_info = car_get_var_ptr(&glob_dbg_info); + struct ehci_debug_info *dbg_info = dbgp_ehci_info(); dbg_info->status &= ~DBGP_EP_ENABLED; } @@ -661,14 +666,19 @@ int dbgp_ep_is_active(struct ehci_debug_info *dbg_info) return (dbg_info->status & DBGP_EP_STATMASK) == (DBGP_EP_VALID | DBGP_EP_ENABLED); } -struct ehci_debug_info *dbgp_ehci_info(void) +struct ehci_debug_info *dbgp_console_input(void) { - return car_get_var_ptr(&glob_dbg_info); + return dbgp_ehci_info(); +} + +struct ehci_debug_info *dbgp_console_input(void) +{ + return dbgp_ehci_info(); } int usbdebug_init(void) { - struct ehci_debug_info *dbg_info = car_get_var_ptr(&glob_dbg_info); + struct ehci_debug_info *dbg_info = dbgp_ehci_info(); #if defined(__PRE_RAM__) || !CONFIG_EARLY_CONSOLE enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT); -- cgit v1.2.3