Re: [RFC PATCH v2 08/10] lib: vdso: Avoid duplication in __cvdso_clock_getres()

2019-12-23 Thread Andy Lutomirski
On Mon, Dec 23, 2019 at 6:31 AM Christophe Leroy
 wrote:
>
> VDSO_HRES and VDSO_RAW clocks are handled the same way.
>
> Don't duplicate code.
>
> Signed-off-by: Christophe Leroy 

Reviewed-by: Andy Lutomirski 


[RFC PATCH v2 08/10] lib: vdso: Avoid duplication in __cvdso_clock_getres()

2019-12-23 Thread Christophe Leroy
VDSO_HRES and VDSO_RAW clocks are handled the same way.

Don't duplicate code.

Signed-off-by: Christophe Leroy 
---
 lib/vdso/gettimeofday.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index 5a17a9d2e6cd..aa4a167bf1e0 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -172,7 +172,7 @@ int __cvdso_clock_getres(const struct vdso_data *vd, 
clockid_t clock,
 * clocks are handled in the VDSO directly.
 */
msk = 1U << clock;
-   if (msk & VDSO_HRES) {
+   if (msk & (VDSO_HRES | VDSO_RAW)) {
/*
 * Preserves the behaviour of posix_get_hrtimer_res().
 */
@@ -182,11 +182,6 @@ int __cvdso_clock_getres(const struct vdso_data *vd, 
clockid_t clock,
 * Preserves the behaviour of posix_get_coarse_res().
 */
ns = LOW_RES_NSEC;
-   } else if (msk & VDSO_RAW) {
-   /*
-* Preserves the behaviour of posix_get_hrtimer_res().
-*/
-   ns = hrtimer_res;
} else {
return -1;
}
-- 
2.13.3