Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20045527rwd; Wed, 28 Jun 2023 19:04:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4BuS48NnZ5eR3hhe8J6JUvsix4y3pF5bkWoYCz6Dn2nUnWoNWbFMiX6psDoPrLJnZGsSlN X-Received: by 2002:a17:902:ce8a:b0:1b8:d4c:725 with SMTP id f10-20020a170902ce8a00b001b80d4c0725mr10554944plg.15.1688004273329; Wed, 28 Jun 2023 19:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688004273; cv=none; d=google.com; s=arc-20160816; b=X8weYsQBkv3xQuCRQCnf4jxIz6KFbKKLcF9v/kjqeyxs9NuUFlc2GNXXONnOUVco07 y5JXV7D1QM7u52+t4gh0cBRQkFyOek2lEL6+42e4G87+i4hJS8yUXkuBSoYLg0b23Er6 +HIu1K1W3wowcJELbM1kC/JEcueb8ARXqJQKNHCgo1SC+w88jU8+uNXz3s3BGtKsy0DE QcNrGGgeSbmafRc3R697r5TOkgU6qt0BEsvoXmnvFbD51jC+OSnbyvxufxwZ/tdqdD8H m3byH73SQANbf185pZVaPXAOzmWQjveqa73tmn3DJEA6nYL9eUdKPe5sWrq1ACruofth QSAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc:to :content-language:subject:user-agent:mime-version:date:message-id; bh=X8oboqdwTcBUJLjJGoSdx03cg9YQuYUsZWn406T7qPs=; fh=eqmWIAtC5uTwpeR8wCt168WxUAMtTTAkwWh1fLOzp3Q=; b=WAV6yZ69PFvih65MvxqPbzR76ju6AUdro25F4iOWdHyppQjmm1U7jgoqenrjs141n4 BEooemvv9NtbQy9abpQysRZOKpQcRGFESB3Yp22tk0JyDDrkzaJOAykGdRqqRwo6Nasz zkD6nfST1VHKbQ6eLQJPC+BAhVZwxQ0Ax0GzxXOLqA0MORlK+pJX1mnHO987IlDHwtmn E5K019L+yfnI3QVTj8TXbYPq+FPUPiY27R/XNgv1rpYDbjM4H3hlYPJeLeVhftn4JCHy X5ynZIAvYktvI6/mGZ87EidiDaOwOusE1POkpq5yaKS4dMbumHp2DleojIW7Y4XBC1b2 XpWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id li11-20020a170903294b00b001b055bd62f6si9276317plb.431.2023.06.28.19.04.20; Wed, 28 Jun 2023 19:04:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231509AbjF2CAG (ORCPT + 99 others); Wed, 28 Jun 2023 22:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231714AbjF2CAC (ORCPT ); Wed, 28 Jun 2023 22:00:02 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 63D9A2961; Wed, 28 Jun 2023 19:00:00 -0700 (PDT) Received: from [172.30.11.106] (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 92556604A13F4; Thu, 29 Jun 2023 09:59:57 +0800 (CST) Message-ID: <325f00e3-1dfd-f77b-9795-6f89e44c0417@nfschina.com> Date: Thu, 29 Jun 2023 09:59:56 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH net-next 08/10] net: mdio: Remove unnecessary (void*) conversions Content-Language: en-US To: "Russell King (Oracle)" Cc: iyappan@os.amperecomputing.com, keyur@os.amperecomputing.com, quan@os.amperecomputing.com, andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org X-MD-Sfrom: yunchuan@nfschina.com X-MD-SrcIP: 180.167.10.98 From: yunchuan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/6/28 17:50, Russell King (Oracle) wrote: > Hi, > > I think you missed one case: > > if (mdio_id == XGENE_MDIO_RGMII) { > mdio_bus->read = xgene_mdio_rgmii_read; > mdio_bus->write = xgene_mdio_rgmii_write; > mdio_bus->priv = (void __force *)pdata; > > This cast using __force is also not required. > > On Wed, Jun 28, 2023 at 10:45:17AM +0800, wuych wrote: >> @@ -211,7 +211,7 @@ static void xgene_enet_wr_mdio_csr(void __iomem *base_addr, >> static int xgene_xfi_mdio_write(struct mii_bus *bus, int phy_id, >> int reg, u16 data) >> { >> - void __iomem *addr = (void __iomem *)bus->priv; >> + void __iomem *addr = bus->priv; >> int timeout = 100; >> u32 status, val; >> >> @@ -234,7 +234,7 @@ static int xgene_xfi_mdio_write(struct mii_bus *bus, int phy_id, >> >> static int xgene_xfi_mdio_read(struct mii_bus *bus, int phy_id, int reg) >> { >> - void __iomem *addr = (void __iomem *)bus->priv; >> + void __iomem *addr = bus->priv; >> u32 data, status, val; >> int timeout = 100; > These probably cause Sparse to warn whether or not the cast is there. Hi, Russell King, I didn't notice this Sparse warning. Should I remove this cast although it cause Sparse warning? > > Given that in this case, bus->priv is initialised via: > > mdio_bus->priv = (void __force *)pdata->mdio_csr_addr; > > I think the simple thing is to _always_ initialise mdio_bus->priv > to point at pdata, and have xgene_xfi_mdio_*() always do: > > struct xgene_mdio_pdata *pdata = bus->priv; > void __iomem *addr = pdata->mdio_csr_addr; > > The extra access will be dwarfed by the time taken to perform the > access. > > This change should be made with a separate patch and not combined with > the patch removing the casts in xgene_mdio_rgmii_*(). yeah, this change is great. I will send a separate patch as your suggestion If we can ignore Sparse warning. Thanks for your suggestion! wuych > > Thanks. >