From patchwork Sat Jun 6 16:53:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 11591319 X-Patchwork-Delegate: marcel@holtmann.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B995D138C for ; Sat, 6 Jun 2020 16:53:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9AB8920772 for ; Sat, 6 Jun 2020 16:53:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="nQINTuhW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728730AbgFFQxL (ORCPT ); Sat, 6 Jun 2020 12:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727815AbgFFQxL (ORCPT ); Sat, 6 Jun 2020 12:53:11 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C46D7C03E96A for ; Sat, 6 Jun 2020 09:53:10 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id o8so6674934pgm.7 for ; Sat, 06 Jun 2020 09:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=E5IVH1RwzvBNNs3Ev+MESymL21dtR3SdkYna0gV8RxU=; b=nQINTuhWAAicRnz2ghEqTIn25FM3Ewcis2VL8L5y6Hb4kXs/eCAqK801+466JhsDnp 2ikJYEE69xieRXEEXoaBPkPEMnc/4ifwCiKFLzAUB1pa9mf9S+41+J1jah+f5RH4FrWG kp8CFiE3mrweQUzkZpKavdekq4It5mFYjOrQc= 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:mime-version :content-transfer-encoding; bh=E5IVH1RwzvBNNs3Ev+MESymL21dtR3SdkYna0gV8RxU=; b=s2G3U17TMxevUersqi7H0vlFSgHLFwOyC2+OwF3KHAlQkMSAPzS/8QTtwiQ/r0eL/p E6jCb/EJ9Ze8F4FPW5keLtPnPmCvq3Kp4v92O65FogFczvCJafhrpSThweeBaYV1pudU oojErSqpoG57W57mnneTYPTtCaW6RwlPn02P66y8PivrJKCB8zoFzhUf74c3XneIbXzN xhGQmnav68jRQ5nrBQqbAdii6VNHlrupoSByghKNQzna2DJ2+rzi3Qa5eMzzcfhw1cJp jZ37vL/S7SKgD2D5EULCyG8XFChHU+JyWc+GiHbf3IqYjRomybMMVDLdwxRmhpKRmfzT rhEw== X-Gm-Message-State: AOAM531rYf4KFKMLUahAksqPypZnB1o70hsnWz6VRSRHw74mjFzQqbRd inprFORSHDvWcCWOCtc2cppbLA== X-Google-Smtp-Source: ABdhPJzzkMi+G5IoPOU0HA2fN/Lr7dQh0S9WHWfDRe//TUqC//7tGTTL5PZjjABfnQbfxON0vUDU8w== X-Received: by 2002:a05:6a00:1510:: with SMTP id q16mr13980299pfu.164.1591462390161; Sat, 06 Jun 2020 09:53:10 -0700 (PDT) Received: from localhost ([2620:15c:202:1:4fff:7a6b:a335:8fde]) by smtp.gmail.com with ESMTPSA id s197sm2796539pfc.188.2020.06.06.09.53.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Jun 2020 09:53:09 -0700 (PDT) From: Matthias Kaehlcke To: Marcel Holtmann , Johan Hedberg Cc: linux-kernel@vger.kernel.org, Abhishek Pandit-Subedi , linux-bluetooth@vger.kernel.org, Rocky Liao , Zijun Hu , Balakrishna Godavarthi , Matthias Kaehlcke Subject: [PATCH] Bluetooth: hci_qca: Simplify determination of serial clock on/off state from votes Date: Sat, 6 Jun 2020 09:53:06 -0700 Message-Id: <20200606095259.1.I0683ea838b69285993c176396349b084562b4e19@changeid> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The serial clocks should be on when there is a vote for at least one of the clocks (RX or TX), and off when there is no 'on' vote. The current logic to determine the combined state is a bit redundant in the code paths for different types of votes, use a single statement in the common path instead. Signed-off-by: Matthias Kaehlcke --- drivers/bluetooth/hci_qca.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 836949d827ee9..997ddab26a33b 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -289,25 +289,21 @@ static void serial_clock_vote(unsigned long vote, struct hci_uart *hu) case HCI_IBS_TX_VOTE_CLOCK_ON: qca->tx_vote = true; qca->tx_votes_on++; - new_vote = true; break; case HCI_IBS_RX_VOTE_CLOCK_ON: qca->rx_vote = true; qca->rx_votes_on++; - new_vote = true; break; case HCI_IBS_TX_VOTE_CLOCK_OFF: qca->tx_vote = false; qca->tx_votes_off++; - new_vote = qca->rx_vote | qca->tx_vote; break; case HCI_IBS_RX_VOTE_CLOCK_OFF: qca->rx_vote = false; qca->rx_votes_off++; - new_vote = qca->rx_vote | qca->tx_vote; break; default: @@ -315,6 +311,8 @@ static void serial_clock_vote(unsigned long vote, struct hci_uart *hu) return; } + new_vote = qca->rx_vote | qca->tx_vote; + if (new_vote != old_vote) { if (new_vote) __serial_clock_on(hu->tty);