Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp935117imw; Fri, 8 Jul 2022 14:46:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u0rXPiJmtwZOUAGX2Nr3dj2Z/gg+lA1m6UG1T876mjNxHeoQewty0UXrxc3nNjdK/QGIUq X-Received: by 2002:a63:3807:0:b0:40c:73a7:b6cf with SMTP id f7-20020a633807000000b0040c73a7b6cfmr4913742pga.240.1657316817296; Fri, 08 Jul 2022 14:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657316817; cv=none; d=google.com; s=arc-20160816; b=hGq7QjMkwWkNc4mqNXgmIwGmsDwjPyttA2Tjs8JzUlkrXpvVBDw3VbIy/PITXZ6HJr EXHj/1iucvAJWMRLHdi4Mxyb1Wyn1TWUzW4amHFaTEbC4g9hUMFzEtW6L7AN4jvZMQYt B72g8YO6hvsp8ZFvPiXukS10yS7yjr3jOiXNaEo/Z5wZD7n/QWvHfpBTmF17S0sGugXN AT4yQh4uUPIvoCyMJ+apDXq8VeIVFVHVt2d1rIWKhWBzWsZf4EOUeD0iRGYBJllgp181 S12pFV6aIzC1Zh1+I3jl5zAv1ucf5FeVjzmVRsTjs+pgKYf0Kp66u3HKv7t5RONWl/iz ce0A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=yAkOf8eLyH7huiXyfQoVZ6jtTcD9Dkq0jKvxnafeMGw=; b=jOHP2+bAlYI1TH7BAag9vIZMvBtaZZ/MocQET18/sZEuAaSeQZvRs6dtMZjiz8f6r1 ddGo9Q6ZGUfmwWgj3KG8eYNH6P9MczCpVPPNEMgfrkSqNo6MdWy9O3F4AzremWq7+gOV 2Jfi0svXtIEFAkUWq0CnaYL0N9FK/NKOD3dwEvMva1j27lEyDAAzhtQmjgGZL3My8bPx Ag/zfZbAd11c/YYBkKy58w/u+YuT6BLiH59Gg1PIhusCWDvzCcQeeNw77X5zyVqCiMT3 EsDKTcCAjjUqkK/BqAjtaXWDCG7q/9TCGeRDdSQRRe1TtadRFMoTqJFq2eYyS40qcX9e aT6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="HNBz9i/a"; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a655582000000b0040d464c972bsi5902043pgs.329.2022.07.08.14.46.37; Fri, 08 Jul 2022 14:46:57 -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=@intel.com header.s=Intel header.b="HNBz9i/a"; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240355AbiGHVI5 (ORCPT + 99 others); Fri, 8 Jul 2022 17:08:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240214AbiGHVI4 (ORCPT ); Fri, 8 Jul 2022 17:08:56 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F2807B367 for ; Fri, 8 Jul 2022 14:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657314535; x=1688850535; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=gFLK1shtx1D6SxBo2Bo4N8I275mKD06V5N6e5VArP+Q=; b=HNBz9i/a9pHDUsyGr90Od5bV5bvksbxFCnhIcJZQ5Lc2kSsvMGzBEJUV DVzWay9GSncxXunKnJMm+pLEbSkt7WP0q9UJQXgUnZgjqqgwqoS/S4aip O+jz+s8bpJFrV9qaPtbRblL3YuZIjZnGDK+SgrUveuHvts3L8YtuywjI3 yWr7JcSbRQKTpDE6P5KJ1IbpHB4C0Mx8pclBbVuxy6vvrDBfmKoFXuNb7 FecGIWl8O7vdbLaFZVvwnqDnWME9eV2JLSx1jSGaTJVb2YxDgpcqE6h9e /kMnj4IZtGi2Io+dr++TmZc/dwf1kjb3ncs7CQiD9Dts/noK7OZDYdyrT w==; X-IronPort-AV: E=McAfee;i="6400,9594,10402"; a="370678950" X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="370678950" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2022 14:08:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="626831689" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 08 Jul 2022 14:08:53 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 90784CE; Sat, 9 Jul 2022 00:09:00 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Cc: john.garry@huawei.com Subject: [PATCH v2 1/4] bus: hisi_lpc: Don't dereference fwnode handle Date: Sat, 9 Jul 2022 00:08:56 +0300 Message-Id: <20220708210859.6774-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 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 Acked-by: John Garry Reviewed-by: Rafael J. Wysocki --- v2: added tags (John, Rafael), tweaked commit message (John) 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.1