platform/x86: fujitsu-laptop: allocate fujitsu_bl in acpi_fujitsu_bl_add()
authorMichał Kępień <kernel@kempniu.pl>
Fri, 19 May 2017 07:44:42 +0000 (09:44 +0200)
committerDarren Hart (VMware) <dvhart@infradead.org>
Sat, 3 Jun 2017 19:03:26 +0000 (12:03 -0700)
commit679374e49c6f6691f5b19751b3a2e36cba0c4a4d
treeb0e0c8118cd9128af7a83fb229f3352bea3eac27
parent7ec3b54d162f5f1794a153e038b3940497579599
platform/x86: fujitsu-laptop: allocate fujitsu_bl in acpi_fujitsu_bl_add()

Only allocate memory for struct fujitsu_bl when the FUJ02B1 ACPI device
is present.  Use devm_kzalloc() for allocating memory to simplify
cleanup.

Due to the fact that the power property of the backlight device created
by the backlight driver is accessed from acpi_fujitsu_laptop_add(),
pointer to the allocated memory will remain stored in a module-wide
variable until the backlight driver is extracted into a separate module.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
drivers/platform/x86/fujitsu-laptop.c