arm/komeda: Convert dp_wait_cond() to return an error code.
Subsystems (4)
Liviu Dudau
maintainerPATCH 1/1 arm/komeda: Convert dp_wait_cond() to return an error code.
dp_wait_cond() currently returns the number of retries left over which is hardly an useful information. Convert to returning -ETIMEDOUT when the wait times out, or 0 (zero) when condition is met before deadline.
Also convert the users of the function to return the error value.
--- drivers/gpu/drm/arm/display/include/malidp_utils.h | 5 ++--- drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/arm/display/include/malidp_utils.h +2 -3
@@ -8,6 +8,7 @@#define _MALIDP_UTILS_#include <linux/delay.h> +#include <linux/errno.h> #define has_bit (nr, mask) (BIT(nr) & (mask))#define has_bits (bits, mask) (((bits) & (mask)) == (bits))
@@ -20,11 +21,9 @@int num_tries = __tries; \while (!__cond && (num_tries >0 )) { \usleep_range (__min_range, __max_range); \ -if (__cond) \ -break ; \ num_tries--; \ } \ - num_tries; \ + (__cond) ?0 : -ETIMEDOUT ; \ })/* the restriction of range is [start, end] */
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +2 -2
@@ -280,7 +280,7 @@ static int d71_change_opmode(struct komeda_dev *mdev, int new_mode) ret =dp_wait_cond (((malidp_read32 (d71->gcu_addr,BLK_CONTROL ) &0x7 ) == opmode),100 ,1000 ,10000 ); -return ret >0 ?0 : -ETIMEDOUT ; +return ret; } static void d71_flush(struct komeda_dev *mdev,
@@ -304,7 +304,7 @@ static int d71_reset(struct d71_dev *d71) ret =dp_wait_cond (!(malidp_read32 (gcu,BLK_CONTROL ) &GCU_CONTROL_SRST ),100 ,1000 ,10000 ); -return ret >0 ?0 : -ETIMEDOUT ; +return ret; }void d71_read_block_header (u32 __iomem *reg,struct block_header *blk)
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 61 lines · Liviu Dudau
dp_wait_cond()currently returns the number of retries left over which is hardly an useful information. Convert to returning-ETIMEDOUTwhen the wait times out, or 0 (zero) when condition is met before deadline.Also convert the users of the function to return the error value.
Signed-off-by Liviu Dudau <[email protected]>--- drivers/gpu/drm/arm/display/include/malidp_utils.h | 5 ++--- drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-)drivers/gpu/drm/arm/display/include/malidp_utils.h +2
-3@@ -8,6 +8,7 @@#define _MALIDP_UTILS_#include <linux/delay.h> +#include <linux/errno.h> #define has_bit (nr, mask) (BIT(nr) & (mask))#define has_bits (bits, mask) (((bits) & (mask)) == (bits))@@ -20,11 +21,9 @@int num_tries = __tries; \while (!__cond && (num_tries >0 )) { \usleep_range (__min_range, __max_range); \ -if (__cond) \ -break ; \ num_tries--; \ } \ - num_tries; \ + (__cond) ?0 : -ETIMEDOUT ; \ })/* the restriction of range is [start, end] */ drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +2
-2@@ -280,7 +280,7 @@ static int d71_change_opmode(struct komeda_dev *mdev, int new_mode) ret =dp_wait_cond (((malidp_read32 (d71->gcu_addr,BLK_CONTROL ) &0x7 ) == opmode),100 ,1000 ,10000 ); -return ret >0 ?0 : -ETIMEDOUT ; +return ret; } static void d71_flush(struct komeda_dev *mdev,@@ -304,7 +304,7 @@ static int d71_reset(struct d71_dev *d71) ret =dp_wait_cond (!(malidp_read32 (gcu,BLK_CONTROL ) &GCU_CONTROL_SRST ),100 ,1000 ,10000 ); -return ret >0 ?0 : -ETIMEDOUT ; +return ret; }void d71_read_block_header (u32 __iomem *reg,struct block_header *blk)Signature · 1 line
2.21.0
Look good to me.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel