From patchwork Sat Jan 29 22:02:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12729668 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 4E634C433F5 for ; Sat, 29 Jan 2022 22:05:00 +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:References:In-Reply-To: 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: List-Owner; bh=89zFlR/txYyiGDC4bRQWbKjId7d2cLVhjnWIEB3JT+M=; b=NeU7hpJ69nfuIY jc0sKKH2tnvz4MuP5zm/QOiGv1HhkxlaVSg6Y3QxklNo7qfy0LCgx+xeAuQolGw6DvuLrMyOU7yv5 yob94jYWUYKCq5JpSmJBcflChbZx+P9OXBhXu9x+YJE7DKhjLyl9ygXQrMidTMrPgvFUWN9lDuaTw 4mVeWZywgdJX6a0nxuuwnrtHpFs9GolB6AItwBI1dvpxy7XMdFWnPr5di2WucJpTzVZuEt1Og83mb ovsqzquT7fUIg4166VkZD8R3vRievsfciPmul4xitfoz2I3TTrqY1KuqwRnRaFA06V6T7AJVDxyG+ 9159ZD44A+tLymyRwd0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nDvoT-005U2H-F8; Sat, 29 Jan 2022 22:03:17 +0000 Received: from mail-dm3nam07on2072b.outbound.protection.outlook.com ([2a01:111:f400:7e83::72b] helo=NAM02-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nDvnz-005Tls-FB for linux-arm-kernel@lists.infradead.org; Sat, 29 Jan 2022 22:02:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IoMLbdbj/VDNg26Fyz6aTKdTIwG6ll/7+3H69tFKLj7mYtRZyUV3TAWyqne6CI+tVBvfC/x7wcXDk5Ezv9OTzzWJwx6qVlr0HhyJVhR3G3BDYy3JeqQo7sw4ilW1e6BSzmCgsOl70sSGp4DbpuJi3CjmWAphwNF5tJzsbWHPz1JzvyDTfJq26IHHgJYvnhWhGAc1ViBQarS4Xm+9hnEuGZniD6o4ePVYeWMAd45AB35wnTEZ1bOgaqZyrwSGyTMg/bPY41qUDOOzNXeQarHyF9sDCouq6Qr4oQjDlZJN+MSMAptueqLaaV2cFfG11tSTxoxQqKMw9up5ycQY+/cFyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zGjLq3EG71sKZWvK0rp311nuL7IZ6E59fNj0zW6os2s=; b=Bivitk8ISFo8EHP0DlzR7/O7TgZoZKAEzzT8NjeQIy07DCZV4fvJOjD52NBOdmxD8YHGoYHOk8J8+FPnPEJhelOplDjUI/qxe6EOmrXedr4lsr1Wx/qBklC1sMluELTte2GZcOFxJfUYc5Nd3mTi3V1BhsnKGJ4scFhIA/vJ5iU+JSEkAvUDqadDZje4Grua7BeFCIDjs13hhLhzei+War7GdpsuEf8/QKfg4swuzClS4Vpmp9YjKZ05/Z/7rtcdfuKAooz5j4iLdYsokdUJV4Nel+Zj7O4xMJyFMssvbEcoqxAFe9s1OhUlrKzeQfQaDZC50idPEXCdc0FKOtDA2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zGjLq3EG71sKZWvK0rp311nuL7IZ6E59fNj0zW6os2s=; b=YDHCh6VKFPMvL8cXSp6av2HcSYsoLMLiE2Jn9ZsOA9+JTlfVzvnpgMKE8DDNup2PiMBcvi4c8szCQrD3Z/5S7gdUrH+kSGoMYDPLnmgMRfxY84eVgt5kEO+UtCW/YKlHfcEzMkBL7zKDdr1p9p7T6CIrAQah0uUgXrEgd41STjI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by BYAPR10MB2968.namprd10.prod.outlook.com (2603:10b6:a03:85::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.18; Sat, 29 Jan 2022 22:02:41 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::2d52:2a96:7e6c:460f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::2d52:2a96:7e6c:460f%4]) with mapi id 15.20.4930.020; Sat, 29 Jan 2022 22:02:41 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v6 net-next 3/9] net: mdio: mscc-miim: add local dev variable to cleanup probe function Date: Sat, 29 Jan 2022 14:02:15 -0800 Message-Id: <20220129220221.2823127-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220129220221.2823127-1-colin.foster@in-advantage.com> References: <20220129220221.2823127-1-colin.foster@in-advantage.com> X-ClientProxiedBy: CO1PR15CA0113.namprd15.prod.outlook.com (2603:10b6:101:21::33) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2da4c9f-a659-4668-e9ec-08d9e3731225 X-MS-TrafficTypeDiagnostic: BYAPR10MB2968:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hhHsWJcRbFYlQV+uraUNuECbl6wmh+nkprh3gzCTDI6cFFDPtJZ8glNBAFA4v9f1Z2tGmtxi5ikLUODkks+6mSK1b2ZhlaYDi3Y01xXNf7q2C3U5LGYl+rTrW77l8STYGO2E0MDYkXZ5uagZSHpO0wyNTDyfYEor6cJVcamZo3kdMjEwz759HRgWIacD87OVhhSbfMiFEj1AyL+Qsk2dfSZQpGyfJ0VP5bE7cd5XOb/aceQclC4jVHAeDax+4v8DN5fZA2sAfZyG2vzZvHNSmSOVtRi/i3/DoCzT8N5Do6I+plGOoQFux/VE0sTPq5W+ZuAaF1m7LgpMarQRSv1+ONstxtrHzKaxAU6QzFiXeUogidHKtCFweLbhPnX4og6VGYaRGujNK71AT8OwQYtKzhmZriR8ACdcOLZU7gtIIi+uvPPBJ3j81vb8GLXFgCP7SCtzTUO9MZRRF2RR35QDJ+Hx64nvl9lNQNn2bu4HA6OaKIXe7WAxGEh2OvvgFreB9kG/CYRcrtZDZ+7aLe4e6DGGVqI12DHMCHxZxrotuqE4uLJyjE2RxWhX/1LQyTTHJv/qR16SEtNM82PvBWy6Sn7bS4KcIfPAXliZxPLZHRtf2OcjEO3COE0Gf+v5NRRxCf8VxyXZze+M5EfivlEupqlaPKrR7J/frf/scDljAPKrVHvZ73ngL5vyKqYX7S+PvdhmppW4qQ0gdbEl9ryctw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(136003)(376002)(346002)(42606007)(396003)(39830400003)(366004)(186003)(508600001)(5660300002)(6486002)(1076003)(86362001)(66946007)(8676002)(66476007)(26005)(4326008)(66556008)(8936002)(7416002)(107886003)(6506007)(38350700002)(6512007)(2906002)(44832011)(6666004)(2616005)(52116002)(38100700002)(83380400001)(316002)(36756003)(54906003)(20210929001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rHT8vabJ+VlGaVcGuVhCOgNSHNW0kzhiKVUVHcogFb55gcCfpWIx5arCBIJMGiGmMxlTLQclbUQtUPeVhvbEKHyilnhIBuNHvQyRaKDPqC4oRcYvi9PXMGxidkKE1EOQ54jc0/W2+mo/kbCB9PuigqW4ZuknP3laQ/TjHBoBwkH3gl8VyWj1Q8FfYGbBxFDyVS5DKref8pckZssUl7hwRMrznaJLEpT0F8FDfSORC60lNxAuQAA1H1IQmuW6Tj/5EDXzwLtuFQX3sKohEsL2bXRoX5E/fEPmVxqhqKBr1JphSkV/EvIeUgXE5Gqnkn0+MzLzjqdYA3vcLZJa38sD99pKRv7NoByB8VwJAk4jXLWf6SmvpnNBrBmj776FwAyTi9czLJXHsWcKjbzGOHQ4OHYCvDR+qVTFig8v6J7k89IDPYbqRdZVkPRE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XYK1x2GYfad2BC5H5PgKkTP4RQ3la5j+ti8Qf3z2YYAdzsD9pl9qD0jhQpBHivlyIY4cqfnPXd4hWVpnaZpaR/wr61oQYJ53nROfzZvjhmFY9E4+zzqVTwAgWVhyp7croXOkl76AQEmQZEn4vi05NmEghxIjVbdFlULJuKtxg== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2da4c9f-a659-4668-e9ec-08d9e3731225 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2022 22:02:41.6104 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dyGDqQiBbKYwVer159VQTxlVxnDnNluoDqLeQ6bl3SpL9ZHLVKeABvj8x0iFnJP03VzT8WcdZcP+AfUTwnFUr+vTAC8NwW73leW/DsA2PzM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2968 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220129_140247_542444_6384A261 X-CRM114-Status: GOOD ( 13.74 ) 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 Create a local device *dev in order to not dereference the platform_device several times throughout the probe function. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/mdio/mdio-mscc-miim.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index 7d2abaf2b2c9..6b14f3cf3891 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -220,6 +220,7 @@ EXPORT_SYMBOL(mscc_miim_setup); static int mscc_miim_probe(struct platform_device *pdev) { struct regmap *mii_regmap, *phy_regmap = NULL; + struct device *dev = &pdev->dev; void __iomem *regs, *phy_regs; struct mscc_miim_dev *miim; struct resource *res; @@ -228,38 +229,37 @@ static int mscc_miim_probe(struct platform_device *pdev) regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(regs)) { - dev_err(&pdev->dev, "Unable to map MIIM registers\n"); + dev_err(dev, "Unable to map MIIM registers\n"); return PTR_ERR(regs); } - mii_regmap = devm_regmap_init_mmio(&pdev->dev, regs, - &mscc_miim_regmap_config); + mii_regmap = devm_regmap_init_mmio(dev, regs, &mscc_miim_regmap_config); if (IS_ERR(mii_regmap)) { - dev_err(&pdev->dev, "Unable to create MIIM regmap\n"); + dev_err(dev, "Unable to create MIIM regmap\n"); return PTR_ERR(mii_regmap); } /* This resource is optional */ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (res) { - phy_regs = devm_ioremap_resource(&pdev->dev, res); + phy_regs = devm_ioremap_resource(dev, res); if (IS_ERR(phy_regs)) { - dev_err(&pdev->dev, "Unable to map internal phy registers\n"); + dev_err(dev, "Unable to map internal phy registers\n"); return PTR_ERR(phy_regs); } - phy_regmap = devm_regmap_init_mmio(&pdev->dev, phy_regs, + phy_regmap = devm_regmap_init_mmio(dev, phy_regs, &mscc_miim_regmap_config); if (IS_ERR(phy_regmap)) { - dev_err(&pdev->dev, "Unable to create phy register regmap\n"); + dev_err(dev, "Unable to create phy register regmap\n"); return PTR_ERR(phy_regmap); } } - ret = mscc_miim_setup(&pdev->dev, &bus, "mscc_miim", mii_regmap, 0); + ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0); if (ret < 0) { - dev_err(&pdev->dev, "Unable to setup the MDIO bus\n"); + dev_err(dev, "Unable to setup the MDIO bus\n"); return ret; } @@ -267,9 +267,9 @@ static int mscc_miim_probe(struct platform_device *pdev) miim->phy_regs = phy_regmap; miim->phy_reset_offset = 0; - ret = of_mdiobus_register(bus, pdev->dev.of_node); + ret = of_mdiobus_register(bus, dev->of_node); if (ret < 0) { - dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret); + dev_err(dev, "Cannot register MDIO bus (%d)\n", ret); return ret; }