From patchwork Mon Mar 7 02:11:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12771076 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 B9328C433F5 for ; Mon, 7 Mar 2022 02:14:41 +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=2+9oZ3Mzj8qi+eleX9RR4PbzQKBN6NjZCKBW/x5sRUs=; b=pLcTmAnhPGS8UO 0ya9FtCpDo94WeC081jNwud1uWeUUNhX0UCM9UeSEtyvHTtsTOyPTkatVAT61FRCzInJxpqPTUJuD OLLiNjZqVvuLTHPJAMzgtA43k8+bttrgjYjEPKh1JXOtJhvMQCOKis0qP7qiPxjapMah5h3ln4esM ZtwNBBSs8eBBWw3xlpkmiQBQzI4M0YP3JK/m4gswRrXQhwsCaU9VQ64fv4MUHykDhY+k9/vDVVuY+ qUeDDj/a0PqWmNfrzaztHnnVP8FarIYTlZvaPnHuDqJuH5AulB+jW4YAsJ9mf51/fUqKLaFkydtPJ Bo4YKljnGeLkBdElMvzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nR2rz-00FXda-Sf; Mon, 07 Mar 2022 02:13:08 +0000 Received: from mail-dm6nam10on20705.outbound.protection.outlook.com ([2a01:111:f400:7e88::705] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nR2rS-00FXQH-75; Mon, 07 Mar 2022 02:12:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FnzHehcmdC8U/zZTstQSuynN4gzvj62tk6BdHGryYVSmG8krXkC3Bx48GsBxQSTytrwMZE9Zm9x4hTUNZlgJ6iuhY7Wuui5bq1xWjYvSBNOIMDPxxps8RVR0qKVLNDtcnJHvfc2ePKckuHfuspq8U2PX8M0rLrc/VGMQDNHZMi2FCe64bM6OsdBOBVjC0dNJWLTlrnzKnsHDnv6AkomRi4IPGXNnXxh1dodCTUv0P2hwAAO+KWXtCHjVOEBBAy71pUGwLZ6RHGF1kg96DpRrKbEtVLMRWDEK6wda1AzO3rrX0KsyN5eN4/ktkPSXo+ocSzVmX6gUc1VoyLA5ijw8Sg== 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=/K1s/Dm04W43wHJPNqg5IK7S3EBNyWBB4vfeO/rfC3A=; b=ETLURKINM5dROF7bVAITylzYAHrBFrXUc0xfYI1ta3E1go+XbsOmYAoqJouU9sC4cHirnAvOyXFolR6hj+/bENZv/0wyuUBMi8y/HJ3Rt+g8BU7C/hmQ/UlUhBEKSa45FgNtZLoJvhAtAW4lS+dmpf3cXSRurrbsE6I3biG7Pnph2jLZ7ZcBgaoiCrZYgAqN6rvr8PU3wqFCdUBRgY92jZ+oA358KRkgy9+6eCGBof+PgMBtbJ+jRqMh9k66qFItioPTpczR+LbxNeGA7znWEAOe1rHoTFdtxjjZNaNFZk4LOeOZYNoa5TybP/hBqQd3wT39y47+iyPXYyoOkj0dYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; 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=/K1s/Dm04W43wHJPNqg5IK7S3EBNyWBB4vfeO/rfC3A=; b=dnn3DxnaGrfwi9Q9M7uowsf3Bl18cnFcq81cbRoJmFIfSwSOMV8+9+qZ63Qnb2gvmbT76U878nL5JLlkMN72Npk9zznFY27FrVCiMFsCL9Gv1BlOWA9w1/oYKIEBQvgaK5uIl1ObfrsBtppuhy+WkKDxECzxv7YvyFkX0PvjfQ4= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:26 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:26 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , 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 v7 net-next 03/13] net: mdio: mscc-miim: add local dev variable to cleanup probe function Date: Sun, 6 Mar 2022 18:11:58 -0800 Message-Id: <20220307021208.2406741-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: 765ae18e-23db-4662-41f4-08d9ffdfeca4 X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xxjI0uwCQwbH+6loqTAmTRcp5v7H058x2yRw2I83iQJtae3mha9cOmXFlW96Dj9hQ7eZn880LC2FUZ6AvHmwpVVfQOYU6DrPzn+8qhfPEJrDTsg2r/I568Eyi/CYcf3un8rfStebgPPv2d+X0mmU3cs6yH3U6s0v1MSjd0dH56Ini1Z6Zm0zs+Lty28M4kg/t29fJtAi1lA1y4sCunK/vTaCLjL8wt3oPMJ6tFn3wGMOYGVk3QPGklywr5Ad5Tqqk5a3dCbODndTzxWVQJnZ1duyKLK0ZlNPRHl/+ycnpbNTl8x+kAEJk1frGBbn+NQqmf66bZpnBpfytaq0tyfJD0nQGxx2+sOYli6wvZUsE4nDaX5woesnmCy1xHv3aE27Krgvx8WFungohEru7fsxlyH2k6mDoMxs/N1lL+LD3QelQDAdHoanBuCGFDCAmZAtikiR/EO28EpGIRMBk2Y8RpHlu0ko47lZhEd/ZqB9BStNbEm8UbvmG4CAmOvVr50jf/z5VkXSoAO9wgzZtR8/NkZtJr+06DJKsAVqY/OnXXisfda6J1Za1vdQ7Z/gj6O/mSIyugUjxmhrpYtlFNvprXtG0K3Fl4AqcvBN5ctyPWSxvhFpHIj9oTlkyYpMyicA0cT+ODF8vUCx/MZsKWSqSNUSI+XobiwUOo9HgJU/WsQXabhQsBY9ZgPYyT+3HSCkzupogFncF1Xmx66EwHXtLw== 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)(366004)(376002)(42606007)(396003)(39830400003)(136003)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 68KpFdEOqHu6O3pEFNj+6pyzW/eHykfVOyhwdQSk/lVgtPOQWj+x5+5nufaAjlF+3AgBaSEz/JiwW5LN+XduFzXh8JKZaajwiaQNQeUep7wRxul0v70nMQ8r/sJmU0w0nQH8bJ+/fmr0l19mX3aegBU4tIL5mX8AO7kbV9srCYH0uRONQQUU2OQ1EIHv3FhgnUdnow1MmRtbqjYC0h+wqm495AGYXkh37MdeRBMHV30Ke1uKEb9Cka6vz9T06M7o9S1MsQeok6gL0WIIPI1f8VjkKeF818cEkbatVn1z/boBtoND0WiNWelwGJzo38Wm6ejdruPEbVnQQYhXoWVtrshQSbIdmD31j2YaCqOofJJEE0b+JCWo8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MHc4UG5mKbMTb5NBHnQJ8WFsXbjhz+gLD3ynYm1p0pSecwb4LemVuYp/y+11MbgTHFE7h/628KFepFRC82yXtiaWFk3lYFOZdQDX98jkeNM2ceSiP3YTGIGfhfOCGBREmlZ7ZDscya3EvsMROtutKlDUaRgVrIIXLXY0CMUOCIjWCUViVl29oy5u+ntYfTMQvM2pQTUGSQY5dnHQQ== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 765ae18e-23db-4662-41f4-08d9ffdfeca4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:26.5269 (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: io9JRYeymQD3I9vkON7qql8QtV58FJGCAfN6qOsDz2IAT/ganyRwEI8mrcz8rcboPWXFkWRrQa3bALe/3cahOaCb7+JjY7WwqoCgXtLJbO0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220306_181234_285168_C904567E X-CRM114-Status: GOOD ( 12.86 ) 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; }