From nobody Mon Apr 6 23:10:25 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE763C433FE for ; Wed, 19 Oct 2022 06:37:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229776AbiJSGhv (ORCPT ); Wed, 19 Oct 2022 02:37:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbiJSGhs (ORCPT ); Wed, 19 Oct 2022 02:37:48 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CDE96BD4A for ; Tue, 18 Oct 2022 23:37:47 -0700 (PDT) Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MsgvZ3rPYzJn2B; Wed, 19 Oct 2022 14:35:06 +0800 (CST) Received: from huawei.com (10.67.175.83) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 19 Oct 2022 14:37:45 +0800 From: ruanjinjie To: , , , , , , CC: Subject: [PATCH -next v2] powerpc/mpic_msgr: fix cast removes address space of expression warnings Date: Wed, 19 Oct 2022 14:34:14 +0800 Message-ID: <20221019063414.3758087-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.175.83] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When build Linux kernel, encounter the following warnings: ./arch/powerpc/sysdev/mpic_msgr.c:230:38: warning: cast removes address spa= ce '__iomem' of expression ./arch/powerpc/sysdev/mpic_msgr.c:230:27: warning: incorrect type in assign= ment (different address spaces) The data type of msgr->mer and msgr->base are 'u32 __iomem *', but converted to 'u32 *' and 'u8 *' directly and cause above warnings, now instead of using a type cast, change the size of the pointer offset to fix these warnings. Signed-off-by: ruanjinjie Reviewed-by: Christophe Leroy --- v2: - change the macro of MPIC_MSGR_MER_OFFSET to avoid type cast and simplify the fix --- arch/powerpc/sysdev/mpic_msgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msg= r.c index a439e33eae06..d75064fb7d12 100644 --- a/arch/powerpc/sysdev/mpic_msgr.c +++ b/arch/powerpc/sysdev/mpic_msgr.c @@ -20,7 +20,7 @@ =20 #define MPIC_MSGR_REGISTERS_PER_BLOCK 4 #define MPIC_MSGR_STRIDE 0x10 -#define MPIC_MSGR_MER_OFFSET 0x100 +#define MPIC_MSGR_MER_OFFSET (0x100 / sizeof(u32)) #define MSGR_INUSE 0 #define MSGR_FREE 1 =20 @@ -234,7 +234,7 @@ static int mpic_msgr_probe(struct platform_device *dev) =20 reg_number =3D block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i; msgr->base =3D msgr_block_addr + i * MPIC_MSGR_STRIDE; - msgr->mer =3D (u32 *)((u8 *)msgr->base + MPIC_MSGR_MER_OFFSET); + msgr->mer =3D msgr->base + MPIC_MSGR_MER_OFFSET; msgr->in_use =3D MSGR_FREE; msgr->num =3D i; raw_spin_lock_init(&msgr->lock); --=20 2.25.1