linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index
@ 2019-10-14 17:40 Dmitry Torokhov
  2019-10-14 17:40 ` [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2019-10-14 17:40 UTC (permalink / raw)
  To: Linus Walleij
  Cc: netdev, David S . Miller, linux-kernel, Andrew Lunn,
	Florian Fainelli, Heiner Kallweit, Russell King

This series switches phy drivers form using fwnode_get_named_gpiod() and
gpiod_get_from_of_node() that are scheduled to be removed in favor
of fwnode_gpiod_get_index() that behaves more like standard
gpiod_get_index() and will potentially handle secondary software
nodes in cases we need to augment platform firmware.

Linus, as David would prefer not to pull in the immutable branch but
rather route the patches through the tree that has the new API, could
you please take them with his ACKs?

Thanks!

v2:
        - rebased on top of Linus' W devel branch
        - added David's ACKs

Dmitry Torokhov (3):
  net: phylink: switch to using fwnode_gpiod_get_index()
  net: phy: fixed_phy: fix use-after-free when checking link GPIO
  net: phy: fixed_phy: switch to using fwnode_gpiod_get_index

 drivers/net/phy/fixed_phy.c | 11 ++++-------
 drivers/net/phy/phylink.c   |  4 ++--
 2 files changed, 6 insertions(+), 9 deletions(-)

-- 
2.23.0.700.g56cf767bdb-goog


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-10-14 17:40 [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index Dmitry Torokhov
@ 2019-10-14 17:40 ` Dmitry Torokhov
  2019-10-14 17:55   ` Russell King - ARM Linux admin
                     ` (2 more replies)
  2019-10-14 17:40 ` [PATCH v2 2/3] net: phy: fixed_phy: fix use-after-free when checking link GPIO Dmitry Torokhov
                   ` (3 subsequent siblings)
  4 siblings, 3 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2019-10-14 17:40 UTC (permalink / raw)
  To: Linus Walleij
  Cc: netdev, David S . Miller, linux-kernel, Andy Shevchenko,
	Andrew Lunn, Florian Fainelli, Heiner Kallweit, Russell King

Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), but
works with arbitrary firmware node.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

 drivers/net/phy/phylink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index a5a57ca94c1a..c34ca644d47e 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -168,8 +168,8 @@ static int phylink_parse_fixedlink(struct phylink *pl,
 			pl->link_config.pause |= MLO_PAUSE_ASYM;
 
 		if (ret == 0) {
-			desc = fwnode_get_named_gpiod(fixed_node, "link-gpios",
-						      0, GPIOD_IN, "?");
+			desc = fwnode_gpiod_get_index(fixed_node, "link", 0,
+						      GPIOD_IN, "?");
 
 			if (!IS_ERR(desc))
 				pl->link_gpio = desc;
-- 
2.23.0.700.g56cf767bdb-goog


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/3] net: phy: fixed_phy: fix use-after-free when checking link GPIO
  2019-10-14 17:40 [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index Dmitry Torokhov
  2019-10-14 17:40 ` [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
@ 2019-10-14 17:40 ` Dmitry Torokhov
  2019-10-15 12:54   ` Andrew Lunn
  2019-10-14 17:40 ` [PATCH v2 3/3] net: phy: fixed_phy: switch to using fwnode_gpiod_get_index Dmitry Torokhov
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Dmitry Torokhov @ 2019-10-14 17:40 UTC (permalink / raw)
  To: Linus Walleij
  Cc: netdev, David S . Miller, linux-kernel, Andrew Lunn,
	Florian Fainelli, Heiner Kallweit

If we fail to locate GPIO for any reason other than deferral or
not-found-GPIO, we try to print device tree node info, however if might
be freed already as we called of_node_put() on it.

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

 drivers/net/phy/fixed_phy.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index 7c5265fd2b94..4190f9ed5313 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -212,16 +212,13 @@ static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np)
 	 */
 	gpiod = gpiod_get_from_of_node(fixed_link_node, "link-gpios", 0,
 				       GPIOD_IN, "mdio");
-	of_node_put(fixed_link_node);
-	if (IS_ERR(gpiod)) {
-		if (PTR_ERR(gpiod) == -EPROBE_DEFER)
-			return gpiod;
-
+	if (IS_ERR(gpiod) && PTR_ERR(gpiod) != -EPROBE_DEFER) {
 		if (PTR_ERR(gpiod) != -ENOENT)
 			pr_err("error getting GPIO for fixed link %pOF, proceed without\n",
 			       fixed_link_node);
 		gpiod = NULL;
 	}
+	of_node_put(fixed_link_node);
 
 	return gpiod;
 }
-- 
2.23.0.700.g56cf767bdb-goog


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/3] net: phy: fixed_phy: switch to using fwnode_gpiod_get_index
  2019-10-14 17:40 [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index Dmitry Torokhov
  2019-10-14 17:40 ` [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
  2019-10-14 17:40 ` [PATCH v2 2/3] net: phy: fixed_phy: fix use-after-free when checking link GPIO Dmitry Torokhov
@ 2019-10-14 17:40 ` Dmitry Torokhov
  2019-10-14 22:37   ` kbuild test robot
  2019-10-16  3:18 ` [PATCH v2 0/3] net: phy: " David Miller
  2019-11-05  0:40 ` Dmitry Torokhov
  4 siblings, 1 reply; 16+ messages in thread
From: Dmitry Torokhov @ 2019-10-14 17:40 UTC (permalink / raw)
  To: Linus Walleij
  Cc: netdev, David S . Miller, linux-kernel, Andrew Lunn,
	Florian Fainelli, Heiner Kallweit

gpiod_get_from_of_node() is being retired in favor of
[devm_]fwnode_gpiod_get_index(), that behaves similar to
[devm_]gpiod_get_index(), but can work with arbitrary firmware node. It
will also be able to support secondary software nodes.

Let's switch this driver over.

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

---

 drivers/net/phy/fixed_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index 4190f9ed5313..73a72ff0fb16 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -210,8 +210,8 @@ static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np)
 	 * Linux device associated with it, we simply have obtain
 	 * the GPIO descriptor from the device tree like this.
 	 */
-	gpiod = gpiod_get_from_of_node(fixed_link_node, "link-gpios", 0,
-				       GPIOD_IN, "mdio");
+	gpiod = fwnode_gpiod_get_index(of_fwnode_handle(fixed_link_node),
+				       "link-gpios", 0, GPIOD_IN, "mdio");
 	if (IS_ERR(gpiod) && PTR_ERR(gpiod) != -EPROBE_DEFER) {
 		if (PTR_ERR(gpiod) != -ENOENT)
 			pr_err("error getting GPIO for fixed link %pOF, proceed without\n",
-- 
2.23.0.700.g56cf767bdb-goog


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-10-14 17:40 ` [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
@ 2019-10-14 17:55   ` Russell King - ARM Linux admin
  2019-10-14 20:30   ` kbuild test robot
  2019-10-15 13:02   ` kbuild test robot
  2 siblings, 0 replies; 16+ messages in thread
From: Russell King - ARM Linux admin @ 2019-10-14 17:55 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linus Walleij, netdev, David S . Miller, linux-kernel,
	Andy Shevchenko, Andrew Lunn, Florian Fainelli, Heiner Kallweit

On Mon, Oct 14, 2019 at 10:40:20AM -0700, Dmitry Torokhov wrote:
> Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
> the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), but
> works with arbitrary firmware node.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: David S. Miller <davem@davemloft.net>

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> 
>  drivers/net/phy/phylink.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index a5a57ca94c1a..c34ca644d47e 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -168,8 +168,8 @@ static int phylink_parse_fixedlink(struct phylink *pl,
>  			pl->link_config.pause |= MLO_PAUSE_ASYM;
>  
>  		if (ret == 0) {
> -			desc = fwnode_get_named_gpiod(fixed_node, "link-gpios",
> -						      0, GPIOD_IN, "?");
> +			desc = fwnode_gpiod_get_index(fixed_node, "link", 0,
> +						      GPIOD_IN, "?");
>  
>  			if (!IS_ERR(desc))
>  				pl->link_gpio = desc;
> -- 
> 2.23.0.700.g56cf767bdb-goog
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-10-14 17:40 ` [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
  2019-10-14 17:55   ` Russell King - ARM Linux admin
@ 2019-10-14 20:30   ` kbuild test robot
  2019-10-15 13:02   ` kbuild test robot
  2 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2019-10-14 20:30 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: kbuild-all, Linus Walleij, netdev, David S . Miller,
	linux-kernel, Andy Shevchenko, Andrew Lunn, Florian Fainelli,
	Heiner Kallweit, Russell King

[-- Attachment #1: Type: text/plain, Size: 5149 bytes --]

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on net/master]
[cannot apply to v5.4-rc3 next-20191014]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Dmitry-Torokhov/net-phy-switch-to-using-fwnode_gpiod_get_index/20191015-020204
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=mips 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/phy/phylink.c: In function 'phylink_parse_fixedlink':
>> drivers/net/phy/phylink.c:171:11: error: implicit declaration of function 'fwnode_gpiod_get_index'; did you mean 'devm_gpiod_get_index'? [-Werror=implicit-function-declaration]
       desc = fwnode_gpiod_get_index(fixed_node, "link", 0,
              ^~~~~~~~~~~~~~~~~~~~~~
              devm_gpiod_get_index
   drivers/net/phy/phylink.c:171:9: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
       desc = fwnode_gpiod_get_index(fixed_node, "link", 0,
            ^
   cc1: some warnings being treated as errors

vim +171 drivers/net/phy/phylink.c

   143	
   144	static int phylink_parse_fixedlink(struct phylink *pl,
   145					   struct fwnode_handle *fwnode)
   146	{
   147		struct fwnode_handle *fixed_node;
   148		const struct phy_setting *s;
   149		struct gpio_desc *desc;
   150		u32 speed;
   151		int ret;
   152	
   153		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
   154		if (fixed_node) {
   155			ret = fwnode_property_read_u32(fixed_node, "speed", &speed);
   156	
   157			pl->link_config.speed = speed;
   158			pl->link_config.duplex = DUPLEX_HALF;
   159	
   160			if (fwnode_property_read_bool(fixed_node, "full-duplex"))
   161				pl->link_config.duplex = DUPLEX_FULL;
   162	
   163			/* We treat the "pause" and "asym-pause" terminology as
   164			 * defining the link partner's ability. */
   165			if (fwnode_property_read_bool(fixed_node, "pause"))
   166				pl->link_config.pause |= MLO_PAUSE_SYM;
   167			if (fwnode_property_read_bool(fixed_node, "asym-pause"))
   168				pl->link_config.pause |= MLO_PAUSE_ASYM;
   169	
   170			if (ret == 0) {
 > 171				desc = fwnode_gpiod_get_index(fixed_node, "link", 0,
   172							      GPIOD_IN, "?");
   173	
   174				if (!IS_ERR(desc))
   175					pl->link_gpio = desc;
   176				else if (desc == ERR_PTR(-EPROBE_DEFER))
   177					ret = -EPROBE_DEFER;
   178			}
   179			fwnode_handle_put(fixed_node);
   180	
   181			if (ret)
   182				return ret;
   183		} else {
   184			u32 prop[5];
   185	
   186			ret = fwnode_property_read_u32_array(fwnode, "fixed-link",
   187							     NULL, 0);
   188			if (ret != ARRAY_SIZE(prop)) {
   189				phylink_err(pl, "broken fixed-link?\n");
   190				return -EINVAL;
   191			}
   192	
   193			ret = fwnode_property_read_u32_array(fwnode, "fixed-link",
   194							     prop, ARRAY_SIZE(prop));
   195			if (!ret) {
   196				pl->link_config.duplex = prop[1] ?
   197							DUPLEX_FULL : DUPLEX_HALF;
   198				pl->link_config.speed = prop[2];
   199				if (prop[3])
   200					pl->link_config.pause |= MLO_PAUSE_SYM;
   201				if (prop[4])
   202					pl->link_config.pause |= MLO_PAUSE_ASYM;
   203			}
   204		}
   205	
   206		if (pl->link_config.speed > SPEED_1000 &&
   207		    pl->link_config.duplex != DUPLEX_FULL)
   208			phylink_warn(pl, "fixed link specifies half duplex for %dMbps link?\n",
   209				     pl->link_config.speed);
   210	
   211		bitmap_fill(pl->supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
   212		linkmode_copy(pl->link_config.advertising, pl->supported);
   213		phylink_validate(pl, pl->supported, &pl->link_config);
   214	
   215		s = phy_lookup_setting(pl->link_config.speed, pl->link_config.duplex,
   216				       pl->supported, true);
   217		linkmode_zero(pl->supported);
   218		phylink_set(pl->supported, MII);
   219		phylink_set(pl->supported, Pause);
   220		phylink_set(pl->supported, Asym_Pause);
   221		if (s) {
   222			__set_bit(s->bit, pl->supported);
   223		} else {
   224			phylink_warn(pl, "fixed link %s duplex %dMbps not recognised\n",
   225				     pl->link_config.duplex == DUPLEX_FULL ? "full" : "half",
   226				     pl->link_config.speed);
   227		}
   228	
   229		linkmode_and(pl->link_config.advertising, pl->link_config.advertising,
   230			     pl->supported);
   231	
   232		pl->link_config.link = 1;
   233		pl->link_config.an_complete = 1;
   234	
   235		return 0;
   236	}
   237	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 62121 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/3] net: phy: fixed_phy: switch to using fwnode_gpiod_get_index
  2019-10-14 17:40 ` [PATCH v2 3/3] net: phy: fixed_phy: switch to using fwnode_gpiod_get_index Dmitry Torokhov
@ 2019-10-14 22:37   ` kbuild test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2019-10-14 22:37 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: kbuild-all, Linus Walleij, netdev, David S . Miller,
	linux-kernel, Andrew Lunn, Florian Fainelli, Heiner Kallweit

[-- Attachment #1: Type: text/plain, Size: 3024 bytes --]

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on net/master]
[cannot apply to v5.4-rc3 next-20191014]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Dmitry-Torokhov/net-phy-switch-to-using-fwnode_gpiod_get_index/20191015-020204
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=mips 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/phy/fixed_phy.c: In function 'fixed_phy_get_gpiod':
>> drivers/net/phy/fixed_phy.c:213:10: error: implicit declaration of function 'fwnode_gpiod_get_index'; did you mean 'devm_gpiod_get_index'? [-Werror=implicit-function-declaration]
     gpiod = fwnode_gpiod_get_index(of_fwnode_handle(fixed_link_node),
             ^~~~~~~~~~~~~~~~~~~~~~
             devm_gpiod_get_index
   drivers/net/phy/fixed_phy.c:213:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     gpiod = fwnode_gpiod_get_index(of_fwnode_handle(fixed_link_node),
           ^
   cc1: some warnings being treated as errors

vim +213 drivers/net/phy/fixed_phy.c

   194	
   195	#ifdef CONFIG_OF_GPIO
   196	static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np)
   197	{
   198		struct device_node *fixed_link_node;
   199		struct gpio_desc *gpiod;
   200	
   201		if (!np)
   202			return NULL;
   203	
   204		fixed_link_node = of_get_child_by_name(np, "fixed-link");
   205		if (!fixed_link_node)
   206			return NULL;
   207	
   208		/*
   209		 * As the fixed link is just a device tree node without any
   210		 * Linux device associated with it, we simply have obtain
   211		 * the GPIO descriptor from the device tree like this.
   212		 */
 > 213		gpiod = fwnode_gpiod_get_index(of_fwnode_handle(fixed_link_node),
   214					       "link-gpios", 0, GPIOD_IN, "mdio");
   215		if (IS_ERR(gpiod) && PTR_ERR(gpiod) != -EPROBE_DEFER) {
   216			if (PTR_ERR(gpiod) != -ENOENT)
   217				pr_err("error getting GPIO for fixed link %pOF, proceed without\n",
   218				       fixed_link_node);
   219			gpiod = NULL;
   220		}
   221		of_node_put(fixed_link_node);
   222	
   223		return gpiod;
   224	}
   225	#else
   226	static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np)
   227	{
   228		return NULL;
   229	}
   230	#endif
   231	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 62121 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/3] net: phy: fixed_phy: fix use-after-free when checking link GPIO
  2019-10-14 17:40 ` [PATCH v2 2/3] net: phy: fixed_phy: fix use-after-free when checking link GPIO Dmitry Torokhov
@ 2019-10-15 12:54   ` Andrew Lunn
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-10-15 12:54 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linus Walleij, netdev, David S . Miller, linux-kernel,
	Florian Fainelli, Heiner Kallweit

On Mon, Oct 14, 2019 at 10:40:21AM -0700, Dmitry Torokhov wrote:
> If we fail to locate GPIO for any reason other than deferral or
> not-found-GPIO, we try to print device tree node info, however if might
> be freed already as we called of_node_put() on it.
> 
> Acked-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-10-14 17:40 ` [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
  2019-10-14 17:55   ` Russell King - ARM Linux admin
  2019-10-14 20:30   ` kbuild test robot
@ 2019-10-15 13:02   ` kbuild test robot
  2 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2019-10-15 13:02 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: kbuild-all, Linus Walleij, netdev, David S . Miller,
	linux-kernel, Andy Shevchenko, Andrew Lunn, Florian Fainelli,
	Heiner Kallweit, Russell King

[-- Attachment #1: Type: text/plain, Size: 4949 bytes --]

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on net/master]
[cannot apply to v5.4-rc3 next-20191014]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Dmitry-Torokhov/net-phy-switch-to-using-fwnode_gpiod_get_index/20191015-020204
config: x86_64-randconfig-a002-201941 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/phy/phylink.c: In function 'phylink_parse_fixedlink':
>> drivers/net/phy/phylink.c:171:11: error: implicit declaration of function 'fwnode_gpiod_get_index' [-Werror=implicit-function-declaration]
       desc = fwnode_gpiod_get_index(fixed_node, "link", 0,
              ^
   drivers/net/phy/phylink.c:171:9: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
       desc = fwnode_gpiod_get_index(fixed_node, "link", 0,
            ^
   cc1: some warnings being treated as errors

vim +/fwnode_gpiod_get_index +171 drivers/net/phy/phylink.c

   143	
   144	static int phylink_parse_fixedlink(struct phylink *pl,
   145					   struct fwnode_handle *fwnode)
   146	{
   147		struct fwnode_handle *fixed_node;
   148		const struct phy_setting *s;
   149		struct gpio_desc *desc;
   150		u32 speed;
   151		int ret;
   152	
   153		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
   154		if (fixed_node) {
   155			ret = fwnode_property_read_u32(fixed_node, "speed", &speed);
   156	
   157			pl->link_config.speed = speed;
   158			pl->link_config.duplex = DUPLEX_HALF;
   159	
   160			if (fwnode_property_read_bool(fixed_node, "full-duplex"))
   161				pl->link_config.duplex = DUPLEX_FULL;
   162	
   163			/* We treat the "pause" and "asym-pause" terminology as
   164			 * defining the link partner's ability. */
   165			if (fwnode_property_read_bool(fixed_node, "pause"))
   166				pl->link_config.pause |= MLO_PAUSE_SYM;
   167			if (fwnode_property_read_bool(fixed_node, "asym-pause"))
   168				pl->link_config.pause |= MLO_PAUSE_ASYM;
   169	
   170			if (ret == 0) {
 > 171				desc = fwnode_gpiod_get_index(fixed_node, "link", 0,
   172							      GPIOD_IN, "?");
   173	
   174				if (!IS_ERR(desc))
   175					pl->link_gpio = desc;
   176				else if (desc == ERR_PTR(-EPROBE_DEFER))
   177					ret = -EPROBE_DEFER;
   178			}
   179			fwnode_handle_put(fixed_node);
   180	
   181			if (ret)
   182				return ret;
   183		} else {
   184			u32 prop[5];
   185	
   186			ret = fwnode_property_read_u32_array(fwnode, "fixed-link",
   187							     NULL, 0);
   188			if (ret != ARRAY_SIZE(prop)) {
   189				phylink_err(pl, "broken fixed-link?\n");
   190				return -EINVAL;
   191			}
   192	
   193			ret = fwnode_property_read_u32_array(fwnode, "fixed-link",
   194							     prop, ARRAY_SIZE(prop));
   195			if (!ret) {
   196				pl->link_config.duplex = prop[1] ?
   197							DUPLEX_FULL : DUPLEX_HALF;
   198				pl->link_config.speed = prop[2];
   199				if (prop[3])
   200					pl->link_config.pause |= MLO_PAUSE_SYM;
   201				if (prop[4])
   202					pl->link_config.pause |= MLO_PAUSE_ASYM;
   203			}
   204		}
   205	
   206		if (pl->link_config.speed > SPEED_1000 &&
   207		    pl->link_config.duplex != DUPLEX_FULL)
   208			phylink_warn(pl, "fixed link specifies half duplex for %dMbps link?\n",
   209				     pl->link_config.speed);
   210	
   211		bitmap_fill(pl->supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
   212		linkmode_copy(pl->link_config.advertising, pl->supported);
   213		phylink_validate(pl, pl->supported, &pl->link_config);
   214	
   215		s = phy_lookup_setting(pl->link_config.speed, pl->link_config.duplex,
   216				       pl->supported, true);
   217		linkmode_zero(pl->supported);
   218		phylink_set(pl->supported, MII);
   219		phylink_set(pl->supported, Pause);
   220		phylink_set(pl->supported, Asym_Pause);
   221		if (s) {
   222			__set_bit(s->bit, pl->supported);
   223		} else {
   224			phylink_warn(pl, "fixed link %s duplex %dMbps not recognised\n",
   225				     pl->link_config.duplex == DUPLEX_FULL ? "full" : "half",
   226				     pl->link_config.speed);
   227		}
   228	
   229		linkmode_and(pl->link_config.advertising, pl->link_config.advertising,
   230			     pl->supported);
   231	
   232		pl->link_config.link = 1;
   233		pl->link_config.an_complete = 1;
   234	
   235		return 0;
   236	}
   237	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30982 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index
  2019-10-14 17:40 [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index Dmitry Torokhov
                   ` (2 preceding siblings ...)
  2019-10-14 17:40 ` [PATCH v2 3/3] net: phy: fixed_phy: switch to using fwnode_gpiod_get_index Dmitry Torokhov
@ 2019-10-16  3:18 ` David Miller
  2019-11-05  0:40 ` Dmitry Torokhov
  4 siblings, 0 replies; 16+ messages in thread
From: David Miller @ 2019-10-16  3:18 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: linus.walleij, netdev, linux-kernel, andrew, f.fainelli,
	hkallweit1, linux

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: Mon, 14 Oct 2019 10:40:19 -0700

> This series switches phy drivers form using fwnode_get_named_gpiod() and
> gpiod_get_from_of_node() that are scheduled to be removed in favor
> of fwnode_gpiod_get_index() that behaves more like standard
> gpiod_get_index() and will potentially handle secondary software
> nodes in cases we need to augment platform firmware.
> 
> Linus, as David would prefer not to pull in the immutable branch but
> rather route the patches through the tree that has the new API, could
> you please take them with his ACKs?

Indeed, please do, also for series:

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index
  2019-10-14 17:40 [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index Dmitry Torokhov
                   ` (3 preceding siblings ...)
  2019-10-16  3:18 ` [PATCH v2 0/3] net: phy: " David Miller
@ 2019-11-05  0:40 ` Dmitry Torokhov
  2019-11-05  0:55   ` Russell King - ARM Linux admin
  4 siblings, 1 reply; 16+ messages in thread
From: Dmitry Torokhov @ 2019-11-05  0:40 UTC (permalink / raw)
  To: Linus Walleij
  Cc: netdev, David S . Miller, linux-kernel, Andrew Lunn,
	Florian Fainelli, Heiner Kallweit, Russell King

Hi Linus,

On Mon, Oct 14, 2019 at 10:40:19AM -0700, Dmitry Torokhov wrote:
> This series switches phy drivers form using fwnode_get_named_gpiod() and
> gpiod_get_from_of_node() that are scheduled to be removed in favor
> of fwnode_gpiod_get_index() that behaves more like standard
> gpiod_get_index() and will potentially handle secondary software
> nodes in cases we need to augment platform firmware.
> 
> Linus, as David would prefer not to pull in the immutable branch but
> rather route the patches through the tree that has the new API, could
> you please take them with his ACKs?

Gentle ping on the series...

> 
> Thanks!
> 
> v2:
>         - rebased on top of Linus' W devel branch
>         - added David's ACKs
> 
> Dmitry Torokhov (3):
>   net: phylink: switch to using fwnode_gpiod_get_index()
>   net: phy: fixed_phy: fix use-after-free when checking link GPIO
>   net: phy: fixed_phy: switch to using fwnode_gpiod_get_index
> 
>  drivers/net/phy/fixed_phy.c | 11 ++++-------
>  drivers/net/phy/phylink.c   |  4 ++--
>  2 files changed, 6 insertions(+), 9 deletions(-)
> 
> -- 
> 2.23.0.700.g56cf767bdb-goog
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index
  2019-11-05  0:40 ` Dmitry Torokhov
@ 2019-11-05  0:55   ` Russell King - ARM Linux admin
  2019-11-05 17:27     ` Dmitry Torokhov
  0 siblings, 1 reply; 16+ messages in thread
From: Russell King - ARM Linux admin @ 2019-11-05  0:55 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linus Walleij, netdev, David S . Miller, linux-kernel,
	Andrew Lunn, Florian Fainelli, Heiner Kallweit

On Mon, Nov 04, 2019 at 04:40:16PM -0800, Dmitry Torokhov wrote:
> Hi Linus,
> 
> On Mon, Oct 14, 2019 at 10:40:19AM -0700, Dmitry Torokhov wrote:
> > This series switches phy drivers form using fwnode_get_named_gpiod() and
> > gpiod_get_from_of_node() that are scheduled to be removed in favor
> > of fwnode_gpiod_get_index() that behaves more like standard
> > gpiod_get_index() and will potentially handle secondary software
> > nodes in cases we need to augment platform firmware.
> > 
> > Linus, as David would prefer not to pull in the immutable branch but
> > rather route the patches through the tree that has the new API, could
> > you please take them with his ACKs?
> 
> Gentle ping on the series...

Given that kbuild found a build issue with patch 1, aren't we waiting
for you to produce an updated patch 1?

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index
  2019-11-05  0:55   ` Russell King - ARM Linux admin
@ 2019-11-05 17:27     ` Dmitry Torokhov
  2019-11-05 18:04       ` David Miller
  0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Torokhov @ 2019-11-05 17:27 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: Linus Walleij, netdev, David S . Miller, lkml, Andrew Lunn,
	Florian Fainelli, Heiner Kallweit

On Mon, Nov 4, 2019 at 4:55 PM Russell King - ARM Linux admin
<linux@armlinux.org.uk> wrote:
>
> On Mon, Nov 04, 2019 at 04:40:16PM -0800, Dmitry Torokhov wrote:
> > Hi Linus,
> >
> > On Mon, Oct 14, 2019 at 10:40:19AM -0700, Dmitry Torokhov wrote:
> > > This series switches phy drivers form using fwnode_get_named_gpiod() and
> > > gpiod_get_from_of_node() that are scheduled to be removed in favor
> > > of fwnode_gpiod_get_index() that behaves more like standard
> > > gpiod_get_index() and will potentially handle secondary software
> > > nodes in cases we need to augment platform firmware.
> > >
> > > Linus, as David would prefer not to pull in the immutable branch but
> > > rather route the patches through the tree that has the new API, could
> > > you please take them with his ACKs?
> >
> > Gentle ping on the series...
>
> Given that kbuild found a build issue with patch 1, aren't we waiting
> for you to produce an updated patch 1?

No: kbuild is unable to parse instructions such as "please pull an
immutable branch" before applying the series. Linus' tree already has
needed changes.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index
  2019-11-05 17:27     ` Dmitry Torokhov
@ 2019-11-05 18:04       ` David Miller
  2019-11-05 18:20         ` Dmitry Torokhov
  0 siblings, 1 reply; 16+ messages in thread
From: David Miller @ 2019-11-05 18:04 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: linux, linus.walleij, netdev, linux-kernel, andrew, f.fainelli,
	hkallweit1

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: Tue, 5 Nov 2019 09:27:51 -0800

> On Mon, Nov 4, 2019 at 4:55 PM Russell King - ARM Linux admin
> <linux@armlinux.org.uk> wrote:
>>
>> On Mon, Nov 04, 2019 at 04:40:16PM -0800, Dmitry Torokhov wrote:
>> > Hi Linus,
>> >
>> > On Mon, Oct 14, 2019 at 10:40:19AM -0700, Dmitry Torokhov wrote:
>> > > This series switches phy drivers form using fwnode_get_named_gpiod() and
>> > > gpiod_get_from_of_node() that are scheduled to be removed in favor
>> > > of fwnode_gpiod_get_index() that behaves more like standard
>> > > gpiod_get_index() and will potentially handle secondary software
>> > > nodes in cases we need to augment platform firmware.
>> > >
>> > > Linus, as David would prefer not to pull in the immutable branch but
>> > > rather route the patches through the tree that has the new API, could
>> > > you please take them with his ACKs?
>> >
>> > Gentle ping on the series...
>>
>> Given that kbuild found a build issue with patch 1, aren't we waiting
>> for you to produce an updated patch 1?
> 
> No: kbuild is unable to parse instructions such as "please pull an
> immutable branch" before applying the series. Linus' tree already has
> needed changes.

This is targetting the networking tree so it doesn't matter what is in
Linus's tree, it has to build against MY tree and that's what Kbuild
tests against.

Resubmit if it builds against my tree, and no sooner.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index
  2019-11-05 18:04       ` David Miller
@ 2019-11-05 18:20         ` Dmitry Torokhov
  2019-11-13 21:26           ` Dmitry Torokhov
  0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Torokhov @ 2019-11-05 18:20 UTC (permalink / raw)
  To: David Miller
  Cc: linux, linus.walleij, netdev, linux-kernel, andrew, f.fainelli,
	hkallweit1

On Tue, Nov 05, 2019 at 10:04:23AM -0800, David Miller wrote:
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Date: Tue, 5 Nov 2019 09:27:51 -0800
> 
> > On Mon, Nov 4, 2019 at 4:55 PM Russell King - ARM Linux admin
> > <linux@armlinux.org.uk> wrote:
> >>
> >> On Mon, Nov 04, 2019 at 04:40:16PM -0800, Dmitry Torokhov wrote:
> >> > Hi Linus,
> >> >
> >> > On Mon, Oct 14, 2019 at 10:40:19AM -0700, Dmitry Torokhov wrote:
> >> > > This series switches phy drivers form using fwnode_get_named_gpiod() and
> >> > > gpiod_get_from_of_node() that are scheduled to be removed in favor
> >> > > of fwnode_gpiod_get_index() that behaves more like standard
> >> > > gpiod_get_index() and will potentially handle secondary software
> >> > > nodes in cases we need to augment platform firmware.
> >> > >
> >> > > Linus, as David would prefer not to pull in the immutable branch but
> >> > > rather route the patches through the tree that has the new API, could
> >> > > you please take them with his ACKs?
> >> >
> >> > Gentle ping on the series...
> >>
> >> Given that kbuild found a build issue with patch 1, aren't we waiting
> >> for you to produce an updated patch 1?
> > 
> > No: kbuild is unable to parse instructions such as "please pull an
> > immutable branch" before applying the series. Linus' tree already has
> > needed changes.
> 
> This is targetting the networking tree so it doesn't matter what is in
> Linus's tree, it has to build against MY tree and that's what Kbuild
> tests against.
> 
> Resubmit if it builds against my tree, and no sooner.

I am confused. You were OK with merging through Linus' Walleij tree, and
you acked all 3 patches earlier...

https://lore.kernel.org/netdev/20191011.140540.2027562826793118009.davem@davemloft.net/

"So submit this into the tree that will have the dependencies."

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index
  2019-11-05 18:20         ` Dmitry Torokhov
@ 2019-11-13 21:26           ` Dmitry Torokhov
  0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2019-11-13 21:26 UTC (permalink / raw)
  To: David Miller
  Cc: linux, linus.walleij, netdev, linux-kernel, andrew, f.fainelli,
	hkallweit1

On Tue, Nov 05, 2019 at 10:20:22AM -0800, Dmitry Torokhov wrote:
> On Tue, Nov 05, 2019 at 10:04:23AM -0800, David Miller wrote:
> > From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Date: Tue, 5 Nov 2019 09:27:51 -0800
> > 
> > > On Mon, Nov 4, 2019 at 4:55 PM Russell King - ARM Linux admin
> > > <linux@armlinux.org.uk> wrote:
> > >>
> > >> On Mon, Nov 04, 2019 at 04:40:16PM -0800, Dmitry Torokhov wrote:
> > >> > Hi Linus,
> > >> >
> > >> > On Mon, Oct 14, 2019 at 10:40:19AM -0700, Dmitry Torokhov wrote:
> > >> > > This series switches phy drivers form using fwnode_get_named_gpiod() and
> > >> > > gpiod_get_from_of_node() that are scheduled to be removed in favor
> > >> > > of fwnode_gpiod_get_index() that behaves more like standard
> > >> > > gpiod_get_index() and will potentially handle secondary software
> > >> > > nodes in cases we need to augment platform firmware.
> > >> > >
> > >> > > Linus, as David would prefer not to pull in the immutable branch but
> > >> > > rather route the patches through the tree that has the new API, could
> > >> > > you please take them with his ACKs?
> > >> >
> > >> > Gentle ping on the series...
> > >>
> > >> Given that kbuild found a build issue with patch 1, aren't we waiting
> > >> for you to produce an updated patch 1?
> > > 
> > > No: kbuild is unable to parse instructions such as "please pull an
> > > immutable branch" before applying the series. Linus' tree already has
> > > needed changes.
> > 
> > This is targetting the networking tree so it doesn't matter what is in
> > Linus's tree, it has to build against MY tree and that's what Kbuild
> > tests against.
> > 
> > Resubmit if it builds against my tree, and no sooner.
> 
> I am confused. You were OK with merging through Linus' Walleij tree, and
> you acked all 3 patches earlier...
> 
> https://lore.kernel.org/netdev/20191011.140540.2027562826793118009.davem@davemloft.net/
> 
> "So submit this into the tree that will have the dependencies."

So what is the final verdict? Merge through Linus Walleij's tree, wait
until after 5.5 merge window?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-11-13 21:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14 17:40 [PATCH v2 0/3] net: phy: switch to using fwnode_gpiod_get_index Dmitry Torokhov
2019-10-14 17:40 ` [PATCH v2 1/3] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
2019-10-14 17:55   ` Russell King - ARM Linux admin
2019-10-14 20:30   ` kbuild test robot
2019-10-15 13:02   ` kbuild test robot
2019-10-14 17:40 ` [PATCH v2 2/3] net: phy: fixed_phy: fix use-after-free when checking link GPIO Dmitry Torokhov
2019-10-15 12:54   ` Andrew Lunn
2019-10-14 17:40 ` [PATCH v2 3/3] net: phy: fixed_phy: switch to using fwnode_gpiod_get_index Dmitry Torokhov
2019-10-14 22:37   ` kbuild test robot
2019-10-16  3:18 ` [PATCH v2 0/3] net: phy: " David Miller
2019-11-05  0:40 ` Dmitry Torokhov
2019-11-05  0:55   ` Russell King - ARM Linux admin
2019-11-05 17:27     ` Dmitry Torokhov
2019-11-05 18:04       ` David Miller
2019-11-05 18:20         ` Dmitry Torokhov
2019-11-13 21:26           ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).