Re: [PATCH] net: ethernet: mtk-star-emac: fix wrong unmap in RX handling

2021-03-02 Thread Bartosz Golaszewski
t; push_new_skb: > desc_data.len = skb_tailroom(new_skb); > desc_data.skb = new_skb; > -- > 2.18.0 > Thanks for spotting that. Maybe also update the commit so that it says: "it's safe to unmap the old skb"? Would make the thing clearer IMO. In any case: Acked-by: Bartosz Golaszewski Bartosz

Re: [PATCH net-next 0/2] dsa: add MT7530 GPIO support

2021-01-14 Thread Bartosz Golaszewski
On Mon, Jan 11, 2021 at 2:43 PM Vladimir Oltean wrote: > > On Mon, Jan 11, 2021 at 01:44:26PM +0800, DENG Qingfang wrote: > > MT7530's LED controller can be used as GPIO controller. Add support for > > it. > > > > DENG Qingfang (2): > > dt-bindings: net: dsa: add MT7530 GPIO controller binding >

Re: [PATCH] dt-bindings: Add missing array size constraints

2021-01-05 Thread Bartosz Golaszewski
+++ b/Documentation/devicetree/bindings/gpio/gpio-pca95xx.yaml > @@ -81,6 +81,7 @@ properties: > const: 2 > >reset-gpios: > +maxItems: 1 > description: >GPIO specification for the RESET input. This is an active low signal to > the PCA953x. Not valid for Maxim MAX732x devices. Acked-by: Bartosz Golaszewski

Re: [PATCH net] net: ethernet: mtk-star-emac: fix error return code in mtk_star_enable()

2020-11-12 Thread Bartosz Golaszewski
if (!priv->phydev) { > netdev_err(ndev, "failed to connect to PHY\n"); > + ret = -ENODEV; > goto err_free_irq; > } > > -- > 2.9.5 > Acked-by: Bartosz Golaszewski

Re: [PATCH] net: ethernet: mtk-star-emac: return ok when xmit drops

2020-11-12 Thread Bartosz Golaszewski
net: mtk-star-emac: new driver") > Signed-off-by: Vincent Stehlé > Cc: David S. Miller > Cc: Bartosz Golaszewski > --- > drivers/net/ethernet/mediatek/mtk_star_emac.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/mediate

[PATCH v3 3/9] ALSA: pcm: use krealloc_array()

2020-11-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Reviewed-by: Takashi Iwai --- sound/core/pcm_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH v3 6/9] edac: ghes: use krealloc_array()

2020-11-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Acked-by: Borislav Petkov --- drivers/edac/ghes_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH v3 7/9] drm: atomic: use krealloc_array()

2020-11-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Acked-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[PATCH v3 4/9] vhost: vringh: use krealloc_array()

2020-11-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Acked-by: Michael S. Tsirkin --- drivers/vhost/vringh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[PATCH v3 9/9] dma-buf: use krealloc_array()

2020-11-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Acked-by: Christian König --- drivers/dma-buf/sync_file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

[PATCH v3 5/9] pinctrl: use krealloc_array()

2020-11-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- drivers/pinctrl/pinctrl-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v3 8/9] hwtracing: intel: use krealloc_array()

2020-11-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski --- drivers/hwtracing/intel_th/msu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers

[PATCH v3 2/9] mm: slab: provide krealloc_array()

2020-11-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski When allocating an array of elements, users should check for multiplication overflow or preferably use one of the provided helpers like: kmalloc_array(). There's no krealloc_array() counterpart but there are many users who use regular krealloc() to reallocate a

[PATCH v3 0/9] slab: provide and use krealloc_array()

2020-11-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Andy brought to my attention the fact that users allocating an array of equally sized elements should check if the size multiplication doesn't overflow. This is why we have helpers like kmalloc_array(). However we don't have krealloc_array() equivalent and

[PATCH v3 1/9] mm: slab: clarify krealloc()'s behavior with __GFP_ZERO

2020-11-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski __GFP_ZERO is ignored by krealloc() (unless we fall-back to kmalloc() path, in which case it's honored). Point that out in the kerneldoc. Signed-off-by: Bartosz Golaszewski --- mm/slab_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --

Re: [PATCH v2 0/8] slab: provide and use krealloc_array()

2020-11-03 Thread Bartosz Golaszewski
On Tue, Nov 3, 2020 at 5:14 AM Joe Perches wrote: > > On Mon, 2020-11-02 at 16:20 +0100, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > > > Andy brought to my attention the fact that users allocating an array of > > equally sized elements should ch

Re: [PATCH v2 1/8] mm: slab: provide krealloc_array()

2020-11-02 Thread Bartosz Golaszewski
On Mon, Nov 2, 2020 at 4:41 PM Matthew Wilcox wrote: > > On Mon, Nov 02, 2020 at 04:20:30PM +0100, Bartosz Golaszewski wrote: > > +Chunks allocated with `kmalloc` can be resized with `krealloc`. Similarly > > +to `kmalloc_array`: a helper for resising arrays is provi

[PATCH v2 3/8] vhost: vringh: use krealloc_array()

2020-11-02 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Acked-by: Michael S. Tsirkin --- drivers/vhost/vringh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[PATCH v2 2/8] ALSA: pcm: use krealloc_array()

2020-11-02 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Reviewed-by: Takashi Iwai --- sound/core/pcm_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH v2 4/8] pinctrl: use krealloc_array()

2020-11-02 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- drivers/pinctrl/pinctrl-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v2 8/8] dma-buf: use krealloc_array()

2020-11-02 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Acked-by: Christian König --- drivers/dma-buf/sync_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH v2 1/8] mm: slab: provide krealloc_array()

2020-11-02 Thread Bartosz Golaszewski
From: Bartosz Golaszewski When allocating an array of elements, users should check for multiplication overflow or preferably use one of the provided helpers like: kmalloc_array(). There's no krealloc_array() counterpart but there are many users who use regular krealloc() to reallocate a

[PATCH v2 5/8] edac: ghes: use krealloc_array()

2020-11-02 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Acked-by: Borislav Petkov --- drivers/edac/ghes_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH v2 6/8] drm: atomic: use krealloc_array()

2020-11-02 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski Acked-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[PATCH v2 7/8] hwtracing: intel: use krealloc_array()

2020-11-02 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski --- drivers/hwtracing/intel_th/msu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers

[PATCH v2 0/8] slab: provide and use krealloc_array()

2020-11-02 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Andy brought to my attention the fact that users allocating an array of equally sized elements should check if the size multiplication doesn't overflow. This is why we have helpers like kmalloc_array(). However we don't have krealloc_array() equivalent and

Re: [PATCH 3/8] vhost: vringh: use krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
On Tue, Oct 27, 2020 at 6:08 PM Joe Perches wrote: > > On Tue, 2020-10-27 at 17:58 +0100, Bartosz Golaszewski wrote: > > On Tue, Oct 27, 2020 at 5:50 PM Joe Perches wrote: > > > > > > On Tue, 2020-10-27 at 11:28 -0400, Michael S. Tsirkin wrote: > > > >

Re: [PATCH 3/8] vhost: vringh: use krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
On Tue, Oct 27, 2020 at 5:50 PM Joe Perches wrote: > > On Tue, 2020-10-27 at 11:28 -0400, Michael S. Tsirkin wrote: > > On Tue, Oct 27, 2020 at 01:17:20PM +0100, Bartosz Golaszewski wrote: > > > From: Bartosz Golaszewski > > > > > > Use the helper that che

[PATCH 5/8] edac: ghes: use krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski --- drivers/edac/ghes_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/edac

[PATCH 1/8] mm: slab: provide krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
From: Bartosz Golaszewski When allocating an array of elements, users should check for multiplication overflow or preferably use one of the provided helpers like: kmalloc_array(). There's no krealloc_array() counterpart but there are many users who use regular krealloc() to reallocate a

[PATCH 6/8] drm: atomic: use krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski --- drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm

[PATCH 8/8] dma-buf: use krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski --- drivers/dma-buf/sync_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf

[PATCH 7/8] hwtracing: intel: use krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski --- drivers/hwtracing/intel_th/msu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers

[PATCH 4/8] pinctrl: use krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski --- drivers/pinctrl/pinctrl-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl

[PATCH 2/8] ALSA: pcm: use krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski --- sound/core/pcm_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/core/pcm_lib.c b

[PATCH 0/8] slab: provide and use krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Andy brought to my attention the fact that users allocating an array of equally sized elements should check if the size multiplication doesn't overflow. This is why we have helpers like kmalloc_array(). However we don't have krealloc_array() equivalent and

[PATCH 3/8] vhost: vringh: use krealloc_array()

2020-10-27 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Signed-off-by: Bartosz Golaszewski --- drivers/vhost/vringh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vringh.c b

[PATCH] hwmon: pmbus: shrink code and remove pmbus_do_remove()

2020-10-26 Thread Bartosz Golaszewski
From: Bartosz Golaszewski The only action currently performed in pmbus_do_remove() is removing the debugfs hierarchy. We can schedule a devm action at probe time and remove pmbus_do_remove() entirely from all pmbus drivers. Signed-off-by: Bartosz Golaszewski --- drivers/hwmon/pmbus/adm1266.c

[PATCH] net: ethernet: mtk-star-emac: select REGMAP_MMIO

2020-10-20 Thread Bartosz Golaszewski
From: Bartosz Golaszewski The driver depends on mmio regmap API but doesn't select the appropriate Kconfig option. This fixes it. Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver") Cc: Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/mediatek/Kconfi

Re: [PATCH] net: ethernet: ixgbe: don't propagate -ENODEV from ixgbe_mii_bus_init()

2020-10-12 Thread Bartosz Golaszewski
On Mon, Sep 28, 2020 at 9:17 AM Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > It's a valid use-case for ixgbe_mii_bus_init() to return -ENODEV - we > still want to finalize the registration of the ixgbe device. Check the > error code and don't bail out

[PATCH] net: ethernet: ixgbe: don't propagate -ENODEV from ixgbe_mii_bus_init()

2020-09-28 Thread Bartosz Golaszewski
From: Bartosz Golaszewski It's a valid use-case for ixgbe_mii_bus_init() to return -ENODEV - we still want to finalize the registration of the ixgbe device. Check the error code and don't bail out if err == -ENODEV. This fixes an issue on C3000 family of SoCs where four ixgbe devic

Re: [PATCH] Revert "net: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init()"

2020-09-25 Thread Bartosz Golaszewski
On Fri, Sep 25, 2020 at 10:51 AM Liu, Yongxin wrote: > [snip] > > > true); > > > > > > - err = ixgbe_mii_bus_init(hw); > > > - if (err) > > > - goto err_netdev; > > > + ixgbe_mii_bus_init(hw); > > > > > > return 0; > > > > > > -err_

Re: [PATCH] Revert "net: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init()"

2020-09-25 Thread Bartosz Golaszewski
On Fri, Sep 25, 2020 at 4:45 AM Yongxin Liu wrote: > > This reverts commit 09ef193fef7efb0175a04634853862d717adbb95. > > For C3000 family of SoCs, they have four ixgbe devices sharing a single MDIO > bus. > ixgbe_mii_bus_init() returns -ENODEV for other three devices. The propagation > of the err

Re: [PATCH 6/9] dt-bindings: gpio: renesas,rcar-gpio: Add r8a774e1 support

2020-08-27 Thread Bartosz Golaszewski
On Thu, Aug 27, 2020 at 6:40 PM Lad, Prabhakar wrote: > > Hi Linus and Bartosz, > > On Mon, Jul 13, 2020 at 10:35 PM Lad Prabhakar > wrote: > > > > Document Renesas RZ/G2H (R8A774E1) GPIO blocks compatibility within the > > relevant dt-bindings. > > > > Signed-off-by: Lad Prabhakar > > --- > >

[net-next PATCH] net: phy: mdio-mvusb: select MDIO_DEVRES in Kconfig

2020-08-02 Thread Bartosz Golaszewski
From: Bartosz Golaszewski PHYLIB is not selected by the mvusb driver but it uses mdio devres helpers. Explicitly select MDIO_DEVRES in this driver's Kconfig entry. Reported-by: kernel test robot Fixes: 1814cff26739 ("net: phy: add a Kconfig option for mdio_devres") Signed-

[PATCH] net: phy: fix mdio-mscc-miim build

2020-07-13 Thread Bartosz Golaszewski
From: Bartosz Golaszewski PHYLIB is not selected by mdio-mscc-miim but it uses mdio devres helpers. Explicitly select MDIO_DEVRES in this driver's Kconfig entry. Reported-by: kernel test robot Fixes: 1814cff26739 ("net: phy: add a Kconfig option for mdio_devres") Signed-

[PATCH net-next] net: phy: add a Kconfig option for mdio_devres

2020-07-05 Thread Bartosz Golaszewski
From: Bartosz Golaszewski If phylib is built as a module and CONFIG_MDIO_DEVICE is 'y', the mdio_device and mdio_bus code will be in the phylib module, not in the kernel image. Meanwhile we build mdio_devres depending on the CONFIG_MDIO_DEVICE symbol, so if it's 'y', i

[PATCH v2 01/10] net: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init()

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski This function may fail. Check its return value and propagate the error code. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe

[PATCH v2 10/10] net: ethernet: mtk-star-emac: use devm_of_mdiobus_register()

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Shrink the code by using the managed variant of of_mdiobus_register(). Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/mediatek/mtk_star_emac.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/ethernet/mediatek

[PATCH v2 09/10] of: mdio: provide devm_of_mdiobus_register()

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Implement a managed variant of of_mdiobus_register(). We need to make mdio_devres into its own module because otherwise we'd hit circular sumbol dependencies between phylib and of_mdio. Signed-off-by: Bartosz Golaszewski --- .../driver-api/driver-model/devre

[PATCH v2 08/10] of: mdio: remove the 'extern' keyword from function declarations

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski The 'extern' keyword in headers doesn't have any benefit. Remove them all from the of_mdio.h header. Signed-off-by: Bartosz Golaszewski --- include/linux/of_mdio.h | 37 ++--- 1 file changed, 18 insertions(+), 19 del

[PATCH v2 07/10] net: phy: don't abuse devres in devm_mdiobus_register()

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski We currently have two managed helpers for mdiobus - devm_mdiobus_alloc() and devm_mdiobus_register(). The idea behind devres is that the release callback releases whatever resource the devm function allocates. In the mdiobus case however there's no devres assoc

[PATCH v2 00/10] net: improve devres helpers

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski So it seems like there's no support for relaxing certain networking devres helpers to not require previously allocated structures to also be managed. However the way mdio devres variants are implemented is still wrong and I modified my series to address it while ke

[PATCH v2 05/10] phy: un-inline devm_mdiobus_register()

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Functions should only be static inline if they're very short. This devres helper is already over 10 lines and it will grow soon as we'll be improving upon its approach. Pull it into mdio_devres.c. Signed-off-by: Bartosz Golaszewski --- drivers/net/ph

[PATCH v2 06/10] phy: mdio: add kerneldoc for __devm_mdiobus_register()

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski This function is not documented. Add a short kerneldoc description. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/mdio_devres.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/phy/mdio_devres.c b/drivers/net/phy/mdio_devres.c index

[PATCH v2 04/10] Documentation: devres: add missing mdio helper

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski We have a devres variant of mdiobus_register() but it's not listed in devres.rst. Add it under other mdio devm functions. Signed-off-by: Bartosz Golaszewski --- Documentation/driver-api/driver-model/devres.rst | 1 + 1 file changed, 1 insertion(+) diff --

[PATCH v2 02/10] net: ethernet: ixgbe: don't call devm_mdiobus_free()

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski The idea behind devres is that the release callbacks are called if probe fails. As we now check the return value of ixgbe_mii_bus_init(), we can drop the call devm_mdiobus_free() in error path as the release callback will be called automatically. Signed-off-by: Bartosz

[PATCH v2 03/10] net: devres: rename the release callback of devm_register_netdev()

2020-06-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Make it an explicit counterpart to devm_register_netdev() just like we do with devm_free_netdev() for better clarity. Signed-off-by: Bartosz Golaszewski --- net/devres.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/devres.c b/net

[PATCH 1/6] net: phy: arrange headers in mdio_bus.c alphabetically

2020-06-26 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Keeping the headers in alphabetical order is better for readability and allows to easily see if given header is already included. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli --- drivers/net/phy/mdio_bus.c | 32

[PATCH 4/6] net: mdio: add a forward declaration for reset_control to mdio.h

2020-06-26 Thread Bartosz Golaszewski
From: Bartosz Golaszewski This header refers to struct reset_control but doesn't include any reset header. The structure definition is probably somehow indirectly pulled in since no warnings are reported but for the sake of correctness add the forward declaration for struct reset_co

[PATCH 0/6] net: phy: relax PHY and MDIO reset handling

2020-06-26 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Previously these patches were submitted as part of a larger series[1] but since the approach in it will have to be reworked I'm resending the ones that were non-controversial and have been reviewed for upstream. Florian suggested a better solution for managing mul

[PATCH 6/6] net: phy: mdio: reset MDIO devices even if probe() is not implemented

2020-06-26 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Similarily to PHY drivers - there's no reason to require probe() to be implemented in order to call mdio_device_reset(). MDIO devices can have resets defined without needing to do anything in probe(). Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew

[PATCH 5/6] net: phy: reset the PHY even if probe() is not implemented

2020-06-26 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Currently we only call phy_device_reset() if the PHY driver implements the probe() callback. This is not mandatory and many drivers (e.g. realtek) don't need probe() for most devices but still can have reset GPIOs defined. There's no reason to depend on the p

[PATCH 2/6] net: phy: arrange headers in mdio_device.c alphabetically

2020-06-26 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Keeping the headers in alphabetical order is better for readability and allows to easily see if given header is already included. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli --- drivers/net/phy/mdio_device.c | 2 +- 1

[PATCH 3/6] net: phy: arrange headers in phy_device.c alphabetically

2020-06-26 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Keeping the headers in alphabetical order is better for readability and allows to easily see if given header is already included. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli --- drivers/net/phy/phy_device.c | 28

Re: [PATCH 06/11] phy: un-inline devm_mdiobus_register()

2020-06-25 Thread Bartosz Golaszewski
On Tue, Jun 23, 2020 at 1:55 AM Florian Fainelli wrote: > > On 6/22/20 3:00 AM, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > > > Functions should only be static inline if they're very short. This > > devres helper is already over 10 lines an

Re: [PATCH 09/15] net: phy: delay PHY driver probe until PHY registration

2020-06-24 Thread Bartosz Golaszewski
On Wed, Jun 24, 2020 at 6:06 PM Florian Fainelli wrote: > [snip!] > > > > This has evolved into several new concepts being proposed vs my > > use-case which is relatively simple. The former will probably take > > several months of development, reviews and discussions and it will > > block suppor

Re: [PATCH 05/15] net: phy: reset the PHY even if probe() is not implemented

2020-06-24 Thread Bartosz Golaszewski
wt., 23 cze 2020 o 21:14 Florian Fainelli napisał(a): > > On 6/22/20 2:37 AM, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > > > Currently we only call phy_device_reset() if the PHY driver implements > > the probe() callback. This is not mandatory and

Re: [PATCH 09/15] net: phy: delay PHY driver probe until PHY registration

2020-06-24 Thread Bartosz Golaszewski
śr., 24 cze 2020 o 11:43 Mark Brown napisał(a): > > On Tue, Jun 23, 2020 at 12:49:15PM -0700, Florian Fainelli wrote: > > On 6/22/20 6:51 AM, Mark Brown wrote: > > > > If the bus includes power management for the devices on the bus the > > > controller is generally responsible for that rather than

Re: [PATCH 14/15] net: phy: add PHY regulator support

2020-06-23 Thread Bartosz Golaszewski
wt., 23 cze 2020 o 11:56 Russell King - ARM Linux admin napisał(a): > > On Tue, Jun 23, 2020 at 11:46:15AM +0200, Bartosz Golaszewski wrote: > > wt., 23 cze 2020 o 11:43 Russell King - ARM Linux admin > > napisał(a): > > > > > > On Tue, Jun 23, 2020 at 11:41:1

Re: [PATCH 14/15] net: phy: add PHY regulator support

2020-06-23 Thread Bartosz Golaszewski
wt., 23 cze 2020 o 11:43 Russell King - ARM Linux admin napisał(a): > > On Tue, Jun 23, 2020 at 11:41:11AM +0200, Bartosz Golaszewski wrote: > > pon., 22 cze 2020 o 15:29 Russell King - ARM Linux admin > > napisał(a): > > > > > > > [snip!] > > > &

Re: [PATCH 14/15] net: phy: add PHY regulator support

2020-06-23 Thread Bartosz Golaszewski
pon., 22 cze 2020 o 15:29 Russell King - ARM Linux admin napisał(a): > [snip!] > > This is likely to cause issues for some PHY drivers. Note that we have > some PHY drivers which register a temperature sensor in the probe > function, which means they can be accessed independently of the lifetim

Re: [PATCH 13/15] net: phy: mdio: add support for PHY supply regulator

2020-06-23 Thread Bartosz Golaszewski
pon., 22 cze 2020 o 15:25 Russell King - ARM Linux admin napisał(a): > > On Mon, Jun 22, 2020 at 11:37:42AM +0200, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > > > Currently many MAC drivers control the regulator supplying the PHY but > > this is con

Re: [PATCH 03/11] net: devres: relax devm_register_netdev()

2020-06-23 Thread Bartosz Golaszewski
wt., 23 cze 2020 o 00:49 Jakub Kicinski napisał(a): > > On Mon, 22 Jun 2020 12:00:48 +0200 Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > > > This devres helper registers a release callback that only unregisters > > the net_device. It works perfectly

[PATCH 03/11] net: devres: relax devm_register_netdev()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski This devres helper registers a release callback that only unregisters the net_device. It works perfectly fine with netdev structs that are not managed on their own. There's no reason to check this - drop the warning. Signed-off-by: Bartosz Golaszewski ---

[PATCH 01/11] net: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski This function may fail. Check its return value and propagate the error code. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe

[PATCH 02/11] net: ethernet: ixgbe: don't call devm_mdiobus_free()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski The idea behind devres is that the release callbacks are called if probe fails. As we now check the return value of ixgbe_mii_bus_init(), we can drop the call devm_mdiobus_free() in error path as the release callback will be called automatically. Signed-off-by: Bartosz

[PATCH 06/11] phy: un-inline devm_mdiobus_register()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Functions should only be static inline if they're very short. This devres helper is already over 10 lines and it will grow soon as we'll be improving upon its approach. Pull it into mdio_devres.c. Signed-off-by: Bartosz Golaszewski --- drivers/net/ph

[PATCH 04/11] net: devres: rename the release callback of devm_register_netdev()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Make it an explicit counterpart to devm_register_netdev() just like we do with devm_free_netdev() for better clarity. Signed-off-by: Bartosz Golaszewski --- net/devres.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/devres.c b/net

[PATCH 05/11] Documentation: devres: add missing mdio helper

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski We have a devres variant of mdiobus_register() but it's not listed in devres.rst. Add it under other mdio devm functions. Signed-off-by: Bartosz Golaszewski --- Documentation/driver-api/driver-model/devres.rst | 1 + 1 file changed, 1 insertion(+) diff --

[PATCH 07/11] phy: mdio: add kerneldoc for __devm_mdiobus_register()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski This function is not documented. Add a short kerneldoc description. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/mdio_devres.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/phy/mdio_devres.c b/drivers/net/phy/mdio_devres.c index

[PATCH 08/11] net: phy: don't abuse devres in devm_mdiobus_register()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski We currently have two managed helpers for mdiobus - devm_mdiobus_alloc() and devm_mdiobus_register(). The idea behind devres is that the release callback releases whatever resource the devm function allocates. In the mdiobus case however there's no devres assoc

[PATCH 11/11] net: ethernet: mtk-star-emac: use devm_of_mdiobus_register()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Shrink the code by using the managed variant of of_mdiobus_register(). Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/mediatek/mtk_star_emac.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/ethernet/mediatek

[PATCH 10/11] of: mdio: provide devm_of_mdiobus_register()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Implement a managed variant of of_mdiobus_register(). We need to reimplement the devres structure and the release callback because we can't put this function in drivers/net/phy/mdio_devres.c or we'd hit circular dependencies between module symbols. We also don

[PATCH 09/11] of: mdio: remove the 'extern' keyword from function declarations

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski The 'extern' keyword in headers doesn't have any benefit. Remove them all from the of_mdio.h header. Signed-off-by: Bartosz Golaszewski --- include/linux/of_mdio.h | 37 ++--- 1 file changed, 18 insertions(+), 19 del

[PATCH 00/11] net: improve devres helpers

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski When I first submitted the series adding devm_register_netdev() I was told during review that it should check if the underlying struct net_device is managed too before proceeding. I initially accepted this as the right approach but in the back of my head something

[PATCH 06/15] net: phy: mdio: reset MDIO devices even if probe() is not implemented

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Similarily to PHY drivers - there's no reason to require probe() to be implemented in order to call mdio_device_reset(). MDIO devices can have resets defined without needing to do anything in probe(). Signed-off-by: Bartosz Golaszewski --- drivers/ne

[PATCH 02/15] net: phy: arrange headers in mdio_device.c alphabetically

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Keeping the headers in alphabetical order is better for readability and allows to easily see if given header is already included. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/mdio_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH 03/15] net: phy: arrange headers in phy_device.c alphabetically

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Keeping the headers in alphabetical order is better for readability and allows to easily see if given header is already included. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/phy_device.c | 28 ++-- 1 file changed, 14 insertions

[PATCH 10/15] net: phy: simplify phy_device_create()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski The last argument passed to phy_device_create() (c45_ids) is never used in current mainline outside of the core PHY code - it can only be configured when reading the PHY ID from phy_device_read_id(). Let's drop this argument treewide. Signed-off-by: Ba

[PATCH 05/15] net: phy: reset the PHY even if probe() is not implemented

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Currently we only call phy_device_reset() if the PHY driver implements the probe() callback. This is not mandatory and many drivers (e.g. realtek) don't need probe() for most devices but still can have reset GPIOs defined. There's no reason to depend on the p

[PATCH 01/15] net: phy: arrange headers in mdio_bus.c alphabetically

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Keeping the headers in alphabetical order is better for readability and allows to easily see if given header is already included. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/mdio_bus.c | 32 1 file changed, 16 insertions

[PATCH 08/15] net: phy: check the PHY presence in get_phy_id()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski get_phy_id() is only called from get_phy_device() so the check for the 0x1fff value can be pulled into the former. This way it'll be easier to remove get_phy_device() later on. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/phy_device.c | 8 --

[PATCH 07/15] net: phy: split out the PHY driver request out of phy_device_create()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Move the code requesting the PHY driver module out of phy_device_create() into a separate helper. This will be later reused when we delay the module loading. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/phy_device.c | 71

[PATCH 09/15] net: phy: delay PHY driver probe until PHY registration

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Currently the PHY ID is read without taking the PHY out of reset. This can only work if no resets are defined. This change delays the ID read until we're actually registering the PHY device - this is needed because earlier (when creating the device) we don

[PATCH 13/15] net: phy: mdio: add support for PHY supply regulator

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski Currently many MAC drivers control the regulator supplying the PHY but this is conceptually wrong. The regulator should be defined as a property of the PHY node on the MDIO bus and controlled by the MDIO sub-system. Add support for an optional PHY regulator which will

[PATCH 14/15] net: phy: add PHY regulator support

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski The MDIO sub-system now supports PHY regulators. Let's reuse the code to extend this support over to the PHY device. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/phy_device.c | 49 include/linux/phy.h

[PATCH 04/15] net: mdio: add a forward declaration for reset_control to mdio.h

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski This header refers to struct reset_control but doesn't include any reset header. The structure definition is probably somehow indirectly pulled in since no warnings are reported but for the sake of correctness add the forward declaration for struct reset_co

[PATCH 12/15] dt-bindings: mdio: add phy-supply property to ethernet phy node

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski The phy-supply property is often added to MAC nodes but this is wrong conceptually. These supplies should be part of the PHY node on the MDIO bus. Add phy-supply property at PHY level to mdio.yaml. Signed-off-by: Bartosz Golaszewski --- Documentation/devicetree

[PATCH 11/15] net: phy: drop get_phy_device()

2020-06-22 Thread Bartosz Golaszewski
From: Bartosz Golaszewski get_phy_device() has now become just a wrapper for phy_device_create() with the phy_id argument set to PHY_ID_NONE. Let's remove this function treewide and replace it with opencoded phy_device_create(). This has the advantage of being more explicit about the PH

  1   2   3   >