From patchwork Thu Dec 22 05:10:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 636199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3B65C4332F for ; Thu, 22 Dec 2022 05:11:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235038AbiLVFLL (ORCPT ); Thu, 22 Dec 2022 00:11:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234972AbiLVFK5 (ORCPT ); Thu, 22 Dec 2022 00:10:57 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3131743F; Wed, 21 Dec 2022 21:10:56 -0800 (PST) From: Thomas =?utf-8?q?Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1671685851; bh=lmzuDjULh3kowLm3TMvFkxEVatyBx6FhtKbQzT2W7mU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=G92vc5fD4RJzAzO3nxwjQcNGLwYlPe5rQt5aoEUC4Yo5uPkn85VtzUGr7fATtFEao uJxAejwNs6/4m9WPN5CaaTGv2km78lm/0Uza7oi0s7DetP8qCgv+3gt00/NYnC6UGw N+WDQCC4KS4N8SL4GvqLAW5kV5hZxYUxfs9a4aIg= Date: Thu, 22 Dec 2022 05:10:51 +0000 Subject: [PATCH 8/8] HID: Make lowlevel driver structs const MIME-Version: 1.0 Message-Id: <20221222-hid-v1-8-f4a6c35487a5@weissschuh.net> References: <20221222-hid-v1-0-f4a6c35487a5@weissschuh.net> In-Reply-To: <20221222-hid-v1-0-f4a6c35487a5@weissschuh.net> To: Hans de Goede , Jiri Kosina , Benjamin Tissoires , David Rheinsberg , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, Thomas =?utf-8?q?Wei=C3=9Fschuh?= X-Mailer: b4 0.11.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1671685845; l=2830; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=lmzuDjULh3kowLm3TMvFkxEVatyBx6FhtKbQzT2W7mU=; b=TrQRzvbiBIvM2hqcwA7qpilAY+5M4CjJABKmBOKmkVq49p7hE4I+VDC3iUmLrbzWhmg2T4XH45CP y6z/aG0rDAmHo/VUlI35Tx/LuQemT+fmoDni2btjQBfTBNztHI7S X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Nothing is nor should be modifying these structs so mark them as const. Signed-off-by: Thomas Weißschuh --- drivers/hid/i2c-hid/i2c-hid-core.c | 2 +- drivers/hid/uhid.c | 2 +- drivers/hid/usbhid/hid-core.c | 2 +- include/linux/hid.h | 2 +- net/bluetooth/hidp/core.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index fc5a0dd4eb92..af98ac31c8d4 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -842,7 +842,7 @@ static void i2c_hid_close(struct hid_device *hid) clear_bit(I2C_HID_STARTED, &ihid->flags); } -static struct hid_ll_driver i2c_hid_ll_driver = { +static const struct hid_ll_driver i2c_hid_ll_driver = { .parse = i2c_hid_parse, .start = i2c_hid_start, .stop = i2c_hid_stop, diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index 6cec0614fc98..f161c95a1ad2 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c @@ -387,7 +387,7 @@ static int uhid_hid_output_report(struct hid_device *hid, __u8 *buf, return uhid_hid_output_raw(hid, buf, count, HID_OUTPUT_REPORT); } -static struct hid_ll_driver uhid_hid_driver = { +static const struct hid_ll_driver uhid_hid_driver = { .start = uhid_hid_start, .stop = uhid_hid_stop, .open = uhid_hid_open, diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 4143bab3380a..257dd73e37bf 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -1318,7 +1318,7 @@ static bool usbhid_may_wakeup(struct hid_device *hid) return device_may_wakeup(&dev->dev); } -static struct hid_ll_driver usb_hid_driver = { +static const struct hid_ll_driver usb_hid_driver = { .parse = usbhid_parse, .start = usbhid_start, .stop = usbhid_stop, diff --git a/include/linux/hid.h b/include/linux/hid.h index 60a092150bc6..39a374c7fbac 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -595,7 +595,7 @@ struct hid_device { /* device report descriptor */ struct device dev; /* device */ struct hid_driver *driver; - struct hid_ll_driver *ll_driver; + const struct hid_ll_driver *ll_driver; struct mutex ll_open_lock; unsigned int ll_open_count; diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index c4a741f6ed5c..bed1a7b9205c 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -739,7 +739,7 @@ static void hidp_stop(struct hid_device *hid) hid->claimed = 0; } -static struct hid_ll_driver hidp_hid_driver = { +static const struct hid_ll_driver hidp_hid_driver = { .parse = hidp_parse, .start = hidp_start, .stop = hidp_stop,