From patchwork Sun Feb 18 19:18:09 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: 202868 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp919139dyc; Sun, 18 Feb 2024 11:18:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWxJ+FMRgqTfs2+DI2/7T/+GzV98bEmijo7yqFjq5Cx2T5TjtbF5T06TCNGVfNEgmTuuCnAwOZ4InNv8or8PdRI6QmMlQ== X-Google-Smtp-Source: AGHT+IGZaYTnmri4WO+e8tDQqGQZ285sbwHcxPX8j49R04Y1YPduuIkD0bvr0BbeL/NwY+aUPVSD X-Received: by 2002:ac2:4e06:0:b0:512:b369:15cf with SMTP id e6-20020ac24e06000000b00512b36915cfmr623200lfr.17.1708283889874; Sun, 18 Feb 2024 11:18:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283889; cv=pass; d=google.com; s=arc-20160816; b=EwKonjMNKGGhOgEtVosoPr2rKEJdnmE15fP+Nt8nRwmweaDJWNhE6vrpUG6UdZ96Sf nGfBHuxJiBwFk8wPa13hWw7r9xZbOm+Ro1EzryyfQuI59zenoNUkp7kgxxo01Ybxadc4 zJHds5k6YPLJhpDtVu2bkF/p/4nF/esS9CNhqltOvD3saJcNBu87WDnM2j+urmcy3V1R KjT2oQ7A1btZcTDj/PtMpv+mq/J6+K65D98o1npwysdUh2yDMMKMWV5cdmPyjmL7QcU2 wZOxqxy/aztt+hkbEO8bbteAE0zXbzxTSL8i3Krtg3/NcsoeTBMousGSrYjyfy0WOj/s 40mw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:dkim-signature:from; bh=F8qO94QSFDmkAfe4dTVfqhOrpLyIFW/SZ4BSF/6KA3Y=; fh=Hh96DzdG486AuheQc9AnCvCuzTDZBBMS6OkwG6I33zE=; b=gFf6sKPY8cOyDhwodGKVTfbHkyt8Cw9jqNmjyVtqbceXqpeYB4SbtbrYBadIZ20i8n WGcNcI1dJcZo2Oot6G+NHlJsSl6rypbUsjjxgug/KG7r1uWYoPK/bANvAag4YYom485D qiHyB4X6+G1dwJQOXpT3D+QCqMbPWLoJ9g4Y5J0N62vvKbp2wwbFYKPQ2sIxY+UREE+k YkUMCMaUT/vmtmrmDw5a/TT+7MUFwlOpbjbqnMtpXiw54RASFXMqr0YBSElsoXlanUVK iWMDPLIFY8CJ+w37uqB+WKr76PaG1mRW0zVPq30rMpo4FxlcrS/7XqtDbkzWZaUFeeq8 hZiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marliere.net header.s=2024 header.b=NJeG1C0W; 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-70544-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70544-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=marliere.net Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o18-20020a170906359200b00a3e6a01a787si675242ejb.907.2024.02.18.11.18.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:18:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70544-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@marliere.net header.s=2024 header.b=NJeG1C0W; 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-70544-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70544-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 51CD81F21479 for ; Sun, 18 Feb 2024 19:18:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5E9573176; Sun, 18 Feb 2024 19:17:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="NJeG1C0W" Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 B694871B2E; Sun, 18 Feb 2024 19:17:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283858; cv=none; b=PyVA8u3o+CUPaGSAOBE+CkVNkt8idPpYwTcMrmOzdNfwo2aC582oqSWb70V1pW5cJ4HnpzYNTHI1JDa1E1b5aRPkXvAxVQCEP0AyTPhU4R3GWHUqovJOXtcTVFcs77QDwAbNoVhpSEZQ1m7sLfLdpily1ltZBT1bWH9BkJRLjHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283858; c=relaxed/simple; bh=t6x/ZRYulTG708GhFefbeSEFl1szUQdpUP2dWsVwTs4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sBPu+kL1jlzF8I0JjWFsGbXFUeB+sP7Js1oxcfFYF+xuFRo+13q8VjgdWpKD2AlUQ8I+SY7KlsVgbPWVNM73i6tMNz2S44Md2UK0BPERN1CnPRqMZjTLVP5HTOHcx9ELeHNxdmqsdp7FHA3/fNR2eK4+Ewewrj4O2I6XlMHprwI= 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=NJeG1C0W; arc=none smtp.client-ip=209.85.210.182 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-f182.google.com with SMTP id d2e1a72fcca58-6da4a923b1bso3067833b3a.2; Sun, 18 Feb 2024 11:17:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708283856; x=1708888656; h=cc:to:in-reply-to:references: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=F8qO94QSFDmkAfe4dTVfqhOrpLyIFW/SZ4BSF/6KA3Y=; b=U1SjWzuYiVjvQ9Ktjkxx5v20clQt8lVkGzOjKmkxY5EwX7hGvURglU3jplam06wGBw DmgfJ47/igMNzPvpVEqZAf1df9az6ueXGW/av7HzkSpfiMwQ6/8hmLAepA3C+/uzmpju j6O+1sCGknB2yE1C39cjl2SyPo6QMkz2oIWOBe5OSGtaKQmtrO0Mcte0sFLwVTEQip13 Zf2LViDpUI3YZyqpxZs5wW67wUooOoa9X00YUNe+nmAqlSpSxlIyBFLIusjyPqBi6fHV hYAbNvu33tg7Jo1PCufEDP4wHEujIAJPDdTAGG2ZswdUosJfhV88DG4rIJbXZ0tk8WXN 7kwA== X-Forwarded-Encrypted: i=1; AJvYcCUbivqqaUfA6SV8ySglYDEjTZpXVioQn5oq/WRhdeoPo6IA/gOPoKh8fxMqm9Muy5WvSd7eDu6vHCfV1ph+aU+RX+dkqsVVRs0ytZsQ X-Gm-Message-State: AOJu0Ywm4Q3XU9Bh42I6hJv+YGKBBhg+/sDMhZEEAq+VZjS7xFpWTs+4 up0SCtQV0tOsVbHJMqvJLrMqU0FwqCo1Fgid4ADZcSnSR4/rMiblyC3Q54VPwQSukg== X-Received: by 2002:a05:6a00:1b42:b0:6e4:5a01:1b4 with SMTP id o2-20020a056a001b4200b006e45a0101b4mr1040827pfv.8.1708283855911; Sun, 18 Feb 2024 11:17:35 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id n7-20020aa79847000000b006e43c263cf1sm1360473pfq.185.2024.02.18.11.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:17:35 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1708283854; 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: in-reply-to:in-reply-to:references:references; bh=F8qO94QSFDmkAfe4dTVfqhOrpLyIFW/SZ4BSF/6KA3Y=; b=NJeG1C0WWBxnPQSqYr72KYe2qn9gnvlvWTlC2CEqn6ZUYhZHpdt76a7rWt75PFPJeCXMxS +WEyIFamykosXa9KnRT9Z9thP644hl12taMO2oFYBNyr0yt6K6Dw290iep+Rh9xwG34ZUC gz1vQANWK8RE80UkArTx0LyVR+uINAmwlYJ+8O+6vYY4gnCcfUWojvX6XzW2arnJkp7Xpl gtFKOSyVDv4BcIe6VryQSTATl+zrpDc4wdDEwRFGeB6SpnhM0TWDsThE9ImcPzuiecsG1h Qi9jHzOO91j8H0Goot9+3G6Z01T9STacemd+XoZmmTeoshL5fELq8rqs/l6U2w== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sun, 18 Feb 2024 16:18:09 -0300 Subject: [PATCH 1/4] usb: typec: constify the struct device_type usage Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-device_cleanup-usb-v1-1-77423c4da262@marliere.net> References: <20240218-device_cleanup-usb-v1-0-77423c4da262@marliere.net> In-Reply-To: <20240218-device_cleanup-usb-v1-0-77423c4da262@marliere.net> To: Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=4971; i=ricardo@marliere.net; h=from:subject:message-id; bh=t6x/ZRYulTG708GhFefbeSEFl1szUQdpUP2dWsVwTs4=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBl0lf1czi/cExGsCNDi2qIVX6RXMBwDiC1OQwzK yS/12GPOkiJAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZdJX9QAKCRDJC4p8Y4ZY pqwnD/0XxI+dN1COkr7ACdhtjVtszHj+xU+RKB8lXEk+PZLk/4bIr45gYXtydNAxzryTKrZf7Rq yoOubCsjHv9wRILA3JGcygk4kSTY+q/nODzUeLRHHPeEPbs4yhqieGDT2kBMpbhR1VRHWfOKKc8 tJvyP5mGQXQLBAjwoIqONArMu0mdO2iBnNGqe2M/VJbrT//sQPJDPQIBr46DujGWu1iMxx1c0KB 1mNpXQ6efUs2Hl1aJ19y68fSl6+RJq1bD/d3zO+N4Nr8pg3UGRXNFcBFiEtkmaFDG4Mt+xiYWjf FmxiLNi06D9Brz3aFe6rHLOPSiq86E+98kwwEzOiaYJyaJnJH0UudxYKAgJF9OuPQan1G9SpdR5 Ml31uIsqItk/pXrWtznMc2GrJsu2JK4eOnW53pOcdPCDIedhRhn4U9vOCN+q1/v58/T40VoQCNN HyCKVGhueh89XfgIF4UsQu+dhGXH5icL7Hjfvr5hjmw01BhJ0j0zkbvvjwsvtwaUyUS2hkYwM1M EJeMo8zjudD4gzpVexEkURuQS4dXajXAnUZsO5CpDC/AW7ztHdPk2oQUcnNhod5QD+4tCu1Yl36 DDteNKBWgvXl/wCGlq9NHx/+9UlYwZ7Qd3mPTQQihrPtpzu+F9OZINQB2dZq8VvB+/06P11d5f0 nXykaZGu4VxQIPA== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791265488235182354 X-GMAIL-MSGID: 1791265488235182354 Since commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move all the device_type variables in use by the driver to be constant structures as well, placing it into read-only memory which can not be modified at runtime. Signed-off-by: Ricardo B. Marliere Acked-by: Heikki Krogerus --- drivers/usb/typec/pd.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c index b9cca2be76fc..d78c04a421bc 100644 --- a/drivers/usb/typec/pd.c +++ b/drivers/usb/typec/pd.c @@ -157,7 +157,7 @@ static const struct attribute_group source_fixed_supply_group = { }; __ATTRIBUTE_GROUPS(source_fixed_supply); -static struct device_type source_fixed_supply_type = { +static const struct device_type source_fixed_supply_type = { .name = "pdo", .release = pdo_release, .groups = source_fixed_supply_groups, @@ -182,7 +182,7 @@ static const struct attribute_group sink_fixed_supply_group = { }; __ATTRIBUTE_GROUPS(sink_fixed_supply); -static struct device_type sink_fixed_supply_type = { +static const struct device_type sink_fixed_supply_type = { .name = "pdo", .release = pdo_release, .groups = sink_fixed_supply_groups, @@ -213,7 +213,7 @@ static struct attribute *source_variable_supply_attrs[] = { }; ATTRIBUTE_GROUPS(source_variable_supply); -static struct device_type source_variable_supply_type = { +static const struct device_type source_variable_supply_type = { .name = "pdo", .release = pdo_release, .groups = source_variable_supply_groups, @@ -227,7 +227,7 @@ static struct attribute *sink_variable_supply_attrs[] = { }; ATTRIBUTE_GROUPS(sink_variable_supply); -static struct device_type sink_variable_supply_type = { +static const struct device_type sink_variable_supply_type = { .name = "pdo", .release = pdo_release, .groups = sink_variable_supply_groups, @@ -258,7 +258,7 @@ static struct attribute *source_battery_attrs[] = { }; ATTRIBUTE_GROUPS(source_battery); -static struct device_type source_battery_type = { +static const struct device_type source_battery_type = { .name = "pdo", .release = pdo_release, .groups = source_battery_groups, @@ -272,7 +272,7 @@ static struct attribute *sink_battery_attrs[] = { }; ATTRIBUTE_GROUPS(sink_battery); -static struct device_type sink_battery_type = { +static const struct device_type sink_battery_type = { .name = "pdo", .release = pdo_release, .groups = sink_battery_groups, @@ -339,7 +339,7 @@ static struct attribute *source_pps_attrs[] = { }; ATTRIBUTE_GROUPS(source_pps); -static struct device_type source_pps_type = { +static const struct device_type source_pps_type = { .name = "pdo", .release = pdo_release, .groups = source_pps_groups, @@ -353,7 +353,7 @@ static struct attribute *sink_pps_attrs[] = { }; ATTRIBUTE_GROUPS(sink_pps); -static struct device_type sink_pps_type = { +static const struct device_type sink_pps_type = { .name = "pdo", .release = pdo_release, .groups = sink_pps_groups, @@ -371,30 +371,30 @@ static const char * const apdo_supply_name[] = { [APDO_TYPE_PPS] = "programmable_supply", }; -static struct device_type *source_type[] = { +static const struct device_type *source_type[] = { [PDO_TYPE_FIXED] = &source_fixed_supply_type, [PDO_TYPE_BATT] = &source_battery_type, [PDO_TYPE_VAR] = &source_variable_supply_type, }; -static struct device_type *source_apdo_type[] = { +static const struct device_type *source_apdo_type[] = { [APDO_TYPE_PPS] = &source_pps_type, }; -static struct device_type *sink_type[] = { +static const struct device_type *sink_type[] = { [PDO_TYPE_FIXED] = &sink_fixed_supply_type, [PDO_TYPE_BATT] = &sink_battery_type, [PDO_TYPE_VAR] = &sink_variable_supply_type, }; -static struct device_type *sink_apdo_type[] = { +static const struct device_type *sink_apdo_type[] = { [APDO_TYPE_PPS] = &sink_pps_type, }; /* REVISIT: Export when EPR_*_Capabilities need to be supported. */ static int add_pdo(struct usb_power_delivery_capabilities *cap, u32 pdo, int position) { - struct device_type *type; + const struct device_type *type; const char *name; struct pdo *p; int ret; @@ -460,7 +460,7 @@ static void pd_capabilities_release(struct device *dev) kfree(to_usb_power_delivery_capabilities(dev)); } -static struct device_type pd_capabilities_type = { +static const struct device_type pd_capabilities_type = { .name = "capabilities", .release = pd_capabilities_release, }; @@ -575,7 +575,7 @@ static void pd_release(struct device *dev) kfree(pd); } -static struct device_type pd_type = { +static const struct device_type pd_type = { .name = "usb_power_delivery", .release = pd_release, .groups = pd_groups, From patchwork Sun Feb 18 19:18:10 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: 202869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp919194dyc; Sun, 18 Feb 2024 11:18:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUKYPHMjsPDwbT+O/Rl5PZg/0NT14YmTrteFbyA9TdVvxFdDv90i9xpz7SlKzfAY57ywueuwzU1vLHMky5AmQG2M1Z3Gw== X-Google-Smtp-Source: AGHT+IEvw2C2V7mNM0vhYhlvFo0V9NpHjyGW/5ecBkTd1jybegrixwMvi75PweDUj87rmALui0IC X-Received: by 2002:a05:6a21:31c8:b0:1a0:7e41:cdc2 with SMTP id zb8-20020a056a2131c800b001a07e41cdc2mr7392290pzb.54.1708283900310; Sun, 18 Feb 2024 11:18:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283900; cv=pass; d=google.com; s=arc-20160816; b=df2atU2d/M6jwjRmXutTcEqed8NxmAL/1ajM3gd+bE8NDcDPG47h1IKiOk+gsELVyr N7hBHTMI8pdqj9oDLbiM3UAo41IkcPKiMbFGdLw1O+6CZuNTS2/DAXIzrdbnNHcQ3m94 WeSon3Htj5tLF13y5TAGSydcsmj/M5ZVnRX9Vt9ns616vJtXb2nbDpDgZR3ev6rtMhs+ Yp7RiYcEitMVl6M6O8m7qgsmWuBqhMxtcQ2u1S6VJncaM6lTkSzl9gUTgqZ5/TtfIyX9 +6q8MwFyxtj23qJWG2FJfYm1+v7Wnu/EnznqpOrB/91KtQvj0QHatMpJV+sgcT4Pw9lC K6Og== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:dkim-signature:from; bh=G04fZygIx/SdPXAIehBNQN19QyJJQNeUl7uwq2q3igg=; fh=FSIloFhjf6czhIOBNvZdiS38hkfDQrvFcerXP6ImDV8=; b=RHkhvkvPd/wGQrUTVqSOrOhluZlDtPQSP/n3YgYlhlU9kV3QDb0T18MwARQIXsgb9e rhnYuGL71dy3DAsuOzd+enYwUQh/q0GnJzCo64Rx6uVBeBFAwGIE9U+YyXdcgQlQLSgS C+uOGdcn9eoEztiBSE0dRF8gT2QEHVaEIvwXgfvzgYL4q6/IWbLegdB0Sxh0AYXpP9Mz of64nEBe+DNrYm/Air1oXfL5xjRm7QJ6faBrKSHdrl/7BAybKG4eE6/E6PT3Kegvz20r Naw/i7wj8oHo3z5GGrMoLlm4m1Y6ZUx92nuqWRw8HrYPUIKnzO0ls953S7a7pI4lTiUO zayg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marliere.net header.s=2024 header.b=D14yr+n3; 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-70545-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70545-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=marliere.net Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y4-20020a636404000000b005cdfaea88adsi3216209pgb.774.2024.02.18.11.18.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:18:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70545-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=D14yr+n3; 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-70545-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70545-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 24BDF2818DB for ; Sun, 18 Feb 2024 19:18:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 244BA73191; Sun, 18 Feb 2024 19:17:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="D14yr+n3" Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 EA7F973162; Sun, 18 Feb 2024 19:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283861; cv=none; b=LXqPdfcgUW79aHIp8IX9EJU6GboSNODDIDgKQVwAtq6OnthiBe3PFhNmjbyu8Jlvr9tIBsAKian3ao7pSXNruRFw7NWWIklGf3auKUU8sQjyqtn92QvmsrjI+w5elkE+Oype2Dte+Bz2cb4ayFuMHCBrr2jlJGWndfo5wmAVqc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283861; c=relaxed/simple; bh=z8aNWQu8hQNB/xEjSr/J7RjvO/XXeZxQtn0qbu3Z94w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ob9ruPfaM+k5yu7oP/QQRK+WVGeORS3Z9wv2K3WSt2E0ibFiwSRhb2GebVTesCsjtpbR3Rq51Eztrn7yqWB2m9S+zI0P/3PH2a8Up2FLZNG9rqHecrr2fFaKxurkWwpuz78H42SA1UBcAyyEyb2vWP6kCYmE4s4/P9AQJkAZj8g= 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=D14yr+n3; arc=none smtp.client-ip=209.85.214.171 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-pl1-f171.google.com with SMTP id d9443c01a7336-1d7393de183so28834305ad.3; Sun, 18 Feb 2024 11:17:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708283859; x=1708888659; h=cc:to:in-reply-to:references: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=G04fZygIx/SdPXAIehBNQN19QyJJQNeUl7uwq2q3igg=; b=IRdQaTL4mDjAFKDWWjVycYxEOtTeiCFnY1SkUTjSUHiaIL0bRZuijDR2+/T+QA7uLH wQa1v57eZhXskOP1vl4AZ/F8TDetHBiZiEOvYP6/UtTMpM6+fKtA0hzMqq1QCkJ2HBjD Hlh8IFxYN83lv3q6h75uRjyqly8o9d7g0RqIha36nWuEhU3svSsz4XqKgoHmRj0ZaWl1 ujwxR1P99hA1hZ64wY8TcjBEYPo6zJ5JCsqsCfThNeBj/1yx3ZRvTf8yoybct8EUwKyV u6EwlpsxGPdSApRPmlo690lrzMfChcAD6zsMLBlnretnAklKj0YytETARvhJzgz67Zhz lgqw== X-Forwarded-Encrypted: i=1; AJvYcCW3c/UcuKzjI7OHAIG3/2IsnL+iktjjjMPZCoUQqyHWPVVUT3OPSnDBvJBrwYdaqGL6skeyhRUZhZayXwbX234n1P3dfdsfsDD4Y9Hz X-Gm-Message-State: AOJu0YzI4bREPH+CkphOI+VvBMcr16pZRgjdQKgPYVFhVNOsdCdm3kXX DVOtaeXy92YF4zFTXA1owUbZIZ30ccC5g3RCsg1uwxgSvMQSurn6PWw0HaA9kd1wlg== X-Received: by 2002:a17:902:cecf:b0:1db:cf64:732e with SMTP id d15-20020a170902cecf00b001dbcf64732emr3766776plg.36.1708283859136; Sun, 18 Feb 2024 11:17:39 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id c24-20020a170902d91800b001d9eef9892asm2969048plz.174.2024.02.18.11.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:17:38 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1708283857; 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: in-reply-to:in-reply-to:references:references; bh=G04fZygIx/SdPXAIehBNQN19QyJJQNeUl7uwq2q3igg=; b=D14yr+n3hGmYxsTMJCL5+tqWz9cAYiTF/zy7MdqTJ5XOyJohFUhVpNYf0La5fIRVceozaJ MlxJqZkJlzEwmV8ZTXqsXAy4NXOnyUZSXtmCyX0Eglvz6n9rMVGaJJYIUtJkqrJ22O/R17 ztxyf0BVmzDlV+1Zuu0Bum4Pu+CkjYpcoWXVEvxLSjaH/fhmZroxLArVTYlUdWKu/4udlI kUcYumUId9f8XNuQfMc3J6tyXi0LmvsyruwRfJzY/Fub7VQCPOcU+5BaohAoUkpNCqpZS/ ZTwzQsOVhOb5MaaXqc7AZziaoCYRT2cAyglDIaPHstaSjVWlTcMsDKjBeo3q6g== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sun, 18 Feb 2024 16:18:10 -0300 Subject: [PATCH 2/4] usb: phy: constify the struct device_type usage Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-device_cleanup-usb-v1-2-77423c4da262@marliere.net> References: <20240218-device_cleanup-usb-v1-0-77423c4da262@marliere.net> In-Reply-To: <20240218-device_cleanup-usb-v1-0-77423c4da262@marliere.net> To: Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=876; i=ricardo@marliere.net; h=from:subject:message-id; bh=z8aNWQu8hQNB/xEjSr/J7RjvO/XXeZxQtn0qbu3Z94w=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBl0lf1aoR4z9JgnoODANxcn3uJcn/IsUFZX2pmw xERE+oX2oaJAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZdJX9QAKCRDJC4p8Y4ZY pobdD/9zyyd+b+J4vGJ4Bgu+1JFMALBKx+U6DY1+O4kpl45N5NLo9qzuWVgdZFA6nAR+oZ98o2I EoT82bbKd8fBe7NZcsi0L2kY3oDWek9huqUon+kEYEqcjOlHG6g5OMdT4W4TCQM1+UIPVsjiagG pMa2dAkBUnNHD17WiBsipoK0sLQAfjE6Zv/JVgIgJB3TwlZu7SiOu3tBJx1OkGY/UcPaa6a7UYG +gJKjgEt4wISQsAVZV1AeKkFXPzG8x9w1s0bimumv/X8jZU+2fkpzgdy7TYVhv5HFRmnNfWgxpH yoQVmZf1OisPRCHNAMWOQHdSTgYiLGVTj5DXpYG3wOshWXpqT0x09Vv65/qA0v8TSegcQXpavZL vwACDk0BQugjARmL0MiD56cGu92zqApLZpcfyh6eYcj29jI1kZpkt53vCJPliM9C2Tm2OkvMHNQ Py9oHdULDeXl9csLWMVHlSNNbIJKa1lIomFxMyKq6laiFw+S3/ltD0ya7/a8hGby504iz6e2snp frLv+h4MScewT0EqpjsD8boGGSt/xZMT9PkSQBlC3rRqb/y8/mqBRJNeweaRyHhDSZ7WyEtM3yQ 50prr+wXWt+ZeZ8HGm8XqzANoJ1PJDYRMjYHOg+tj6O/spLxcGq8msW8XuQ/pozFEFI+RFmVulb INyTL0LOfDeVALg== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791265498931171706 X-GMAIL-MSGID: 1791265498931171706 Since commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the usb_phy_dev_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Signed-off-by: Ricardo B. Marliere --- drivers/usb/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index 4b468bde19cf..06e0fb23566c 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c @@ -699,7 +699,7 @@ int usb_add_phy(struct usb_phy *x, enum usb_phy_type type) } EXPORT_SYMBOL_GPL(usb_add_phy); -static struct device_type usb_phy_dev_type = { +static const struct device_type usb_phy_dev_type = { .name = "usb_phy", .uevent = usb_phy_uevent, }; From patchwork Sun Feb 18 19:18:11 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: 202870 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp919266dyc; Sun, 18 Feb 2024 11:18:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWDZOCiJ3oChAazi+7ZWW5tE2gohqifmW9sgNCtVsd4CPq0IZFa5bD1xSKl7BMdWBilSX1h44z/FkaC6F/iz6oPw+Xsnw== X-Google-Smtp-Source: AGHT+IEzIt0UB1eCkYcFaqkvxVnTj68kFF+sacvH1QzJNNQzEFHXKMxvDz/eawSL7AE+caExfE63 X-Received: by 2002:a05:6a20:43a2:b0:19e:ba42:4edf with SMTP id i34-20020a056a2043a200b0019eba424edfmr16113538pzl.7.1708283915026; Sun, 18 Feb 2024 11:18:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283915; cv=pass; d=google.com; s=arc-20160816; b=KwBGFB0ckfYWoKQlFbj1N7u+7cHqCTBdayXTwqebAM0mwJbwJa4r8INAdqHvJA8SF1 mOclTrNwN8hnQC6aJUVv6PDxZcL+FbrVgQTI5ieELbfq35AtzDV/WWK01FHGMpNABAXP 2nStQCmzHJOL5KvRqpojVqnBFpeNCsYu46UFkxC7zGRoiZyDIW61jDzMZCYV/Sgl4+rw Vz4k6H7d4wC4RBUpSkm4UP7FtTD7xGgeQQYsldt/lpK4T+Jyl7U8xpMR+XHDIIwQRgZn efElt0nGSWboMfWqy9SFyLD6OqF+3bb6dm+ftOIeBbdh30i8bxAfY2D/fFtyNgnhn6hf Iz4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:dkim-signature:from; bh=yNj6ussvD5KRxU3ePwBAngKM9ROKdohi9c97Bm1e8SM=; fh=Iin0VZ8MHdvq2XwEwD5+hungWJbXPU7lMoInN3JeyRI=; b=DBNp/RgXMLovzMQCvtOJYpbHuIKhOGv97oYEsfLSTmqCfqaAUr4MLhEUWlfIS9mUom qArNYFK1ZJIQl2sM21QxfEN0AaRxpmHRQVVj9R8qSMKfLKuSUaE232uALJdwGp6PX3v3 Wz+zeevoMLDxc0clhibPYwtVafEx/H/KTKvlE0kzXE/ukI+5hV8Wb2P8bNon3ZEcEwLS Cmh1+3+TPsNZTjZPiMC3MfqO4puy/jrgxr6f5oc/FKHgCwjWCZY0SHez56TJxZWZX6Pz FR1lTN6TRmFblEmsK6Ypd0qFrocNUUSZpL7kHSLkZSqLw+YbZ/+7KrSJNDhfx+ylBTZV 6HiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marliere.net header.s=2024 header.b=AoXU6+2m; 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-70546-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70546-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=marliere.net Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n30-20020a63721e000000b005dca1e01c0asi3178716pgc.880.2024.02.18.11.18.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:18:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70546-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=AoXU6+2m; 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-70546-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70546-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 D453E28183E for ; Sun, 18 Feb 2024 19:18:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24649745C4; Sun, 18 Feb 2024 19:17:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="AoXU6+2m" Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 EFF907318A; Sun, 18 Feb 2024 19:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283864; cv=none; b=eCKXZSLRapFk7H4Vm6Yi/HXaDcuKiDQFsQ2woLrtQ+5rO9md7KmTFpdRvuunP9JgZDebvPK9NXUuP1RcHqSKV3z9ibG0v5KeWjWu08ybQDDmJpgUsleFAWdGfnO6Wn/eGuLlG4Z1XAwrdhlpsBf13zZj56tpqkKwfsXfyGCALhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283864; c=relaxed/simple; bh=+OReJk//Vhg4+WPQN5USvzq0O8yv2ebv4GQcKRlzh/k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=skoDyEaSRYGMQx3PCWV39QeHkEA7lccckN9uVYN3ERJ2Pvgfj3khTDpUP0nZwFZ0g4jooSETe8x8tE4fRBGy5dqTCOocH9YIuqpXQwuOw92StZxk9YwEgB5ZPALw5U+PyalL7z0YLEZ/xBbIrxlHovNzyk105fJxSWBOV15/rxI= 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=AoXU6+2m; arc=none smtp.client-ip=209.85.210.170 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-f170.google.com with SMTP id d2e1a72fcca58-6e4560664b5so382224b3a.1; Sun, 18 Feb 2024 11:17:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708283862; x=1708888662; h=cc:to:in-reply-to:references: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=yNj6ussvD5KRxU3ePwBAngKM9ROKdohi9c97Bm1e8SM=; b=dF+d+hUGthi4Tb8S/1sEtpglkRH51aysgI1xctTDxnlxPwzsyaPWRqFwSMOmARIfhy QfYyT12vvv5dWtH0lvD4aho957FP10djyrc6mEIzUKdoOn2te6W/mGO94U97AYRKWdR+ oEkQKht3Nb6VRcbm7HfOqbXlg6nHPH68DXZByeWfueEtmXfigKdxuWm4tF0CmRsL+/js OK4wfvT/iNxwS4Of74/V8/mz43BiilnshY4M5xhKlMOsw55v9ILlvbXLe3kqKYQ250Nf 4i1SlTqsrMkzZmItI8USMLSNbhQD6Vs31AcwFCm+bt14rwcb4loM+oTGRmo84kZCjxQ+ xWTA== X-Forwarded-Encrypted: i=1; AJvYcCWsazori90eN/YXuocSZSPBhAoBkOflcmslpADHv9vA/u+D8CteEM8npqS3rhZWrReMnHkuxocKAdJDhhgxcS9u0PWhV+Le4jt9Hwb5 X-Gm-Message-State: AOJu0Yxt+lgueXCUBXnuah0xwiixvONNK1HM/i678A69XhEXfW9BJ2dZ wtMwGbVwhAgde0Nbg8ikD1WkjdeW7Ixs82hIpTAskGClYcyTE5rl X-Received: by 2002:a05:6a20:6f07:b0:1a0:a1f6:19a8 with SMTP id gt7-20020a056a206f0700b001a0a1f619a8mr2454439pzb.27.1708283862310; Sun, 18 Feb 2024 11:17:42 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id gx11-20020a056a001e0b00b006e35764f9a6sm2608375pfb.213.2024.02.18.11.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:17:41 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1708283860; 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: in-reply-to:in-reply-to:references:references; bh=yNj6ussvD5KRxU3ePwBAngKM9ROKdohi9c97Bm1e8SM=; b=AoXU6+2miNwusGTw4Z2eI/vNuZr2ZGOj752zEcXTLmIa1e6OFynTd2v9EfvlsTkdOgg/0J kwVsGl/vzXkdJpvcgl0o+C2CvPpQ/+dfMcdjEatMViwLBoV/Ehlv/6Ur0B0Lj7mzPOnQdm eZiH7qbmzE/YIgi2mzc6rj/KCEVG79aBhl3M2WGwTnPUKG3I2mWIBNxQqIR51dCanveITm iQPKhxTUUE2jjfVssoneqfpMsDEPLMB7odeNrWZsLzyxTvh6dz/KjKuACs6/Xka77Aw0Gc C7GkvmNai8AufvUXeWei7cw+rdB5f7JIeKUR4qqBcUw9jzfx/u3YAYJIuwMe1Q== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sun, 18 Feb 2024 16:18:11 -0300 Subject: [PATCH 3/4] usb: gadget: constify the struct device_type usage Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-device_cleanup-usb-v1-3-77423c4da262@marliere.net> References: <20240218-device_cleanup-usb-v1-0-77423c4da262@marliere.net> In-Reply-To: <20240218-device_cleanup-usb-v1-0-77423c4da262@marliere.net> To: Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=919; i=ricardo@marliere.net; h=from:subject:message-id; bh=+OReJk//Vhg4+WPQN5USvzq0O8yv2ebv4GQcKRlzh/k=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBl0lf1+iYwfgu+86WLxZG8BHmYAkm8/QVRBluKr b4UsMuhCKWJAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZdJX9QAKCRDJC4p8Y4ZY pil0D/9eehHQG23b3RVySLh7vtmA8hP1BUl9Rr1KAn++zfbsTAEQ+v/aauYlA+EgUSUzsxTAKb6 4KO2zaE6v9plqDxAJ22XFj1eYsJ5Zx/yWNIg3W1uHe3b5XmkTFZfm24h2o8fxY93dsq2Q/iRCyg gtT0JJucC0WmW/3pXMgjOpheurhrjIhn3Wa6SeA8c5zUn25ppBNK/7kWj3+G9WXON2+oObPatgH D05N1Wb3l8prCkl8mnMifGBJZlUNaZEs5oURYD1HBDEVA9vSb04cAVZSGiPIHpEQkRH17X+M5Ni LWb1jYdIf3IDIcRg/TVcHH4jT2THBaut0Awdwr7Gmlc9P2yj9wS76rUoe0lBnMhQLrvOY/paYs7 aIetCnbKCOwPiXSiT+OskDPj+ibvAjNGqvXmKi646f3TankpUQSQPvo+z7QlaZ8agE54dKTQ5rD qIatCofkTWSdG//5cz4cGV+t8uWl70ITyDhN4/faTUWUgMuaqUe0wgClZZJqqsNSzR0/a09Okd3 +D+JBFM4V+z0xeOIi2R3GZFJ0oTT0R8dJNH80Zgt+2AoEwzGh2LUymfKNkkEf2wv8Uig6MNFRL6 o5jYGtNpApEMjigcvXuwgiLQW+xGkFCcBe+0FJAyyUrenrIC40TEEreuJRuAmG2HTzEbzuzSCSa 2X5sMIFbBkUsXMg== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791265514559843902 X-GMAIL-MSGID: 1791265514559843902 Since commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the gadget_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Signed-off-by: Ricardo B. Marliere --- drivers/usb/gadget/function/u_ether.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index 3c5a6f6ac341..444212c0b5a9 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -718,7 +718,7 @@ static const struct net_device_ops eth_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -static struct device_type gadget_type = { +static const struct device_type gadget_type = { .name = "gadget", }; From patchwork Sun Feb 18 19:18:12 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: 202871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp919360dyc; Sun, 18 Feb 2024 11:18:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUHtxwtAkvnsx6opiL8XmCpQHq9WRgWDIbsiwK6EfPi3vF+DnFMPn2KNDDpkNpXgLQdW3UGbGLx/tWt+jPG4TqnLOwHFQ== X-Google-Smtp-Source: AGHT+IGZCvGWBUk1rWCm0UAPfEgZMDw0VaNZ/2zOcNt6ij6ygUq5F8glWOfIrajkJmECbMmntn9c X-Received: by 2002:a05:6359:4c0b:b0:176:d5b7:344a with SMTP id kj11-20020a0563594c0b00b00176d5b7344amr10913073rwc.29.1708283930610; Sun, 18 Feb 2024 11:18:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283930; cv=pass; d=google.com; s=arc-20160816; b=stKUNDYW2gRdaIvPxYZ+RJIT2h4nxhpxz3usXPrxBX2+OaopE6D47ozgaSg4vxEIkG HHZ/n7c4gC9nbaPQRQLPSK5J+5ksudD+kxaK/rfK6JRIWwsVU1SEbADZMrVRM7Tv3omD TC8W94UBB3YcaSKkszzDjbUI1AeEASuhQH6iudpEq/45Av8iSuqkJdmgAxClYVT3BTFr 0nXcwktZ5IYVENTJ+FiiqNsK+N1vCvkScb6RrTNLXCXX6UoT+utBBw+vPtjdNezhFCdW 7Yj7Em9qGknW5FPWpUsQJXxh0C5fGKcjEHDdyVNzzg/1igfozPXpbruv2Ae6XlaLZNbc plfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:dkim-signature:from; bh=vQNRYm3ukxsOLCb4b7JJwL+j5XGiWOnosPqQUAzHJIQ=; fh=WOUe6uK2fvPCz2EUDmn0OWJEEorG1Zl4/sfSQN5WVk0=; b=L+wHSoklwNrR7h+hvtWHQD9x8HOMVZPTrQ9qVTjCe5nJtOJR+2UMvlOf7NiPQLU3aN oUFifS9plXff2oPEKKb7GPnUbkjdX0MAK/hptY7rICboehXLpjLYniyM2PaHE/ULG5N/ E8LHIb3ajroVXX+90BRAlh/wlNIFvuXsCpQ/xlh+i1nXtkXuHBBBKUq3nK9fm0SpWDsu 4I/qng9DRWdhWDM7rsNGdUtVLJ+NTpL3bskf3fhI5qhn4oVqsm6DycZ3Uw0OJ5dwUuXU API3AMzfeTP9hNW95Tyftp3pWv5ejytolIOwQZuCJSJ9Ogn3Og4Z5yFVUNci/KT1Ie/z jnYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marliere.net header.s=2024 header.b=jxr11Znv; 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-70547-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70547-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=marliere.net Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n30-20020a63721e000000b005dca1e01c0asi3178716pgc.880.2024.02.18.11.18.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:18:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70547-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=jxr11Znv; 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-70547-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70547-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 5EAED2818D2 for ; Sun, 18 Feb 2024 19:18:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E90B745D4; Sun, 18 Feb 2024 19:17:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="jxr11Znv" Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (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 B5A3171B2B; Sun, 18 Feb 2024 19:17:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283868; cv=none; b=sPWO6+xAIchFPvGSaTn5+LSaHbNTUGLCypLPvrPvy2WXuOD0S+knwxTxkI5nmwkuYsWcCop2K/9eJYPdLRdtnu4ff58Tp3zg1Ps4/S1IpwoLIpw7nJUNi/Bv16cR1u9RgSeh8m1VxiiEKvm2mhoLlJKk3S5vhnV3OzDps7goXvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283868; c=relaxed/simple; bh=PlDZ/DQXM/07PMDcTyBhIrDP9W36zYqNuPUo0TzKbvE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pWVhib8L8yiajBboNLyWo3fL4EMuK85PXBbuRTkpAN47pbPGUIYWISB5hVrRoflN0TBSiI09p/zSOcEEr2ovRvLf2DzGc6rkEWpWlUXCqcqZQiNtNDt+h6qWhqkIre3k7923GiL5Jzm/488pfX4zf6+o/5ISYM2cQbTxJA6BCW8= 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=jxr11Znv; arc=none smtp.client-ip=209.85.161.41 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-oo1-f41.google.com with SMTP id 006d021491bc7-59d7cbf1279so2313273eaf.2; Sun, 18 Feb 2024 11:17:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708283866; x=1708888666; h=cc:to:in-reply-to:references: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=vQNRYm3ukxsOLCb4b7JJwL+j5XGiWOnosPqQUAzHJIQ=; b=bxyI0iNH9wH7eQpyHy6QXkFsnjLvRT4PtANswm+WQpQ1V8uwxdILlif3/F3yZ45ycY OkCPDKr8ObPY9iAWSBnWgoaPThuPbDKYEmjB3/sT68pA+RF0UwLAQuCr951rzn37a0/r ellZxVEBCGmiomB6E08osLq/XFklXnudoq3sjd8FrBIQMz+OwwOSBMtaMmWV48UakciO vBv7lg8ivBHd/hWT/QnKPRhOVTIz08up/J5EE+QpZV1ecoj658ygrvp6trvZGHWNAen8 k36lM0BkG8suyawg75mbxd/aO8RPDsth5WkwCxxx49kkh3UaLdWAZ+9MsQIRZ7X40PTC IIgw== X-Forwarded-Encrypted: i=1; AJvYcCVY8w7quQkQxoD2VlJq01A7pm65fHr+cQSEMFw/J7hyZCOAu+prKCz1JgchhVRFDLG9OKoGbaKyTXTFsPl88LUFfv7O43+voyMHw5P/ X-Gm-Message-State: AOJu0YxzrBZc6S+l1sa8vt9BZBgk5O2n+vVk5FKMufOfISz32C5I6taY RLfNr77FrPa12Fg6pkgBKuF+bW8MnS0l8/3IaorUXyk+QpvtgfEq X-Received: by 2002:a05:6358:63a2:b0:178:b7c0:323f with SMTP id k34-20020a05635863a200b00178b7c0323fmr12456899rwh.19.1708283865667; Sun, 18 Feb 2024 11:17:45 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id p21-20020aa78615000000b006e0949b2548sm2634422pfn.209.2024.02.18.11.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:17:45 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1708283864; 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: in-reply-to:in-reply-to:references:references; bh=vQNRYm3ukxsOLCb4b7JJwL+j5XGiWOnosPqQUAzHJIQ=; b=jxr11ZnvAo4cR83d6om9WnVVOUns/mfSWeHif+O75tci1hSFO8RfZ8Op/hwvqqh+01nE2/ 95WQTinlCXTX2v7qbqFfxj33V+g026d9ixsPkn3/+dH552dokspiuT7x/BbhTo6jpcJu4h Dd2LvJDrp8qXO+ZjDWR9NSVTCjYUMweQA6g7jTkZAcFUjXIe04UbSkdIK1OZRkfOtBQ8A+ SDM/vGT340u7flzNWJIGYPvSUTeF2jJTi5rEJ9649q7+X71dcdOheRNhIr4ninfFwsE3gz +b85WgFSovQ7OVEz8nPm3248+GYog+GFpLA5tJlO0AUF10nQnCVpUcrCHw4M0g== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sun, 18 Feb 2024 16:18:12 -0300 Subject: [PATCH 4/4] usb: core: constify the struct device_type usage Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-device_cleanup-usb-v1-4-77423c4da262@marliere.net> References: <20240218-device_cleanup-usb-v1-0-77423c4da262@marliere.net> In-Reply-To: <20240218-device_cleanup-usb-v1-0-77423c4da262@marliere.net> To: Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=3413; i=ricardo@marliere.net; h=from:subject:message-id; bh=PlDZ/DQXM/07PMDcTyBhIrDP9W36zYqNuPUo0TzKbvE=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBl0lf1mygX1QLxHNFMAm/dvDIotCaFbkuZjMfCB AtIDT8fKbeJAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZdJX9QAKCRDJC4p8Y4ZY pjfYD/49rP6j1XNXmK3NjDC1kryNy/X232I7AlecWd+LG6BquAUQA1H/l/STXE6NccXSXdK5SOE 4Db5GT6YeX2Vh6VF02/wUDXUMqVtdWyq0tyRgUKJ872+T2KFM+jcgMIfyi7Urg7EwTJ029CgYIZ dBjZAdLKk1AZr2CzoRUzxPi+dMbE8Ah0qWghMU4Lg67ift1V9FDuApGQaIFKaRiqDDehdptmGaF v7aIEwsXbbqOfvbWLcMz4ncJv32fhA0UwxT8qCTUZ3+P1ClXC45ycsJV3X27pfC44Oej7OpUeEc lSP4/iryIyy3UqTmmiFFS/g+Ud4eTaJNMKsSL6AY49DcRzywrS5kO/7+SuW7AvecMnTNMs1SLX0 ktGt8125IK658Bsde2d8lQ9YEeu5OSM118abbTg9lDwKTpbP02kI0iFO7TtA2ISXcOjWf8Nb1cu 7jCs+o3AlTcC6kDzNJ4tObqUDuT/czEDRLUDdG8T8xpHCccKVj3tHMwCscP80cuC5E/D1sne/wQ /NjjjwJytBmFcsuLTZQaQG1K0GSyM3MBzSdNUVRhhVmrUnsNk30dCmI+QaTfWrgrFvYx8tFaSJE Pk0IYISliJNTyIrsBrJfbgq74gAIzXRYXYW/N5PF8bBTa6El1IRuYcq+hJr/gQ1X4PRK6DuPZVJ s3Pgt9Q3AEkiH1w== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791265530665819788 X-GMAIL-MSGID: 1791265530665819788 Since commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the usb_device_type, usb_if_device_type, usb_ep_device_type and usb_port_device_type variables to be constant structures as well, placing it into read-only memory which can not be modified at runtime. Signed-off-by: Ricardo B. Marliere --- drivers/usb/core/endpoint.c | 2 +- drivers/usb/core/message.c | 2 +- drivers/usb/core/port.c | 2 +- drivers/usb/core/usb.c | 2 +- drivers/usb/core/usb.h | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index a2530811cf7d..4b38b87a1343 100644 --- a/drivers/usb/core/endpoint.c +++ b/drivers/usb/core/endpoint.c @@ -141,7 +141,7 @@ static void ep_device_release(struct device *dev) kfree(ep_dev); } -struct device_type usb_ep_device_type = { +const struct device_type usb_ep_device_type = { .name = "usb_endpoint", .release = ep_device_release, }; diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 077dfe48d01c..67316d271596 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1849,7 +1849,7 @@ static int usb_if_uevent(const struct device *dev, struct kobj_uevent_env *env) return 0; } -struct device_type usb_if_device_type = { +const struct device_type usb_if_device_type = { .name = "usb_interface", .release = usb_release_interface, .uevent = usb_if_uevent, diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index c628c1abc907..84d36172b040 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -429,7 +429,7 @@ static const struct dev_pm_ops usb_port_pm_ops = { #endif }; -struct device_type usb_port_device_type = { +const struct device_type usb_port_device_type = { .name = "usb_port", .release = usb_port_device_release, .pm = &usb_port_pm_ops, diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index dc8d9228a5e7..a0c432b14b20 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -592,7 +592,7 @@ static char *usb_devnode(const struct device *dev, usb_dev->bus->busnum, usb_dev->devnum); } -struct device_type usb_device_type = { +const struct device_type usb_device_type = { .name = "usb_device", .release = usb_release_dev, .uevent = usb_dev_uevent, diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index bfecb50773b6..b8324ea05b20 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -144,10 +144,10 @@ static inline int usb_disable_usb2_hardware_lpm(struct usb_device *udev) extern const struct class usbmisc_class; extern const struct bus_type usb_bus_type; extern struct mutex usb_port_peer_mutex; -extern struct device_type usb_device_type; -extern struct device_type usb_if_device_type; -extern struct device_type usb_ep_device_type; -extern struct device_type usb_port_device_type; +extern const struct device_type usb_device_type; +extern const struct device_type usb_if_device_type; +extern const struct device_type usb_ep_device_type; +extern const struct device_type usb_port_device_type; extern struct usb_device_driver usb_generic_driver; static inline int is_usb_device(const struct device *dev)