From patchwork Tue Feb 13 14:48:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 200853 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1048000dyb; Tue, 13 Feb 2024 23:39:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCViosY3ir+rAR3Sv3KwXr6FFd25NjnH9HlUw57Qzq72701wcvXXf2HJozvjikY90a8XWQqpMlvm3HCz8aRvPxK8TxMA/A== X-Google-Smtp-Source: AGHT+IEH4PeJEUqLQUbs+41z2QfA3RDdWe/0If5eiEKdf2irVr5JK341OUVZixA8kjLUXUjI4jTL X-Received: by 2002:a05:6358:88e:b0:178:e2b3:98da with SMTP id m14-20020a056358088e00b00178e2b398damr1958890rwj.28.1707896389097; Tue, 13 Feb 2024 23:39:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707896389; cv=pass; d=google.com; s=arc-20160816; b=xVUKoXXB4qy1SMi7cQnWaalmQBO6sDaHU3/yKO3DCSceNYFeP1PxE6DR8Kkk8pF0EX patOaQZXI1vMFKBaCKRkyL8D5PPVYCHJpHHof6ivszFL068msWeqstAjaxyUNA9UU4Q7 9a8pcWV/Xqigju2zXJYkhoMAkuaPdtBc1MSPDqYlhrVegqEDLsRnNFS0F8oNZFRyqKvj wCX5/rImeqILUFrJwiu1WWRljGrF8lCLbpomiCQwHoeBHWWuiPQ5KIe7WyJaY37TCctz 1PjhtPlrRzgaiq6wrV99Jv4BiAOYHiwCNcyreXTrllWtNAQOwnw1NiK8dti0D6xHKYzP hBmw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :dkim-signature:from; bh=rSv+EkEwcIxRTN6Zs9j66Wun/yagrIt+dYmJkNqa1B4=; fh=40QV43lI/OUiMd2SpG8RFGI2qP/z3F0Iet+8ce80BMY=; b=PFGDJotk99Z597iomA5lyrY3DMjnHpeLpM7/OgmKZ6bUfhghl4ZcER8tWKvb8RFUjl Fg5XstuVpsj13AdN5XzRUDt1nuErYQiCdzRMpZohQDvfFETflU+vUYJExgSFm8gHekhQ cXdKczMc9TZV4xCPP7MnMCpnbeW/p59hkkLTYRRPFTulNlLpkIvGXZKE2dfdw6W3fIps HuipeKx5OjIakXuH9QMfi7kRGYdJsel/EPTdb76yy5Vf/hcQMJL7nd22nxrmogGK+Hp6 WHq/0zIPcGX4iocrfqHFxiEuhDsPWOytaP+xry+W7ZL45GYrc2WmnHnzPWJOoOIDo0xC V72w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marliere.net header.s=2024 header.b=h0pHd52i; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=marliere.net dmarc=pass fromdomain=marliere.net); spf=pass (google.com: domain of linux-kernel+bounces-63710-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63710-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=marliere.net X-Forwarded-Encrypted: i=2; AJvYcCXnl/7U3e8VrNcFT7N22laA4Aj75r0VcbbMpYmI5P6umHzdugCPlDAPWNvIGdAV+0FPEGjyifAkCsMo0n6PwCcCQyLGfw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id by37-20020a056a0205a500b005dc89648272si1955582pgb.24.2024.02.13.23.39.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 23:39:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63710-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@marliere.net header.s=2024 header.b=h0pHd52i; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=marliere.net dmarc=pass fromdomain=marliere.net); spf=pass (google.com: domain of linux-kernel+bounces-63710-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63710-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=marliere.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AA4CB28C6A0 for ; Tue, 13 Feb 2024 14:47:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8BB55DF02; Tue, 13 Feb 2024 14:47:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="h0pHd52i" Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7915857872; Tue, 13 Feb 2024 14:47:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707835647; cv=none; b=E/7mqBKmafb9fe16BWH8FcyPaxyEI1nQsvLlG7STKIiJwWepkpZU/GwQA4VVlANbwa8deA54ImkoLIL0r7uj4tLnjpk/hj6M/LYOnJrME4zdkAwM4kgAfSDMXKH7xhClNhMXCVZXG4Ait5LU8j2+FALEuDfrGlKle9CRBfSEWsI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707835647; c=relaxed/simple; bh=2+cceclGcci8ULNy1D19PpTajOUJ+CpjOxx4xydbjGk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=KwbRX2ygmaxDPFwBIBPHFCM7bRXgUgOk87M5jEIL1k1klu1giQ+ex80BYkM5gvTVL2ZTNVGAcjxAJDGyeQUhl5kQdvKix2UpBoNEncKdyWRouq+aWM28id0nKBSwxSAgRteJQeygAtQ8QlqNww1S90OndSt1iAD9WOUY5kLi/h4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b=h0pHd52i; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6e10614c276so66554b3a.3; Tue, 13 Feb 2024 06:47:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707835646; x=1708440446; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:dkim-signature:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rSv+EkEwcIxRTN6Zs9j66Wun/yagrIt+dYmJkNqa1B4=; b=UTKQr933PA3Dl3cAn7+bdVFe+bjNJcSfgc/Pv+tsxoYFO5uEfx8FBb0JtbOKlB42Qr RuBQzFu7ut1lDEgSu/arV00HjnHBMVE70597FbqL0X7YajpIEVFM4C7N6NmRHC0efoa/ ITGfjXDp+Ik4GXulZkZEvy/vq6zA+PhWMTd98RkFX2EKjOPmNAUSTO2uWyEHk6ixy8/z +ptoJvrkvFM8c2wj2iO2WRmRGY1D/dqoEqijrh5OGG2N7Ejd4rfx61ZHKBhbc+KMxsbQ 6NGxSYpkfcM4tdoGZFhA0C3sSeblVYFg5ikInxthZoAz4Exrl338uAD8VRsj9540lo19 uxcQ== X-Forwarded-Encrypted: i=1; AJvYcCXsFL7AGNCn1XpRao+d22bkDCWuKW39A8Bv+llj3X1Ou4fD8yUgGbEvXfRSWnaISP50RSq4WamyzhRZOERDl97suAzdexhZjCL4V/Qt X-Gm-Message-State: AOJu0YwS4egHZNn07OdcyuIMrO0XhXkYaJxSnV18oPBtUWvHuL+oxVVP 8Wp9rf44btl6zFl03QHFpBogtfUXHm1PXa3br3kTdRNNeH/U0Q1j X-Received: by 2002:a05:6a20:d704:b0:19e:c32f:35fc with SMTP id iz4-20020a056a20d70400b0019ec32f35fcmr7739203pzb.38.1707835645692; Tue, 13 Feb 2024 06:47:25 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXp2cKLlc3WXp80Ux0wkelgGEB7JGwZWU1HX3DxOq4cPevTrsC8yF60XBcXcpZrRJef5BWRN69w44RzcuqF2XuXg4UuFcqyxjjPczcQ+CGMXcM225t1lX7wlNSGUS79yEMVwmilOIfm2KJ0KpuLH/1tk6NEg3yTiCAAVMReB/ypnwXNIjuXfXg4IF9fwAwoHmCsTFdt/z9VNQ8+8HhDV33ybSfiyNiqZvky2jVzLycx8GOtYJJLmha/w2TmxNS12Qteflf1Q199t+1gzw2KwQ8XDjSkcAOJFe0jwJWFP4ybPuLoxA== Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id jc19-20020a17090325d300b001db2ff16acasm1533547plb.128.2024.02.13.06.47.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 06:47:24 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1707835643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rSv+EkEwcIxRTN6Zs9j66Wun/yagrIt+dYmJkNqa1B4=; b=h0pHd52i6myN8o63s3wRdqxEhvksXndaTTzrvcKxCIZc+Jjb5vp29wzxptNNgAsd9f7FgJ m4nzEPclOQIUdQk397mYe/DOy9XPavdr2v70jD1hYtpAUSnbkQWsTdw8XzohHAPZGSyvRT 2keM8Xey4o+s45UNZm1MSVrfuicgr0WerpxxYJghJzQnZVXGIqog0rvZYFM2rNS0f+ZmFp E7xIpRwXqix49E1pgXmQzwxzqyFFx7DBNEf2KbYNKh3q6v8gxfe5Geyp2I9McPGBzqrPmG k+MnfqvN0BnnbC83z+tRJoEKfE3eN8ndcDCnIa899yeSXfDoU16zAJPPU2E3Sg== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Tue, 13 Feb 2024 11:48:00 -0300 Subject: [PATCH] net: mdio_bus: make mdio_bus_type const Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240213-bus_cleanup-mdio-v1-1-f9e799da7fda@marliere.net> X-B4-Tracking: v=1; b=H4sIAB+By2UC/x3MTQqAIBBA4avErBP8g6KrRITpVAOlohhBdPek5 bd474GMiTDD0DyQ8KJMwVeItgG7G78hI1cNkkvNpVBsKXm2BxpfIjsdBdajcFx1uteqg5rFhCv d/3Kc3vcDSr6q4GIAAAA= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=2589; i=ricardo@marliere.net; h=from:subject:message-id; bh=2+cceclGcci8ULNy1D19PpTajOUJ+CpjOxx4xydbjGk=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBly4Eg/zE4zI0bun71Kvm4k5B9LEWDKef8FNLCD nE/VEZmubeJAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZcuBIAAKCRDJC4p8Y4ZY ptqsD/0VNY132uydVtSLLUjl8TUKpyoomDt3Kx5iWHf82OVZnI91FM21JtbEcjsX9SXx1lhs19v MH1jkEZHct7NUUGtploHuPkPCQGvJv7w66s1zji5VliXY9GZ6pWPLg7G9AV0SYsIsdOtmhf9yq0 0mcLWt/Z06moe3HYYOvbs0RuSK8X5V3bbS1Xm0awP6LDGw31Z9Q7prcA/r11CNbocql1usC7m2C HxgeaD1ZO7bY7C9z9m3vyDbL13ioQ+CKweUqCXn5ApUTyHSNkEidUkICW3+XOzVMIur+uVBz7or NRJK3fVLV7mhy7U3zU1YCmtyYvn+KollFDcLxZNNWpjGSF7nRFH7vgCRW/qXtU7nlGaZgqvlPz/ wZOIphFRl1iYgmIuwKIdFXb7ctjuFpmTgf28109qtxANFWossyxtvjlqSPQqlyyCimcGVyjR3hL gJWMoAeKzl4K0jR4hViURgHKfIoZPh85QdYgCBnw5u+jjgjziIc+YnIsEdn4gr6DeZctQfbqO45 GMHBd2CH9rnvBOYQU3ySKQBA+86cpkfQE9kxNQlKHVUhsKyHEVdXh3opB6TgNfbVS80ao8VYoyx IzLAffTaH/9RpDHguU5W8C1nUU3M2Zqiv3MaiThN3I+0v+RT7hW8nfx3Ivz8QYSNLN+u+TCgraZ xrDwnC5PY6O5PAA== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790797334865709020 X-GMAIL-MSGID: 1790859163803086413 Since commit d492cc2573a0 ("driver core: device.h: make struct bus_type a const *"), the driver core can properly handle constant struct bus_type, move the mdio_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B. Marliere --- drivers/net/phy/mdio_bus.c | 2 +- drivers/net/phy/phy_device.c | 3 +-- include/linux/phy.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) --- base-commit: 400909df6e6543cb5cce3db9bbcd413d59125327 change-id: 20240213-bus_cleanup-mdio-8e1d03748437 Best regards, diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 08624f073014..b765466e767f 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -1426,7 +1426,7 @@ static const struct attribute_group *mdio_bus_dev_groups[] = { NULL, }; -struct bus_type mdio_bus_type = { +const struct bus_type mdio_bus_type = { .name = "mdio_bus", .dev_groups = mdio_bus_dev_groups, .match = mdio_bus_match, diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 9f37c0bfbf8d..d63dca535746 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1604,7 +1604,6 @@ EXPORT_SYMBOL(phy_attach_direct); struct phy_device *phy_attach(struct net_device *dev, const char *bus_id, phy_interface_t interface) { - struct bus_type *bus = &mdio_bus_type; struct phy_device *phydev; struct device *d; int rc; @@ -1615,7 +1614,7 @@ struct phy_device *phy_attach(struct net_device *dev, const char *bus_id, /* Search the list of PHY devices on the mdio bus for the * PHY with the requested name */ - d = bus_find_device_by_name(bus, NULL, bus_id); + d = bus_find_device_by_name(&mdio_bus_type, NULL, bus_id); if (!d) { pr_err("PHY %s not found\n", bus_id); return ERR_PTR(-ENODEV); diff --git a/include/linux/phy.h b/include/linux/phy.h index 2249cdb5957a..c2dda21b39e1 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -2129,7 +2129,7 @@ static inline bool phy_package_probe_once(struct phy_device *phydev) return __phy_package_set_once(phydev, PHY_SHARED_F_PROBE_DONE); } -extern struct bus_type mdio_bus_type; +extern const struct bus_type mdio_bus_type; struct mdio_board_info { const char *bus_id;