Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1174956pxj; Fri, 18 Jun 2021 00:57:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbfM0mhEHlbcZoiJeJZQZwrORnHV1y6JQVuBZcbRdwV2dO6ZnwTB5H5sUV2auscQM22vm7 X-Received: by 2002:a02:6f5e:: with SMTP id b30mr2139269jae.94.1624003041960; Fri, 18 Jun 2021 00:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624003041; cv=none; d=google.com; s=arc-20160816; b=kV8T0z1A41KXk4DmNHaAenW2zkpXf/+bPrXNQWXq52K+cftS3hb2mZDCLsl3G47DAc U+0Ec9a/2O4fqm4++LkXXUv9n0rgFDTpTsDxD4g9fktfNxo4Ombh5km9x1d3k5zyC3CN hNWm7VfLqtSt4Q+CbrVYDK8v6xTH2hY+2e08kqI86BLbQ+L8ZWY17+al3zsWs4xi963w z6OE3l4cTm1Uv5LeY6l6e+ymGAs477xuQE7okDJDUVm6RHOtOEaLyYzkasRtU4L2zs5D zdE/szqs24MaUHmaUdgnJjxZ+J31jlTcK2TpLSV2ztN8yKCEiZ0OIPJIK09lrY/3iQa9 +bYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=09gAYUsQLSTwmesVg5HD5hHuYAJXC9aGPbdXdf71N6I=; b=fb/EBMSMub0l3569EeelG1FhR70d7uKKM1q3HPN43HrCRjzrZ5FtmvihbZlHV4wwr3 +ixW139fkmMEyL7FoU6085/w2rjn1Na8VuG5vneHOIpKjxNcibMDKoxtiQQMio4wncBR FgPR2wwGJTCnBLwX0J92tH2aiv4Ppiqw1Kkf3+AEPjBl/+IALpgygVt96KizmcywaREr ORkPghVSIA4cuqTg561SvT04mKKxqlsGYN3ZE37C6/NP0xFshNNfXCoxA6Dorm5qUKsZ qWs+F9Q3a3JFuzCy948sdrkF6rbVAxr1G8Kg6+oxdN5P+Cu4gBz1yT2e63G/IgRR6VZY SB3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G9pPYFEP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h78si8125812iof.66.2021.06.18.00.57.09; Fri, 18 Jun 2021 00:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G9pPYFEP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232809AbhFRGPG (ORCPT + 99 others); Fri, 18 Jun 2021 02:15:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:33258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232270AbhFRGPG (ORCPT ); Fri, 18 Jun 2021 02:15:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B9E1961154; Fri, 18 Jun 2021 06:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623996777; bh=jNED0w5AnR+TFf49A2R1gRokQJ3wgVwVy2+mDUkr3gc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G9pPYFEPtDRQmWCFF0nSnHfpRsa59lBlcHTyK7kG30efaFgiWHWkOTJk3CbpORdwT ZHp0QvWIP/8BVRod+BK69AMGxhCIcmwL6TJaPR8wX2qar2RiBzKPxgpfkhifb1DbK5 5xlFiD5iJDXzQKwT8jT9Xo9bjMi54gaB22urkSNxoWupTgQ4/+7lNgRYUKhZKcJf5c dJO4DN67LkxS4vSmfK4OfGa+DEzZJdbzkbP+OrU+xb3sTFhy3qHHiwolYuwbN2XSv4 zlQCuJbbqRHcSqPMi9zwVzSZoYplz/ki/s7K+9ElrC837CrdZZ20A3HuNwv7znU3dk KvPoaHph29Ybw== Date: Fri, 18 Jun 2021 11:42:51 +0530 From: Manivannan Sadhasivam To: Paul Davey Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] bus: mhi: Fix pm_state conversion to string Message-ID: <20210618054731.GJ3682@workstation> References: <20210618033132.24839-1-paul.davey@alliedtelesis.co.nz> <20210618033132.24839-2-paul.davey@alliedtelesis.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210618033132.24839-2-paul.davey@alliedtelesis.co.nz> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 18, 2021 at 03:31:31PM +1200, Paul Davey wrote: > On big endian architectures the mhi debugfs files which report pm state > give "Invalid State" for all states. > > Fix to_mhi_pm_state_str by using a local unsigned long as an intemediate > to pass the state to find_last_bit to avoid endianness issues with cast > from enum mhi_pm_state * to unsigned long *. > > Signed-off-by: Paul Davey Reviewed-by: Manivannan Sadhasivam Thanks, Mani > --- > drivers/bus/mhi/core/init.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c > index c81b377fca8f..87cc0c449078 100644 > --- a/drivers/bus/mhi/core/init.c > +++ b/drivers/bus/mhi/core/init.c > @@ -79,7 +79,8 @@ static const char * const mhi_pm_state_str[] = { > > const char *to_mhi_pm_state_str(enum mhi_pm_state state) > { > - int index = find_last_bit((unsigned long *)&state, 32); > + unsigned long tmp = state; > + int index = find_last_bit((unsigned long *)&tmp, 32); > > if (index >= ARRAY_SIZE(mhi_pm_state_str)) > return "Invalid State"; > -- > 2.32.0 >