X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=drivers%2Fmacintosh%2Fvia-pmu-backlight.c;h=7e27071746e4582c54ae6b622b2160f36782778e;hb=57ed3eda977a215f054102b460ab0eb5d8d112e6;hp=a82f313d9dc97681a8d7220d25d1faa5de6eceb0;hpb=c547fc28ab3e8716076fdaf4bd0260c5d63a18f7;p=linux-2.6-omap-h63xx.git diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c index a82f313d9dc..7e27071746e 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c @@ -15,8 +15,8 @@ #define MAX_PMU_LEVEL 0xFF -static struct backlight_properties pmu_backlight_data; -static spinlock_t pmu_backlight_lock; +static struct backlight_ops pmu_backlight_data; +static DEFINE_SPINLOCK(pmu_backlight_lock); static int sleeping; static u8 bl_curve[FB_BACKLIGHT_LEVELS]; @@ -72,7 +72,7 @@ static int pmu_backlight_update_status(struct backlight_device *bd) { struct adb_request req; unsigned long flags; - int level = bd->props->brightness; + int level = bd->props.brightness; spin_lock_irqsave(&pmu_backlight_lock, flags); @@ -80,8 +80,8 @@ static int pmu_backlight_update_status(struct backlight_device *bd) if (sleeping) goto out; - if (bd->props->power != FB_BLANK_UNBLANK || - bd->props->fb_blank != FB_BLANK_UNBLANK) + if (bd->props.power != FB_BLANK_UNBLANK || + bd->props.fb_blank != FB_BLANK_UNBLANK) level = 0; if (level > 0) { @@ -107,14 +107,13 @@ out: static int pmu_backlight_get_brightness(struct backlight_device *bd) { - return bd->props->brightness; + return bd->props.brightness; } -static struct backlight_properties pmu_backlight_data = { - .owner = THIS_MODULE, +static struct backlight_ops pmu_backlight_data = { .get_brightness = pmu_backlight_get_brightness, .update_status = pmu_backlight_update_status, - .max_brightness = (FB_BACKLIGHT_LEVELS - 1), + }; #ifdef CONFIG_PM @@ -147,14 +146,15 @@ void __init pmu_backlight_init() snprintf(name, sizeof(name), "pmubl"); - bd = backlight_device_register(name, NULL, &pmu_backlight_data); + bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data); if (IS_ERR(bd)) { printk("pmubl: Backlight registration failed\n"); goto error; } + bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; pmu_backlight_init_curve(0x7F, 0x46, 0x0E); - level = pmu_backlight_data.max_brightness; + level = bd->props.max_brightness; if (autosave) { /* read autosaved value if available */ @@ -164,19 +164,12 @@ void __init pmu_backlight_init() level = pmu_backlight_curve_lookup( (req.reply[0] >> 4) * - pmu_backlight_data.max_brightness / 15); + bd->props.max_brightness / 15); } - down(&bd->sem); - bd->props->brightness = level; - bd->props->power = FB_BLANK_UNBLANK; - bd->props->update_status(bd); - up(&bd->sem); - - mutex_lock(&pmac_backlight_mutex); - if (!pmac_backlight) - pmac_backlight = bd; - mutex_unlock(&pmac_backlight_mutex); + bd->props.brightness = level; + bd->props.power = FB_BLANK_UNBLANK; + backlight_update_status(bd); printk("pmubl: Backlight initialized (%s)\n", name);