From patchwork Tue Feb 21 16:15:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9585009 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53F9760578 for ; Tue, 21 Feb 2017 16:16:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4299628582 for ; Tue, 21 Feb 2017 16:16:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37774285DD; Tue, 21 Feb 2017 16:16:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B2A0285C6 for ; Tue, 21 Feb 2017 16:16:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753760AbdBUQQc (ORCPT ); Tue, 21 Feb 2017 11:16:32 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:34241 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753716AbdBUQQW (ORCPT ); Tue, 21 Feb 2017 11:16:22 -0500 Received: by mail-lf0-f66.google.com with SMTP id h67so3751931lfg.1 for ; Tue, 21 Feb 2017 08:16:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YKCj3KWQf0qmOkgvUWvXQNQ4kol9PfZa3uIzwSOh7/c=; b=H8gETyq0m8z4pZbtDvrdiSoha0jcan78tklSGeKv8JMmA1qcjJ2VqfJn6mGhsjpmXp 5A1L5Ey5nNgx/NlY2ETed3O9hOGPVDQRvY94bSsi+fU1IFJrPM9OcquI1D1hxaypJGit bnYE/xFWiAqbtJSDN3EGe/8KiOTvRGu61XL8h8TKP8Q2g1Z6omkcdjBgkDfnzunQSXKP pFDMtVCxHQnbmZlIuLpL7yVAl3R9CYf4MOwn8gAHKVyPfZEBxMxoqSQslhggR99ZG2vc zSO1Xz/emIRSij7oOYBJ7iwo4Pzv4sTs7CUTwgEtFDgB9OpFf6rbKWKQ677I1s5/WjzI cI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YKCj3KWQf0qmOkgvUWvXQNQ4kol9PfZa3uIzwSOh7/c=; b=IoxFoX1asqsd9GT0y7n5dW+Dg5Re/FiG44kBQH4K3vMkcytACeBq0E0D7NvcrVTP++ DpyR4k0vfTlnnm/NrSctEp/AVrOF4FbnZhuSuWjwTD156ONmEqkXgQ++xoehxyXhLhct 1N1XDcddF6sJfm+r0E5UCAZ3D8V/TcRXeo23W7F9kr2q8EPWACLsBbEwf4iuUgfWSG1Y DcsYKGzcOJgwsZ+98kvRnsbdc34QCWPfgDKphCSUPpGKR3kOGlhEcVFWo08/KZNadmWM O8x+zMBql3Di9sv0yx7eufbSGZ8KBTCS1gY3wUXhpw6/YvtkstuhBLJ083w9ebq3qL7l wxVA== X-Gm-Message-State: AMke39kAmqEQFUnzs372y3b+RTJkhaUXoZzVNKaXwfVMErVGxZplzZXGiWj/1W0+R1QidQ== X-Received: by 10.46.9.216 with SMTP id 207mr7197364ljj.4.1487693775198; Tue, 21 Feb 2017 08:16:15 -0800 (PST) Received: from erik-mate-1604.lan (90-227-62-61-no75.tbcn.telia.com. [90.227.62.61]) by smtp.gmail.com with ESMTPSA id t29sm6336069ljd.39.2017.02.21.08.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Feb 2017 08:16:14 -0800 (PST) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Cc: Erik Stromdahl Subject: [RFC v4 03/21] ath10k: htc: move htc ctrl ep connect to htc_init Date: Tue, 21 Feb 2017 17:15:23 +0100 Message-Id: <1487693741-10042-4-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487693741-10042-1-git-send-email-erik.stromdahl@gmail.com> References: <1487693741-10042-1-git-send-email-erik.stromdahl@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch moves the HTC ctrl service connect from htc_wait_target to htc_init. This is done in order to make sure the htc ctrl service is setup properly before hif_start is called. The reason for this is that we want the HTC ctrl service callback to be initialized before the target sends the HTC ready message. The ready message will always be transmitted on endpoint 0 (which is always assigned to the HTC control service) so it makes more sense if HTC control has been connected before the ready message is received. Since the service to pipe mapping is done as a part of the service connect, the get_default_pipe call is redundant and was removed. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/htc.c | 39 +++++++++++++++-------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index e72f385..f39eef6 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -584,8 +584,6 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) struct ath10k *ar = htc->ar; int i, status = 0; unsigned long time_left; - struct ath10k_htc_svc_conn_req conn_req; - struct ath10k_htc_svc_conn_resp conn_resp; struct ath10k_htc_msg *msg; u16 message_id; u16 credit_count; @@ -648,22 +646,6 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) return -ECOMM; } - /* setup our pseudo HTC control endpoint connection */ - memset(&conn_req, 0, sizeof(conn_req)); - memset(&conn_resp, 0, sizeof(conn_resp)); - conn_req.ep_ops.ep_tx_complete = ath10k_htc_control_tx_complete; - conn_req.ep_ops.ep_rx_complete = ath10k_htc_control_rx_complete; - conn_req.max_send_queue_depth = ATH10K_NUM_CONTROL_TX_BUFFERS; - conn_req.service_id = ATH10K_HTC_SVC_ID_RSVD_CTRL; - - /* connect fake service */ - status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp); - if (status) { - ath10k_err(ar, "could not connect to htc service (%d)\n", - status); - return status; - } - return 0; } @@ -873,8 +855,10 @@ int ath10k_htc_start(struct ath10k_htc *htc) /* registered target arrival callback from the HIF layer */ int ath10k_htc_init(struct ath10k *ar) { - struct ath10k_htc_ep *ep = NULL; + int status; struct ath10k_htc *htc = &ar->htc; + struct ath10k_htc_svc_conn_req conn_req; + struct ath10k_htc_svc_conn_resp conn_resp; spin_lock_init(&htc->tx_lock); @@ -882,10 +866,21 @@ int ath10k_htc_init(struct ath10k *ar) htc->ar = ar; - /* Get HIF default pipe for HTC message exchange */ - ep = &htc->endpoint[ATH10K_HTC_EP_0]; + /* setup our pseudo HTC control endpoint connection */ + memset(&conn_req, 0, sizeof(conn_req)); + memset(&conn_resp, 0, sizeof(conn_resp)); + conn_req.ep_ops.ep_tx_complete = ath10k_htc_control_tx_complete; + conn_req.ep_ops.ep_rx_complete = ath10k_htc_control_rx_complete; + conn_req.max_send_queue_depth = ATH10K_NUM_CONTROL_TX_BUFFERS; + conn_req.service_id = ATH10K_HTC_SVC_ID_RSVD_CTRL; - ath10k_hif_get_default_pipe(ar, &ep->ul_pipe_id, &ep->dl_pipe_id); + /* connect fake service */ + status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp); + if (status) { + ath10k_err(ar, "could not connect to htc service (%d)\n", + status); + return status; + } init_completion(&htc->ctl_resp);