--- zzzz-none-000/linux-3.10.107/drivers/video/backlight/jornada720_lcd.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/video/backlight/jornada720_lcd.c 2021-02-04 17:41:59.000000000 +0000 @@ -27,11 +27,7 @@ static int jornada_lcd_get_power(struct lcd_device *ld) { - /* LDD2 in PPC = LCD POWER */ - if (PPSR & PPC_LDD2) - return FB_BLANK_UNBLANK; /* PW ON */ - else - return FB_BLANK_POWERDOWN; /* PW OFF */ + return PPSR & PPC_LDD2 ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; } static int jornada_lcd_get_contrast(struct lcd_device *ld) @@ -43,37 +39,38 @@ jornada_ssp_start(); - if (jornada_ssp_byte(GETCONTRAST) != TXDUMMY) { - dev_err(&ld->dev, "get contrast failed\n"); - jornada_ssp_end(); - return -ETIMEDOUT; - } else { + if (jornada_ssp_byte(GETCONTRAST) == TXDUMMY) { ret = jornada_ssp_byte(TXDUMMY); - jornada_ssp_end(); - return ret; + goto success; } + + dev_err(&ld->dev, "failed to set contrast\n"); + ret = -ETIMEDOUT; + +success: + jornada_ssp_end(); + return ret; } static int jornada_lcd_set_contrast(struct lcd_device *ld, int value) { - int ret; + int ret = 0; jornada_ssp_start(); /* start by sending our set contrast cmd to mcu */ - ret = jornada_ssp_byte(SETCONTRAST); - - /* push the new value */ - if (jornada_ssp_byte(value) != TXDUMMY) { - dev_err(&ld->dev, "set contrast failed\n"); - jornada_ssp_end(); - return -ETIMEDOUT; + if (jornada_ssp_byte(SETCONTRAST) == TXDUMMY) { + /* if successful push the new value */ + if (jornada_ssp_byte(value) == TXDUMMY) + goto success; } - /* if we get here we can assume everything went well */ - jornada_ssp_end(); + dev_err(&ld->dev, "failed to set contrast\n"); + ret = -ETIMEDOUT; - return 0; +success: + jornada_ssp_end(); + return ret; } static int jornada_lcd_set_power(struct lcd_device *ld, int power) @@ -100,7 +97,8 @@ struct lcd_device *lcd_device; int ret; - lcd_device = lcd_device_register(S1D_DEVICENAME, &pdev->dev, NULL, &jornada_lcd_props); + lcd_device = devm_lcd_device_register(&pdev->dev, S1D_DEVICENAME, + &pdev->dev, NULL, &jornada_lcd_props); if (IS_ERR(lcd_device)) { ret = PTR_ERR(lcd_device); @@ -119,18 +117,8 @@ return 0; } -static int jornada_lcd_remove(struct platform_device *pdev) -{ - struct lcd_device *lcd_device = platform_get_drvdata(pdev); - - lcd_device_unregister(lcd_device); - - return 0; -} - static struct platform_driver jornada_lcd_driver = { .probe = jornada_lcd_probe, - .remove = jornada_lcd_remove, .driver = { .name = "jornada_lcd", },