• Jani Nikula's avatar
    drm/print: introduce new struct drm_device based logging macros · fb6c7ab8
    Jani Nikula authored
    Add new struct drm_device based logging macros modeled after the core
    kernel device based logging macros. These would be preferred over the
    drm printk and struct device based macros in drm code, where possible.
    
    We have existing drm specific struct device based logging functions, but
    they are too verbose to use for two main reasons:
    
     * The names are unnecessarily long, for example DRM_DEV_DEBUG_KMS().
    
     * The use of struct device over struct drm_device is too generic for
       most users, leading to an extra dereference.
    
    For example:
    
    	DRM_DEV_DEBUG_KMS(drm->dev, "Hello, world\n");
    
    vs.
    
    	drm_dbg_kms(drm, "Hello, world\n");
    
    It's a matter of taste, but the SHOUTING UPPERCASE has been argued to be
    less readable than lowercase.
    
    Some names are changed from old DRM names to be based on the core kernel
    logging functions. For example, NOTE -> notice, ERROR -> err, DEBUG ->
    dbg.
    
    Due to the conflation of DRM_DEBUG and DRM_DEBUG_DRIVER macro use
    (DRM_DEBUG is used widely in drivers though it's supposed to be a core
    debugging category), they are named as drm_dbg_core and drm_dbg,
    respectively.
    
    The drm_err and _once/_ratelimited variants no longer include the
    function name in order to be able to use the core device based logging
    macros. Arguably this is not a significant change; error messages should
    not be so common to be only distinguishable by the function name.
    
    Ratelimited debug logging macros are to be added later.
    
    Cc: Sam Ravnborg <sam@ravnborg.org>
    Acked-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
    Acked-by: default avatarSean Paul <sean@poorly.run>
    Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
    Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20191210123050.8799-1-jani.nikula@intel.com
    fb6c7ab8
drm_print.h 15.7 KB