Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 599a52d1 authored by Richard Purdie's avatar Richard Purdie
Browse files

backlight: Separate backlight properties from backlight ops pointers



Per device data such as brightness belongs to the indivdual device
and should therefore be separate from the the backlight operation
function pointers. This patch splits the two types of data and
allows simplifcation of some code.

Signed-off-by: default avatarRichard Purdie <rpurdie@rpsys.net>
parent 321709c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ int die(const char *str, struct pt_regs *regs, long err)
	if (machine_is(powermac) && pmac_backlight) {
		struct backlight_properties *props;

		props = pmac_backlight->props;
		props = &pmac_backlight->props;
		props->brightness = props->max_brightness;
		props->power = FB_BLANK_UNBLANK;
		backlight_update_status(pmac_backlight);
+4 −4
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ DEFINE_MUTEX(pmac_backlight_mutex);

/* Main backlight storage
 *
 * Backlight drivers in this variable are required to have the "props"
 * Backlight drivers in this variable are required to have the "ops"
 * attribute set and to have an update_status function.
 *
 * We can only store one backlight here, but since Apple laptops have only one
@@ -103,7 +103,7 @@ static void pmac_backlight_key_worker(struct work_struct *work)
		struct backlight_properties *props;
		int brightness;

		props = pmac_backlight->props;
		props = &pmac_backlight->props;

		brightness = props->brightness +
			((pmac_backlight_key_queued?-1:1) *
@@ -141,7 +141,7 @@ static int __pmac_backlight_set_legacy_brightness(int brightness)
	if (pmac_backlight) {
		struct backlight_properties *props;

		props = pmac_backlight->props;
		props = &pmac_backlight->props;
		props->brightness = brightness *
			(props->max_brightness + 1) /
			(OLD_BACKLIGHT_MAX + 1);
@@ -190,7 +190,7 @@ int pmac_backlight_get_legacy_brightness()
	if (pmac_backlight) {
		struct backlight_properties *props;

		props = pmac_backlight->props;
		props = &pmac_backlight->props;

		result = props->brightness *
			(OLD_BACKLIGHT_MAX + 1) /
+3 −3
Original line number Diff line number Diff line
@@ -848,7 +848,7 @@ static int set_brightness(int value)

static int set_brightness_status(struct backlight_device *bd)
{
	return set_brightness(bd->props->brightness);
	return set_brightness(bd->props.brightness);
}

static int
@@ -1352,10 +1352,9 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
	return 0;
}

static struct backlight_properties asus_backlight_data = {
static struct backlight_ops asus_backlight_data = {
        .get_brightness = read_brightness,
        .update_status  = set_brightness_status,
        .max_brightness = 15,
};

static void __exit asus_acpi_exit(void)
@@ -1409,6 +1408,7 @@ static int __init asus_acpi_init(void)
		asus_backlight_device = NULL;
		asus_acpi_exit();
	}
        asus_backlight_device->props.max_brightness = 15;

	return 0;
}
+4 −3
Original line number Diff line number Diff line
@@ -1701,13 +1701,12 @@ static int brightness_write(char *buf)

static int brightness_update_status(struct backlight_device *bd)
{
	return brightness_set(bd->props->brightness);
	return brightness_set(bd->props.brightness);
}

static struct backlight_properties ibm_backlight_data = {
static struct backlight_ops ibm_backlight_data = {
        .get_brightness = brightness_get,
        .update_status  = brightness_update_status,
        .max_brightness = 7,
};

static int brightness_init(void)
@@ -1719,6 +1718,8 @@ static int brightness_init(void)
		return PTR_ERR(ibm_backlight_device);
	}

        ibm_backlight_device->props.max_brightness = 7;

	return 0;
}

+3 −3
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ static int set_lcd(int value)

static int set_lcd_status(struct backlight_device *bd)
{
	return set_lcd(bd->props->brightness);
	return set_lcd(bd->props.brightness);
}

static unsigned long write_lcd(const char *buffer, unsigned long count)
@@ -533,10 +533,9 @@ static acpi_status __exit remove_device(void)
	return AE_OK;
}

static struct backlight_properties toshiba_backlight_data = {
static struct backlight_ops toshiba_backlight_data = {
        .get_brightness = get_lcd,
        .update_status  = set_lcd_status,
        .max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1,
};

static void __exit toshiba_acpi_exit(void)
@@ -596,6 +595,7 @@ static int __init toshiba_acpi_init(void)
		toshiba_backlight_device = NULL;
		toshiba_acpi_exit();
	}
        toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1;

	return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
}
Loading