mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
- Fix-ups
- Handle 32bit overflow; pwm_bl - Remove redundant code/checks; tps65217_bl, ili922x -----BEGIN PGP SIGNATURE----- iQIcBAABCAAGBQJaDaGyAAoJEFGvii+H/HdhCpUP/A5ulsrmGU4VdibUDw4aRqxl SS8ABIbOyXMYwPdYH5FeXuumMJAWfuagfNaxWAvo2fMdwe4ZRerDqmo+bPhM47wU ji3LvtRXqapPNfdWFYirGD7wmlxD5CURZ588zB6sAmANsvnpP9ceBRkCQFEn1KmM sqyvcq/qmlFM7c2JY/Qdtb+YFF1HaNiIG7XjPEshP8QX2GNzo3HQfy+XOzVNLKdy 9R5J9lhDAGmeQ8QWMfF9M16MnoF3EznHRadttJhmBBqq8k8cJq+7p49l9JijmGNc Ro3Ss2sIvX0BbcWCde50eGtgAXqwlf1SuNsO0fJ9Hksvl8teE+Q8vtdyKwQsiSc+ yJueD/pc/G3B11UEv6DBJfJSuFyVjvjWvXanLyUVVmMuj+/nurlE8wfhQnmMjc3+ d3slePOpncrfez+0fhL3ImB3MEFkTthej+lhMayJs+rQd6gf3hs6fFp4pXSzbDCi EV5UleHLmwbt6geSo7rS5AHu1h1FGsCMiQrG5T9W7tF/i6WdvZxjK5IuGf6oe1jb bwkMdf3qTze/dyNsCkCd9YdyorfOOkn+xcg2o76ClqOj0TjB1BIB0ExhWQ+qzYlc kX9JzNJ0ROnG1/6NsgR+t6h+DXIaxlrA9sUi83F+245+FEF33Eq3SYv0nk2X0n6V 3TwZeeOUtvEaeYSdwsjx =KIqd -----END PGP SIGNATURE----- Merge tag 'backlight-next-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight Pull backlight updates from Lee Jones: - handle 32bit overflow in pwm_bl - remove redundant code/checks in tps65217_bl and ili922x * tag 'backlight-next-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight: ili922x: Remove redundant variable len backlight: tps65217_bl: Remove unnecessary default brightness check backlight: pwm_bl: Fix overflow condition
This commit is contained in:
commit
9c7a867ebd
3 changed files with 7 additions and 6 deletions
|
@ -251,7 +251,7 @@ static int ili922x_write(struct spi_device *spi, u8 reg, u16 value)
|
|||
struct spi_transfer xfer_regindex, xfer_regvalue;
|
||||
unsigned char tbuf[CMD_BUFSIZE];
|
||||
unsigned char rbuf[CMD_BUFSIZE];
|
||||
int ret, len = 0;
|
||||
int ret;
|
||||
|
||||
memset(&xfer_regindex, 0, sizeof(struct spi_transfer));
|
||||
memset(&xfer_regvalue, 0, sizeof(struct spi_transfer));
|
||||
|
@ -273,7 +273,6 @@ static int ili922x_write(struct spi_device *spi, u8 reg, u16 value)
|
|||
ret = spi_sync(spi, &msg);
|
||||
|
||||
spi_message_init(&msg);
|
||||
len = 0;
|
||||
tbuf[0] = set_tx_byte(START_BYTE(ili922x_id, START_RS_REG,
|
||||
START_RW_WRITE));
|
||||
tbuf[1] = set_tx_byte((value & 0xFF00) >> 8);
|
||||
|
|
|
@ -79,14 +79,17 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb)
|
|||
static int compute_duty_cycle(struct pwm_bl_data *pb, int brightness)
|
||||
{
|
||||
unsigned int lth = pb->lth_brightness;
|
||||
int duty_cycle;
|
||||
u64 duty_cycle;
|
||||
|
||||
if (pb->levels)
|
||||
duty_cycle = pb->levels[brightness];
|
||||
else
|
||||
duty_cycle = brightness;
|
||||
|
||||
return (duty_cycle * (pb->period - lth) / pb->scale) + lth;
|
||||
duty_cycle *= pb->period - lth;
|
||||
do_div(duty_cycle, pb->scale);
|
||||
|
||||
return duty_cycle + lth;
|
||||
}
|
||||
|
||||
static int pwm_backlight_update_status(struct backlight_device *bl)
|
||||
|
|
|
@ -239,8 +239,7 @@ tps65217_bl_parse_dt(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
if (!of_property_read_u32(node, "default-brightness", &val)) {
|
||||
if (val < 0 ||
|
||||
val > 100) {
|
||||
if (val > 100) {
|
||||
dev_err(&pdev->dev,
|
||||
"invalid 'default-brightness' value in the device tree\n");
|
||||
err = ERR_PTR(-EINVAL);
|
||||
|
|
Loading…
Reference in a new issue