From patchwork Wed Dec 20 07:38:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181512 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2475693dyi; Tue, 19 Dec 2023 23:40:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdXxOOeuU63nCyx2kqdRP55RfcxBMPAMHUPP92VmdNo/Dc2ds6mHrgyfLoK50Bd1zM2e3P X-Received: by 2002:a17:902:d549:b0:1d0:6ffd:9e22 with SMTP id z9-20020a170902d54900b001d06ffd9e22mr24068287plf.116.1703058016117; Tue, 19 Dec 2023 23:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703058016; cv=none; d=google.com; s=arc-20160816; b=SVZ+uT30eqUQp4IbSMEim2DOU1x3NQLdEmflLLegH78znTB6A1IQ5o45VZtwJ1n0ei QnqfovA4x7FOJODMWWges0tP7LainzjfkzROlkw/i41doa3A+c9aANKDZp7qKxm8jTz/ bKB/jjEFRC0Gq1r7wPMhaiGvVBw5m6kMjPouASVGXfVfmPkJfljbfAjI0+r4wfqTRDfj w54l5S+Hm9sUQihA4g5bmHdUDQgqG9alWGs8rVvm5JEeByUsOgdv7eaZ9zf/98I2mmja xeERg2yZvcY5UurTYYiewYxHMyMNIvbniEMpmLszxc5rAShPYhlEbXjViyZ9JQj1L8qs XIlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=VD7VU3dGVgY6F186VLiUTX3L1l32uiPHwdOuIGGyKmg=; fh=V6EI65/7Us4aYZ0HWydbpj0C6On27xDv541s2UP4+U4=; b=OPJ9a+cOVxfQPJsAi5diGl2gwsP0v6Kc0wYNx2SyppCPnqJLbfqB90kQzklYwSwlvV 7ScM3vq7i6GWmtd4e3NRPq3vCfqZOYqP2BJst4+fuURTIXHgdNHRb9zryt+ZaY+EZRCE EcOKjyKR1r/y44b+KynC2ND1U3sX7b4Ktn8KvvaTDw/JDMzMdSXuYbThgtKLzxKKFEXG /eRy0ZMJJMtHroF57sQsZbVuY1ukvc5mB3jYQ9/7MWydGAW8WtgHKBg9VDfVpmnN+4JB PBozvpwSxrzcwj+rxz/0UxlfvBjD/1kGBnnNw2XRYbn8bsnwbDVL6+cPJCpEWQtMT8kU JWrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DoXcTtdv; spf=pass (google.com: domain of linux-kernel+bounces-6503-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6503-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d7-20020a170902cec700b001d065c68f06si21497294plg.494.2023.12.19.23.40.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 23:40:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6503-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DoXcTtdv; spf=pass (google.com: domain of linux-kernel+bounces-6503-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6503-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org 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 B3D5E28801D for ; Wed, 20 Dec 2023 07:40:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D722A208DF; Wed, 20 Dec 2023 07:39:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DoXcTtdv" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D998320317; Wed, 20 Dec 2023 07:38:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A892C433C8; Wed, 20 Dec 2023 07:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1703057937; bh=eNwCbKBc8bEaqjAy+qYjJj2OPZznDf1/3qGd2xNtjGs=; h=From:To:Cc:Subject:Date:From; b=DoXcTtdvuYY0UfYPC0jC70LKzoLYhj4f4tqaA68RIF4LjPI51PI7VxH1kJdK/sS6y rvo0mMBwa97QA9f3KtmISGbwUyFPN0AqUbQ402lMizseWsh/VpB1C8/o/jmXzFmqCR qiwCbVhIXrciUqKba85p/l8s64eR9vUvdpDgC6UI= From: Greg Kroah-Hartman To: jikos@kernel.org, benjamin.tissoires@redhat.com Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-input@vger.kernel.org Subject: [PATCH 1/3] HID: make hid_bus_type const Date: Wed, 20 Dec 2023 08:38:46 +0100 Message-ID: <2023122045-pellet-eggbeater-8d2f@gregkh> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lines: 41 X-Developer-Signature: v=1; a=openpgp-sha256; l=1507; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=eNwCbKBc8bEaqjAy+qYjJj2OPZznDf1/3qGd2xNtjGs=; b=owGbwMvMwCRo6H6F97bub03G02pJDKlNs9h+TroyMfL7F87Fe1IWsEbOVXDm0gt9k5HFFPfMc tZ7QS7bjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjISVuGBau2BHx6Kz5vtaLJ yTqp/Wce+fXM+MEwv1hrc1Er7xMftVeXN8gLukhlqy/gAwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785785762442144075 X-GMAIL-MSGID: 1785785762442144075 Now that the driver core can properly handle constant struct bus_type, move the hid_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Jiri Kosina Cc: Benjamin Tissoires Cc: linux-input@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-core.c | 2 +- include/linux/hid.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index e0181218ad85..de7a477d6665 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -2749,7 +2749,7 @@ static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env) return 0; } -struct bus_type hid_bus_type = { +const struct bus_type hid_bus_type = { .name = "hid", .dev_groups = hid_dev_groups, .drv_groups = hid_drv_groups, diff --git a/include/linux/hid.h b/include/linux/hid.h index bf43f3ff6664..7c26db874ff0 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -912,7 +912,7 @@ extern bool hid_ignore(struct hid_device *); extern int hid_add_device(struct hid_device *); extern void hid_destroy_device(struct hid_device *); -extern struct bus_type hid_bus_type; +extern const struct bus_type hid_bus_type; extern int __must_check __hid_register_driver(struct hid_driver *, struct module *, const char *mod_name);