From patchwork Mon Oct 18 21:54:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12568147 X-Patchwork-Delegate: kuba@kernel.org 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8451EC433F5 for ; Mon, 18 Oct 2021 21:55:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6EC3D6108E for ; Mon, 18 Oct 2021 21:55:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233553AbhJRV5R (ORCPT ); Mon, 18 Oct 2021 17:57:17 -0400 Received: from mail-db8eur05on2080.outbound.protection.outlook.com ([40.107.20.80]:24544 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229529AbhJRV5Q (ORCPT ); Mon, 18 Oct 2021 17:57:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IJDA1TeVhx+0Tdt+txGcwgCZWu9sNn60ihNTFWXhS756mBSDTDlAzOKVhenQTWAvL+bjaDVCvNFiFh6fUxL7E5QF6bJIjKZLFc9JQZ1LacFpnmOz+3lYG4yzeZvESsFByRFwxn/nVM5260e6MF9QuoaxbANM0thCeeuZXaP6vCangS4rYVAtGBX0qGzYWhYGZcrPSHWchJyKwVKyEnfHQroWc7D4LBhSIc9uoR04aM7g2arwgrGUGpccuuSslNkToTkraSCm1MujXOzWSY/cFFDWvd9DHwPGKS0dMRM1X3q9umiqzTzfpfWOuwUALZ2ca6CMe3XKv80SAwapSz0hSQ== 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=YaNqg4SLqEbF0k6uAvpxThwQVIK9te7xE70uEeTzfL0=; b=hwyUnj3hZUMoUDbf7fFCOz6GjqU8UZWcv+PrfTGZsd2U/660wptcmFQRIOkXFLxsArB2XQV78R6xoL2puiclQLmW2JwhNIpyMqdqrK/LEJTByPXQEul1w8EW68nUqxFcX5s+iYYY6GfamrIeyLzICQxfRfUCmr7rsSqV+V2xjbt7Hat+nclM1l3f5usTKdRhLjk4gysQiw/zeNYIiOGlLfPvvbxvPPXxEW/t5SQxMDy9uxc13ZkVVq9kqIJ09ZLMGA/Pm/oykU3Z8MY1OziRpraxg+hiXsBwWYevS+Cu1MT/5TKgs8/1/3IZ+T1Fhvi6vzJHmT9K8AWdvXIms05d5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YaNqg4SLqEbF0k6uAvpxThwQVIK9te7xE70uEeTzfL0=; b=eYaP9fYU8Cer9kSqg4wLaNsDHe31VIEXF+c4EFp2lQfY+u+mvdxJDa/0JAmkP2RmgIKkqjOUggO6KQDbpiSsfNdmx+v+bN1pCQ5FiA44UM/N+mmRE5VEw6SzQOTztirMTCkwl0e0J35CS61yfzPdkBfemsIOUZRjinvRXZS+/6c= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (20.176.234.91) by DBBPR03MB5366.eurprd03.prod.outlook.com (10.255.79.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Mon, 18 Oct 2021 21:55:02 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf%6]) with mapi id 15.20.4608.018; Mon, 18 Oct 2021 21:55:02 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit Cc: linux-kernel@vger.kernel.org, "David S . Miller" , Jakub Kicinski , Russell King , Sean Anderson Subject: [PATCH 1/3] net: mdio: Add helper functions for accessing MDIO devices Date: Mon, 18 Oct 2021 17:54:46 -0400 Message-Id: <20211018215448.1723702-1-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: MN2PR19CA0003.namprd19.prod.outlook.com (2603:10b6:208:178::16) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 Received: from plantagenet.inhand.com (50.195.82.171) by MN2PR19CA0003.namprd19.prod.outlook.com (2603:10b6:208:178::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Mon, 18 Oct 2021 21:55:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 49a1bdc4-d292-4fd5-4d76-08d99281effb X-MS-TrafficTypeDiagnostic: DBBPR03MB5366: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LIokGSpRCdZTD+RxOoU75IsxuT2vE3EY5bFAyQ31Zw8h2iSXx+mO/2EIVIGcJ9uHxK/tABH4aqgPGYoBxWjuyGfRFXJ/IP2uuTThX9D7xEYbm9HwNgVyqbhWoLnaNX/kvr0Gix8dM0Khhwrme0sysEHCf340RJQTZFZiLOWwYtKo+qOpmXEfd3pe9JQl/HO1vY1o6SnKn9cuqfRsWXexKGzb9bQoxp2mDdVHa+NoJ3wAjTp6Bt7NXH71Wl+h0cPp3yOVlbJgh/HLyWWqTx842Rg1tasF1ECvPWQ+9bfMH/Ydnycf524Eza+6IQVMHpuHgPz80oQq6kXzmDjmRfyJWEtemlkWV0TQy5pF5YC1NJw5W8FffksvvoW47cM05qlNgb1EicLaZ6bkpXF2PwF/OzMikrXasPoLDOAgBsTKtxtqMihp3R+3VvnJP57Pr2zGT5F4gfyTa2YX8jGWhbablgyusggH/7BTNydP28ea/AVA/a5Xlxs97kVgtKQ/tzlDp+vpDFiwUHA7Mmmly9VyU9TRWexNzM1ljHU2iiS3WxG7+oe7Ewkmgd+RMhiInUHXAVVE0S4hI9UPO1ZjV+KMFqOHAB3KqBx+4Xqu/fx299GgxE7c9k4o5V1DEoOyydYXKYOGAv3akEBvcLPf+7Ld2Lh4G1YnlXjgv/LzaOPk2FzQKIOuDXNXOSFlVdJ/je9nR4ku+x4PCNNXfPA7HS1SFBIhf6gSguVHn9fRXNUtgFlyS3QNCV1u1oXNxabbLGKyX0ScnnEB4YOYkFvRSBNmlOFBvMCkPkC+996ntkHelSI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4523.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(5660300002)(83380400001)(52116002)(6512007)(186003)(1076003)(38350700002)(4326008)(966005)(110136005)(6506007)(8936002)(66556008)(66476007)(107886003)(956004)(6486002)(2906002)(8676002)(86362001)(66946007)(44832011)(6666004)(316002)(54906003)(36756003)(26005)(508600001)(2616005)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: esGudIiGy/XxekTdhxerP9pVHkWglB0S5abbKYTF+fSidQoenk0t0tDM0FSGlMvhFdWN3uLV/eMszKj5GgzcyunbFVqu3Dtu1r0nc+mplNX9xD3HJ1NG49+uo1d88UN4COq+aYgmeqB3fXGj4yST/tBwJDi3Ug9Y85Y131pd9SnGU0Z0uWZJrIC+Xp6lVam4vRQnO5OYwWmrF3O80wQ58l80ifGzExrWG4hMEHnqg2o4Ely1t+wQ9DHMR4m8CQgxROx/sBf4flWj6bK3iP+qqaLhG8XU1+j7aQuPsbsf8HXOxe4ExKfyJP3f/Z0m1SdkJ3Urs6DbrzzRbBEYms0+Ul0x9qBbP4fTm6VaUHNDlCz+bg+nO0CVbMpNkizmSa/rpl7Uzl7w6uIfTETIeEGqT8cKs5XOC1YGMH5ucSpbRmkhiE8BSxV/b2+paTQBCWMzwGuxU8mQmnUrMZBIZs8CL5HxJw0zV7quXZ9zphRItyBNTKwVYhF3wrBS6dK+Ecbaq4LAEEqUClRgzuPj1+nzkKIiTEr4h+eXwoZz/jOGWnFsi7v5Y5OLIAtrC7iMdKvokgyLH3aCB3mPK5m/69idVOZDjuI2baPFrZgcuDx9+oFj7qUb6yfS09axyF2gNuviTaH4M07aF0jFmPRIKf5rjtvp1o7AYJcgmLs3redoBTySwK07xlr56GwA06enIxOFz7t+dNs2M81YgFZPZAzdPQ5gcjpCx6Da1qCC+aKlMz8/g7JdyDnVSqc3GCITfhhhTs5bclXog77bxE3gC3PiSvISX0hoIJ0BtXCfUf0RtGicGpn94UKEBWSt1+ZHPVYmSswz3GLOtxkAOKBg5du7trRAe/lAP9vRjQ2GbTcNy9Gzxwwd2JxFoTSLP7DpG0K0n+ntaGuTq7wwblIuJUdfm4kPvKzUpiTfajL5FDlVB5rnXusTTFnY6lMKLUhNgndIr4/oMx2wwERr1tRtM7KU9fZsnE9xPvx3f4YbBP7roDVU4gPHvRJTrndgU0xbUF5MDx5KzY3J8j9qhFG22MBCayauUOo3d/P2N13HZ2leVzvwWFRI1IN46qCTzkxU1jvazba2bYJnIoZ+7aa+4xDXhIktnrIIEToy8zMbfuB06z6MKorlYBKdPJ0FSsKtNOK9APVtaUHysMY/PAjU0+ji/La7H4BNNBPuSX0VSZI96HCii8tc/FZhFQNNLG00rxJ4ai4D7v3bTWHqZ+rAajiKiU+7qseXqLETgr5BFnid/xfO/r5p8xUlC4VZMLfZUGjzDbLFfjmIwCFvScQMglIIl29Lc43ll+VOl3I0+J59r0T9LxueUJaHLtYIxPrUsNIS X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49a1bdc4-d292-4fd5-4d76-08d99281effb X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2021 21:55:02.5995 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kKDj7K/UiMNfIQ3KtP8eUWBLYPDDzfJ4hi59GH7Rn+fe/qvnzMGkh29g5y3raGXPi24fYiI6oBjzNG7aLKWr/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB5366 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This adds some helpers for accessing non-phy MDIO devices. They are analogous to phy_(read|write|modify), except that they take an mdio_device and not a phy_device. Signed-off-by: Sean Anderson --- This patch was originally submitted as [1]. [1] https://lore.kernel.org/netdev/20211004191527.1610759-15-sean.anderson@seco.com/ include/linux/mdio.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/linux/mdio.h b/include/linux/mdio.h index f622888a4ba8..9f3587a61e14 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -352,6 +352,30 @@ int mdiobus_modify(struct mii_bus *bus, int addr, u32 regnum, u16 mask, int mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum, u16 mask, u16 set); +static inline int mdiodev_read(struct mdio_device *mdiodev, u32 regnum) +{ + return mdiobus_read(mdiodev->bus, mdiodev->addr, regnum); +} + +static inline int mdiodev_write(struct mdio_device *mdiodev, u32 regnum, + u16 val) +{ + return mdiobus_write(mdiodev->bus, mdiodev->addr, regnum, val); +} + +static inline int mdiodev_modify(struct mdio_device *mdiodev, u32 regnum, + u16 mask, u16 set) +{ + return mdiobus_modify(mdiodev->bus, mdiodev->addr, regnum, mask, set); +} + +static inline int mdiodev_modify_changed(struct mdio_device *mdiodev, + u32 regnum, u16 mask, u16 set) +{ + return mdiobus_modify_changed(mdiodev->bus, mdiodev->addr, regnum, + mask, set); +} + static inline u32 mdiobus_c45_addr(int devad, u16 regnum) { return MII_ADDR_C45 | devad << MII_DEVADDR_C45_SHIFT | regnum; From patchwork Mon Oct 18 21:54:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12568149 X-Patchwork-Delegate: kuba@kernel.org 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20CCCC433EF for ; Mon, 18 Oct 2021 21:55:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06A456113E for ; Mon, 18 Oct 2021 21:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233527AbhJRV5U (ORCPT ); Mon, 18 Oct 2021 17:57:20 -0400 Received: from mail-db8eur05on2080.outbound.protection.outlook.com ([40.107.20.80]:24544 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233407AbhJRV5S (ORCPT ); Mon, 18 Oct 2021 17:57:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lD3cToVfzFIdtbySU2PRHVlXMa/jpzrMNbcPVjRC3jr4jMr+Km9HQ0bBwzHo7T8RszCI2YDMvDble7zSxNb2uEEeFBwvsjA4Se2d8TFxsigYfD8KQSKCsdEXIPpHyTp/a6RAupMPGLWvWFxkZOYuiR8fTGtPnE9GMYMfBN74eCl86hjFk+JZz2qDRQBizZ3Bm8j/WWXYXv8RRLLJWvwz+zj/UL63e4qmznqUk9xv8ST2THHcyRzE1VaL0s9yoJVQTuY2xgXicar1kB0HIP+R03rzQGJ9NXmk3f2KmQjX90Pn646XDmEIy8/UTLW2WFV22v4voFm2/9sG8MrPZbAnPA== 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=bU4K09rciqwffmaoxf4ZNC7E8WLgrHeGnP/qgo8aG9k=; b=N64amIQB0RHkWz7A6a8f7Bnr8M5MRn2JA5UoRj74j2qc3XklHbrju6rylpHofviPtzMXj2/Utr2Ww23dVah8dH4j9j2ewGrS15C4lkkI+yBAy88op5o0IaBh2he6OL8cITdw3SBzG6VjqNsSLTACdlv6NnQ8NQFlSZpd8AFLOThF+m6ArFkVnWl+LapU4LaNsNX5W3F0DJ3ot6pM7wdJiNu6QE1c3eIkgMcROyTqh+YaspY9ZRsPMSLTqmQKPsAl+HvBp2dTrQD4eFJy+GcpzDiOaJ8KgJoa1XLAOu6ha7TMOf5uVBRsNYVln3V5e9XuV6MFZnLmIrR9S4Dw7MlOYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bU4K09rciqwffmaoxf4ZNC7E8WLgrHeGnP/qgo8aG9k=; b=t954SxU2+ikaiiMc9wDU4Y42Vyy4RWSjTJkaSoBY860f592LY8DuUbPSUs53hLa9hdgkBBUd0D5TfDJXfLw9lj7a7FF28oEYkUuxop8ZYisbCmbADj4mx8DSPgdpzaVgwW50nwb/t1alXUlqF4NKJC3TXZJRwwuc+wS78M7JVWI= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (20.176.234.91) by DBBPR03MB5366.eurprd03.prod.outlook.com (10.255.79.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Mon, 18 Oct 2021 21:55:04 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf%6]) with mapi id 15.20.4608.018; Mon, 18 Oct 2021 21:55:04 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit Cc: linux-kernel@vger.kernel.org, "David S . Miller" , Jakub Kicinski , Russell King , Sean Anderson Subject: [PATCH 2/3] net: phylink: Convert some users of mdiobus_* to mdiodev_* Date: Mon, 18 Oct 2021 17:54:47 -0400 Message-Id: <20211018215448.1723702-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211018215448.1723702-1-sean.anderson@seco.com> References: <20211018215448.1723702-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR19CA0003.namprd19.prod.outlook.com (2603:10b6:208:178::16) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 Received: from plantagenet.inhand.com (50.195.82.171) by MN2PR19CA0003.namprd19.prod.outlook.com (2603:10b6:208:178::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Mon, 18 Oct 2021 21:55:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68a5836d-f9e7-4fec-d5d0-08d99281f11b X-MS-TrafficTypeDiagnostic: DBBPR03MB5366: X-MS-Exchange-Transport-Forked: True 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: sXb3aG7q48YR7HpXVhGmA5Xta4md4uUFRcdgIHn8w01KUUdqCLJJlLWoQYsdlxlGGftggZBPT4FoDk99DigoBkp/sBR51c73kOGyGJuPDi9R6hUYf42mh+XMqLGxUGlLsGrYBC9GCJVgH0vXW+IMSpi7PyPMMAeuR6C5vrAY1roCnTtbyZNgnmmPcnSzGkTZZY0nl9rPGbP3LR4j5fyhlplJHGMApeux6zzXBY/XRNIVoVkcAf0CHg0sgf97cgAaPuTuduf00BcfUrjL5S4mSt/STqgHso6YuGAs1S0uOTYIqJwhuylTBMkdwtS8/s1NTfP7Ou1TaBk3FaqIbiEa+hi+vvCf9sqYMx8LBlQj5vlslti0YyvXx+sj4TOsDTR+cwqGbbq4q8OEjMSSjWM1QfIP8J294SmxYFTOhmpmrh3AHRZISomJjG0FwKl/EEeANzLvzz7birHHgTz9ymWDr4V67TwqUrS7q8NRENGGjUioZaQAq6X+NWMcllU53Zl7386JJfj2pN9MrD6I0xsQjf/rdJxYb6Ff2ODVD05O4kFR/dxBMsqEsza3gkBHLzCPry/QzD7MWBLQgS5gOTnO+WX9wE2K/8OKwxb1EzIhwg5HaHETg+sQ3NaAcTp4sG+K8qmP3rrubeps/t/YeiAgkWat/9yT8dXa2D4iPl53BAR1mQwimCmLEQ75i1rDeb2HM/HPsre/Fpg9wnr0dqVorA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4523.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(5660300002)(83380400001)(52116002)(6512007)(186003)(1076003)(38350700002)(4326008)(110136005)(6506007)(8936002)(66556008)(66476007)(107886003)(956004)(6486002)(2906002)(8676002)(86362001)(66946007)(44832011)(6666004)(316002)(54906003)(36756003)(26005)(508600001)(2616005)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1jKk1EjNpSb/eyulJF8/bR67mwXVDZP7kwgGQ41FSVM7KVHd9TNmt41OU084VqpRmJoEn/TXYG6CSP7vl3AiKAaK4scQrmo9eJPns3/dbss8EhfrAaXnjRMXHLXZxS7l9uOKtDmATPmDA2N0aNhRHgcj04lJo55XPK5w4yKTeQxUeXOfIKvOu3d/MTlKCQYjXOaPVfkO9xI6ercNWqIUDBOocB30A26TJrsoAoqowZ6a8fGIyQvr9l9tjbBQWo9iJtSbVsgEf6ShPTjHVL4vIdH0tMnks+PyyfM9HsTIGcQDZAtKoSfsUxsYuVlmN/9wlcV1IGDNhs3vGb5PDmHDN41X26uV3HeNpHZGqTTeS5alHQflWSrrSmd/3NnrMbxW0gCbOOgK5M60xHosaxWty9dRRnHtrhGbYYbKD95/BXKXzeM+s89QO0o+MJlz4Rgb0KFBCQ4ryxzdEMnrHshEm+U3ATA0C2o5sYlL5QskyRlhAAmbc0Zitw0JeN5Bevzee17/7Wq1NvCPNoN7rW6IbxGdTfwH5KLOOlH+yB7gBvjBdex1afdcayjRU9r3HXMfR0Iz8O+d5di9sTfx28/whH0fSwFvx/YvKyuVcnyJOyhElIAm/FGngkQdTdD3VdHLgaZvjvOJ/C8hKO7rL/LynO6N74ir3CpTJW2BKlS3jhVrGKbjoyKzHQtudBbAvbSmNREVf7hpPDczdj0UD0a1my5jTzsr+WTEyC2gg4vIPKxub6+5HqV+t8yBjw3k/9Hd4CPRgerJPWlOkV0grGallRuq/Gaz9mKJTauwFRhGpKXDhkvN598kE8+ZkqlxBONm7WSOwhIg5nGQdDGdDllmm1elaas/sxEXkPB9P6BI1L5gYOJLbMBhKGmUuNlJ6WvSfWEAabk29Ys67Q5u8gFWGyTLU6txYytF6G3okfkcyrg1QN96LnZ2nkWUqrLECt233dYHT0MrKALLF14DQoLzP11dQWp8D8BmBf66oWu6TqTsTtYQmx7WgQBFVLy3ygtiF8LOE9xi9d6Bzf6CrINHNnLFQwMOLBpuWbb70biVkWCIHIIWrDFmsZ3hoRZrwqY4qqf4AQF+HzEaLPGf7QP6WuJtBdxzgPPfvEBmGlBupqYIZMo4xj7SjGEslhFPG++3XGKGscxbH5YTwXogrdDaot2GVRkfjCQJ7FrmjDvI4U9eWdYdS4Vs4hUIfzjXYO2TqEp/46JvSz01eODl/UhcHKpIOPbVVNuHjaUQSXTX8WwFl4uFKu4Ag/4Ke0CFvEWskuqJyuR8HBIsXEW3Gq+F3T25ncj07wCkphY3VplpgH967vqNC09uwjkzB4pNNC7l X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68a5836d-f9e7-4fec-d5d0-08d99281f11b X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2021 21:55:04.4354 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WNO4SUbC3Uib7uHbOjQO72sShPQG9+aWQ4CyaUkMfbur/+uXb2nvxCCWuUIGo+rzHaF0wM2sABQX5RvLJsotgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB5366 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This refactors the phylink pcs helper functions to use mdiobus_* instead of mdiodev_*. Signed-off-by: Sean Anderson --- drivers/net/phy/phylink.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 16240f2dd161..58219457db16 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -2536,12 +2536,10 @@ EXPORT_SYMBOL_GPL(phylink_decode_usxgmii_word); void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, struct phylink_link_state *state) { - struct mii_bus *bus = pcs->bus; - int addr = pcs->addr; int bmsr, lpa; - bmsr = mdiobus_read(bus, addr, MII_BMSR); - lpa = mdiobus_read(bus, addr, MII_LPA); + bmsr = mdiodev_read(pcs, MII_BMSR); + lpa = mdiodev_read(pcs, MII_LPA); if (bmsr < 0 || lpa < 0) { state->link = false; return; @@ -2594,8 +2592,6 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs, phy_interface_t interface, const unsigned long *advertising) { - struct mii_bus *bus = pcs->bus; - int addr = pcs->addr; u16 adv; switch (interface) { @@ -2609,12 +2605,10 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs, advertising)) adv |= ADVERTISE_1000XPSE_ASYM; - return mdiobus_modify_changed(bus, addr, MII_ADVERTISE, - 0xffff, adv); + return mdiodev_modify_changed(pcs, MII_ADVERTISE, 0xffff, adv); case PHY_INTERFACE_MODE_SGMII: - return mdiobus_modify_changed(bus, addr, MII_ADVERTISE, - 0xffff, 0x0001); + return mdiodev_modify_changed(pcs, MII_ADVERTISE, 0xffff, 0x0001); default: /* Nothing to do for other modes */ @@ -2652,8 +2646,7 @@ int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode, /* Ensure ISOLATE bit is disabled */ bmcr = mode == MLO_AN_INBAND ? BMCR_ANENABLE : 0; - ret = mdiobus_modify(pcs->bus, pcs->addr, MII_BMCR, - BMCR_ANENABLE | BMCR_ISOLATE, bmcr); + ret = mdiodev_modify(pcs, MII_BMCR, BMCR_ANENABLE | BMCR_ISOLATE, bmcr); if (ret < 0) return ret; @@ -2674,14 +2667,12 @@ EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_config); */ void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs) { - struct mii_bus *bus = pcs->bus; - int val, addr = pcs->addr; + int val = mdiodev_read(pcs, MII_BMCR); - val = mdiobus_read(bus, addr, MII_BMCR); if (val >= 0) { val |= BMCR_ANRESTART; - mdiobus_write(bus, addr, MII_BMCR, val); + mdiodev_write(pcs, MII_BMCR, val); } } EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_an_restart); From patchwork Mon Oct 18 21:54:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12568151 X-Patchwork-Delegate: kuba@kernel.org 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 088D3C433F5 for ; Mon, 18 Oct 2021 21:55:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2F9F6112D for ; Mon, 18 Oct 2021 21:55:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233784AbhJRV50 (ORCPT ); Mon, 18 Oct 2021 17:57:26 -0400 Received: from mail-db8eur05on2080.outbound.protection.outlook.com ([40.107.20.80]:24544 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233571AbhJRV5T (ORCPT ); Mon, 18 Oct 2021 17:57:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CucsfkiTe/IWiGvkKn2xywXc5DEko23m92XxKdN9ZRfYO+m+LJtiHTp0Dv2JAoNoO2CvsXB0T9PwxwA1DzrbJrx5nGa486uETjyAFoVX6PopDQI6Tb+4nEp9ilbSwsxgvM+jnTmBChNOP9hU1vbhsMehgiqX9Wx/Ez5+QQ+VmW2fpgbFKZkNIM3+l4uCRP01AKfoWsR10eqloAygu7y/k0W4A+pKZXv1W3n4Q7BmtzGokMjZ9Ra9f7s26irFHiJf8XK7fr0GHIWNt43lET6Flqyqc8Wm/CQ72lSBHmIaqo5dsit6Q6aNRg8/xVSq2Yg0XROOR28EQF18Q2gvdOukVA== 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=px2TT514bHRbG7p/dO5ydmGWvLG54/oSs+zSGR8MeZc=; b=Gnrgkxd+bi5tjm2cvnFj/DoXOb7Jji6TUZJ6Fb6Plc0RAxLLmVEPmbOWHK78+00pSnUHsu3zuw0gZcCeMg8LEL1g1EBTQrc6ZlClouTAIA+CXsw3uBJltVHqIeHCh2/ZLvNL9uCdmNv0Zg3snLVrGP5uPT00+/KTvfBkmdYZIlZvUt0fmAJV0SMocNhg+HzRNAHvMxANfuWeHKKbZ+5kLEqlrC0DikAz5FL6d3futGuTOP7f8GH6vArfK+pB+iZO+SoWdg8Vevkd7kqOMAErNuN3Y9cgPDJ1tV8E9w4vS55O3UXh9SP/IY99qXOrx9uyLuHOZ7LWoarIkWiguk78Kg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=px2TT514bHRbG7p/dO5ydmGWvLG54/oSs+zSGR8MeZc=; b=jKDe6YNNQSWKhOf8lZ9K5VDcHhlGSqB7GSDUNnhKnVGHOIDAooFyFpQE2ibawMDdzooVGcV3dla575yZ0MPDUJj+vr7tyJlwaeoBe+MefwiOBBzf2ttg8XIbe0XpiOVHucWVSJVppgq3j3+VlNbNgVxiK2qAOjNaI15px/WDCTQ= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (20.176.234.91) by DBBPR03MB5366.eurprd03.prod.outlook.com (10.255.79.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Mon, 18 Oct 2021 21:55:06 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf%6]) with mapi id 15.20.4608.018; Mon, 18 Oct 2021 21:55:06 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit Cc: linux-kernel@vger.kernel.org, "David S . Miller" , Jakub Kicinski , Russell King , Sean Anderson , Florian Fainelli , George McCollister , Kishon Vijay Abraham I , Mark Brown , Vivien Didelot , Vladimir Oltean Subject: [PATCH 3/3] net: Convert more users of mdiobus_* to mdiodev_* Date: Mon, 18 Oct 2021 17:54:48 -0400 Message-Id: <20211018215448.1723702-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211018215448.1723702-1-sean.anderson@seco.com> References: <20211018215448.1723702-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR19CA0003.namprd19.prod.outlook.com (2603:10b6:208:178::16) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 Received: from plantagenet.inhand.com (50.195.82.171) by MN2PR19CA0003.namprd19.prod.outlook.com (2603:10b6:208:178::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Mon, 18 Oct 2021 21:55:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 03cd1fff-664e-438e-f913-08d99281f24e X-MS-TrafficTypeDiagnostic: DBBPR03MB5366: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NEaTYesWS/JCh3+Sb8hMtUG6UmubOPKPl8RmZq8ox63Ga1Xsx5hEsCCLkzFERFIAvWzVdBnu5RsOMJpk5xplboAu/XovyVi0mc5vIfq+GC55wGzcLWuoztSj4VOccsWM1DMumn3xJ4VgOwheT87lrgX+2teWLZ5/WKQdXPd8i2ZwJ/nk6HX9Ex8CwdsvcSrdT69JPYWop/dDRTIFBhWjf6xe8x6ZVdgMGAEJb++Lewd+trRs06B07ZPS2wCTBaXPIAuNZnriXm6ETbXdQqYmSoSkFzS5QOjpE0XDeh63S/Q0rXCizaKVL1cXuxCGfOci34zxvILVJvZGKtrGCB/BiBzPEQ3/RYbEa25nQKPIh//TUEApxnTA9N4QmU23TcbamzLhOJYpKX9Bg6QIHOTSbAJl3cDvrKsTsmEYufc7BaoGMEYLYUwonR0vJwnaUmtcdQMDJrSGT7O46JjDF3pknx/urNixOF6dhawOB8AizNfhm5cULrnCQiQCxCh1KLZKkI2sQ6QUsniuOQCM6uvZoFW86dL9VQacsb4N/DULjrPWyXVJLDn28pQMUWQAQMWO7Rto4PzHZhRc7dst6h5oxIivHF1P4xnJ3Pfz8r0i1GSRq73CJjZurY42IoaUuzSMlfln/vferBgFGBJMU20dQ6bxU2//jM27eT6GRthG18GkNYjhkB9GVqj17bhGqDOpxT+eIAKSs8VmtZbkGDHTTg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4523.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(5660300002)(83380400001)(52116002)(6512007)(186003)(1076003)(38350700002)(4326008)(110136005)(6506007)(8936002)(66556008)(66476007)(956004)(6486002)(2906002)(8676002)(86362001)(66946007)(44832011)(6666004)(316002)(54906003)(7416002)(36756003)(26005)(508600001)(2616005)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cVyJiXTSx0OrQjObZcDB0+phOmaWdNL5EjU156NtuBdd2sqZ5wmuU3l6v1b3sPNkKF+K1GTZs/JJFAzELC426NEJ8WLkRVxvsysZmthNUUHE1UzoCD0/ZlMY4bC3+HaFnfv7f7Z08+QwXUNbcSueLz8fqAirC9vm+YonQViX/b+Q9kP3PwWzFS9l+pY1+N33qVawHV6XgkhKNi2nQu3TrMkzzT3UzmoxiBgN8DU7xxoiZhT8P7NCccyg5HxAiJTMHNNhTTmgs2DImMoEHCknNbTiQsHp/yPIOXY0GN9W6pn6X5P4D7HEbbv93mmEHCcZGRb7ujLEhGRDoF3qu6OPeJ9b2y+DpHjY2LYok2EpingL62sOII2e/eXweN/SeROaihepKqAGGqpZd2sxM3PzQoJg9KX6wMOjZZBa0Vu7572sE3RFgKuwQDS24oOajZokaK97gU24WWILiJTTzvlttJ/QDO2Uws96/NYJNdR+5OjMaj1BJhfJ4Gu5NYL2KxqCMbfvXb9FTfwsXoMvjn7ZMcuJY91ZYlI41v5l5TBogFlm6KR5JXN0Zrf2f4501NcYjGG8WvG7pVcbuMQzOgX3wfdKGO3Tsag8fBEI/PKKtfRhGAJZdZw+F5NI5E97KK3VUReY7fr6j2KUwJYF80piz3K+QqI7+3sA0Vx4fgzAVlxRdj9uHAhfFv4Io7X7xscPzy3eQ9gYVsE+6AlJf886IbCkwQp+plYMq8KWUsbExA9GxSqDzRvAv+eOQkYnBVofJkZJSSV6Jx6HuSkQiDwkNhf8Gazh60QMHJYgfcygFxfN6JxRu2j2GHs5ksUmhUDq/iYmKqy4cgxQvJUVmiPL1V8t04FlGWioRRAaRd27fF07fWltphi8IIE0b5eygZ+ox3fhpMP4HiSzbS8hk9mCgkcf3Tx506udo/RUc92aSE9yUZgM4vRNeySyKP8duO6JgyfzglYmjD864dIEYrmyThaZ3k58ZsQVfFQjcUDaef+XmHurDcJvSUJk82Tby5b40s+ByKgakxaQVME5ON/zJodpX7g+eHhUs4IwMbqBOWj16h30tpHhVr7R5sI5boh7mTJGvo7uNPGNX54lnX4aGO8yVa9lXDPRamegZ3a/s46xRxtjgmeqN5lvAW56uw+ZYg1BdQUV1EjKuT1M03c6us4KXpTWyrR+JGovJoAkEWx8jjXZeEUCHj6wbqw8yo8Sd1QpG5IJ+OZbPSRyepSrAlqPjkAb3C1Q8E8XxUEQqk8O7SEkv0BNdOGTERz+17ZBoZPsX/615su/JhQwO0hLdidfTbhTM5L6mzXGOonWk5ysEOWdJkkHJfe6C2NR9Tr0 X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03cd1fff-664e-438e-f913-08d99281f24e X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2021 21:55:06.5922 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LfDYM+y53jT7+ibBZRwejhk842iU1z+k16j2LCSxBFMtE4VRHvwlnLJY3toWRAiY+HxhCjjSYdDZRp6dyxCphw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB5366 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This converts users of mdiobus to mdiodev using the following semantic patch: @@ identifier mdiodev; expression regnum; @@ - mdiobus_read(mdiodev->bus, mdiodev->addr, regnum) + mdiodev_read(mdiodev, regnum) @@ identifier mdiodev; expression regnum, val; @@ - mdiobus_write(mdiodev->bus, mdiodev->addr, regnum, val) + mdiodev_write(mdiodev, regnum, val) Signed-off-by: Sean Anderson Reviewed-by: Florian Fainelli --- I am not too experienced with coccinelle, so pointers would be appreciated. In particular, is it possible to convert things like bus = mdiodev->bus; addr = mdiodev->addr; mdiobus_foo(bus, addr, ...); in a generic way? drivers/base/regmap/regmap-mdio.c | 6 +++--- drivers/net/dsa/xrs700x/xrs700x_mdio.c | 12 ++++++------ drivers/phy/broadcom/phy-bcm-ns-usb3.c | 2 +- drivers/phy/broadcom/phy-bcm-ns2-pcie.c | 6 ++---- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/base/regmap/regmap-mdio.c b/drivers/base/regmap/regmap-mdio.c index 6a20201299f5..f7293040a2b1 100644 --- a/drivers/base/regmap/regmap-mdio.c +++ b/drivers/base/regmap/regmap-mdio.c @@ -14,7 +14,7 @@ static int regmap_mdio_read(struct mdio_device *mdio_dev, u32 reg, unsigned int { int ret; - ret = mdiobus_read(mdio_dev->bus, mdio_dev->addr, reg); + ret = mdiodev_read(mdio_dev, reg); if (ret < 0) return ret; @@ -24,7 +24,7 @@ static int regmap_mdio_read(struct mdio_device *mdio_dev, u32 reg, unsigned int static int regmap_mdio_write(struct mdio_device *mdio_dev, u32 reg, unsigned int val) { - return mdiobus_write(mdio_dev->bus, mdio_dev->addr, reg, val); + return mdiodev_write(mdio_dev, reg, val); } static int regmap_mdio_c22_read(void *context, unsigned int reg, unsigned int *val) @@ -44,7 +44,7 @@ static int regmap_mdio_c22_write(void *context, unsigned int reg, unsigned int v if (unlikely(reg & ~REGNUM_C22_MASK)) return -ENXIO; - return mdiobus_write(mdio_dev->bus, mdio_dev->addr, reg, val); + return mdiodev_write(mdio_dev, reg, val); } static const struct regmap_bus regmap_mdio_c22_bus = { diff --git a/drivers/net/dsa/xrs700x/xrs700x_mdio.c b/drivers/net/dsa/xrs700x/xrs700x_mdio.c index d01cf1073d49..127a677d1f39 100644 --- a/drivers/net/dsa/xrs700x/xrs700x_mdio.c +++ b/drivers/net/dsa/xrs700x/xrs700x_mdio.c @@ -31,7 +31,7 @@ static int xrs700x_mdio_reg_read(void *context, unsigned int reg, uval = (u16)FIELD_GET(GENMASK(31, 16), reg); - ret = mdiobus_write(mdiodev->bus, mdiodev->addr, XRS_MDIO_IBA1, uval); + ret = mdiodev_write(mdiodev, XRS_MDIO_IBA1, uval); if (ret < 0) { dev_err(dev, "xrs mdiobus_write returned %d\n", ret); return ret; @@ -39,13 +39,13 @@ static int xrs700x_mdio_reg_read(void *context, unsigned int reg, uval = (u16)((reg & GENMASK(15, 1)) | XRS_IB_READ); - ret = mdiobus_write(mdiodev->bus, mdiodev->addr, XRS_MDIO_IBA0, uval); + ret = mdiodev_write(mdiodev, XRS_MDIO_IBA0, uval); if (ret < 0) { dev_err(dev, "xrs mdiobus_write returned %d\n", ret); return ret; } - ret = mdiobus_read(mdiodev->bus, mdiodev->addr, XRS_MDIO_IBD); + ret = mdiodev_read(mdiodev, XRS_MDIO_IBD); if (ret < 0) { dev_err(dev, "xrs mdiobus_read returned %d\n", ret); return ret; @@ -64,7 +64,7 @@ static int xrs700x_mdio_reg_write(void *context, unsigned int reg, u16 uval; int ret; - ret = mdiobus_write(mdiodev->bus, mdiodev->addr, XRS_MDIO_IBD, (u16)val); + ret = mdiodev_write(mdiodev, XRS_MDIO_IBD, (u16)val); if (ret < 0) { dev_err(dev, "xrs mdiobus_write returned %d\n", ret); return ret; @@ -72,7 +72,7 @@ static int xrs700x_mdio_reg_write(void *context, unsigned int reg, uval = (u16)FIELD_GET(GENMASK(31, 16), reg); - ret = mdiobus_write(mdiodev->bus, mdiodev->addr, XRS_MDIO_IBA1, uval); + ret = mdiodev_write(mdiodev, XRS_MDIO_IBA1, uval); if (ret < 0) { dev_err(dev, "xrs mdiobus_write returned %d\n", ret); return ret; @@ -80,7 +80,7 @@ static int xrs700x_mdio_reg_write(void *context, unsigned int reg, uval = (u16)((reg & GENMASK(15, 1)) | XRS_IB_WRITE); - ret = mdiobus_write(mdiodev->bus, mdiodev->addr, XRS_MDIO_IBA0, uval); + ret = mdiodev_write(mdiodev, XRS_MDIO_IBA0, uval); if (ret < 0) { dev_err(dev, "xrs mdiobus_write returned %d\n", ret); return ret; diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb3.c b/drivers/phy/broadcom/phy-bcm-ns-usb3.c index b1adaecc26f8..bbfad209c890 100644 --- a/drivers/phy/broadcom/phy-bcm-ns-usb3.c +++ b/drivers/phy/broadcom/phy-bcm-ns-usb3.c @@ -183,7 +183,7 @@ static int bcm_ns_usb3_mdio_phy_write(struct bcm_ns_usb3 *usb3, u16 reg, { struct mdio_device *mdiodev = usb3->mdiodev; - return mdiobus_write(mdiodev->bus, mdiodev->addr, reg, value); + return mdiodev_write(mdiodev, reg, value); } static int bcm_ns_usb3_mdio_probe(struct mdio_device *mdiodev) diff --git a/drivers/phy/broadcom/phy-bcm-ns2-pcie.c b/drivers/phy/broadcom/phy-bcm-ns2-pcie.c index 4c7d11d2b378..9e7434a0d3e0 100644 --- a/drivers/phy/broadcom/phy-bcm-ns2-pcie.c +++ b/drivers/phy/broadcom/phy-bcm-ns2-pcie.c @@ -29,14 +29,12 @@ static int ns2_pci_phy_init(struct phy *p) int rc; /* select the AFE 100MHz block page */ - rc = mdiobus_write(mdiodev->bus, mdiodev->addr, - BLK_ADDR_REG_OFFSET, PLL_AFE1_100MHZ_BLK); + rc = mdiodev_write(mdiodev, BLK_ADDR_REG_OFFSET, PLL_AFE1_100MHZ_BLK); if (rc) goto err; /* set the 100 MHz reference clock amplitude to 2.05 v */ - rc = mdiobus_write(mdiodev->bus, mdiodev->addr, - PLL_CLK_AMP_OFFSET, PLL_CLK_AMP_2P05V); + rc = mdiodev_write(mdiodev, PLL_CLK_AMP_OFFSET, PLL_CLK_AMP_2P05V); if (rc) goto err;