Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6198468rwl; Wed, 22 Mar 2023 07:42:35 -0700 (PDT) X-Google-Smtp-Source: AK7set8HSq+QXQ1SgZ2QVTGX/uQZxsQEh4fAKIk1YyMafpC9WATdJvXJKXaYSsBB1JqFTfze1hE8 X-Received: by 2002:a05:6402:48e:b0:4fa:4bc4:a911 with SMTP id k14-20020a056402048e00b004fa4bc4a911mr7504943edv.13.1679496154911; Wed, 22 Mar 2023 07:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679496154; cv=none; d=google.com; s=arc-20160816; b=PfbzTWW1TsWXxgE4ycK8lb5wVLcnQeDFva9uAKgES6clm6n9DXZIZRJf0/O3k15KSM CRaP1Xsc4xUU1Ev7xthLcYNm9xeRGCTCQCGwqhThM08jOF7PuNzPW4VUA3TyYVP72FyS P1knMBCU82im52qYlKOh0BRh4DjDhAUZmH1eR4M12bxDJ6DOswyeN97tPCtv0+YIgxGg S2E8iinrL9rQeTDOuF9jQEetDApTUgUvWoU06Edgm7W9CkUaZDCYFD+2eVFuwnoCg9sl Tr+Tc3SF7GbyQB8RoKcSdExx3OzaY7RcMoXgELv4O+Ti4fwS4bqE338TZg+0ojpdg6GC ewAg== 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:cc:to:from :dkim-signature; bh=rxr4jDj5cYahu2Zgxpqj1s0vLFN49sU0zzxRIJpT5w8=; b=tvm1Jy0bHKyGoFb1oLzjjZ1OhQ8rxW+GZ1YdUjhwdU+hqRjYUBi9Sg7eOcdE+ZzQGD UfuagyX1WtRT4kFAxlFfhndanywgmbxqDdVOWuaxPArRrQ9GT+R+WzeBTlUXQ8ojJfEh JBQ/Y8dPh0dAROuy2K+mDNWDVVWqz1XKdfErDlmpEXp+UO2GXxTBbuHxQ0f17/+Zjzx3 bkXDXKMvp80uP8po2Uqc/LfwiFp5P5qVChSpH0EPJKx88PIoPb6RFjlg+ptF3AFadMSL fUQmcisBmM3Mce9ZR1C+C4pgWO6LeMOcA3qqbcL9emwp3KuB1nQi+JePCVGVBoO6lAO3 44Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BtBtGPs4; 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 y12-20020aa7c24c000000b004eaaf1dc512si15362240edo.466.2023.03.22.07.42.08; Wed, 22 Mar 2023 07:42:34 -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=BtBtGPs4; 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 S231735AbjCVOjw (ORCPT + 99 others); Wed, 22 Mar 2023 10:39:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231523AbjCVOj0 (ORCPT ); Wed, 22 Mar 2023 10:39:26 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F00EC51CAD for ; Wed, 22 Mar 2023 07:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679495965; x=1711031965; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CBCCxTTZs2kCb/p6GUvHy/Ipc4yohpZu5RckL85FL+w=; b=BtBtGPs4sd8XAJa1/i4OUiCKPcb50n+ES0wsgzxtZ4rHVIbVvrEy/fFQ gLNfqal8bP0yjt6fBPlykacRnTtwDkVNjzhVLYWAkYhHRGB3xQQUVzsDJ hrt1UMohuWHwX2VONKn6QgmQjwrh23aJn0A/NFaN7CK0+/BA2u0IQBLHn 7sH0gS8GetdN04b7MtQmeYkDVjBx/wkst3Y/qD+nE7FrySS1iNmheoIgg YKZ0ne1L+LVgzE/Wa9mLd/uaMRNQj73HYyQsVUfyDLhZEKUiDILnYkj6p 5TQh13Awd8FnyzxzcfAQ4I0RdFWDx5GxkxQyaRhm9puFfmhG/z0AGLpoY g==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327609306" X-IronPort-AV: E=Sophos;i="5.98,282,1673942400"; d="scan'208";a="327609306" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 07:39:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="792579435" X-IronPort-AV: E=Sophos;i="5.98,282,1673942400"; d="scan'208";a="792579435" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 22 Mar 2023 07:39:23 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E3BC480A; Wed, 22 Mar 2023 16:40:06 +0200 (EET) From: Andy Shevchenko To: Bumwoo Lee , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: MyungJoo Ham , Chanwoo Choi Subject: [PATCH v1 10/14] extcon: use dev_of_node(dev) instead of dev->of_node Date: Wed, 22 Mar 2023 16:40:01 +0200 Message-Id: <20230322144005.40368-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230322144005.40368-1-andriy.shevchenko@linux.intel.com> References: <20230322144005.40368-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=unavailable 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 The dev_of_node function should be preferred. In the result we may drop unneeded NULL check of the pointer to the device object. Signed-off-by: Andy Shevchenko --- drivers/extcon/extcon.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 5cadbfc151e6..32e96cb49067 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -1429,21 +1429,17 @@ struct extcon_dev *extcon_find_edev_by_node(struct device_node *node) */ struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) { - struct device_node *node; + struct device_node *node, *np = dev_of_node(dev); struct extcon_dev *edev; - if (!dev) - return ERR_PTR(-EINVAL); - - if (!dev->of_node) { + if (!np) { dev_dbg(dev, "device does not have a device node entry\n"); return ERR_PTR(-EINVAL); } - node = of_parse_phandle(dev->of_node, "extcon", index); + node = of_parse_phandle(np, "extcon", index); if (!node) { - dev_dbg(dev, "failed to get phandle in %pOF node\n", - dev->of_node); + dev_dbg(dev, "failed to get phandle in %pOF node\n", np); return ERR_PTR(-ENODEV); } -- 2.40.0.1.gaa8946217a0b