From patchwork Wed Apr 27 09:54:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102435 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2088026qge; Wed, 27 Apr 2016 02:55:20 -0700 (PDT) X-Received: by 10.67.1.3 with SMTP id bc3mr7985571pad.138.1461750920315; Wed, 27 Apr 2016 02:55:20 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x11si4585141par.178.2016.04.27.02.55.20; Wed, 27 Apr 2016 02:55:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752651AbcD0JzR (ORCPT + 29 others); Wed, 27 Apr 2016 05:55:17 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:62829 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751988AbcD0JzM (ORCPT ); Wed, 27 Apr 2016 05:55:12 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue101) with ESMTPA (Nemesis) id 0MeBaA-1bLHQH3Kfu-00PvTL; Wed, 27 Apr 2016 11:55:03 +0200 From: Arnd Bergmann To: Kishon Vijay Abraham I Cc: Arnd Bergmann , Thierry Reding , linux-kernel@vger.kernel.org Subject: [PATCH] phy: leave out DT based interfaces without CONFIG_OF Date: Wed, 27 Apr 2016 11:54:43 +0200 Message-Id: <1461750901-2704136-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:I/m4pGXe4Ltq4nzhihjNKwKsGUBCXaHTt9J9e4rX1ZrroxKghSB 09mcSB7WWfVqD4l8f7NZpSDYlfVsBO1pNqENPXXGDgVSFQXQwV7KxfLln4T83Q3NPYxNJ/I 7mxWmIJ7DXSaif0LJhysCb/9hlL/fhwHxNfbpIhSDCrXYWJ6lfND4abPNrpJeFNXBVJ33EC MOUbilUl/asBD5MAMcaLg== X-UI-Out-Filterresults: notjunk:1; V01:K0:eWUNYUSRSW8=:ERoeLD6KMRl9PnM3kGvXyB Zho9GRw1nNaMSoG7enHPr+kCd0a3tONV0tvvMnyirYFGmPMIHcB9xiuWJqtmYV8bkO+Tc4VSp ulXmJCSkr2p/qCktwUC/YKDwn1uAegfzRWQEQXYXMex9NmK5knYLcxryA9wX7H62fp8gwtgxU NcssJWaYVNFOkUyb68nPOQO4U2I4ChKnoqMQJQUEnCFtFKoTWLpg9LoogNF//vgpE3ssWE0yU fg3lqkywK+DnVGTEDT9T+hDFxKNwl2i6/GbDEhLbQyy6rTOCKfwerkP28HH6hh/elpFZgRaFl Phi/QhjvqsEdDwTKUmJmI58C30oMeujpVTIzq1Svna0lLoS7btPIAcT3HNiujT/4J+UK8WVKq 9wv/EMo1/OdIzdwqJfulMv+fbswjKCvh+3f7lYmGCl0nwqCHxOCU+ftq9KjUQy9gkVQ8x6aNH 0/INIB/5RDf0ZxMfJ3DdbRNMiQKKB0BuPxcbtEGId9/jlPtp0BDSd+YYFi86jvOmntfmSEx3J Du8whAYL8DWqZEkxkR0vnKRP0BNcFyk5TsaeYCriGt+tJASp/nC8V5v/faDwxlwElfI2T3Loq 3XOUsoCpuskbahMNb9QFgc2uONqwzNKypYPRZk1LEqVtVBHGQD1yyq2Ks67ytJKVp0+SmFmkX X+1nF+5dBSKMIaqPA/CXAdPGQGah14U87KTNil21DnRjy4WYfISAkKLA9NpauKYJ3PQA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After a recent change in the PHY core, we get a build error when CONFIG_OF is disabled: drivers/phy/phy-core.c: In function '__of_phy_provider_register': drivers/phy/phy-core.c:848:13: error: implicit declaration of function 'of_get_next_parent' [-Werror=implicit-function-declaration] It would not be hard to avoid this error by adding a declaration for of_get_next_parent, but I'm taking a different approach here and remove all the unused DT handling from the PHY core in configurations with CONFIG_OF, which avoids the build error and reduces the object code size. Signed-off-by: Arnd Bergmann Fixes: 2f7600bc981c ("phy: core: Allow children node to be overridden") --- drivers/phy/phy-core.c | 20 ++++++++-- include/linux/phy/phy.h | 101 +++++++++++++++++++++++++----------------------- 2 files changed, 69 insertions(+), 52 deletions(-) -- 2.7.0 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 4e905a4313c0..bb03fcc65497 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -36,12 +36,14 @@ static void devm_phy_release(struct device *dev, void *res) phy_put(phy); } +#ifdef CONFIG_OF static void devm_phy_provider_release(struct device *dev, void *res) { struct phy_provider *phy_provider = *(struct phy_provider **)res; of_phy_provider_unregister(phy_provider); } +#endif static void devm_phy_consume(struct device *dev, void *res) { @@ -132,6 +134,7 @@ static struct phy *phy_find(struct device *dev, const char *con_id) return pl ? pl->phy : ERR_PTR(-ENODEV); } +#ifdef CONFIG_OF static struct phy_provider *of_phy_provider_lookup(struct device_node *node) { struct phy_provider *phy_provider; @@ -148,6 +151,7 @@ static struct phy_provider *of_phy_provider_lookup(struct device_node *node) return ERR_PTR(-EPROBE_DEFER); } +#endif int phy_pm_runtime_get(struct phy *phy) { @@ -342,6 +346,7 @@ int phy_power_off(struct phy *phy) } EXPORT_SYMBOL_GPL(phy_power_off); +#ifdef CONFIG_OF /** * _of_phy_get() - lookup and obtain a reference to a phy by phandle * @np: device_node for which to get the phy @@ -419,6 +424,7 @@ struct phy *of_phy_get(struct device_node *np, const char *con_id) return phy; } EXPORT_SYMBOL_GPL(of_phy_get); +#endif /** * phy_put() - release the PHY @@ -456,6 +462,7 @@ void devm_phy_put(struct device *dev, struct phy *phy) } EXPORT_SYMBOL_GPL(devm_phy_put); +#ifdef CONFIG_OF /** * of_phy_simple_xlate() - returns the phy instance from phy provider * @dev: the PHY provider device @@ -486,6 +493,7 @@ struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args return ERR_PTR(-ENODEV); } EXPORT_SYMBOL_GPL(of_phy_simple_xlate); +#endif /** * phy_get() - lookup and obtain a reference to a phy. @@ -499,21 +507,21 @@ EXPORT_SYMBOL_GPL(of_phy_simple_xlate); */ struct phy *phy_get(struct device *dev, const char *string) { - int index = 0; struct phy *phy; if (string == NULL) { dev_WARN(dev, "missing string\n"); return ERR_PTR(-EINVAL); } - +#ifdef CONFIG_OF if (dev->of_node) { + int index; index = of_property_match_string(dev->of_node, "phy-names", string); phy = _of_phy_get(dev->of_node, index); - } else { + } else +#endif phy = phy_find(dev, string); - } if (IS_ERR(phy)) return phy; @@ -601,6 +609,7 @@ struct phy *devm_phy_optional_get(struct device *dev, const char *string) } EXPORT_SYMBOL_GPL(devm_phy_optional_get); +#ifdef CONFIG_OF /** * devm_of_phy_get() - lookup and obtain a reference to a phy. * @dev: device that requests this phy @@ -672,6 +681,7 @@ struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, return phy; } EXPORT_SYMBOL_GPL(devm_of_phy_get_by_index); +#endif /** * phy_create() - create a new phy @@ -808,6 +818,7 @@ void devm_phy_destroy(struct device *dev, struct phy *phy) } EXPORT_SYMBOL_GPL(devm_phy_destroy); +#ifdef CONFIG_OF /** * __of_phy_provider_register() - create/register phy provider with the framework * @dev: struct device of the phy provider @@ -945,6 +956,7 @@ void devm_of_phy_provider_unregister(struct device *dev, dev_WARN_ONCE(dev, r, "couldn't find PHY provider device resource\n"); } EXPORT_SYMBOL_GPL(devm_of_phy_provider_unregister); +#endif /** * phy_release() - release the phy diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index a810f2a18842..184a61167ff6 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -138,32 +138,14 @@ struct phy *phy_get(struct device *dev, const char *string); struct phy *phy_optional_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); struct phy *devm_phy_optional_get(struct device *dev, const char *string); -struct phy *devm_of_phy_get(struct device *dev, struct device_node *np, - const char *con_id); -struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, - int index); void phy_put(struct phy *phy); void devm_phy_put(struct device *dev, struct phy *phy); -struct phy *of_phy_get(struct device_node *np, const char *con_id); -struct phy *of_phy_simple_xlate(struct device *dev, - struct of_phandle_args *args); struct phy *phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops); struct phy *devm_phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops); void phy_destroy(struct phy *phy); void devm_phy_destroy(struct device *dev, struct phy *phy); -struct phy_provider *__of_phy_provider_register(struct device *dev, - struct device_node *children, struct module *owner, - struct phy * (*of_xlate)(struct device *dev, - struct of_phandle_args *args)); -struct phy_provider *__devm_of_phy_provider_register(struct device *dev, - struct device_node *children, struct module *owner, - struct phy * (*of_xlate)(struct device *dev, - struct of_phandle_args *args)); -void of_phy_provider_unregister(struct phy_provider *phy_provider); -void devm_of_phy_provider_unregister(struct device *dev, - struct phy_provider *phy_provider); int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id); void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id); #else @@ -265,20 +247,6 @@ static inline struct phy *devm_phy_optional_get(struct device *dev, return ERR_PTR(-ENOSYS); } -static inline struct phy *devm_of_phy_get(struct device *dev, - struct device_node *np, - const char *con_id) -{ - return ERR_PTR(-ENOSYS); -} - -static inline struct phy *devm_of_phy_get_by_index(struct device *dev, - struct device_node *np, - int index) -{ - return ERR_PTR(-ENOSYS); -} - static inline void phy_put(struct phy *phy) { } @@ -287,17 +255,6 @@ static inline void devm_phy_put(struct device *dev, struct phy *phy) { } -static inline struct phy *of_phy_get(struct device_node *np, const char *con_id) -{ - return ERR_PTR(-ENOSYS); -} - -static inline struct phy *of_phy_simple_xlate(struct device *dev, - struct of_phandle_args *args) -{ - return ERR_PTR(-ENOSYS); -} - static inline struct phy *phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops) @@ -320,6 +277,35 @@ static inline void devm_phy_destroy(struct device *dev, struct phy *phy) { } +static inline int +phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id) +{ + return 0; +} +static inline void phy_remove_lookup(struct phy *phy, const char *con_id, + const char *dev_id) { } +#endif + +#if defined(CONFIG_GENERIC_PHY) && defined(CONFIG_OF) +struct phy_provider *__of_phy_provider_register(struct device *dev, + struct device_node *children, struct module *owner, + struct phy * (*of_xlate)(struct device *dev, + struct of_phandle_args *args)); +struct phy_provider *__devm_of_phy_provider_register(struct device *dev, + struct device_node *children, struct module *owner, + struct phy * (*of_xlate)(struct device *dev, + struct of_phandle_args *args)); +void of_phy_provider_unregister(struct phy_provider *phy_provider); +void devm_of_phy_provider_unregister(struct device *dev, + struct phy_provider *phy_provider); +struct phy *devm_of_phy_get(struct device *dev, struct device_node *np, + const char *con_id); +struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, + int index); +struct phy *of_phy_get(struct device_node *np, const char *con_id); +struct phy *of_phy_simple_xlate(struct device *dev, + struct of_phandle_args *args); +#else static inline struct phy_provider *__of_phy_provider_register( struct device *dev, struct device_node *children, struct module *owner, struct phy * (*of_xlate)(struct device *dev, @@ -344,13 +330,32 @@ static inline void devm_of_phy_provider_unregister(struct device *dev, struct phy_provider *phy_provider) { } -static inline int -phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id) + +static inline struct phy *devm_of_phy_get(struct device *dev, + struct device_node *np, + const char *con_id) { - return 0; + return ERR_PTR(-ENOSYS); } -static inline void phy_remove_lookup(struct phy *phy, const char *con_id, - const char *dev_id) { } + +static inline struct phy *devm_of_phy_get_by_index(struct device *dev, + struct device_node *np, + int index) +{ + return ERR_PTR(-ENOSYS); +} + +static inline struct phy *of_phy_get(struct device_node *np, const char *con_id) +{ + return ERR_PTR(-ENOSYS); +} + +static inline struct phy *of_phy_simple_xlate(struct device *dev, + struct of_phandle_args *args) +{ + return ERR_PTR(-ENOSYS); +} + #endif #endif /* __DRIVERS_PHY_H */