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 Kroah-Hartman X-Patchwork-Id: 756659 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) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DoXcTtdv" 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-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 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 Acked-by: Srinivas Pandruvada --- 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); From patchwork Wed Dec 20 07:38:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 757706 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 D70051F600; Wed, 20 Dec 2023 07:38:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wXLTQ5DO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04D3EC433C8; Wed, 20 Dec 2023 07:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1703057934; bh=npKwGFoNMhkCrPaQzFSksmdJeACxgz31jGlwwfNba5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wXLTQ5DOuw8vuINew63Di+cUKndnXKNnLeeR+9xaqyme9Q0xp1a4dwPHRDWVDLwtu h08YXfOOB4Pa6wVOTQHjuO5djsydVAMmjeHAlGwx79hReb/4bqdxZUj0YKFF3ful7n dG4BVX6qcUQ70oUU8bIFHuWS5o5uyCN/OBrb5ybM= From: Greg Kroah-Hartman To: jikos@kernel.org, benjamin.tissoires@redhat.com Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Srinivas Pandruvada , linux-input@vger.kernel.org Subject: [PATCH 2/3] HID: make ishtp_cl_bus_type const Date: Wed, 20 Dec 2023 08:38:47 +0100 Message-ID: <2023122048-tribute-quote-1b4d@gregkh> X-Mailer: git-send-email 2.43.0 In-Reply-To: <2023122045-pellet-eggbeater-8d2f@gregkh> References: <2023122045-pellet-eggbeater-8d2f@gregkh> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1130; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=npKwGFoNMhkCrPaQzFSksmdJeACxgz31jGlwwfNba5s=; b=owGbwMvMwCRo6H6F97bub03G02pJDKlNszjSz5+K8hO9yCq294n0X6ksiWDO8hfMW/O/LP+r0 7Dif41/RywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEyE6wvDPLuHu6c7bGea5t2x Lthxa8S/Be4/TzPMFS9S66pOsP4Vs0fNX+9cpPfR91nyAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Now that the driver core can properly handle constant struct bus_type, move the ishtp_cl_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Srinivas Pandruvada Cc: Jiri Kosina Cc: Benjamin Tissoires Cc: linux-input@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c index 7fc738a22375..aa6cb033bb06 100644 --- a/drivers/hid/intel-ish-hid/ishtp/bus.c +++ b/drivers/hid/intel-ish-hid/ishtp/bus.c @@ -378,7 +378,7 @@ static const struct dev_pm_ops ishtp_cl_bus_dev_pm_ops = { .restore = ishtp_cl_device_resume, }; -static struct bus_type ishtp_cl_bus_type = { +static const struct bus_type ishtp_cl_bus_type = { .name = "ishtp", .dev_groups = ishtp_cl_dev_groups, .probe = ishtp_cl_device_probe, From patchwork Wed Dec 20 07:38:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 757705 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 A9D0D208D6; 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="H5xI8sLy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD808C433C8; Wed, 20 Dec 2023 07:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1703057941; bh=ZB1Fpehfxz1OYRnlaoOsVM8LmfGkRvS/BbeYZcRWryA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H5xI8sLyoEomG1i907Zb/EZTQKW2N10h2n7VfSK283UUP4iEWXnzXDe/5fF0RdAnm +yYeAk3x4ARMHbhtjBq2bklKs/lerpAhOAJ35LI77OkC3JkWtdhEBGvz72w64MDS8Y YaS/8hfMJamOWAOd4nlEtulA1Ms1I3EpZy4O/jr8= 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 3/3] HID: bpf: make bus_type const in struct hid_bpf_ops Date: Wed, 20 Dec 2023 08:38:48 +0100 Message-ID: <2023122048-dormitory-headboard-e248@gregkh> X-Mailer: git-send-email 2.43.0 In-Reply-To: <2023122045-pellet-eggbeater-8d2f@gregkh> References: <2023122045-pellet-eggbeater-8d2f@gregkh> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1053; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ZB1Fpehfxz1OYRnlaoOsVM8LmfGkRvS/BbeYZcRWryA=; b=owGbwMvMwCRo6H6F97bub03G02pJDKlNszj7DiSeDZdW1jI+pHBLNLKFkf9+w6+t958JM1p3R cRmK3zqiGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgInYrGRYMPXCammvJfOO/23s SpjFdFBLa/+6MIYFm5+UXH+45pB7Q5t1newpycf3C3XjAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 The struct bus_type pointer in hid_bpf_ops just passes the pointer to the driver core, and the driver core can handle, and expects, a constant pointer, so also make the pointer constant in hid_bpf_ops. Part of the process of moving all usages of struct bus_type to be constant to move them all to read-only memory. Cc: Jiri Kosina Cc: Benjamin Tissoires Cc: linux-input@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- include/linux/hid_bpf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h index e9afb61e6ee0..840cd254172d 100644 --- a/include/linux/hid_bpf.h +++ b/include/linux/hid_bpf.h @@ -115,7 +115,7 @@ struct hid_bpf_ops { size_t len, enum hid_report_type rtype, enum hid_class_request reqtype); struct module *owner; - struct bus_type *bus_type; + const struct bus_type *bus_type; }; extern struct hid_bpf_ops *hid_bpf_ops;