Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751928AbdFFM00 (ORCPT ); Tue, 6 Jun 2017 08:26:26 -0400 Received: from mga07.intel.com ([134.134.136.100]:31054 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751548AbdFFM0Y (ORCPT ); Tue, 6 Jun 2017 08:26:24 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,306,1493708400"; d="scan'208";a="865073826" From: Mika Westerberg To: Greg Kroah-Hartman Cc: Andreas Noever , Michael Jamet , Yehezkel Bernat , Lukas Wunner , Amir Levy , Andy Lutomirski , Mario.Limonciello@dell.com, Jared.Dominguez@dell.com, Andy Shevchenko , Mika Westerberg , linux-kernel@vger.kernel.org Subject: [PATCH v4 16/27] thunderbolt: Expose make_header() to other files Date: Tue, 6 Jun 2017 15:25:08 +0300 Message-Id: <20170606122519.35401-17-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170606122519.35401-1-mika.westerberg@linux.intel.com> References: <20170606122519.35401-1-mika.westerberg@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3191 Lines: 96 We will be using this function in files introduced in subsequent patches. While there the function is renamed to tb_cfg_make_header() following tb_cfg_get_route(). Signed-off-by: Mika Westerberg Reviewed-by: Yehezkel Bernat Reviewed-by: Michael Jamet Reviewed-by: Andy Shevchenko Signed-off-by: Andreas Noever --- drivers/thunderbolt/ctl.c | 19 ++++--------------- drivers/thunderbolt/ctl.h | 11 +++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c index 8352ee8662aa..c6633da582b8 100644 --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c @@ -54,17 +54,6 @@ struct tb_ctl { /* utility functions */ -static struct tb_cfg_header make_header(u64 route) -{ - struct tb_cfg_header header = { - .route_hi = route >> 32, - .route_lo = route, - }; - /* check for overflow, route_hi is not 32 bits! */ - WARN_ON(tb_cfg_get_route(&header) != route); - return header; -} - static int check_header(struct ctl_pkg *pkg, u32 len, enum tb_cfg_pkg_type type, u64 route) { @@ -501,7 +490,7 @@ int tb_cfg_error(struct tb_ctl *ctl, u64 route, u32 port, enum tb_cfg_error error) { struct cfg_error_pkg pkg = { - .header = make_header(route), + .header = tb_cfg_make_header(route), .port = port, .error = error, }; @@ -520,7 +509,7 @@ struct tb_cfg_result tb_cfg_reset(struct tb_ctl *ctl, u64 route, int timeout_msec) { int err; - struct cfg_reset_pkg request = { .header = make_header(route) }; + struct cfg_reset_pkg request = { .header = tb_cfg_make_header(route) }; struct tb_cfg_header reply; err = tb_ctl_tx(ctl, &request, sizeof(request), TB_CFG_PKG_RESET); @@ -542,7 +531,7 @@ struct tb_cfg_result tb_cfg_read_raw(struct tb_ctl *ctl, void *buffer, { struct tb_cfg_result res = { 0 }; struct cfg_read_pkg request = { - .header = make_header(route), + .header = tb_cfg_make_header(route), .addr = { .port = port, .space = space, @@ -579,7 +568,7 @@ struct tb_cfg_result tb_cfg_write_raw(struct tb_ctl *ctl, const void *buffer, { struct tb_cfg_result res = { 0 }; struct cfg_write_pkg request = { - .header = make_header(route), + .header = tb_cfg_make_header(route), .addr = { .port = port, .space = space, diff --git a/drivers/thunderbolt/ctl.h b/drivers/thunderbolt/ctl.h index 9812b1c86d4f..914da86ec77d 100644 --- a/drivers/thunderbolt/ctl.h +++ b/drivers/thunderbolt/ctl.h @@ -43,6 +43,17 @@ static inline u64 tb_cfg_get_route(const struct tb_cfg_header *header) return (u64) header->route_hi << 32 | header->route_lo; } +static inline struct tb_cfg_header tb_cfg_make_header(u64 route) +{ + struct tb_cfg_header header = { + .route_hi = route >> 32, + .route_lo = route, + }; + /* check for overflow, route_hi is not 32 bits! */ + WARN_ON(tb_cfg_get_route(&header) != route); + return header; +} + int tb_cfg_error(struct tb_ctl *ctl, u64 route, u32 port, enum tb_cfg_error error); struct tb_cfg_result tb_cfg_reset(struct tb_ctl *ctl, u64 route, -- 2.11.0