Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5569671pxb; Mon, 14 Feb 2022 02:13:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzztiDHEjOXPf+MLYn35bZ91v9MidfJdEPn9XKbE3o2RxsbCrl1wWSjYr00wEROS+jTu/RL X-Received: by 2002:a17:90b:1a90:: with SMTP id ng16mr13887898pjb.72.1644833596586; Mon, 14 Feb 2022 02:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644833596; cv=none; d=google.com; s=arc-20160816; b=v0VgPX+CzoiMtRU6CcGb6ADPQT/jqPykl5VvHcfipZUIQ1XeA64puT4Mkw4GGKwSPT Bb2VnW37QikAt7mbsWa9Lxfcx4HKdWRQoOGLcJfngSZVJjDee19GYxHUWN+hDkE2MatM s4OC3Ab8dnVHC0yrKQ3S/l1hUC2QgCtRtZLepaP4mK0IVaDgOeJXI6jX/+g9XE7WJv6g wvIHyCZMW8PGknGsQ3y/K1cHEBnsIIeQsZU9pn9F9dAd/c5GA0j6TfKqbwTJSPr1kTnY cQkyaZNsAZQbmJmUijoBi801dU9W3Nt5cmSbrPxQmp6Z5SOoEdzL1FK23brzAmFLN4S6 KoNA== 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=x7DQ/ZJ2gQOCs8afpwgV3IUsPGlYg0pNNMCW2zNhUO8=; b=KJ6gf55OFl/V6YBfJ0nsIKoEJx2d384fZOtGhf51Vw5r/1zXSdkgQ/T85pSzUXSsJ9 x3zm0lY36BAxmgviLaNgEFAzLrjGlDJA+AM51Ng/EVLgGSJ7w7zPSkHV9Qw8yGatBQUV MZemcPBEp7tZW0kOKtPiqV4HOIz0GnnzWsynrSyPfFIpcf73vAEcU227/LI29pFDVZaI ywKTpB64F8xLMa4W0lrSMST7omdjIYO6ysMcjl/UauSkBVYgsrf5fU2YAt7wyD+ASSYJ oOjdEPSl/UCE1Y/BS0GgA/vmRFCZcgsOcrVz/IK8LZuLwvQgISNdny3cNmWbNI3kGOWe huJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WYLrcsL4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n20si5674155pfa.160.2022.02.14.02.13.00; Mon, 14 Feb 2022 02:13:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WYLrcsL4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229588AbiBLSVx (ORCPT + 99 others); Sat, 12 Feb 2022 13:21:53 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbiBLSVw (ORCPT ); Sat, 12 Feb 2022 13:21:52 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E9E95418B for ; Sat, 12 Feb 2022 10:21:48 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id v13-20020a17090ac90d00b001b87bc106bdso14968832pjt.4 for ; Sat, 12 Feb 2022 10:21:48 -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=x7DQ/ZJ2gQOCs8afpwgV3IUsPGlYg0pNNMCW2zNhUO8=; b=WYLrcsL4z93Z79+6TZmR1sVn94tNgubl+JfaCtqejObohJL+hcAyUh2RWSDzlpwEr+ 1lsptBo9XrX0q94C9ENxJCybs2WAo4k5EOvR2VFZV6JhrIxtDcaX6hlxryb1/gWwI5c9 3JyBQDEXfL5LwEbsdEbQj1/4nfsSZ3/ZEEEtdOaZhYjrLXIEkCGc8l2X3KYPqgAgR2re piR+uv8ZxFo9C1Z9rN07f1KomwTl/RO2BMuQZI3tvXo1XOg8+GVlyCxfbP0kEYpBk8L5 1tjo/7gSqaywFI9hP8JPaAgTNsNA8v7gZC2cRTgu5CweLwyer/c1iy2df/nq9sJ9W0q1 zPKQ== 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=x7DQ/ZJ2gQOCs8afpwgV3IUsPGlYg0pNNMCW2zNhUO8=; b=We1R8ebaU/7RIJWKdpXOXhJXMM4999X3LHkM/6YMkaxF5IVln/crT3h/8GAP3Z0gC0 SVkfPT4plQxwtErr5Ehl7V9PNaQKMfihP7yUYnW8itRvD2y5odhzM+CVYzUptC0ExkqW yKCFOYZ395AciWn8TlGHIF/q7Epp9MT09jHye87zUKkW7WGFbfXeo1Sgn7jCtyzB5x/R Lwkr+wSrDVRScvBZ0GA8GiXdvgUx14MnkbPNvtaVkFmNksWfp1HuuWjWgHtYPHqb/asP 6YPF9W5W0aUpmkvBJj61nYN+gswrWtCpicOTsodzBu2wa7wO6ZvOv4U1ywiIcdVKcGgt /xZw== X-Gm-Message-State: AOAM5316LfZfU5gp//dpW34s11C6jxepbpxc6hPdMgZR5iuznJyEMaZp abstvMVXsmUG69a1C5H66vQM X-Received: by 2002:a17:902:bcca:: with SMTP id o10mr6894783pls.147.1644690107434; Sat, 12 Feb 2022 10:21:47 -0800 (PST) Received: from localhost.localdomain ([27.111.75.57]) by smtp.gmail.com with ESMTPSA id g12sm14961987pfj.148.2022.02.12.10.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Feb 2022 10:21:47 -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 v3 01/25] bus: mhi: Fix pm_state conversion to string Date: Sat, 12 Feb 2022 23:50:53 +0530 Message-Id: <20220212182117.49438-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220212182117.49438-1-manivannan.sadhasivam@linaro.org> References: <20220212182117.49438-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 046f407dc5d6..af484b03558a 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]; -- 2.25.1