The patch titled powermac: defer work in backlight key press (and export fixes) has been removed from the -mm tree. Its filename is powermac-defer-work-in-backlight-key-press-and-export-fixes.patch This patch was dropped because an updated version was merged ------------------------------------------------------ Subject: powermac: defer work in backlight key press (and export fixes) From: Michael Hanselmann <linux-kernel@xxxxxxxxx> pmac_backlight_key() is called under interrupt context, and therefore can't use mutexes or semaphores, so defer the backlight level for later, as it's not critical (code by Aristeu S. Rozanski F. <aris@xxxxxxxxxx>). Also, it fixes exports and Kconfig depdencies. Signed-off-by: Michael Hanselmann <linux-kernel@xxxxxxxxx> Acked-by: Aristeu S. Rozanski F. <aris@xxxxxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/powerpc/platforms/powermac/backlight.c | 31 ++++++++++++------ drivers/macintosh/Kconfig | 5 ++ include/asm-powerpc/backlight.h | 9 +++-- 3 files changed, 32 insertions(+), 13 deletions(-) diff -puN arch/powerpc/platforms/powermac/backlight.c~powermac-defer-work-in-backlight-key-press-and-export-fixes arch/powerpc/platforms/powermac/backlight.c --- a/arch/powerpc/platforms/powermac/backlight.c~powermac-defer-work-in-backlight-key-press-and-export-fixes +++ a/arch/powerpc/platforms/powermac/backlight.c @@ -15,6 +15,15 @@ #define OLD_BACKLIGHT_MAX 15 +static void pmac_backlight_key_worker(void *data); +static DECLARE_WORK(pmac_backlight_key_work, pmac_backlight_key_worker, NULL); + +/* Although this variable is used in interrupt context, it makes no sense to + * protect it. No user is able to produce enough key events per second and + * notice the errors that might happen. + */ +static int pmac_backlight_key_queued; + /* Protect the pmac_backlight variable */ DEFINE_MUTEX(pmac_backlight_mutex); @@ -71,7 +80,7 @@ int pmac_backlight_curve_lookup(struct f return level; } -static void pmac_backlight_key(int direction) +static void pmac_backlight_key_worker(void *data) { mutex_lock(&pmac_backlight_mutex); if (pmac_backlight) { @@ -82,7 +91,8 @@ static void pmac_backlight_key(int direc props = pmac_backlight->props; brightness = props->brightness + - ((direction?-1:1) * (props->max_brightness / 15)); + ((pmac_backlight_key_queued?-1:1) * + (props->max_brightness / 15)); if (brightness < 0) brightness = 0; @@ -97,14 +107,13 @@ static void pmac_backlight_key(int direc mutex_unlock(&pmac_backlight_mutex); } -void pmac_backlight_key_up() +void pmac_backlight_key(int direction) { - pmac_backlight_key(0); -} - -void pmac_backlight_key_down() -{ - pmac_backlight_key(1); + /* we can receive multiple interrupts here, but the scheduled work + * will run only once, with the last value + */ + pmac_backlight_key_queued = direction; + schedule_work(&pmac_backlight_key_work); } int pmac_backlight_set_legacy_brightness(int brightness) @@ -157,3 +166,7 @@ int pmac_backlight_get_legacy_brightness return result; } + +EXPORT_SYMBOL_GPL(pmac_backlight); +EXPORT_SYMBOL_GPL(pmac_backlight_mutex); +EXPORT_SYMBOL_GPL(pmac_has_backlight_type); diff -puN drivers/macintosh/Kconfig~powermac-defer-work-in-backlight-key-press-and-export-fixes drivers/macintosh/Kconfig --- a/drivers/macintosh/Kconfig~powermac-defer-work-in-backlight-key-press-and-export-fixes +++ a/drivers/macintosh/Kconfig @@ -113,7 +113,10 @@ config PMAC_MEDIABAY config PMAC_BACKLIGHT bool "Backlight control for LCD screens" - depends on ADB_PMU && (BROKEN || !PPC64) + depends on ADB_PMU && FB = y && (BROKEN || !PPC64) + select FB_BACKLIGHT + select BACKLIGHT_CLASS_DEVICE + select BACKLIGHT_LCD_SUPPORT help Say Y here to enable Macintosh specific extensions of the generic backlight code. With this enabled, the brightness keys on older diff -puN include/asm-powerpc/backlight.h~powermac-defer-work-in-backlight-key-press-and-export-fixes include/asm-powerpc/backlight.h --- a/include/asm-powerpc/backlight.h~powermac-defer-work-in-backlight-key-press-and-export-fixes +++ a/include/asm-powerpc/backlight.h @@ -16,13 +16,16 @@ extern struct backlight_device *pmac_backlight; extern struct mutex pmac_backlight_mutex; -extern void pmac_backlight_calc_curve(struct fb_info*); extern int pmac_backlight_curve_lookup(struct fb_info *info, int value); extern int pmac_has_backlight_type(const char *type); -extern void pmac_backlight_key_up(void); -extern void pmac_backlight_key_down(void); +extern void pmac_backlight_key(int direction); + +#define pmac_backlight_key_up() \ + do { pmac_backlight_key(0); } while(0); +#define pmac_backlight_key_down() \ + do { pmac_backlight_key(1); } while(0); extern int pmac_backlight_set_legacy_brightness(int brightness); extern int pmac_backlight_get_legacy_brightness(void); _ Patches currently in -mm which might be from linux-kernel@xxxxxxxxx are powermac-combined-fixes-for-backlight-code.patch powermac-defer-work-in-backlight-key-press-and-export-fixes.patch locking-fixes-for-powermac-backlight-infrastructure.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html