From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com> To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com> Subject: [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K Date: Fri, 29 Dec 2023 16:52:32 +0200 [thread overview] Message-ID: <20231229145232.6163-1-ilpo.jarvinen@linux.intel.com> (raw) 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
WARNING: multiple messages have this Message-ID (diff)
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com> To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com> Subject: [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K Date: Fri, 29 Dec 2023 16:52:32 +0200 [thread overview] Message-ID: <20231229145232.6163-1-ilpo.jarvinen@linux.intel.com> (raw) 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2023-12-29 14:52 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-12-29 14:52 Ilpo Järvinen [this message] 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 17:31 ` Florian Fainelli 2024-01-03 18:17 ` Ray Jui 2024-01-04 1:00 ` patchwork-bot+netdevbpf 2024-01-04 1:00 ` patchwork-bot+netdevbpf
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231229145232.6163-1-ilpo.jarvinen@linux.intel.com \ --to=ilpo.jarvinen@linux.intel.com \ --cc=andrew@lunn.ch \ --cc=bcm-kernel-feedback-list@broadcom.com \ --cc=davem@davemloft.net \ --cc=edumazet@google.com \ --cc=hkallweit1@gmail.com \ --cc=kuba@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=netdev@vger.kernel.org \ --cc=pabeni@redhat.com \ --cc=rjui@broadcom.com \ --cc=sbranden@broadcom.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.