From patchwork Fri Mar 17 12:36:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 71277 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp327115wrt; Fri, 17 Mar 2023 06:05:25 -0700 (PDT) X-Google-Smtp-Source: AK7set9JWAe4S6efuK7QQsm4dlE/CPy83sRDlj45t/3ByRflXQ3mN2bsTus9D9FOISGH2WQTctrs X-Received: by 2002:a05:6a20:6914:b0:cc:4118:65c4 with SMTP id q20-20020a056a20691400b000cc411865c4mr8547938pzj.5.1679058325309; Fri, 17 Mar 2023 06:05:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679058325; cv=none; d=google.com; s=arc-20160816; b=e5JBe6TnzZbaQpi4HUAdcAg/5BEaEcureTqiF+jr8BLpuEZ9vF4N2xLqDBRX1aq8U5 BE2NcrBHXhhlIE/MM4QMmeHN+k8ahTKf8Qd3okf+ACmAGyKsuaJ6qU2rMuv4ri35cBsn oy7O90InVr7zKMBa15E7jB4Ucw45zdIuVp2EH7O9RcosdzwgI6L/GLRxB/3VxUbEfZxL ZF5L2d0pJ6dwLlw2HOdjnJ4ft70NT24uvqIZEh6aktIzabt2bOIxV5y02zSc4xUqylem AuxgUe4xEh8Ag6mIm6YguWmHE3hFyN6H4EHMZveuZqe98AP/wNHY1ajsfY3NVCZXmHaS R46A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=zG+Fullr1evfHoIsSVfpr6zWgtZeQgscYvErLPyQFGI=; b=tgoZk6CushudziGn/xoSTBDrMT2qvhOJDs/favJ/hl+rsVUXfyMdlFI3fkaDf/ql4O rFK0Kcj09au5ieGyipDYS+hIXu/y/nHt0bIwQ8uzCG9IFMqNkeh8P6NJyPiq6RFvjkd+ aecvJbsclECDhvs/H8nSwJS5ekf5s2t7dVmVe+ot7B2MogRz4BVyNvVcToRPSHc0zSlo Aqx1fXec2wP3qK6KDaVML8EJCDjam5iv02PxByF51O1syuz7siF3h7EYjkyi+fqpFnPC 5ScfRteKvXSDjPCstRrxNey4Hzw+NERwXUBNLJtM9j1J1tmKQUBkpypDf2XG5UPdizHw BNYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gCuBPF8Q; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n127-20020a632785000000b004fb3845932esi2449981pgn.576.2023.03.17.06.05.13; Fri, 17 Mar 2023 06:05:25 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=gCuBPF8Q; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230256AbjCQMiH (ORCPT + 99 others); Fri, 17 Mar 2023 08:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230252AbjCQMiE (ORCPT ); Fri, 17 Mar 2023 08:38:04 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9884674A48 for ; Fri, 17 Mar 2023 05:37:26 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id ek18so19777996edb.6 for ; Fri, 17 Mar 2023 05:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679056644; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=zG+Fullr1evfHoIsSVfpr6zWgtZeQgscYvErLPyQFGI=; b=gCuBPF8Q//qtJHEANJYlS6l2sNTnvzGXgW7oTC/0ZEhziDZzOKxWNrWzMMHXTNNQaB qpJ9TBGAx1KZldJ9Q4XGAlKm+biixAVxoASEdMetmF56HW/DHGXq/jOBBagk28gQAxN+ qS2vWBOSOU7l9hg6M4qMs4fnzxqeyh2F2NdOCj1WKHrEkB2x/ZZnsBfk3caUEv2ml7NE Vr/+HbOQu0F3csoE7FmF9Y3XLNU20UF5Go3vwh9AWmDti3T3NtrCEN3siUMxT/hHUagE IENK+8SDm8FcxSctWoKtHnFMteYpoeTrReYQccAxNIQqoS08kzKgfIgi8G7ePWYWr+v4 odjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679056644; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zG+Fullr1evfHoIsSVfpr6zWgtZeQgscYvErLPyQFGI=; b=ps1etpqszXyn8s1GrzIGCdHPtqhSp+2MlOmeoRmf816ZBf07jcJjLIZgOpiCykUVbw vJJQQ3Kc3ha2QeHR8ozYeH2dVD/BbNIkoXZ55Pkxg6ukxKTFDMGWBwB3WpQUaIMvTXEw 8a0eBNV5Z+ECs+F4P8e5fpA9L/oWCPQmz0SliNa7341Y1BW9nLMrFCzYYJUTNqSq7I19 SH08cGOVTgqMHWwe4v6/zY8CYup8kAfS4uTdP19yw/7CC4wUaFfNLc7fQMbfosl/gJrm gMlqqxHJ1IvZZH3OjHv8F0BTTvJtKZ2tqJsL0wn6yhAebizcWPp6tFdol0uOkrBUS5If eOWg== X-Gm-Message-State: AO0yUKUhUIZaTF6NJnx5ZkWgiiXYXMD+cyBXi8AYaQlubBMOGaAWZRpe tNhz5OUtHBBb/lnLj2NFJ+E= X-Received: by 2002:a17:906:1254:b0:8b1:fc58:a4ad with SMTP id u20-20020a170906125400b008b1fc58a4admr13864475eja.11.1679056643943; Fri, 17 Mar 2023 05:37:23 -0700 (PDT) Received: from ?IPV6:2a01:c23:c5b8:6200:dd0b:20c2:4c96:a825? (dynamic-2a01-0c23-c5b8-6200-dd0b-20c2-4c96-a825.c23.pool.telefonica.de. [2a01:c23:c5b8:6200:dd0b:20c2:4c96:a825]) by smtp.googlemail.com with ESMTPSA id k6-20020a17090632c600b00924d38bbdc0sm938073ejk.105.2023.03.17.05.37.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Mar 2023 05:37:23 -0700 (PDT) Message-ID: <6dbdf458-9f46-613e-de58-b4a56a6cdd9f@gmail.com> Date: Fri, 17 Mar 2023 13:36:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: [PATCH 1/2] base: soc: populate machine name in soc_device_register if empty Content-Language: en-US From: Heiner Kallweit To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Jerome Brunet , Martin Blumenstingl , Neil Armstrong , Kevin Hilman Cc: Linux Kernel Mailing List , "open list:ARM/Amlogic Meson..." , "linux-arm-kernel@lists.infradead.org" References: In-Reply-To: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760620262696282200?= X-GMAIL-MSGID: =?utf-8?q?1760620262696282200?= Several SoC drivers use the same of-based mechanism to populate the machine name. Therefore move this to the core and try to populate the machine name in soc_device_register if it's not set yet. Signed-off-by: Heiner Kallweit Acked-by: Martin Blumenstingl --- drivers/base/soc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/base/soc.c b/drivers/base/soc.c index 0fb1d4ab9..8dec5228f 100644 --- a/drivers/base/soc.c +++ b/drivers/base/soc.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -110,6 +111,18 @@ static void soc_release(struct device *dev) kfree(soc_dev); } +static void soc_device_get_machine(struct soc_device_attribute *soc_dev_attr) +{ + struct device_node *np; + + if (soc_dev_attr->machine) + return; + + np = of_find_node_by_path("/"); + of_property_read_string(np, "model", &soc_dev_attr->machine); + of_node_put(np); +} + static struct soc_device_attribute *early_soc_dev_attr; struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr) @@ -118,6 +131,8 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr const struct attribute_group **soc_attr_groups; int ret; + soc_device_get_machine(soc_dev_attr); + if (!soc_bus_registered) { if (early_soc_dev_attr) return ERR_PTR(-EBUSY); From patchwork Fri Mar 17 12:37:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 71278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp327719wrt; Fri, 17 Mar 2023 06:06:11 -0700 (PDT) X-Google-Smtp-Source: AK7set+PIrbYpf8VdnZwPfNCuZ05WkSIvo5CyYAYPeZ0Ywf3qWWe1A3gjtQAP9DiAluMSlwZXW0H X-Received: by 2002:a05:6a00:32c7:b0:5db:aa2d:9ea0 with SMTP id cl7-20020a056a0032c700b005dbaa2d9ea0mr7600888pfb.2.1679058371058; Fri, 17 Mar 2023 06:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679058371; cv=none; d=google.com; s=arc-20160816; b=0eS1lL8lEEtWvXgW92yew1ghOyskgPtIMQNPWjnZRpFZbzMlmErzrUE9J5h1KT65Yd Vm3Ag+9n0vtJRKHmmgJaZAVnjkFVvig3jrfaoQAKJdSXVurqJ3wM1f01q1pdcuAiCWP8 tH1ub0HqvntJVur2+LOo8uKHjWtrnhH9cQXmIzwpP+VLQdCoTyRiSFpjwo1rqxh35Wy7 c0T9fUVbSi+l6eTfdJ61izP9fORhx6Pp7nY7BGahlk4yyaVuOFNx5RaEAe+dVJvMojVc rQzT9pfryxZn2CWtMCLx2VtQzd6iimUsJEq+6ty8xsTuyz2CCchFA61giFoQVBi9DJpB iJqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=5ZayqswrbZ5QKKAD9r+P5nbMwyqOYAxRHhSqir5Y47A=; b=0u+8/b4tIadwgWfeiO2+gtOpD5tfUk5bXuQ3qQe9etibCoqS7Yh4I3rCoH0tIQB7dv zp4lyAVO/2o/aJsFIJQbaIVV20MbMkJvY9Mjh39Cwo9yCz55m0vbP6aHiP+IKGFEUkB3 HCHk3wew40pgvFVXCK4xjqYQgGVGJXz6BfH1UayxHd9ug+l9Ssz4fEaLudLIVssixYuw FjzWpF0HVt55T7QTA9s0uEAY6pfq0KfOLph2fceOmGWJDNNh+t3Cvy4FbpT/WalOEGkD wp6Iur+fsk3qHlP8XR3cClOLPl4OaFr8zOCX94re69GFcclhyRteRPqcsSSxpCkAW8RX DTnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HBPD3CnS; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n24-20020a635918000000b00502f3d1a058si2201468pgb.479.2023.03.17.06.05.57; Fri, 17 Mar 2023 06:06:11 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=HBPD3CnS; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230254AbjCQMiJ (ORCPT + 99 others); Fri, 17 Mar 2023 08:38:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230259AbjCQMiG (ORCPT ); Fri, 17 Mar 2023 08:38:06 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0069A8617A for ; Fri, 17 Mar 2023 05:37:26 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id eh3so19714719edb.11 for ; Fri, 17 Mar 2023 05:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679056645; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=5ZayqswrbZ5QKKAD9r+P5nbMwyqOYAxRHhSqir5Y47A=; b=HBPD3CnSAB/ZPFiN2l3lS+vD3GXGwIyXa+NJzUy4XLbOBqPoXnalzl0SdCHcM68oSB ugFPC8w4TXBJVN6oBPVA/OHnF1qttx7eZ/2qV0QujCA5bRKqu/Kf7R7ffb39VgKoUSvD vdSntNH+0/E3Yc5TI7++fGS67+j0Hbed0njnveIcwu1rOa+d/ExOcPxl5JupULGwojVW vUZTUQgyQlnJZv2w/GHX9XnbBSuVPHP/sRB95mDlVWdYyjxuBHpt1L3p8TK4FkbL4737 wKID/TYOYMlYdY2A8ChY6TZGuWx1LW/38VcV8BzKz3mtpppAM0MeheCJS0RjfR/41eup lXFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679056645; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5ZayqswrbZ5QKKAD9r+P5nbMwyqOYAxRHhSqir5Y47A=; b=HUCft3uIvVO4kJhgAshoF2ox67fspWpw4pBz1QJ72jmuzfq+s8/yWHJfizGIQc6EA+ EPjvEyJBLNn23JAZNoUBCBz4ZVeO+HMUaeNMANR++Gg9GLIMhlGrumFNItD1pjvC19OL IKXwViPc6VbGJFIKdtbQ2kCw53/kvbdnbEgJObrB4ucp9G5pv/s0K7PQTfKk5cWCb0Cc ioMiy4Uui+ZAyIDUtYn+G0ZkYH7Exz5sp6AXVZ6Y/DheLr0odM4OFP3dsnpGEQgFXix8 prGUffknTgSmhIrxdLB7STWArdUTSuGYyiv49t7jjJ79o9vbE8X9ESwpamowkmcUpdnb VTkQ== X-Gm-Message-State: AO0yUKUjAz7uTmaF9CBw7b5NmknVlLKUkjqBLKyT5WwKQ6r0oXqkl5Zn +K8i+RNbpoAcmeEaQS6pOy4= X-Received: by 2002:a17:906:3f87:b0:922:446b:105a with SMTP id b7-20020a1709063f8700b00922446b105amr2847350ejj.19.1679056645209; Fri, 17 Mar 2023 05:37:25 -0700 (PDT) Received: from ?IPV6:2a01:c23:c5b8:6200:dd0b:20c2:4c96:a825? (dynamic-2a01-0c23-c5b8-6200-dd0b-20c2-4c96-a825.c23.pool.telefonica.de. [2a01:c23:c5b8:6200:dd0b:20c2:4c96:a825]) by smtp.googlemail.com with ESMTPSA id cd11-20020a170906b34b00b0093009bc5825sm945928ejb.2.2023.03.17.05.37.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Mar 2023 05:37:24 -0700 (PDT) Message-ID: Date: Fri, 17 Mar 2023 13:37:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: [PATCH 2/2] soc: amlogic: meson-gx-socinfo: use new soc_device_register functionality to populate machine name Content-Language: en-US From: Heiner Kallweit To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Jerome Brunet , Martin Blumenstingl , Neil Armstrong , Kevin Hilman Cc: Linux Kernel Mailing List , "open list:ARM/Amlogic Meson..." , "linux-arm-kernel@lists.infradead.org" References: In-Reply-To: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760620310136257020?= X-GMAIL-MSGID: =?utf-8?q?1760620310136257020?= A new fallback mechanism has been added to soc_device_register that populates machine with the DT model information if machine isn't set yet. This allows to remove this code here. Signed-off-by: Heiner Kallweit Reviewed-by: Martin Blumenstingl --- drivers/soc/amlogic/meson-gx-socinfo.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c index 165f75484..6abb73034 100644 --- a/drivers/soc/amlogic/meson-gx-socinfo.c +++ b/drivers/soc/amlogic/meson-gx-socinfo.c @@ -174,11 +174,6 @@ static int __init meson_gx_socinfo_init(void) return -ENODEV; soc_dev_attr->family = "Amlogic Meson"; - - np = of_find_node_by_path("/"); - of_property_read_string(np, "model", &soc_dev_attr->machine); - of_node_put(np); - soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x:%x - %x:%x", socinfo_to_major(socinfo), socinfo_to_minor(socinfo),