[PATCH v3 1/2] winebus.sys: Fix non-Linux builds

Rémi Bernon rbernon at codeweavers.com
Mon Sep 27 04:32:47 CDT 2021


From: Gerald Pfeifer <gerald at pfeifer.com>

commit 40a9f69a1de088fb72c6b8966bc4333dea5fdfff

   winebus.sys: Rename UDEV bus device variables to be consistent.

   Introducing a struct base_device, and hidraw_device / lnxev_device
   depending on the sub-type of the device.

moved an existing use of ABS_VOLUME that was guarded by

  #ifdef HAS_PROPER_INPUT_HEADER

outside that guard, breaking the build on non-Linux platforms.

Address this by putting appropriate guards in place.

Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/winebus.sys/bus_udev.c | 48 ++++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c
index 88db78360e2..fce3a7672d9 100644
--- a/dlls/winebus.sys/bus_udev.c
+++ b/dlls/winebus.sys/bus_udev.c
@@ -110,11 +110,23 @@ struct base_device
     int device_fd;
 };
 
+static inline struct base_device *impl_from_unix_device(struct unix_device *iface)
+{
+    return CONTAINING_RECORD(iface, struct base_device, unix_device);
+}
+
 struct hidraw_device
 {
     struct base_device base;
 };
 
+static inline struct hidraw_device *hidraw_impl_from_unix_device(struct unix_device *iface)
+{
+    return CONTAINING_RECORD(impl_from_unix_device(iface), struct hidraw_device, base);
+}
+
+#ifdef HAS_PROPER_INPUT_HEADER
+
 #define HID_REL_MAX (REL_MISC+1)
 #define HID_ABS_MAX (ABS_VOLUME+1)
 
@@ -130,21 +142,13 @@ struct lnxev_device
     int haptic_effect_id;
 };
 
-static inline struct base_device *impl_from_unix_device(struct unix_device *iface)
-{
-    return CONTAINING_RECORD(iface, struct base_device, unix_device);
-}
-
-static inline struct hidraw_device *hidraw_impl_from_unix_device(struct unix_device *iface)
-{
-    return CONTAINING_RECORD(impl_from_unix_device(iface), struct hidraw_device, base);
-}
-
 static inline struct lnxev_device *lnxev_impl_from_unix_device(struct unix_device *iface)
 {
     return CONTAINING_RECORD(impl_from_unix_device(iface), struct lnxev_device, base);
 }
 
+#endif /* HAS_PROPER_INPUT_HEADER */
+
 #define MAX_DEVICES 128
 static int close_fds[MAX_DEVICES];
 static struct pollfd poll_fds[MAX_DEVICES];
@@ -201,6 +205,18 @@ static struct base_device *find_device_from_fd(int fd)
     return NULL;
 }
 
+static struct base_device *find_device_from_udev(struct udev_device *dev)
+{
+    struct base_device *impl;
+
+    LIST_FOR_EACH_ENTRY(impl, &device_list, struct base_device, unix_device.entry)
+        if (impl->udev_device == dev) return impl;
+
+    return NULL;
+}
+
+#ifdef HAS_PROPER_INPUT_HEADER
+
 static const char *get_device_syspath(struct udev_device *dev)
 {
     struct udev_device *parent;
@@ -224,18 +240,6 @@ static struct base_device *find_device_from_syspath(const char *path)
     return NULL;
 }
 
-static struct base_device *find_device_from_udev(struct udev_device *dev)
-{
-    struct base_device *impl;
-
-    LIST_FOR_EACH_ENTRY(impl, &device_list, struct base_device, unix_device.entry)
-        if (impl->udev_device == dev) return impl;
-
-    return NULL;
-}
-
-#ifdef HAS_PROPER_INPUT_HEADER
-
 static const BYTE ABS_TO_HID_MAP[][2] = {
     {HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_X},              /*ABS_X*/
     {HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_Y},              /*ABS_Y*/
-- 
2.33.0




More information about the wine-devel mailing list