Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1814333pxb; Wed, 9 Feb 2022 05:11:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwd/NF0J964xRaftdjKrgMqJ9EaacJw0FSt66WatW3npHZcLegq4fgZnELORWS9N8RTaRvB X-Received: by 2002:a63:b50:: with SMTP id a16mr1878575pgl.185.1644412304830; Wed, 09 Feb 2022 05:11:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644412304; cv=none; d=google.com; s=arc-20160816; b=gA0UHUzTJmLwqcrWg26IVCGW9dxbO44SPMXpvk7rDfQTiAZkfrgFZ9wmdcgQgIvucY Z8ETHyw5L7vo36RtMmW90prOWKeV4/PRY1O5CQXY6RwidWJ3eAIPVPRLK1NXogO1hUyy ceWxjU1Alnw2eLgQdelvH2Yy615Mg6PTlFWU6Zi7xBiOJc74e40SlD5sadyExLfmV0/7 EvZTHAJrGvfnsFEgLUaLnkXEFzCfhUinO/V0Nrif3iGsZQ3p6J1H6fAm8eRkyMLEtRP8 +QuklB3it9gVhXOHwJNf0I5jFysfiQG1tc4FyN0bzxtAVK6e4Au/uVogf3tNLwazUbh0 ISCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1wTIjLivrgPfop/XqqzPH2ki4x3bw9zR7SXERTNkUpE=; b=srOYLY5ZZ2sW7WknSOIjYULw8z/vWNwa0bAQ+s0jGT8V4mJhCcDbd57OTKH4Vb0clt 3sY4jjurmUKf8YgEXJVjJPb9vgIgG3nnTheZihO4HCup1kkEcdP/7kPuttOKHtwmAhuL N5HwrPUg+TWq80o4Ui+wnUEelR8idRLDXgdKDPS5tOdKCMxBfov8LqsAMz0XUf/gvZdn NYiw8gPmsH38zLkBpK4ZG5tgrjXuBWSUdWmNEI6Vpw/h3vw8s5QAlkhFBi3XONDAU98t yM/j3d62SOE3o5YKGa/ZkijZE2289U5d7JbqjdYg0xRnbrXC3R0ewbYGc9pZ8+zNtM5P addQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BmPUOAsO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k16si15366491plg.518.2022.02.09.05.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 05:11:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BmPUOAsO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CAA60E17ECED; Wed, 9 Feb 2022 02:37:11 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235598AbiBIJuX (ORCPT + 99 others); Wed, 9 Feb 2022 04:50:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234919AbiBIJuL (ORCPT ); Wed, 9 Feb 2022 04:50:11 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CB8EE0738A8 for ; Wed, 9 Feb 2022 01:50:05 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id t4-20020a17090a510400b001b8c4a6cd5dso1688410pjh.5 for ; Wed, 09 Feb 2022 01:50:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1wTIjLivrgPfop/XqqzPH2ki4x3bw9zR7SXERTNkUpE=; b=BmPUOAsOyFIy/ROJwTkfoKGMMQeUrXZ/VeQ51zjV07Oac0N2yds6QbO0e46Q0aEy+w RzfdmSJfLrhkXDvAl+TStnSEorr/uvecb97lskcIQtfwWhvJ4ULNtZJqGkOkpmCZNH3W Q6m40/vzhC4VIgAJBBiRZi6TgEXtztRXLD+lh/tF+6LBexJo1/3l4XEeFynju7nYyt7C esNcDX/34rID/6YlaNhDw23+D8wYzL5R9OfLtxRkvEBgA5SmDaXbrKVVDubjfSQbQ5qj tHj5ovyN2qH2tYJPqoZj3rlC+i+EcTfJcc1CbvjrT4K6nu7+qQT4M0mNfeGhQv/BYlAl NEAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1wTIjLivrgPfop/XqqzPH2ki4x3bw9zR7SXERTNkUpE=; b=L4QZEFeSvyAPANXS6KC8+2bs9OwtoK/pl1xtXKgGkPeNFj0w6ueVUoraB/hz1s2raO BwsEbGDQNM38//utJTn1rjEjz2H7RkCE9zQ+xwHo3zn24Ly25diuAuoy1lAeuTHMXlDl fR3KbwUNf3QaPI5TpviLTNnjqtjVlqBCrxnB6azL7qM1SDlDc2fNGB02HkP+CMN0PC9S Cv9QLz2cSRHskTbhoPQkuv7pXi8BaO2gml+EvWrL21+nVKY8oNW987oRADPTdjQHzVTA /kKiAi0L3HjXg6aNsQWDxCaIn4Xb54UODT4NiR/WWxdLsrDyshOAf8oHxVQoru1IXjtu sMSg== X-Gm-Message-State: AOAM5327StPEKCMglFqq/3+PWpqqlQa8o/5L8CkSgJSLyvnioGiCLpvB s2Am4eHSRLT+fhRi3dIBClsX X-Received: by 2002:a17:902:ce04:: with SMTP id k4mr1403914plg.153.1644399983719; Wed, 09 Feb 2022 01:46:23 -0800 (PST) Received: from localhost.localdomain ([117.217.179.178]) by smtp.gmail.com with ESMTPSA id p4sm1912948pgh.53.2022.02.09.01.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:46:23 -0800 (PST) From: Manivannan Sadhasivam To: mhi@lists.linux.dev Cc: quic_hemantk@quicinc.com, quic_bbhatt@quicinc.com, quic_jhugo@quicinc.com, vinod.koul@linaro.org, bjorn.andersson@linaro.org, dmitry.baryshkov@linaro.org, quic_vbadigan@quicinc.com, quic_cang@quicinc.com, quic_skananth@quicinc.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, elder@linaro.org, Paul Davey , Manivannan Sadhasivam , Hemant Kumar , stable@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 01/23] bus: mhi: Fix pm_state conversion to string Date: Wed, 9 Feb 2022 15:15:39 +0530 Message-Id: <20220209094601.26131-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220209094601.26131-1-manivannan.sadhasivam@linaro.org> References: <20220209094601.26131-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul Davey On big endian architectures the mhi debugfs files which report pm state give "Invalid State" for all states. This is caused by using find_last_bit which takes an unsigned long* while the state is passed in as an enum mhi_pm_state which will be of int size. Fix by using __fls to pass the value of state instead of find_last_bit. Fixes: a6e2e3522f29 ("bus: mhi: core: Add support for PM state transitions") Signed-off-by: Paul Davey Reviewed-by: Manivannan Sadhasivam Reviewed-by: Hemant Kumar Cc: stable@vger.kernel.org Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 046f407dc5d6..0d588b60929e 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -79,10 +79,12 @@ static const char * const mhi_pm_state_str[] = { const char *to_mhi_pm_state_str(enum mhi_pm_state state) { - unsigned long pm_state = state; - int index = find_last_bit(&pm_state, 32); + int index; - if (index >= ARRAY_SIZE(mhi_pm_state_str)) + if (state) + index = __fls(state); + + if (!state || index >= ARRAY_SIZE(mhi_pm_state_str)) return "Invalid State"; return mhi_pm_state_str[index]; @@ -789,7 +791,6 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl, mhi_chan->offload_ch = ch_cfg->offload_channel; mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch; mhi_chan->pre_alloc = ch_cfg->auto_queue; - mhi_chan->wake_capable = ch_cfg->wake_capable; /* * If MHI host allocates buffers, then the channel direction -- 2.25.1