Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4040591ybg; Fri, 25 Oct 2019 12:27:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfBVGNXzdaG6FiAOZMbYKEYJBoWYYy1K3Y1cmQ1JEYiuO2Ls3+1JRb+XW0/nrmfmbvfkNG X-Received: by 2002:a50:ec03:: with SMTP id g3mr5826487edr.83.1572031662809; Fri, 25 Oct 2019 12:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572031662; cv=none; d=google.com; s=arc-20160816; b=TMn8pV95CFlAPTT1JHcjQU9gotkXwy47fj4aao/vBxqno/sA7Q6PX9/fWrxEdIM+1O W1F/dxS9cwQhhRu9V110drPLaLzMSml9SSh0o8L6vib7FXqkIzuN4OsCDM0qSKaGZ1A4 i+XHZTxnr5m5znBsugO6uUZEs8vDWGRIGo5pOTQcfF+/wWo5AGIIjN99Lf/mPvw6NhpQ bEKX8HWiZ/BmvhOrB+wljvxYysxUNV8ljgl4XyLrG8uwWosfGA+v7W8x7LvyABAWVg10 XB5ZMdvmm67R+JWdnSOuKV1cU2hoLctbDf3khSyLMNHBGcAIJ3fQG0lLvi47t/n/hUF7 N3Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=VGcT1M031U0oFgSLOWLKTs6BgwNbx6t00L+WQJixw+g=; b=yCB5/KJ5L15AmbsaWUx3ryXfYY39ZJU2YNKEok8e/5SP8pWorQx2+lpBixCJa646A/ 7aSsxS+5PJ8oQxAkgs7dPMdghKhKERhYN3HjLTUPkHlTR5iRqr6anjzFgobyuIgPl1lW usjqxxT9+eOaTs7Dji2PrPVsNZX++w+Sks9Ps9GG0LvNqZRe72tXW0fWMRqTW+TBv1SR BkqSuYbd603Ee04FHqm0IJBqqxd8gw2p2nmosDD0T1L6NSUsIv09vqSr3fMwkJQa008B RprTrmF3q+IWyd5Lxr8qDCBH+qg65046SNseBI5SoIuRsRL93kxq2oQ+X5JlKTnDgdA6 wFuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dx19si1805267ejb.113.2019.10.25.12.27.19; Fri, 25 Oct 2019 12:27:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405749AbfJYG7f (ORCPT + 99 others); Fri, 25 Oct 2019 02:59:35 -0400 Received: from inva021.nxp.com ([92.121.34.21]:37694 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727595AbfJYG7f (ORCPT ); Fri, 25 Oct 2019 02:59:35 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 51A0E2008F3; Fri, 25 Oct 2019 08:59:33 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 0A94B200438; Fri, 25 Oct 2019 08:59:28 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 432B2402BC; Fri, 25 Oct 2019 14:59:21 +0800 (SGT) From: Anson Huang To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, daniel.baluta@nxp.com, aisheng.dong@nxp.com, abel.vesa@nxp.com, leonard.crestez@nxp.com, viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH 1/2] soc: imx8: Using existing serial_number instead of UID Date: Fri, 25 Oct 2019 14:56:22 +0800 Message-Id: <1571986583-21138-1-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The soc_device_attribute structure already contains a serial_number attribute to show SoC's unique ID, just use it to show SoC's unique ID instead of creating a new file called soc_uid. Signed-off-by: Anson Huang --- drivers/soc/imx/soc-imx8.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c index b9831576..fcbf745 100644 --- a/drivers/soc/imx/soc-imx8.c +++ b/drivers/soc/imx/soc-imx8.c @@ -29,14 +29,6 @@ struct imx8_soc_data { static u64 soc_uid; -static ssize_t soc_uid_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return sprintf(buf, "%016llX\n", soc_uid); -} - -static DEVICE_ATTR_RO(soc_uid); - static u32 __init imx8mq_soc_revision(void) { struct device_node *np; @@ -174,22 +166,25 @@ static int __init imx8_soc_init(void) goto free_soc; } + soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid); + if (!soc_dev_attr->serial_number) { + ret = -ENOMEM; + goto free_rev; + } + soc_dev = soc_device_register(soc_dev_attr); if (IS_ERR(soc_dev)) { ret = PTR_ERR(soc_dev); - goto free_rev; + goto free_serial_number; } - ret = device_create_file(soc_device_to_device(soc_dev), - &dev_attr_soc_uid); - if (ret) - goto free_rev; - if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT)) platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0); return 0; +free_serial_number: + kfree(soc_dev_attr->serial_number); free_rev: if (strcmp(soc_dev_attr->revision, "unknown")) kfree(soc_dev_attr->revision); -- 2.7.4