Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755393Ab3JWBVP (ORCPT ); Tue, 22 Oct 2013 21:21:15 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:40952 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755300Ab3JWBVM (ORCPT ); Tue, 22 Oct 2013 21:21:12 -0400 X-AuditID: cbfee691-b7f866d000001b8c-4c-5267247b48a3 From: Jingoo Han To: "'Johan Hovold'" Cc: "'Richard Purdie'" , "'Nicolas Ferre'" , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, "'Jingoo Han'" References: <1382462819-28576-1-git-send-email-jhovold@gmail.com> <1382462819-28576-2-git-send-email-jhovold@gmail.com> In-reply-to: <1382462819-28576-2-git-send-email-jhovold@gmail.com> Subject: Re: [PATCH 1/9] backlight: atmel-pwm-bl: fix reported brightness Date: Wed, 23 Oct 2013 10:20:59 +0900 Message-id: <001901cecf8e$21764db0$6462e910$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac7PS/RjWC/OkS1dQmy5wBjBYeX3+QAQgPPg Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCIsWRmVeSWpSXmKPExsVy+t8zA91qlfQgg1vfVSxeHtK0uLzwEqvF 3lXSFif6PrBaXN41h83i2+Vmdovdu56yWizY+IjRgcNjwa+tLB47Z91l99gz/werR9+WVYwe nzfJBbBGcdmkpOZklqUW6dslcGUcuPaNvWCfQEXDtY2sDYxvebsYOTkkBEwkOjZ+ZoGwxSQu 3FvP1sXIxSEksIxRYvWjCWwwRZf/n2KGSCxilGhf8ZoFwvnFKPFhzQKwKjYBNYkvXw6zg9gi QPaT3iPsIEXMAhcYJY6/fMIIkhASqJS413uBCcTmFHCS+D79EVizsICnxLr+s2B3sAioSlz5 MQdoHQcH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LKsYRVMLkguKk9JzDfWK E3OLS/PS9ZLzczcxghPEM6kdjCsbLA4xCnAwKvHwWrSnBQmxJpYVV+YeYpTgYFYS4W32BQrx piRWVqUW5ccXleakFh9iTAZ6cyKzlGhyPjB55ZXEGxqbmBlZGplZGJmYm5MmrCTOe6DVOlBI ID2xJDU7NbUgtQhmCxMHp1QDo8zDI2aHCjk21l3/e7hsg5q+yd+D7530LqdkG9pOVGzPVe68 FZ8z28y+QGDihzsySerfmfIlfOsvf9hgdIbrgqS8bjbv/TN+8lEHvS/b+CwqufXM0emCTEuC rkTxI/F7U53Whiot+LrzwKzFrvOSE+qtc26XKrjr36yN/37WwlleIPp1HleWEktxRqKhFnNR cSIAsAji6FQDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2293 Lines: 67 On Wednesday, October 23, 2013 2:27 AM, Johan Hovold wrote: > > The driver supports 16-bit brightness values, but the value returned > from get_brightness was truncated to eight bits. > > Cc: stable@vger.kernel.org > Signed-off-by: Johan Hovold > --- > drivers/video/backlight/atmel-pwm-bl.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c > index 66885fb..8aac273 100644 > --- a/drivers/video/backlight/atmel-pwm-bl.c > +++ b/drivers/video/backlight/atmel-pwm-bl.c > @@ -70,7 +70,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) > static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) > { > struct atmel_pwm_bl *pwmbl = bl_get_data(bd); > - u8 intensity; > + u32 intensity; > > if (pwmbl->pdata->pwm_active_low) { > intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) - > @@ -80,7 +80,7 @@ static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) > pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY); > } > > - return intensity; > + return (u16)intensity; However, atmel_pwm_bl_get_intensity() should return 'int', instead of 'u16'. Also, pwm_channel_readl() returns 'u32'. Then, how about the following? --- a/drivers/video/backlight/atmel-pwm-bl.c +++ b/drivers/video/backlight/atmel-pwm-bl.c @@ -70,17 +70,17 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) { struct atmel_pwm_bl *pwmbl = bl_get_data(bd); - u8 intensity; + u16 intensity; if (pwmbl->pdata->pwm_active_low) { - intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) - + intensity = (u16) pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) - pwmbl->pdata->pwm_duty_min; } else { - intensity = pwmbl->pdata->pwm_duty_max - + intensity = (u16) pwmbl->pdata->pwm_duty_max - pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY); } - return intensity; + return (int)intensity; } Best regards, Jingoo Han -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/