From patchwork Wed Nov 22 12:56:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viacheslav X-Patchwork-Id: 168355 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1300213vqb; Wed, 22 Nov 2023 04:58:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFfPoRvKuEsLNmCZoirB2rWW9DdjnZqvlTNwqQ0d45jfAcafSKdgDVWz8xGNi+wrHd0M+tK X-Received: by 2002:a05:6a20:5485:b0:148:f952:552b with SMTP id i5-20020a056a20548500b00148f952552bmr2556473pzk.51.1700657900457; Wed, 22 Nov 2023 04:58:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700657900; cv=none; d=google.com; s=arc-20160816; b=BTVQ8OWA4XERz5eIZvrjgnqgKLJ3W5AXLVWm0LLALKiijLeEE58spLGESoPlNcX1wg sX7qr1wDr0dzhrpsNmjOZ2pIiXblV2Q8+aXMcOO+tzZApYO7bvdE1rhrnhpV/PiGFq6G un/sFBko2GNYBt9pd9orrKsNllBL7vWOuUP/S1cM8jODGmtDSgrt17plIdqk9ypDpmSf fnsUcHzENmLGq9IarnEdsSsqTCLq+ONaXJhDi2LabRoiAbY0U/gCr9ITGpE+VqBtHhqQ AnQImqCiqQLSqERDspQMFOvKWE42gcWf9whhsv/u47k5ZM454epgVU1TNid3HUlk2wla wfyw== 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:to:from :dkim-signature; bh=TCt0JoZg+p6aWcClOSdNWHnx4AX17W2tb5XYFeiobmA=; fh=Bllhknq5mciwRt9/KlTV9ZyEB86DXiZLRo/zORr6zwc=; b=Til+hnb/qSBlqiAVFbAWn/0it3n+FqdjVNIbF2PspaAl0DbqylpbxJreFioEigcHkl koBGvLGIbsLs7G17exHykk42OKI0QwagvFDSSiw8K63Vq9ylG/RN70gyf4By0g6ER9ON +nqU5y0/q0Cfa/gvP/XNibpCRfY1Kzye0H/6PIPlr47RlNZC7qOWfOUgucEzcD2lHtzr z3f14hOwBN3EhAHE8L6T9Prfj8me/zMF7x7vXeZ81+kIgRnONasRdejqkyQx6IOtVDEQ 7EjajxiMvhZW+qVuoS5ivNSSStMu4t97ZnHlIIVjRvZI9HazIbPcwtVFJWjXzIkti7V0 9mVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lexina.in header.s=dkim header.b="mA/UeoFe"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=lexina.in Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id q26-20020a65685a000000b005c21fa725casi9500490pgt.596.2023.11.22.04.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 04:58:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@lexina.in header.s=dkim header.b="mA/UeoFe"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=lexina.in Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4E4A0824632C; Wed, 22 Nov 2023 04:57:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344222AbjKVM5M (ORCPT + 99 others); Wed, 22 Nov 2023 07:57:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344243AbjKVM5H (ORCPT ); Wed, 22 Nov 2023 07:57:07 -0500 Received: from mx.msync.work (mx.msync.work [62.182.159.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6249AD62; Wed, 22 Nov 2023 04:56:56 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 79DD953ED8; Wed, 22 Nov 2023 12:56:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lexina.in; s=dkim; t=1700657814; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding:in-reply-to:references; bh=TCt0JoZg+p6aWcClOSdNWHnx4AX17W2tb5XYFeiobmA=; b=mA/UeoFeBoCs2qSwF7nxxjkUFaDJmKEQOU5Wa3EZR57SwbPJTyghxGJyrkaqLlt8artEKp XetuKqfHJtF0FUusVm5MxTpbBorJ6XO4yi80Y7kkKVSgxqCsAFgHMeKkXHY7kl/1JKXOAT 3wPLJioi0l8r9tRD4y3K8w8M4TFym6Vpy7w3Hmsy366qrWz8KB1AxlhOZFmK/4LqYMOG8I hxfRLPKqZyrMcGbFncrldnP0BQZFg9HX+CpDFkKMWYDG6sHM29vpnyPSAOTDVjvR1pDeb/ 2kQxQdwn3GkaAdg0SZ3BjvPke9JVwMBaXzMDv741W7XbCIzRVhVnV5A6g2RVPQ== From: Viacheslav Bocharov To: Neil Armstrong , Jerome Brunet , Kevin Hilman , Martin Blumenstingl , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 2/5] soc: amlogic: meson-gx-socinfo: move common code to exported function Date: Wed, 22 Nov 2023 15:56:40 +0300 Message-Id: <20231122125643.1717160-3-adeep@lexina.in> In-Reply-To: <20231122125643.1717160-1-adeep@lexina.in> References: <20231122125643.1717160-1-adeep@lexina.in> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2574; h=from:subject; bh=BnHHuUquDeW8vfYvoIWuzuZnrP1gP/Gae/DQ47jDLU8=; b=owGbwMvMwCHmnhFhrJcZuJTxtFoSQ2rstyP3FWz+1wqt///MM3F/QLJsm3D3Tg8PsXbvuoya5uoP 2tYdpSwMYhwMsmKKLGEdQVP3eay+OHGB0QGYOaxMIEMYuDgFYCInExkZjjtfuFXcoBVz8Iw/O9fm2t J7qisu61w0ZbuSXG3wg/9AAMN/j4jY8vh1NuZZeuEcnzYK/Vc+u6NVsUyGn//ftKlmJyQ5AQ== X-Developer-Key: i=adeep@lexina.in; a=openpgp; fpr=E2FA1A767ACB0716E02E3E7AEE36B110025A8DFA X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 22 Nov 2023 04:57:29 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783269058233896335 X-GMAIL-MSGID: 1783269058233896335 Move common code fill soc_device_attribute to common function for later use Signed-off-by: Viacheslav Bocharov --- .../soc/amlogic/meson-gx-socinfo-internal.h | 3 +++ drivers/soc/amlogic/meson-gx-socinfo.c | 26 ++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/soc/amlogic/meson-gx-socinfo-internal.h b/drivers/soc/amlogic/meson-gx-socinfo-internal.h index 884cf8fb580f..5a742cc16fc8 100644 --- a/drivers/soc/amlogic/meson-gx-socinfo-internal.h +++ b/drivers/soc/amlogic/meson-gx-socinfo-internal.h @@ -95,5 +95,8 @@ static inline unsigned int socinfo_to_misc(u32 socinfo) return FIELD_GET(SOCINFO_MISC, socinfo); } +int meson_gx_socinfo_prepare_soc_driver_attr(struct soc_device_attribute *soc_dev_attr, + unsigned int socattr); + #endif /* _MESON_GX_SOCINFO_INTERNAL_H_ */ diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c index 9d7921c0fb91..8cf69dd238ee 100644 --- a/drivers/soc/amlogic/meson-gx-socinfo.c +++ b/drivers/soc/amlogic/meson-gx-socinfo.c @@ -47,6 +47,22 @@ static const char *socinfo_to_soc_id(u32 socinfo) return "Unknown"; } +int meson_gx_socinfo_prepare_soc_driver_attr(struct soc_device_attribute *soc_dev_attr, + unsigned int socattr) +{ + soc_dev_attr->family = "Amlogic Meson"; + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x:%x - %x:%x", + socinfo_to_major(socattr), + socinfo_to_minor(socattr), + socinfo_to_pack(socattr), + socinfo_to_misc(socattr)); + soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%s (%s)", + socinfo_to_soc_id(socattr), + socinfo_to_package_id(socattr)); + return 0; +} +EXPORT_SYMBOL(meson_gx_socinfo_prepare_soc_driver_attr); + static int __init meson_gx_socinfo_init(void) { struct soc_device_attribute *soc_dev_attr; @@ -95,15 +111,7 @@ static int __init meson_gx_socinfo_init(void) if (!soc_dev_attr) return -ENODEV; - soc_dev_attr->family = "Amlogic Meson"; - soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x:%x - %x:%x", - socinfo_to_major(socinfo), - socinfo_to_minor(socinfo), - socinfo_to_pack(socinfo), - socinfo_to_misc(socinfo)); - soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%s (%s)", - socinfo_to_soc_id(socinfo), - socinfo_to_package_id(socinfo)); + meson_gx_socinfo_prepare_soc_driver_attr(soc_dev_attr, socinfo); soc_dev = soc_device_register(soc_dev_attr); if (IS_ERR(soc_dev)) {