From: Michal Kazior <michal.kazior@tieto.com> To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior <michal.kazior@tieto.com> Subject: [PATCH 1/2] ath10k: share board file loading code across FW APIs Date: Mon, 23 Mar 2015 12:38:20 +0000 [thread overview] Message-ID: <1427114301-18886-2-git-send-email-michal.kazior@tieto.com> (raw) In-Reply-To: <1427114301-18886-1-git-send-email-michal.kazior@tieto.com> There's no need to implement the same thing twice. Reduce code duplication. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> --- drivers/net/wireless/ath/ath10k/core.c | 68 +++++++++++++++------------------- 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index c0e454b..1785e0e 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -482,6 +482,30 @@ static int ath10k_fetch_cal_file(struct ath10k *ar) return 0; } +static int ath10k_core_fetch_board_file(struct ath10k *ar) +{ + int ret; + + if (!ar->hw_params.fw.board) { + ath10k_err(ar, "failed to find board file fw entry\n"); + return -EINVAL; + } + + ar->board = ath10k_fetch_fw_file(ar, + ar->hw_params.fw.dir, + ar->hw_params.fw.board); + if (IS_ERR(ar->board)) { + ret = PTR_ERR(ar->board); + ath10k_err(ar, "failed to fetch board data: %d\n", ret); + return ret; + } + + ar->board_data = ar->board->data; + ar->board_len = ar->board->size; + + return 0; +} + static int ath10k_core_fetch_firmware_api_1(struct ath10k *ar) { int ret = 0; @@ -491,23 +515,6 @@ static int ath10k_core_fetch_firmware_api_1(struct ath10k *ar) return -EINVAL; } - if (ar->hw_params.fw.board == NULL) { - ath10k_err(ar, "board data file not defined"); - return -EINVAL; - } - - ar->board = ath10k_fetch_fw_file(ar, - ar->hw_params.fw.dir, - ar->hw_params.fw.board); - if (IS_ERR(ar->board)) { - ret = PTR_ERR(ar->board); - ath10k_err(ar, "could not fetch board data (%d)\n", ret); - goto err; - } - - ar->board_data = ar->board->data; - ar->board_len = ar->board->size; - ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, ar->hw_params.fw.fw); @@ -695,27 +702,6 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) goto err; } - /* now fetch the board file */ - if (ar->hw_params.fw.board == NULL) { - ath10k_err(ar, "board data file not defined"); - ret = -EINVAL; - goto err; - } - - ar->board = ath10k_fetch_fw_file(ar, - ar->hw_params.fw.dir, - ar->hw_params.fw.board); - if (IS_ERR(ar->board)) { - ret = PTR_ERR(ar->board); - ath10k_err(ar, "could not fetch board data '%s/%s' (%d)\n", - ar->hw_params.fw.dir, ar->hw_params.fw.board, - ret); - goto err; - } - - ar->board_data = ar->board->data; - ar->board_len = ar->board->size; - return 0; err: @@ -730,6 +716,12 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar) /* calibration file is optional, don't check for any errors */ ath10k_fetch_cal_file(ar); + ret = ath10k_core_fetch_board_file(ar); + if (ret) { + ath10k_err(ar, "failed to fetch board file: %d\n", ret); + return ret; + } + ar->fw_api = 4; ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); -- 2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: Michal Kazior <michal.kazior@tieto.com> To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior <michal.kazior@tieto.com> Subject: [PATCH 1/2] ath10k: share board file loading code across FW APIs Date: Mon, 23 Mar 2015 12:38:20 +0000 [thread overview] Message-ID: <1427114301-18886-2-git-send-email-michal.kazior@tieto.com> (raw) In-Reply-To: <1427114301-18886-1-git-send-email-michal.kazior@tieto.com> There's no need to implement the same thing twice. Reduce code duplication. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> --- drivers/net/wireless/ath/ath10k/core.c | 68 +++++++++++++++------------------- 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index c0e454b..1785e0e 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -482,6 +482,30 @@ static int ath10k_fetch_cal_file(struct ath10k *ar) return 0; } +static int ath10k_core_fetch_board_file(struct ath10k *ar) +{ + int ret; + + if (!ar->hw_params.fw.board) { + ath10k_err(ar, "failed to find board file fw entry\n"); + return -EINVAL; + } + + ar->board = ath10k_fetch_fw_file(ar, + ar->hw_params.fw.dir, + ar->hw_params.fw.board); + if (IS_ERR(ar->board)) { + ret = PTR_ERR(ar->board); + ath10k_err(ar, "failed to fetch board data: %d\n", ret); + return ret; + } + + ar->board_data = ar->board->data; + ar->board_len = ar->board->size; + + return 0; +} + static int ath10k_core_fetch_firmware_api_1(struct ath10k *ar) { int ret = 0; @@ -491,23 +515,6 @@ static int ath10k_core_fetch_firmware_api_1(struct ath10k *ar) return -EINVAL; } - if (ar->hw_params.fw.board == NULL) { - ath10k_err(ar, "board data file not defined"); - return -EINVAL; - } - - ar->board = ath10k_fetch_fw_file(ar, - ar->hw_params.fw.dir, - ar->hw_params.fw.board); - if (IS_ERR(ar->board)) { - ret = PTR_ERR(ar->board); - ath10k_err(ar, "could not fetch board data (%d)\n", ret); - goto err; - } - - ar->board_data = ar->board->data; - ar->board_len = ar->board->size; - ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, ar->hw_params.fw.fw); @@ -695,27 +702,6 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) goto err; } - /* now fetch the board file */ - if (ar->hw_params.fw.board == NULL) { - ath10k_err(ar, "board data file not defined"); - ret = -EINVAL; - goto err; - } - - ar->board = ath10k_fetch_fw_file(ar, - ar->hw_params.fw.dir, - ar->hw_params.fw.board); - if (IS_ERR(ar->board)) { - ret = PTR_ERR(ar->board); - ath10k_err(ar, "could not fetch board data '%s/%s' (%d)\n", - ar->hw_params.fw.dir, ar->hw_params.fw.board, - ret); - goto err; - } - - ar->board_data = ar->board->data; - ar->board_len = ar->board->size; - return 0; err: @@ -730,6 +716,12 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar) /* calibration file is optional, don't check for any errors */ ath10k_fetch_cal_file(ar); + ret = ath10k_core_fetch_board_file(ar); + if (ret) { + ath10k_err(ar, "failed to fetch board file: %d\n", ret); + return ret; + } + ar->fw_api = 4; ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); -- 2.1.4 _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k
next prev parent reply other threads:[~2015-03-23 12:41 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-03-23 12:38 [PATCH 0/2] ath10k: load device specific board files Michal Kazior 2015-03-23 12:38 ` Michal Kazior 2015-03-23 12:38 ` Michal Kazior [this message] 2015-03-23 12:38 ` [PATCH 1/2] ath10k: share board file loading code across FW APIs Michal Kazior 2015-03-23 16:01 ` Kalle Valo 2015-03-23 16:01 ` Kalle Valo 2015-03-24 7:04 ` Michal Kazior 2015-03-24 7:04 ` Michal Kazior 2015-03-23 12:38 ` [PATCH 2/2] ath10k: allow loading device specific board files Michal Kazior 2015-03-23 12:38 ` Michal Kazior
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1427114301-18886-2-git-send-email-michal.kazior@tieto.com \ --to=michal.kazior@tieto.com \ --cc=ath10k@lists.infradead.org \ --cc=linux-wireless@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.