• Lyude Paul's avatar
    drm/nouveau: Refactor nvXX_backlight_init() · e15e4c13
    Lyude Paul authored
    There's literally no difference between any of the backlight init
    functions besides the backlight properties they set and the backlight
    callbacks that they set, so move all of the duplicated backlight init
    code out of there and into nouveau_backlight_init().
    
    This gets rid of a lot of copy pasta!
    
    Changes since v1:
    - Some of the pre-refactor callbacks were storing nv_encoder in callback
      data for the backlight devices that they registered, as opposed to
      nouveau_drm. This got missed and caused some bugs that didn't
      originally appear on my setup (NULL kernel derefs) for some reason.
      So, fix this by finding the nouveau_encoder in
      nouveau_backlight_init(), and using that as the callback data for all
      gens instead even if they don't care about the encoder.
    Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
    Cc: Jeffery Miller <jmiller@neverware.com>
    Cc: Karol Herbst <kherbst@redhat.com>
    Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
    e15e4c13
nouveau_backlight.c 8.54 KB