If setting rate on a clock with no set_rate function, and the desired rate

matches the current rate, don't return an error.
This commit is contained in:
jmcneill 2018-06-12 23:08:37 +00:00
parent f4e29d9a9f
commit 8b313b2313
1 changed files with 10 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: clk.c,v 1.4 2018/04/28 15:20:33 jmcneill Exp $ */
/* $NetBSD: clk.c,v 1.5 2018/06/12 23:08:37 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clk.c,v 1.4 2018/04/28 15:20:33 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: clk.c,v 1.5 2018/06/12 23:08:37 jmcneill Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
@ -208,14 +208,17 @@ clk_get_rate(struct clk *clk)
int
clk_set_rate(struct clk *clk, u_int rate)
{
if (clk->flags & CLK_SET_RATE_PARENT) {
if (clk->flags & CLK_SET_RATE_PARENT)
return clk_set_rate(clk_get_parent(clk), rate);
} else if (clk->domain->funcs->set_rate) {
if (clk->domain->funcs->set_rate)
return clk->domain->funcs->set_rate(clk->domain->priv,
clk, rate);
} else {
return EINVAL;
}
if (clk_get_rate(clk) == rate)
return 0;
return EINVAL;
}
u_int