use inline functions instead of do while(0) for dev_*
authorjsg <jsg@openbsd.org>
Fri, 5 Apr 2024 14:31:57 +0000 (14:31 +0000)
committerjsg <jsg@openbsd.org>
Fri, 5 Apr 2024 14:31:57 +0000 (14:31 +0000)
avoids unused variable warning on gcc archs with ttm_tt.c rev 1.21
reported by deraadt@

sys/dev/pci/drm/drm_fb_helper.c
sys/dev/pci/drm/include/linux/device.h

index 36fb281..0911eb6 100644 (file)
@@ -1517,9 +1517,7 @@ static uint32_t drm_fb_helper_find_color_mode_format(struct drm_fb_helper *fb_he
                                                     const uint32_t *formats, size_t format_count,
                                                     unsigned int color_mode)
 {
-#ifdef notyet
        struct drm_device *dev = fb_helper->dev;
-#endif
        uint32_t bpp, depth;
 
        switch (color_mode) {
index 74ad8d0..2321332 100644 (file)
@@ -112,16 +112,32 @@ devm_device_add_group(struct device *dev, const struct attribute_group *g)
        printf("drm:pid%d:%s *DEBUG* " fmt, curproc->p_p->ps_pid,       \
            __func__ , ## arg)
 #else
-#define dev_info(dev, fmt, arg...)                             \
-           do { } while(0)
-#define dev_info_once(dev, fmt, arg...)                        \
-           do { } while(0)
-#define dev_dbg(dev, fmt, arg...)                              \
-           do { } while(0)
-#define dev_dbg_once(dev, fmt, arg...)                                 \
-           do { } while(0)
-#define dev_dbg_ratelimited(dev, fmt, arg...)                  \
-           do { } while(0)
+
+static inline void
+dev_info(struct device *dev, const char *fmt, ...)
+{
+}
+
+static inline void
+dev_info_once(struct device *dev, const char *fmt, ...)
+{
+}
+
+static inline void
+dev_dbg(struct device *dev, const char *fmt, ...)
+{
+}
+
+static inline void
+dev_dbg_once(struct device *dev, const char *fmt, ...)
+{
+}
+
+static inline void
+dev_dbg_ratelimited(struct device *dev, const char *fmt, ...)
+{
+}
+
 #endif
 
 static inline const char *