From: jsg Date: Fri, 5 Apr 2024 14:31:57 +0000 (+0000) Subject: use inline functions instead of do while(0) for dev_* X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3f7c134ffe9cdb72a35475e1d8777e39978c0bf9;p=openbsd use inline functions instead of do while(0) for dev_* avoids unused variable warning on gcc archs with ttm_tt.c rev 1.21 reported by deraadt@ --- diff --git a/sys/dev/pci/drm/drm_fb_helper.c b/sys/dev/pci/drm/drm_fb_helper.c index 36fb281fb08..0911eb6cdfd 100644 --- a/sys/dev/pci/drm/drm_fb_helper.c +++ b/sys/dev/pci/drm/drm_fb_helper.c @@ -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) { diff --git a/sys/dev/pci/drm/include/linux/device.h b/sys/dev/pci/drm/include/linux/device.h index 74ad8d0205b..2321332b338 100644 --- a/sys/dev/pci/drm/include/linux/device.h +++ b/sys/dev/pci/drm/include/linux/device.h @@ -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 *