From 400ced3501a696cf63fe1d0671a9da45c28c86fb Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Fri, 22 Jul 2022 09:48:33 +0100 Subject: [PATCH] drivers: ssd16xx: Clean up ssd16xx_clear_cntlr_mem Remove the optional call to ssd16xx_update_display() in ssd16xx_clear_cntlr_mem(). This doesn't really belong in that function and just adds a non-obvious boolean argument to the function. Signed-off-by: Andreas Sandberg --- drivers/display/ssd16xx.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/display/ssd16xx.c b/drivers/display/ssd16xx.c index c279408b12..973347fc15 100644 --- a/drivers/display/ssd16xx.c +++ b/drivers/display/ssd16xx.c @@ -605,8 +605,7 @@ static int ssd16xx_set_pixel_format(const struct device *dev, return -ENOTSUP; } -static int ssd16xx_clear_cntlr_mem(const struct device *dev, uint8_t ram_cmd, - bool update) +static int ssd16xx_clear_cntlr_mem(const struct device *dev, uint8_t ram_cmd) { const struct ssd16xx_config *config = dev->config; uint16_t panel_h = config->height / EPD_PANEL_NUMOF_ROWS_PER_PAGE; @@ -655,10 +654,6 @@ static int ssd16xx_clear_cntlr_mem(const struct device *dev, uint8_t ram_cmd, } } - if (update) { - return ssd16xx_update_display(dev); - } - return 0; } @@ -873,13 +868,17 @@ static int ssd16xx_controller_init(const struct device *dev) return err; } - err = ssd16xx_clear_cntlr_mem(dev, SSD16XX_CMD_WRITE_RAM, true); + err = ssd16xx_clear_cntlr_mem(dev, SSD16XX_CMD_WRITE_RAM); if (err < 0) { return err; } - err = ssd16xx_clear_cntlr_mem(dev, SSD16XX_CMD_WRITE_RED_RAM, - false); + err = ssd16xx_clear_cntlr_mem(dev, SSD16XX_CMD_WRITE_RED_RAM); + if (err < 0) { + return err; + } + + err = ssd16xx_update_display(dev); if (err < 0) { return err; }