From patchwork Sun Apr 2 17:58:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 78281 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1864424vqo; Sun, 2 Apr 2023 11:23:05 -0700 (PDT) X-Google-Smtp-Source: AKy350brHG3f2kpnefbqCGkN6TN3mpZIBlosYF7iV4FgcvIujD43DDskXE/dvv6GHDXVQG4ITt9h X-Received: by 2002:a17:907:6e04:b0:930:3916:df17 with SMTP id sd4-20020a1709076e0400b009303916df17mr45872584ejc.0.1680459785657; Sun, 02 Apr 2023 11:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680459785; cv=none; d=google.com; s=arc-20160816; b=bWrz9wL6CMSgOVIEk0TFNamemr+2GAubeb9K2/OtQNMvwwpLan33hi6mnrUDVRPsf/ JWMnbwuoSTA8pSfh4k2HVzQPuUlFEVJWpVUla0NWfqibgFmxxX1BcGFwWH8sKErFmUgq YztuV4wt9te18YbuW7GsyMRtKv1oEHOTTCecegDvkQkJ8Jxy98qRoHoRCIFaU29pL9x1 obN8AoINYVmg6XVagw8xRq8s0+7f3/4A4MvS75fxyzssokG6IgHfiz4Bc/lFHo0EIPDr jNrwoK55RtCQL+RXbIjrZYRYelItrpFB0Yvsf1018G9juOzw3vj66woYIZUT6f1XiEeO A/Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:lines:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=J4wVwvt42hkAKvM1gY6gbUABq7KbpWVCeZcrak9ZILc=; b=MDzsm3BFW/p07Wh7RTy6xmJqzFMzwBfOuwMKcX9AEDtpnFEnOJJkZ+8UeCP712I23r NXeh2CkKXPbREDNh1p+jzjL5m/fcZrpHKAzfBghzhH/3y4gDbkj3nDHUEgzTD4aIJDN0 jAp6x6PB9XNOx8H++swwT6ZCXfP8P0QCwmE5Ym7Qz4YNh+HZemyrBOArwYBd53w2vuYk 2a8WYb2pwpYvwf2YJTNS0yB4E6+HtUzEr/j44Jew/eqLc+OLv3Q+FB5i7K0E037I92J+ EIG61sxZUpjVA2kMWGJccJvdJKQIR+Rez0JshHPuSlCS3VVXTzoqWPw6yY6XgOYyWOPi deTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bbtMeHcf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e3-20020a170906044300b009341587edabsi4740649eja.89.2023.04.02.11.22.42; Sun, 02 Apr 2023 11:23:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bbtMeHcf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231308AbjDBR7S (ORCPT + 99 others); Sun, 2 Apr 2023 13:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231293AbjDBR7R (ORCPT ); Sun, 2 Apr 2023 13:59:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E51C0E049 for ; Sun, 2 Apr 2023 10:59:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 86EDFB80F2B for ; Sun, 2 Apr 2023 17:59:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9C46C433D2; Sun, 2 Apr 2023 17:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680458352; bh=pRhq4yGE+rRCid5ll0m5GDPBM3XxuF3voRhflViLux0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bbtMeHcfM0Z8nMH6TfPb7pUT0IAvzwnYkc/+3f1tk1/E+o0fiP/+Ygzd8HGNXde6O VCp8KkzexSCfY8YU+GoKXyMLV++tmDaDPBV6ICoKPWOJ/v6HR31cLfoDRyHyVdrc1+ T92NcIpTi2KcHZ/M6TqwBkBd2Imo0HUG3IKJ3ucw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: rafael@kernel.org, Greg Kroah-Hartman Subject: [PATCH 3/5] driver core: class: mark the struct class in struct class_interface constant Date: Sun, 2 Apr 2023 19:58:48 +0200 Message-Id: <2023040249-handball-gruffly-5da7@gregkh> X-Mailer: git-send-email 2.40.0 In-Reply-To: <2023040244-duffel-pushpin-f738@gregkh> References: <2023040244-duffel-pushpin-f738@gregkh> MIME-Version: 1.0 Lines: 39 X-Developer-Signature: v=1; a=openpgp-sha256; l=1425; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=pRhq4yGE+rRCid5ll0m5GDPBM3XxuF3voRhflViLux0=; b=owGbwMvMwCRo6H6F97bub03G02pJDCmahyKVbSf+KTPUceK4smmDfp/1PlXdOalLAudEp1bJx Dz2N7HviGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgIlEvGCYX2uWq3NAK6b3USub cNalq9Jt9fGCDPMzFgr1PWVeFSF7/PDTxVtU79cU/b0HAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762089799817105440?= X-GMAIL-MSGID: =?utf-8?q?1762089799817105440?= The struct class pointer in struct class_interface is never modified, so mark it as const so that no one accidentally tries to modify it in the future. Cc: "Rafael J. Wysocki" Signed-off-by: Greg Kroah-Hartman Acked-by: Rafael J. Wysocki --- drivers/base/class.c | 2 +- include/linux/device/class.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/class.c b/drivers/base/class.c index 05bce79d3d19..ad8b9f163fd2 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -498,7 +498,7 @@ EXPORT_SYMBOL_GPL(class_interface_register); void class_interface_unregister(struct class_interface *class_intf) { struct subsys_private *sp; - struct class *parent = class_intf->class; + const struct class *parent = class_intf->class; struct class_dev_iter iter; struct device *dev; diff --git a/include/linux/device/class.h b/include/linux/device/class.h index 4bf46f9bbb56..53287aa105b8 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -217,7 +217,7 @@ ssize_t show_class_attr_string(const struct class *class, const struct class_att struct class_interface { struct list_head node; - struct class *class; + const struct class *class; int (*add_dev) (struct device *, struct class_interface *); void (*remove_dev) (struct device *, struct class_interface *);