public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K
@ 2023-12-29 14:52 Ilpo Järvinen
  2024-01-03 17:31 ` Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ilpo Järvinen @ 2023-12-29 14:52 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, netdev, linux-arm-kernel,
	linux-kernel
  Cc: Ilpo Järvinen

Instead of open coding, use IS_ALIGNED() and ALIGN_DOWN() when dealing
with alignment. Replace also literals with SZ_4K.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/net/mdio/mdio-mux-bcm-iproc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mdio/mdio-mux-bcm-iproc.c b/drivers/net/mdio/mdio-mux-bcm-iproc.c
index a750bd4c77a0..1ce7d67ba72e 100644
--- a/drivers/net/mdio/mdio-mux-bcm-iproc.c
+++ b/drivers/net/mdio/mdio-mux-bcm-iproc.c
@@ -2,6 +2,7 @@
 /*
  * Copyright 2016 Broadcom
  */
+#include <linux/align.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/device.h>
@@ -11,6 +12,7 @@
 #include <linux/of_mdio.h>
 #include <linux/phy.h>
 #include <linux/platform_device.h>
+#include <linux/sizes.h>
 
 #define MDIO_RATE_ADJ_EXT_OFFSET	0x000
 #define MDIO_RATE_ADJ_INT_OFFSET	0x004
@@ -220,12 +222,12 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
 	md->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(md->base))
 		return PTR_ERR(md->base);
-	if (res->start & 0xfff) {
+	if (!IS_ALIGNED(res->start, SZ_4K)) {
 		/* For backward compatibility in case the
 		 * base address is specified with an offset.
 		 */
 		dev_info(&pdev->dev, "fix base address in dt-blob\n");
-		res->start &= ~0xfff;
+		res->start = ALIGN_DOWN(res->start, SZ_4K);
 		res->end = res->start + MDIO_REG_ADDR_SPACE_SIZE - 1;
 	}
 
-- 
2.39.2


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

* Re: [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K
  2023-12-29 14:52 [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K Ilpo Järvinen
@ 2024-01-03 17:31 ` Florian Fainelli
  2024-01-03 18:17 ` Ray Jui
  2024-01-04  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2024-01-03 17:31 UTC (permalink / raw)
  To: Ilpo Järvinen, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Ray Jui, Scott Branden, Broadcom internal kernel review list,
	netdev, linux-arm-kernel, linux-kernel

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

On 12/29/23 06:52, Ilpo Järvinen wrote:
> Instead of open coding, use IS_ALIGNED() and ALIGN_DOWN() when dealing
> with alignment. Replace also literals with SZ_4K.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

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

* Re: [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K
  2023-12-29 14:52 [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K Ilpo Järvinen
  2024-01-03 17:31 ` Florian Fainelli
@ 2024-01-03 18:17 ` Ray Jui
  2024-01-04  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ray Jui @ 2024-01-03 18:17 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, netdev, linux-arm-kernel,
	linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1884 bytes --]

On Fri, Dec 29, 2023 at 6:53 AM Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
wrote:

> Instead of open coding, use IS_ALIGNED() and ALIGN_DOWN() when dealing
> with alignment. Replace also literals with SZ_4K.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/net/mdio/mdio-mux-bcm-iproc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/mdio/mdio-mux-bcm-iproc.c
> b/drivers/net/mdio/mdio-mux-bcm-iproc.c
> index a750bd4c77a0..1ce7d67ba72e 100644
> --- a/drivers/net/mdio/mdio-mux-bcm-iproc.c
> +++ b/drivers/net/mdio/mdio-mux-bcm-iproc.c
> @@ -2,6 +2,7 @@
>  /*
>   * Copyright 2016 Broadcom
>   */
> +#include <linux/align.h>
>  #include <linux/clk.h>
>  #include <linux/delay.h>
>  #include <linux/device.h>
> @@ -11,6 +12,7 @@
>  #include <linux/of_mdio.h>
>  #include <linux/phy.h>
>  #include <linux/platform_device.h>
> +#include <linux/sizes.h>
>
>  #define MDIO_RATE_ADJ_EXT_OFFSET       0x000
>  #define MDIO_RATE_ADJ_INT_OFFSET       0x004
> @@ -220,12 +222,12 @@ static int mdio_mux_iproc_probe(struct
> platform_device *pdev)
>         md->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
>         if (IS_ERR(md->base))
>                 return PTR_ERR(md->base);
> -       if (res->start & 0xfff) {
> +       if (!IS_ALIGNED(res->start, SZ_4K)) {
>                 /* For backward compatibility in case the
>                  * base address is specified with an offset.
>                  */
>                 dev_info(&pdev->dev, "fix base address in dt-blob\n");
> -               res->start &= ~0xfff;
> +               res->start = ALIGN_DOWN(res->start, SZ_4K);
>                 res->end = res->start + MDIO_REG_ADDR_SPACE_SIZE - 1;
>         }
>
> --
> 2.39.2
>

Acked-by: Ray Jui <ray.jui@broadcom.com>

Thanks.

[-- Attachment #1.2: Type: text/html, Size: 2662 bytes --]

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4194 bytes --]

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

* Re: [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K
  2023-12-29 14:52 [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K Ilpo Järvinen
  2024-01-03 17:31 ` Florian Fainelli
  2024-01-03 18:17 ` Ray Jui
@ 2024-01-04  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-04  1:00 UTC (permalink / raw)
  To: =?utf-8?q?Ilpo_J=C3=A4rvinen_=3Cilpo=2Ejarvinen=40linux=2Eintel=2Ecom=3E?=
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, rjui,
	sbranden, bcm-kernel-feedback-list, netdev, linux-arm-kernel,
	linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 29 Dec 2023 16:52:32 +0200 you wrote:
> Instead of open coding, use IS_ALIGNED() and ALIGN_DOWN() when dealing
> with alignment. Replace also literals with SZ_4K.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/net/mdio/mdio-mux-bcm-iproc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K
    https://git.kernel.org/netdev/net-next/c/73b2e2e3fe26

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-01-04  1:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-29 14:52 [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K Ilpo Järvinen
2024-01-03 17:31 ` Florian Fainelli
2024-01-03 18:17 ` Ray Jui
2024-01-04  1:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox