Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp345489pxb; Tue, 1 Feb 2022 00:47:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzo5mJlKjHlQ0nM0IWe99SgkhFiek8jofXevJq8fX3eftA9LOk8q6e3pW5cdcFoUPEHJfiE X-Received: by 2002:a17:907:6089:: with SMTP id ht9mr19697244ejc.612.1643705268241; Tue, 01 Feb 2022 00:47:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1643705268; cv=pass; d=google.com; s=arc-20160816; b=TItU7OSvRukYZET8HUBIkBeVk1mOHyvYCM2dp8EG2UfT1S5hyLRO0ocB35jCgD3Hzj GoRdvTyL33xCVBXbjsYjxvLdgbkWSWrx1gHTs4luxcZPk4qPQZQsaMjlwEK5VqAt9Pna yV8PsKOLYw+0bmd1XCGSVra7bwKRHAtjF/hg/xmc02jdSovKAmbwlHpeT1d94fEcJkbT bs8hUyZazGJStE/jsjnVXPRAB9aLMznoCKkKLzb5WEqXF+tnKFxfZlZJfgvVVKPLgnKZ RSt96RU1sM9coUvNUYFtqohFN7np8A9RjFo2b/966FVA6UfjMfRAY9zI7/2P3qZ8h4c6 Qskg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zGjLq3EG71sKZWvK0rp311nuL7IZ6E59fNj0zW6os2s=; b=JqEGl2kNN73d2gyiTZhuvCOT208/T3sa/sGLuS9M76D4TT6EIcTxcDNoj9Kwekp6lQ imnSDd/7yMQ8pbmVlUiriM8n17mgdo6Oe96f2WqRIHB3/SgbyV6VjByGVgQX3DNtjtav zAM7o+NFAozCkJM8Atl2Em5ypEIUFQJ+6IHh5O0p2Zc9idirLnxQovMzjZbkxFeeLA0c f+GhVM23Kt/3xkq645KLcA9AgJ9xBTjHZAErktr4gI/xE8yb1q+jHAZy4fOjPZH2kfRV pqoZBUHPhIWu3U1qaMEOKVEkK6r0cIMbt8vbAxMqJ0MhVQsqUvgRfNuouL+cvrz0YvNL pbhA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=YDHCh6VK; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=in-advantage.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt22si9047132ejc.562.2022.02.01.00.47.23; Tue, 01 Feb 2022 00:47:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=YDHCh6VK; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=in-advantage.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353361AbiA2WC4 (ORCPT + 99 others); Sat, 29 Jan 2022 17:02:56 -0500 Received: from mail-dm3nam07on2115.outbound.protection.outlook.com ([40.107.95.115]:64192 "EHLO NAM02-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353296AbiA2WCo (ORCPT ); Sat, 29 Jan 2022 17:02:44 -0500 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> Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: =?us-ascii?Q?rHT8vabJ+VlGaVcGuVhCOgNSHNW0kzhiKVUVHcogFb55gcCfpWIx5arCBIJM?= =?us-ascii?Q?GiGmMxlTLQclbUQtUPeVhvbEKHyilnhIBuNHvQyRaKDPqC4oRcYvi9PXMGxi?= =?us-ascii?Q?dkKE1EOQ54jc0/W2+mo/kbCB9PuigqW4ZuknP3laQ/TjHBoBwkH3gl8VyWj1?= =?us-ascii?Q?Q8FfYGbBxFDyVS5DKref8pckZssUl7hwRMrznaJLEpT0F8FDfSORC60lNxAu?= =?us-ascii?Q?QAA1H1IQmuW6Tj/5EDXzwLtuFQX3sKohEsL2bXRoX5E/fEPmVxqhqKBr1Jph?= =?us-ascii?Q?SkV/EvIeUgXE5Gqnkn0+MzLzjqdYA3vcLZJa38sD99pKRv7NoByB8VwJAk4j?= =?us-ascii?Q?XLWf6SmvpnNBrBmj776FwAyTi9czLJXHsWcKjbzGOHQ4OHYCvDR+qVTFig8v?= =?us-ascii?Q?6J7k89IDPYbqRdZVkPREK6cGt82fmmi2aCvQPHFI/sWyg8w6GLS+ItdL4DCB?= =?us-ascii?Q?ARF4yK55hN8CuKrF6Kievdi8+jNRkrNNVrLQ0K3vxflBkmt3LmuK4zxrwAec?= =?us-ascii?Q?2fweTrqE1xr4p4b3MOfHUpWzrz3GDFHBNnzXS3SAwA9ZUs/MhFMCPMQcz/nK?= =?us-ascii?Q?2tuE+7H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8R+t34bq?= =?us-ascii?Q?ieNP1kIGUyP6mavLUXYK1x2GYfad2BC5H5PgKkTP4RQ3la5j+ti8Qf3z2YYA?= =?us-ascii?Q?dzsD9pl9qD0jhQpBHivlyIY4cqfnPXd4hWVpnaZpaR/wr61oQYJ53nROfzZv?= =?us-ascii?Q?jhmFY9E4+zzqVTwAgWVhyp7croXOkl76AQEmQZEn4vi05NmEghxIjVbdFlUL?= =?us-ascii?Q?JuKtxg=3D=3D?= 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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; } -- 2.25.1