Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp617254rwe; Thu, 1 Sep 2022 05:18:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR42e8+RxgaQKrcNXk55bww5XjQRfKYZWTfZ7Pe7uCUfAn54Qwc1g9W+f2+OxmfUz/4TTcm4 X-Received: by 2002:a17:907:31c1:b0:742:28a3:5d08 with SMTP id xf1-20020a17090731c100b0074228a35d08mr9171615ejb.112.1662034688423; Thu, 01 Sep 2022 05:18:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662034688; cv=none; d=google.com; s=arc-20160816; b=HW1VixFmDbxofaCF7mwnaJB3YpKtJUD0SY9Fm8bo9dAigOglu2pQtObGlZYStseqDI i/2aip4TiE+Sowno/EG4y112epzOd1s2QhHPz1Lg7SWdr9uJeIwccWcdOatv3CSxZng6 388WuAR2zzQYMEzpPwIphJuijypj0mJxbHHzOUO43k7tgksiJIIfEVkPSRCcVPaot3lH l0Qgf8iTrW9w9ppQlZIBr/SXjW31S3VxO/gorkZVbxrMhQUe1W7rsHlKyFtaDu6ZbFIL HsVKCIaKg+U2YAd02oe+UKMyJLiWFPsQ298fDY2LZdsq5oWOrsEOJYgQ4L0u4CCyNhfm Idgw== 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=fYmlm9lpQ7Uohi0i3/zxSPkgBGJ2GjoEKm/JU2L0CqXkonzskcvMob4R3Q2jvitgSp 6ePJ00a+FJwnRGgG5wBNdZMdGAdpr7PtCBHfU6GWYOImt5YUTudBwC5UJuSnwoBf6cBx hrzOGb+BRbnVRNJ3/K/BkUbwehk6FofN1/q8LFiNi57r8qgDLNwtahSqj48qwGetWN7G IDEzOjB8to+ceyidNDpelfyevEht44WUZA+i+af8coLt8MHjQ9vbthGeCL6HwrZs3hEW okwh4FPIPiLO+XI4A1h3jRaSnbaiGkEKagsvuZDUqkIUlMxHSKLSvvFzXpu5QPfwieEa E72Q== 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 x40-20020a50baab000000b004489d4bc786si1487981ede.369.2022.09.01.05.17.25; Thu, 01 Sep 2022 05:18:08 -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 S234312AbiIALVP (ORCPT + 99 others); Thu, 1 Sep 2022 07:21:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234247AbiIALVI (ORCPT ); Thu, 1 Sep 2022 07:21:08 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6416125B90 for ; Thu, 1 Sep 2022 04:21:04 -0700 (PDT) Received: from fraeml715-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MJJVz6G9fz681Zh; Thu, 1 Sep 2022 19:20:27 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml715-chm.china.huawei.com (10.206.15.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 1 Sep 2022 13:21:02 +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; Thu, 1 Sep 2022 12:21:00 +0100 From: John Garry To: CC: , , , , , , John Garry Subject: [PATCH 1/5] bus: hisi_lpc: Don't dereference fwnode handle Date: Thu, 1 Sep 2022 19:14:27 +0800 Message-ID: <1662030871-182688-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1662030871-182688-1-git-send-email-john.garry@huawei.com> References: <1662030871-182688-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: dggems701-chm.china.huawei.com (10.3.19.178) 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