From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6646BC7EE3A for ; Fri, 26 May 2023 02:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233074AbjEZC3k (ORCPT ); Thu, 25 May 2023 22:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbjEZC3i (ORCPT ); Thu, 25 May 2023 22:29:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74271B6; Thu, 25 May 2023 19:29:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 08F286122B; Fri, 26 May 2023 02:29:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8FA0C433EF; Fri, 26 May 2023 02:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685068176; bh=TP3AYaJ4gP/2S+h8KfHn4g2GfOx8vMvuIghBrxr/fiA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qtMQ1xiJkF679FZSYrrmjpzKauW9jGgFbHaW+BHUX6pT4eHYK/J1nyR1xqmVhdAIu /a5npppaQ74QON+5Aiu36bz9oEd4NfLcQzLzUZagM02o3RwbA36/R7FX7eqXk2OwgI pxCpoAQM5Y4NP8hd0HZczvIkVzNw8Pr7ZhZ9QuwZtRXsz0rvkvgPOiHSMftQFXHWs4 IpsSutE1QrS2iUPIuJnGYYq1pLl56hFA5S614xIEeZnM/WgkK25UkqGUHl8QySHxv9 SMHPkkhCiXXCpCPb93YcCDRu9Z3ZZH2IOKToIxwlTfTANvo/888CjB+7JmYRdEJ6qd Vq8yWfg5g/LGA== Date: Thu, 25 May 2023 19:33:25 -0700 From: Bjorn Andersson To: Konrad Dybcio Cc: Robert Marko , agross@kernel.org, ilia.lin@kernel.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, ansuelsmth@gmail.com Subject: Re: [PATCH v4 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id() Message-ID: <20230526023325.y7iqygmbtjmbf4zo@ripper> References: <20230525210214.78235-1-robimarko@gmail.com> <20230525210214.78235-3-robimarko@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 26, 2023 at 01:18:17AM +0200, Konrad Dybcio wrote: > > > On 25.05.2023 23:02, Robert Marko wrote: > > Introduce a helper to return the SoC SMEM ID, which is used to identify the > > exact SoC model as there may be differences in the same SoC family. > > > > Currently, cpufreq-nvmem does this completely in the driver and there has > > been more interest expresed for other drivers to use this information so > > lets expose a common helper to prevent redoing it in individual drivers > > since this field is present on every SMEM table version. > > > > Signed-off-by: Robert Marko > > --- > > Changes in v4: > > * Change helper name to qcom_smem_get_soc_id() > > * Remove len and just pass NULL, that is sufficient here > > > > Changes in v3: > > * Change export to EXPORT_SYMBOL_GPL > > * Use an argument for returning SoC ID > > * Update kerneldoc > > --- > > drivers/soc/qcom/smem.c | 23 +++++++++++++++++++++++ > > include/linux/soc/qcom/smem.h | 2 ++ > > 2 files changed, 25 insertions(+) > > > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c > > index bc98520c4969..78cf79ea4924 100644 > > --- a/drivers/soc/qcom/smem.c > > +++ b/drivers/soc/qcom/smem.c > > @@ -14,6 +14,7 @@ > > #include > > #include > > #include > > +#include > > > > /* > > * The Qualcomm shared memory system is a allocate only heap structure that > > @@ -772,6 +773,28 @@ phys_addr_t qcom_smem_virt_to_phys(void *p) > > } > > EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys); > > > > +/** > > + * qcom_smem_get_soc_id() - return the SoC ID > > + * @id: On success, we return the SoC ID here. > > + * > > + * Look up SoC ID from HW/SW build ID and return it. > > + * > > + * Return: 0 on success, negative errno on failure. > > + */ > > +int qcom_smem_get_soc_id(u32 *id) > __le32 *id > Why do you want this passed back to the user in little endian? When is it not going to be compared to a cpu-endian constant? > LGTM otherwise! > > Konrad > > +{ > > + struct socinfo *info; > > + > > + info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, NULL); > > + if (IS_ERR(info)) > > + return PTR_ERR(info); > > + > > + *id = info->id; This should be __le32_to_cpu() though... Regards, Bjorn > > + > > + return 0; > > +} > > +EXPORT_SYMBOL_GPL(qcom_smem_get_soc_id); > > + > > static int qcom_smem_get_sbl_version(struct qcom_smem *smem) > > { > > struct smem_header *header; > > diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h > > index 86e1b358688a..223db6a9c733 100644 > > --- a/include/linux/soc/qcom/smem.h > > +++ b/include/linux/soc/qcom/smem.h > > @@ -11,4 +11,6 @@ int qcom_smem_get_free_space(unsigned host); > > > > phys_addr_t qcom_smem_virt_to_phys(void *p); > > > > +int qcom_smem_get_soc_id(u32 *id); > > + > > #endif