From patchwork Wed Oct 5 15:29:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 613515 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26D08C433F5 for ; Wed, 5 Oct 2022 15:29:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230479AbiJEP3j (ORCPT ); Wed, 5 Oct 2022 11:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230390AbiJEP3i (ORCPT ); Wed, 5 Oct 2022 11:29:38 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37AD8EA8; Wed, 5 Oct 2022 08:29:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664983777; x=1696519777; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kjLtd57mMK+EVcgFbt6pO20kW/y/VllWb3uvAku8dxQ=; b=dVzJjI+HdGFrrUFJkfa5BjPLeQNxV79ns2uhILfjPuNCSu3BosYWkWTv Zf8uiJmwxf8DE5dEa6U55LiRIECkGWreMgxCtRJt9eaOHurdNX+MVQYGL CIZU3A+A2wIzG2KifPmdccnk8TGC44J8rygzGl5uK4jgJyEDf+NRQl87l g4BGvWaGBt1ixVu02QsuaHniDhRAmNpqjlxf2jzodc5lbQAiueNY/C5Hl 5CbyheWjxPAIu9l6XxfBDPHfE33db3yUjZ5qqHWbuGKMDtXy8Hxs4+VrM 69wix7In/GNff/WBE0nNXYhi5DdQ+tn6P1QdF4LOS2ZjJwDCfQz22OU9S w==; X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="290432489" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="290432489" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 08:29:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="626609384" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="626609384" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 05 Oct 2022 08:29:31 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0E7E97C; Wed, 5 Oct 2022 18:29:51 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Qiang Zhao , Li Yang , Daniel Scally , Heikki Krogerus , Sakari Ailus Subject: [PATCH v2 1/2] device property: Introduce fwnode_device_is_compatible() helper Date: Wed, 5 Oct 2022 18:29:46 +0300 Message-Id: <20221005152947.71696-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221005152947.71696-1-andriy.shevchenko@linux.intel.com> References: <20221005152947.71696-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The fwnode_device_is_compatible() helper searches for the given string in the "compatible" string array property and, if found, returns true. Signed-off-by: Andy Shevchenko --- include/linux/property.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/linux/property.h b/include/linux/property.h index 1c26d263d5e4..701570423943 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -55,7 +55,6 @@ int device_property_read_string(struct device *dev, const char *propname, int device_property_match_string(struct device *dev, const char *propname, const char *string); -bool fwnode_device_is_available(const struct fwnode_handle *fwnode); bool fwnode_property_present(const struct fwnode_handle *fwnode, const char *propname); int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode, @@ -77,6 +76,15 @@ int fwnode_property_read_string(const struct fwnode_handle *fwnode, const char *propname, const char **val); int fwnode_property_match_string(const struct fwnode_handle *fwnode, const char *propname, const char *string); + +bool fwnode_device_is_available(const struct fwnode_handle *fwnode); + +static inline +bool fwnode_device_is_compatible(const struct fwnode_handle *fwnode, const char *compat) +{ + return fwnode_property_match_string(fwnode, "compatible", compat) >= 0; +} + int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, const char *prop, const char *nargs_prop, unsigned int nargs, unsigned int index, From patchwork Wed Oct 5 15:29:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 613516 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48FF1C433F5 for ; Wed, 5 Oct 2022 15:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230236AbiJEP3i (ORCPT ); Wed, 5 Oct 2022 11:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230002AbiJEP3g (ORCPT ); Wed, 5 Oct 2022 11:29:36 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC85E2FE; Wed, 5 Oct 2022 08:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664983774; x=1696519774; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uI6x+OuIX8Zsde+No42SImigImxqe3gZvNiHUYWU+j8=; b=jTK/k6wlJqtsbUHZYSkT7DkMQkEYRgAvGNDZRcPd491CCu+zgGsz2Tn4 eidNqusb4oVg05y6Bx/kvlO8Fs8YhyO4DLhoKL5d69D00x2ZTp2CM28Oe JPXPBOfHDMG8eKy+KexhMr/EHb0vHKL4JeuRAVlg7CV+6VnRgzn7lKnOY Un4gAxV6Do5XgDa7JtVtze4pY/Bu/DY+dXKNb9JsYn0jYI9QH7tBi/5Yk UxQL/rW1JkCB/zA9AT7av0sZv+QP1pqInI/tdyJmKG87d6nPQk8XkZ4lV H/d3O1l5Y0+Qw/ZDkcr1bEPPPyXHMs3eljzzt0lQEXe/LgafUbRJevNaR A==; X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="290432486" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="290432486" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 08:29:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="626609383" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="626609383" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 05 Oct 2022 08:29:31 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 15725199; Wed, 5 Oct 2022 18:29:51 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Qiang Zhao , Li Yang , Daniel Scally , Heikki Krogerus , Sakari Ailus Subject: [PATCH v2 2/2] soc: fsl: qe: Switch to use fwnode instead of of_node Date: Wed, 5 Oct 2022 18:29:47 +0300 Message-Id: <20221005152947.71696-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221005152947.71696-1-andriy.shevchenko@linux.intel.com> References: <20221005152947.71696-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The OF node in the GPIO library is deprecated and soon will be removed. GPIO library now accepts fwnode as a firmware node, so switch the driver to use it. Signed-off-by: Andy Shevchenko --- drivers/soc/fsl/qe/gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/fsl/qe/gpio.c b/drivers/soc/fsl/qe/gpio.c index 99f7de43c3c6..9abb45ab138b 100644 --- a/drivers/soc/fsl/qe/gpio.c +++ b/drivers/soc/fsl/qe/gpio.c @@ -19,6 +19,8 @@ #include #include #include +#include + #include struct qe_gpio_chip { @@ -179,7 +181,7 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index) goto err0; } - if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) { + if (!fwnode_device_is_compatible(gc->fwnode, "fsl,mpc8323-qe-pario-bank")) { pr_debug("%s: tried to get a non-qe pin\n", __func__); err = -EINVAL; goto err0;