From patchwork Thu Jul 11 18:04:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zeng Tao X-Patchwork-Id: 168836 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp11170828ilk; Thu, 11 Jul 2019 03:05:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzquR8TKgs06ozv3P+2UIGBzRO4TNcoN+SlkD7UJqvdlfiD0cm0Fshq7KodE2ZCAlLLaMx X-Received: by 2002:a17:902:2f:: with SMTP id 44mr3764043pla.5.1562839524113; Thu, 11 Jul 2019 03:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562839524; cv=none; d=google.com; s=arc-20160816; b=bUaHWTjRd6uSNdKcVc7VGoRn2gXWgedEhesNzrTCE3qj/6d6J+JQXG1XFxuNP9Kk6x DyeF7bCzQqZyxQ7yBYBfqNrBXGyWRqze3ALkCA88LudGdjzzJ6bsNE6W3VqPecISevBi fAsE/gEp4wimisnhRGQDKCheouqGmfGQHu9B1ZTXEWJfk5FJktehL5esFr0KZg+vltiC ZTtwh47JoYbqfD4/Gw57fQHfy3tHOcO1fZcTUtvWyD5/jpa1LuMMtC/GjK6lGjDHNbSz kHJC1bS4gPVMM6EAWruUefuTvTVvqc7nxWPp59DYQruceZqrDq/LnvUm/5hYoex+vNyX c6Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=9lNv0OINLgSpd7vA+Cu/FFMcUEHdLOR7KSc6EVIBDAQ=; b=pCn58tTKZGK+ln+sGBGUCv59Hn/aURGOYf5EGd1A2nZnYyvGuFRJtjmEamE4pg3oeH GrfQpaxh00PTQYrSQ4P9ZF068c+LnTNmfXFwS0ga4oeE0Qm4vRP3GHn2NFpHh7vUKU6+ 4cbdn42Ojq8c7Rh3OSYUZMO66oqsiecz49OQb4ig2+wiFzMGjXluQNn/6TgKEFYFqqGR UtznHrlQrPVGKkmB5kcRi5A0aY7dhVjhfYq/4fKJCQJaGIcRGdjfFm6NmiOD4flav4Ts ZLkK3ZUD+lGGLmtLT7qi6n2f1c6JhkCJU6GkgYu4aUHdUluGHFCq1MzpapTByjaq5MAO SCHQ== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r71si4884919pfc.152.2019.07.11.03.05.23; Thu, 11 Jul 2019 03:05:24 -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 S1728399AbfGKKFV (ORCPT + 29 others); Thu, 11 Jul 2019 06:05:21 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2202 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727881AbfGKKFT (ORCPT ); Thu, 11 Jul 2019 06:05:19 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1FC3EE21183BD9091EEB; Thu, 11 Jul 2019 18:05:13 +0800 (CST) Received: from dessert.huawei.com (10.69.192.158) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Thu, 11 Jul 2019 18:05:05 +0800 From: Zeng Tao To: , CC: Maxime Ripard , Chen-Yu Tsai , Paul Kocialkowski , Sakari Ailus , , Subject: [PATCH] phy: Change the configuration interface param to void* to make it more general Date: Fri, 12 Jul 2019 02:04:08 +0800 Message-ID: <1562868255-31467-1-git-send-email-prime.zeng@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.69.192.158] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The phy framework now allows runtime configurations, but only limited to mipi now, and it's not reasonable to introduce user specified configurations into the union phy_configure_opts structure. An simple way is to replace with a void *. We have already got some phy drivers which introduce private phy API for runtime configurations, and with this patch, they can switch to the phy_configure as a replace. Signed-off-by: Zeng Tao --- drivers/phy/allwinner/phy-sun6i-mipi-dphy.c | 4 ++-- drivers/phy/cadence/cdns-dphy.c | 8 ++++---- drivers/phy/phy-core.c | 4 ++-- include/linux/phy/phy.h | 24 ++++++------------------ 4 files changed, 14 insertions(+), 26 deletions(-) -- 2.7.4 diff --git a/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c b/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c index 79c8af5..6a60473 100644 --- a/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c +++ b/drivers/phy/allwinner/phy-sun6i-mipi-dphy.c @@ -105,12 +105,12 @@ static int sun6i_dphy_init(struct phy *phy) return 0; } -static int sun6i_dphy_configure(struct phy *phy, union phy_configure_opts *opts) +static int sun6i_dphy_configure(struct phy *phy, void *opts) { struct sun6i_dphy *dphy = phy_get_drvdata(phy); int ret; - ret = phy_mipi_dphy_config_validate(&opts->mipi_dphy); + ret = phy_mipi_dphy_config_validate(opts); if (ret) return ret; diff --git a/drivers/phy/cadence/cdns-dphy.c b/drivers/phy/cadence/cdns-dphy.c index 90c4e9b..0ec5013 100644 --- a/drivers/phy/cadence/cdns-dphy.c +++ b/drivers/phy/cadence/cdns-dphy.c @@ -233,23 +233,23 @@ static int cdns_dphy_config_from_opts(struct phy *phy, } static int cdns_dphy_validate(struct phy *phy, enum phy_mode mode, int submode, - union phy_configure_opts *opts) + void *opts) { struct cdns_dphy_cfg cfg = { 0 }; if (mode != PHY_MODE_MIPI_DPHY) return -EINVAL; - return cdns_dphy_config_from_opts(phy, &opts->mipi_dphy, &cfg); + return cdns_dphy_config_from_opts(phy, opts, &cfg); } -static int cdns_dphy_configure(struct phy *phy, union phy_configure_opts *opts) +static int cdns_dphy_configure(struct phy *phy, void *opts) { struct cdns_dphy *dphy = phy_get_drvdata(phy); struct cdns_dphy_cfg cfg = { 0 }; int ret; - ret = cdns_dphy_config_from_opts(phy, &opts->mipi_dphy, &cfg); + ret = cdns_dphy_config_from_opts(phy, opts, &cfg); if (ret) return ret; diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index e3880c4a1..048d4d6 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -420,7 +420,7 @@ EXPORT_SYMBOL_GPL(phy_calibrate); * * Returns: 0 if successful, an negative error code otherwise */ -int phy_configure(struct phy *phy, union phy_configure_opts *opts) +int phy_configure(struct phy *phy, void *opts) { int ret; @@ -455,7 +455,7 @@ EXPORT_SYMBOL_GPL(phy_configure); * Returns: 0 if successful, an negative error code otherwise */ int phy_validate(struct phy *phy, enum phy_mode mode, int submode, - union phy_configure_opts *opts) + void *opts) { int ret; diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 15032f14..8948f94 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -16,8 +16,6 @@ #include #include -#include - struct phy; enum phy_mode { @@ -41,15 +39,6 @@ enum phy_mode { PHY_MODE_SATA }; -/** - * union phy_configure_opts - Opaque generic phy configuration - * - * @mipi_dphy: Configuration set applicable for phys supporting - * the MIPI_DPHY phy mode. - */ -union phy_configure_opts { - struct phy_configure_opts_mipi_dphy mipi_dphy; -}; /** * struct phy_ops - set of function pointers for performing phy operations @@ -80,7 +69,7 @@ struct phy_ops { * * Returns: 0 if successful, an negative error code otherwise */ - int (*configure)(struct phy *phy, union phy_configure_opts *opts); + int (*configure)(struct phy *phy, void *opts); /** * @validate: @@ -99,7 +88,7 @@ struct phy_ops { * error code otherwise */ int (*validate)(struct phy *phy, enum phy_mode mode, int submode, - union phy_configure_opts *opts); + void *opts); int (*reset)(struct phy *phy); int (*calibrate)(struct phy *phy); void (*release)(struct phy *phy); @@ -207,9 +196,9 @@ int phy_power_off(struct phy *phy); int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode); #define phy_set_mode(phy, mode) \ phy_set_mode_ext(phy, mode, 0) -int phy_configure(struct phy *phy, union phy_configure_opts *opts); +int phy_configure(struct phy *phy, void *opts); int phy_validate(struct phy *phy, enum phy_mode mode, int submode, - union phy_configure_opts *opts); + void *opts); static inline enum phy_mode phy_get_mode(struct phy *phy) { @@ -354,8 +343,7 @@ static inline int phy_calibrate(struct phy *phy) return -ENOSYS; } -static inline int phy_configure(struct phy *phy, - union phy_configure_opts *opts) +static inline int phy_configure(struct phy *phy, void *opts) { if (!phy) return 0; @@ -364,7 +352,7 @@ static inline int phy_configure(struct phy *phy, } static inline int phy_validate(struct phy *phy, enum phy_mode mode, int submode, - union phy_configure_opts *opts) + void *opts) { if (!phy) return 0;