if (ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, "GBRT", &handle))) {
sony_backlight_device = backlight_device_register("sony", NULL,
NULL, &sony_backlight_properties);
+
if (IS_ERR(sony_backlight_device)) {
printk(LOG_PFX "unable to register backlight device\n");
+ sony_backlight_device = NULL;
}
+ else
+ sony_backlight_properties.brightness =
+ sony_backlight_get_brightness(sony_backlight_device);
}
for (item = sony_acpi_values; item->name; ++item) {
return 0;
outproc:
+ if (sony_backlight_device)
+ backlight_device_unregister(sony_backlight_device);
+
for (item = sony_acpi_values; item->name; ++item)
if (item->proc)
remove_proc_entry(item->name, acpi_device_dir(device));