]> git.baikalelectronics.ru Git - kernel.git/commit
drm/nouveau: Refactor nvXX_backlight_init()
authorLyude Paul <lyude@redhat.com>
Thu, 6 Sep 2018 21:43:26 +0000 (17:43 -0400)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 10 Oct 2018 23:54:10 +0000 (09:54 +1000)
commit1d895206474f2525153f478db60bba4d7a9aa1c3
treec336c4be8335a5b876d3d2345fa609e84e55b6d7
parentf3f85aa691218f4cb2a8163cd8fa8dcc8b37015c
drm/nouveau: Refactor nvXX_backlight_init()

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: Lyude Paul <lyude@redhat.com>
Cc: Jeffery Miller <jmiller@neverware.com>
Cc: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_backlight.c