From patchwork Fri Dec 29 14:52:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 13506549 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5CB01C46CD3 for ; Fri, 29 Dec 2023 14:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=IpJVYlYIH97zq5KGp/xjVbZxQIGdVsJ4ZDbyUSdrY6U=; b=OWzX6mMdb4rXvA ZutS8A+xafyjzw1xBwjv2ZkgZn0Nhzh+pDDWmXyVPbPCcXRFNDkp9V4VgOhwRzyu9tJS5L/FduLE2 ctRD//FTnMq1J+Rfv5KIk/0T7jAyZjCH4CuENon46hfTLnWKlepWxutHPpiEhFRGqt4hPFLDprcgT vTd7GtkvVekLzh6s4/F/OIkJroA7EThlEHHaIwxQsWnLuu8eeYs2E6sxrN/ZzI+SEjLB7Smr38QEe C7VoD7fXDK8wI7CM7vPICy4dfAHG0niVrWh3ujs6Jn1mKd/KfnuYj6Icx6n6xb61HhXLtyCahYb++ JQKwMDdHMW0u3VBPrhNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rJEED-0014fm-22; Fri, 29 Dec 2023 14:52:49 +0000 Received: from mgamail.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rJEEA-0014fE-17 for linux-arm-kernel@lists.infradead.org; Fri, 29 Dec 2023 14:52:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703861566; x=1735397566; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=jcb3d1Eurdn7JoSDwWMgzToJsi8wV219/OcIstMM8H4=; b=lf/g9/gZoFV4pU5Wje16rB7H/hC+ele2ErjiUn0+aR2NsQV3dWqUzLSd pKKV5lOz10kIqBMDx+lhQHmJdfFmYAtAZjT4EhpXKip+XvKAyyLjilrMr nYpEKbRRvcAZ5nIAuUz7wDtkM/zCrue942MzkiJ27Hp5Wy/2BnZg5Ivex IoCU1xF/qJ4fJSwRzVOPJ3rgEX/05jRctIvsz1lEMHkqhG74PyKuQ64hV To7AwslrBA+zvt27vWpCIMKQB90GJP+TzkR596JS+wLmpkSffDQYXp/sP FlSpUi2OYTcq4tkicJYeIijOvS9jCDGjVZv7dxo0S2sZV6ky6ph6ArSN1 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10938"; a="396379426" X-IronPort-AV: E=Sophos;i="6.04,315,1695711600"; d="scan'208";a="396379426" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Dec 2023 06:52:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,315,1695711600"; d="scan'208";a="20888995" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.246.48.133]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Dec 2023 06:52:39 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= 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@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K Date: Fri, 29 Dec 2023 16:52:32 +0200 Message-Id: <20231229145232.6163-1-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231229_065246_398692_6E4D12BA X-CRM114-Status: GOOD ( 14.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Florian Fainelli --- 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 #include #include #include @@ -11,6 +12,7 @@ #include #include #include +#include #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; }