Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2366854pxb; Fri, 17 Sep 2021 08:14:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxiGQJpOmJwEKkP+sQVAanZ8Bq9cPore0CEnFy7fXG/gIClqFIu9RtQXFQCDwxZeuPZgD2 X-Received: by 2002:a5d:8458:: with SMTP id w24mr8892575ior.168.1631891698188; Fri, 17 Sep 2021 08:14:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1631891698; cv=pass; d=google.com; s=arc-20160816; b=WQbEqEIdlWoT/UkavNxA/EVhSGUJLEB44KmehyCFx1OmLcRZ/x03xjLGs60FXPahSo xbbLrnT5F+9bc/0e5XRoGFGVLeSCnuz9k76TU2yfkrnp3zP9SClmXMQlIzff0cBbskze GKYDbKa8IMjLZlXUTDqe5eCxBKHrkSld3uuF2dqSxRLwammxnPt/XY4CKDDS1lgeTkON xbkoLUxmcjTU7LZaDDs49GPKT6PjF6Il1pt6iaj2xyD9YbHd3Dfack6IFrwkWkKnXlqZ H3uJY9fowtOuozQ1XAO7GGi9+9BBCeDk4DKeWdTzoJ9LbgVuhIH6ufvV80VbE1JLD2nV OquQ== 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=pjd39OuiyfPLTnwLybfGezRem2rn9KKpaPy2kqVnG6Y=; b=NGVZUVA6PNke7jFwLrmwY0gBe7RFsoXoP3KVDx/Pedb/ta0jN5q1SC5DiedxjKBiWF 9ClUnigcikLPGmjoTKmFqWmcmz0AD40+YXWvKu9pBFIMQRFHNaTP4YdPMlaDqHDZ/6qy Q90EtRAMk/eUEg7OoSOW83dx6w9r6ZfKTEWm4rbCa7LPT4SQ/JF9xM3GjZRqcTCtQonM Imub4VGEfTNe5WcAJZ+h0w+xPfBdiuh/piTv1lf3mgckXcDgROWHyoYgV3CbXeYWc3kR mAC1Fl6RSi4wMjyVSeWsK8VGVD9+loxqEFepZb9eL7A9qX/nOGtRUcLESKq3UK2gO6O3 wPlA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=W4BrBG6l; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si5979560ion.66.2021.09.17.08.14.45; Fri, 17 Sep 2021 08:14:58 -0700 (PDT) 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=@nxp.com header.s=selector2 header.b=W4BrBG6l; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344466AbhIQNgx (ORCPT + 99 others); Fri, 17 Sep 2021 09:36:53 -0400 Received: from mail-eopbgr40079.outbound.protection.outlook.com ([40.107.4.79]:32296 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1343564AbhIQNg1 (ORCPT ); Fri, 17 Sep 2021 09:36:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IvQaDYDgX/rVNK2HEtc8d1kmL8RHkN9HlEYAdHT0H1YVq58r7CkG3SRe8XBBFJ1kxWdtC+Q58Ll1js50yntp67fBt6mpZmKO6FbzygWDCEK3gCRLcZMFTiU3+XWRM8QwQ91GcvbZOs+7qeaLOoa7sZjMhJqMzLEx0HvU7MlyklSHEkHtxM22dNUdNq2WZ9ElOOZ48N/qfVInj+vsAcDubaNlTuB/1FQPQZwYEimNlgD46ZzjezIFvAVkSCRmZLZ/HBGaUWfG7huXzZ96Ev9GzOaG365UUayi7FDcLHcdQGadz+wcbjTr9cNd+c6QkPLnwpJc8Uy//eHjC0YlUcSULQ== 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; bh=pjd39OuiyfPLTnwLybfGezRem2rn9KKpaPy2kqVnG6Y=; b=GRcNKummeMBW1hxBbGha2VmRRAj94HaLqRwgRZk6OmW9z3MW37MIRWYPIWjzswx6aZ/zDCxpKnoLTGwX/6T9kztZyZTf5t28gs0Bxrs4StYNoliOcC/FLcaFs3O7pZCZJxTrOTaVe4vKULwAVdl8TY0NyRxXFIy7ri98+9NPjYWIhZgOC204VqLYtMVannW1fvwJL3x1A5znygEzvRdWhLjie7yHZQnbS1psaWkZcO2Y2lfVG3SMK+toHB/OlGBNtqvaeTNWTf1jI1FhSR2iMAveRe9si1pWde7ggwTwaQRAnzyejfN0MopkSsc8Rym3+WKi/X72h5yj+XWtEjacFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pjd39OuiyfPLTnwLybfGezRem2rn9KKpaPy2kqVnG6Y=; b=W4BrBG6lAOScpdveFdOmPmDh8G/IuuX5IEQz1c8p6uJOh02tnGRXVMP51s5GUJmb9yi2wLJJ7cSg3w0X32oX06K7A25GpUM03irruYr4bIOgFehM4SaIzWL/xjG3C9vPJHVxbUP+VjtUu6/4kd71qV+IoWJB4+0zo/MOSTNEpHs= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VE1PR04MB7341.eurprd04.prod.outlook.com (2603:10a6:800:1a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Fri, 17 Sep 2021 13:34:52 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0%2]) with mapi id 15.20.4500.019; Fri, 17 Sep 2021 13:34:52 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vivien Didelot , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , UNGLinuxDriver@microchip.com, Sean Wang , Landen Chao , DENG Qingfang , Matthias Brugger , Claudiu Manoil , Alexandre Belloni , Linus Walleij , George McCollister , Heiner Kallweit , Russell King , Oleksij Rempel , Michael Grzeschik , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Lino Sanfilippo Subject: [PATCH v2 net 1/5] net: mdio: introduce a shutdown method to mdio device drivers Date: Fri, 17 Sep 2021 16:34:32 +0300 Message-Id: <20210917133436.553995-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210917133436.553995-1-vladimir.oltean@nxp.com> References: <20210917133436.553995-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM0PR02CA0199.eurprd02.prod.outlook.com (2603:10a6:20b:28f::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (82.78.148.104) by AM0PR02CA0199.eurprd02.prod.outlook.com (2603:10a6:20b:28f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Fri, 17 Sep 2021 13:34:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0abbda9d-8b6e-4e9e-f278-08d979dfed8f X-MS-TrafficTypeDiagnostic: VE1PR04MB7341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pDMY4zuRWVVn9kAvXuQE+NMiaqB+YLPIUY3Y6fylArOg/0gUCut7PFA9TmgnYNig5NawxwCEAE2SL3pbneoIw/lJjfjyCPviFRyQt5YxdV2gYBluGY0+PCy7diUuCGqTBSOLVyixT2VixdHpbR6AMLE88NzdrNWeO1Q4QM56jFFgH2FcLylfgj/aZsdpSEUDTaR27VsKdxKGp7DZ9NIhJ+7+QxnqvkSRitK9SbJjwU7LFBoJS+J1wI6W04hsZfrIt7GCS4tLgiep4BwSQZU7FVIWEmKZfEEKhBs47m+IuOnyw5oHYTHZOQnN/UP5kkMiCNmOp7rTH5xiPIdEn8PLFI7dw8uyrX9BoN+6VrO9A5nbAa/uvykdiZw7ysjwJJSx0Fl/pCBxF2CDqaBjRmIJ7RzKjYNO7U955XUgpk345IoyVFUo0JphYYM+VDzMlTbJgbMDKOstPfwV1ZZLGpsIYcfsL2bKgQsQ+YpbrUmI6cdoIuFtC2zxkWPJOiZpBNHySe82OW6+z4FsumDY/Stbcs+wfJ9x2uWQ6dD+IP4LxxNM2nP9bTqe+D3D1Fgc+MjWMJARkihkvFJjtduF7uuLB7QC6wHApcT6aQ7IjyBec7vymnRz+/vUJT7tQvPKTB8edkzu0rDxamwHXyo4J0xvgSlY7kcFUVuZGFH2XPFP9M8x+osIw8KEliOQATT/qpsxvReCoimfNuO8tyoF3oQcWw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(366004)(376002)(136003)(39860400002)(346002)(54906003)(316002)(38100700002)(38350700002)(36756003)(44832011)(2616005)(86362001)(6916009)(66556008)(478600001)(6512007)(6666004)(6486002)(8936002)(8676002)(26005)(1076003)(5660300002)(6506007)(52116002)(186003)(83380400001)(2906002)(4326008)(7416002)(66946007)(66476007)(956004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KS1nV9WOsEYU5h7nsgegyAmNV4t2yYDN0DQSUf8PiKUeiPhnKyLtaZ8+Qbdz?= =?us-ascii?Q?S3pCDZaIdq1wpEBxYThx08vgfMz2N3MLXV7g77iJOHlTQtp3XoWCFN5r29+4?= =?us-ascii?Q?zKISE78ZbopB5jcz2TXLvZWqfQFCgtXvUbPNReKx62WKMzByVczq8JyAwLXq?= =?us-ascii?Q?Xz7nIGDBoUx4mchKm0TqJxylrtloyClfizYrD6GdkCorUcCDs0fgvtq91w6l?= =?us-ascii?Q?sy/wy4MFmAR1wwtYqUgEJ3FcOpA3guIVxEF3QH6UcEcLDJGQ8pJnv987EYG7?= =?us-ascii?Q?y8eMHqBlhE28cRexeQxlLsTA7E35V4Gn85KTMgjUohSUXgSpcfpxdgcrM76P?= =?us-ascii?Q?cZcqSk52nrsGPNWKoLTU+r9krO/wMWS2fxYx6xbXSk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wvbkLzwCtM9k4fWrHQauC2rDFk99wQPBti3XuP6BNKnyciL9TW?= =?us-ascii?Q?YlMqjPZhJlDfe1i7LSucVJAz?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0abbda9d-8b6e-4e9e-f278-08d979dfed8f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2021 13:34:52.2036 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xY0Qaj7Fpl00e4Vku2jwdOtpNN0mfaVYX6XJw/5hy6V//PtCqe1Wtzmo1q1X/5ve6GvdptufgyQN2+tzDGiV7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7341 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MDIO-attached devices might have interrupts and other things that might need quiesced when we kexec into a new kernel. Things are even more creepy when those interrupt lines are shared, and in that case it is absolutely mandatory to disable all interrupt sources. Moreover, MDIO devices might be DSA switches, and DSA needs its own shutdown method to unlink from the DSA master, which is a new requirement that appeared after commit 2f1e8ea726e9 ("net: dsa: link interfaces with the DSA master to get rid of lockdep warnings"). So introduce a ->shutdown method in the MDIO device driver structure. Signed-off-by: Vladimir Oltean Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli --- drivers/net/phy/mdio_device.c | 11 +++++++++++ include/linux/mdio.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c index c94cb5382dc9..250742ffdfd9 100644 --- a/drivers/net/phy/mdio_device.c +++ b/drivers/net/phy/mdio_device.c @@ -179,6 +179,16 @@ static int mdio_remove(struct device *dev) return 0; } +static void mdio_shutdown(struct device *dev) +{ + struct mdio_device *mdiodev = to_mdio_device(dev); + struct device_driver *drv = mdiodev->dev.driver; + struct mdio_driver *mdiodrv = to_mdio_driver(drv); + + if (mdiodrv->shutdown) + mdiodrv->shutdown(mdiodev); +} + /** * mdio_driver_register - register an mdio_driver with the MDIO layer * @drv: new mdio_driver to register @@ -193,6 +203,7 @@ int mdio_driver_register(struct mdio_driver *drv) mdiodrv->driver.bus = &mdio_bus_type; mdiodrv->driver.probe = mdio_probe; mdiodrv->driver.remove = mdio_remove; + mdiodrv->driver.shutdown = mdio_shutdown; retval = driver_register(&mdiodrv->driver); if (retval) { diff --git a/include/linux/mdio.h b/include/linux/mdio.h index ffb787d5ebde..5e6dc38f418e 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -80,6 +80,9 @@ struct mdio_driver { /* Clears up any memory if needed */ void (*remove)(struct mdio_device *mdiodev); + + /* Quiesces the device on system shutdown, turns off interrupts etc */ + void (*shutdown)(struct mdio_device *mdiodev); }; static inline struct mdio_driver * -- 2.25.1