From 5163e77faddb12c6c0485c3a407a8952174d22d4 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Mon, 3 Oct 2016 17:20:34 +0000 Subject: [PATCH] const-ify struct evdev_methods Submitted by: Vladimir Kondratiev Suggested by: hselasky --- sys/dev/evdev/evdev.c | 2 +- sys/dev/evdev/evdev.h | 3 ++- sys/dev/evdev/evdev_private.h | 2 +- sys/dev/usb/input/ukbd.c | 2 +- sys/dev/usb/input/ums.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index 095552ed26f6..4ad1db20cef0 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -302,7 +302,7 @@ evdev_set_serial(struct evdev_dev *evdev, const char *serial) inline void evdev_set_methods(struct evdev_dev *evdev, void *softc, - struct evdev_methods *methods) + const struct evdev_methods *methods) { evdev->ev_methods = methods; diff --git a/sys/dev/evdev/evdev.h b/sys/dev/evdev/evdev.h index 902763f325ed..7cfd21d6b63b 100644 --- a/sys/dev/evdev/evdev.h +++ b/sys/dev/evdev/evdev.h @@ -89,7 +89,8 @@ void evdev_set_name(struct evdev_dev *, const char *); void evdev_set_id(struct evdev_dev *, uint16_t, uint16_t, uint16_t, uint16_t); void evdev_set_phys(struct evdev_dev *, const char *); void evdev_set_serial(struct evdev_dev *, const char *); -void evdev_set_methods(struct evdev_dev *, void *, struct evdev_methods *); +void evdev_set_methods(struct evdev_dev *, void *, + const struct evdev_methods *); int evdev_register(struct evdev_dev *); int evdev_unregister(struct evdev_dev *); int evdev_push_event(struct evdev_dev *, uint16_t, uint16_t, int32_t); diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h index 8e44ae5a84a0..e8bfda49cd52 100644 --- a/sys/dev/evdev/evdev_private.h +++ b/sys/dev/evdev/evdev_private.h @@ -116,7 +116,7 @@ struct evdev_dev uint64_t ev_report_count; /* Parent driver callbacks: */ - struct evdev_methods * ev_methods; + const struct evdev_methods * ev_methods; void * ev_softc; LIST_ENTRY(evdev_dev) ev_link; diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index 893d46b7e0da..8e1eb23522a2 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -364,7 +364,7 @@ static device_detach_t ukbd_detach; static device_resume_t ukbd_resume; #ifdef EVDEV_SUPPORT -static struct evdev_methods ukbd_evdev_methods = { +static const struct evdev_methods ukbd_evdev_methods = { .ev_event = evdev_ev_kbd_event, }; #endif diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c index dc7d37786aa3..4d60517e1b50 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -191,7 +191,7 @@ static struct usb_fifo_methods ums_fifo_methods = { }; #ifdef EVDEV_SUPPORT -static struct evdev_methods ums_evdev_methods = { +static const struct evdev_methods ums_evdev_methods = { .ev_open = &ums_ev_open, .ev_close = &ums_ev_close, };