Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1664955rwe; Fri, 2 Sep 2022 01:23:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Ew7RFC0V0H6ajODhQJnf2IGu3+g5A5RlcZzEVBEv4iU2gMX3KtXNt/7pOu7gdHPcdz4XU X-Received: by 2002:a17:906:9c82:b0:6df:c5f0:d456 with SMTP id fj2-20020a1709069c8200b006dfc5f0d456mr27335508ejc.287.1662107021886; Fri, 02 Sep 2022 01:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662107021; cv=none; d=google.com; s=arc-20160816; b=uYlLHYg8WpUUQ/xlTqFYEpZ6Yz9aleC7TMv9+O7gJm8RW6eOz2pZHPTYyWwhjqX+Cu iA7nB6pJkjsUYBoAcR3jfRoChBQLNG2x8I99Kk9aTRtM8kmQCQuFgQxGs/Opg1iZj2Gd nSczWB9yoCl8av56n4skv2OE2bGe2s4hreqUaXe52bNBvQCdF2HgyV0fP5BPHAO03v7w aIUUNPg05O7eDDMx/OlT4Kp8YkvH8gR03vImg4SxZ1B2FqimbzKhW+kc/O6HYBBz+1EQ LuGCiL1rlebt8yqzbkY/JuXW0MYKv7VSNwzxClh4Rt/Tj32ouOEybK5Eg383yV5ZRJts Te/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=oAqZvuxBwkjoRB5D5ybIHr1c7/h74LZKi0WBizztjtw=; b=ERBmIi1yj5vMe4rfjJURFSiYuQnT4y5qUXcBPo0qRw6ByxyG4tSafFRgzm7X0OWZtu AXoZ4fFOBWv+3MmuOOWIXot2c8nL/eu27YMq0VoSGN7VJYAX5UVhyHM6AYBYDb9ql2wO sbDLOX61OhN0HzGqTZj1yXC/tb28irB0K8NJNGeb91VpBxKiD4PwDfafn1BfFmLWbUag D1nspFBpGZ+cZ3MN8JReHExqPtv2e1Nqh9+HF4DgIlgn/CpApa8MQyl48rtmgGawOazo fwmnTPtHKOOQUXBPChWBxAF8sRQo5DEnxpqV9CuXs9/nNINGaBe7clNkMTesVS2tOv+s rmNQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a056402358b00b0043df9ca3ff8si1545902edc.50.2022.09.02.01.23.16; Fri, 02 Sep 2022 01:23:41 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234495AbiIBHyI (ORCPT + 99 others); Fri, 2 Sep 2022 03:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235434AbiIBHyG (ORCPT ); Fri, 2 Sep 2022 03:54:06 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DC72B99FF for ; Fri, 2 Sep 2022 00:54:05 -0700 (PDT) Received: from fraeml707-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MJqnx5zn4z683hj; Fri, 2 Sep 2022 15:50:13 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml707-chm.china.huawei.com (10.206.15.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 2 Sep 2022 09:54:03 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 08:54:01 +0100 From: John Garry To: CC: , , , , , , John Garry Subject: [PATCH v2 1/5] bus: hisi_lpc: Don't dereference fwnode handle Date: Fri, 2 Sep 2022 15:47:17 +0800 Message-ID: <1662104841-55360-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1662104841-55360-1-git-send-email-john.garry@huawei.com> References: <1662104841-55360-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Andy Shevchenko Use dev_fwnode() and acpi_fwnode_handle() instead of dereferencing an fwnode handle directly, which is a better coding practice. While at it, reuse fwnode instead of ACPI_COMPANION(). Signed-off-by: Andy Shevchenko Reviewed-by: Rafael J. Wysocki Signed-off-by: John Garry --- drivers/bus/hisi_lpc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c index 2e564803e786..6d432a07cbba 100644 --- a/drivers/bus/hisi_lpc.c +++ b/drivers/bus/hisi_lpc.c @@ -347,7 +347,7 @@ static int hisi_lpc_acpi_xlat_io_res(struct acpi_device *adev, unsigned long sys_port; resource_size_t len = resource_size(res); - sys_port = logic_pio_trans_hwaddr(&host->fwnode, res->start, len); + sys_port = logic_pio_trans_hwaddr(acpi_fwnode_handle(host), res->start, len); if (sys_port == ~0UL) return -EFAULT; @@ -615,7 +615,6 @@ static void hisi_lpc_acpi_remove(struct device *hostdev) static int hisi_lpc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct acpi_device *acpi_device = ACPI_COMPANION(dev); struct logic_pio_hwaddr *range; struct hisi_lpc_dev *lpcdev; resource_size_t io_end; @@ -637,7 +636,7 @@ static int hisi_lpc_probe(struct platform_device *pdev) if (!range) return -ENOMEM; - range->fwnode = dev->fwnode; + range->fwnode = dev_fwnode(dev); range->flags = LOGIC_PIO_INDIRECT; range->size = PIO_INDIRECT_SIZE; range->hostdata = lpcdev; @@ -651,7 +650,7 @@ static int hisi_lpc_probe(struct platform_device *pdev) } /* register the LPC host PIO resources */ - if (acpi_device) + if (is_acpi_device_node(range->fwnode)) ret = hisi_lpc_acpi_probe(dev); else ret = of_platform_populate(dev->of_node, NULL, NULL, dev); @@ -672,11 +671,10 @@ static int hisi_lpc_probe(struct platform_device *pdev) static int hisi_lpc_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct acpi_device *acpi_device = ACPI_COMPANION(dev); struct hisi_lpc_dev *lpcdev = dev_get_drvdata(dev); struct logic_pio_hwaddr *range = lpcdev->io_host; - if (acpi_device) + if (is_acpi_device_node(range->fwnode)) hisi_lpc_acpi_remove(dev); else of_platform_depopulate(dev); -- 2.35.3