lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201102150936.26110.jeremy.kerr@canonical.com>
Date:	Tue, 15 Feb 2011 09:36:25 +0800
From:	Jeremy Kerr <jeremy.kerr@...onical.com>
To:	linux-arm-kernel@...ts.infradead.org
Cc:	Ryan Mallon <ryan@...ewatersys.com>,
	Nicolas Pitre <nicolas.pitre@...aro.org>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@....com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	linux-sh@...r.kernel.org,
	Ben Herrenschmidt <benh@...nel.crashing.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Paul Mundt <lethal@...ux-sh.org>, linux-kernel@...r.kernel.org,
	Dima Zavin <dmitriyz@...gle.com>,
	Saravana Kannan <skannan@...eaurora.org>,
	Ben Dooks <ben-linux@...ff.org>,
	"Uwe Kleine-König" 
	<u.kleine-koenig@...gutronix.de>,
	Russell King <linux@....linux.org.uk>
Subject: Re: [RFC,PATCH 1/3] Add a common struct clk

Hi Ryan,

> > +int clk_enable(struct clk *clk)
> > +{
> > +	unsigned long flags;
> > +	int ret = 0;
> > +
> > +	spin_lock_irqsave(&clk->enable_lock, flags);
> 
> 	WARN_ON(clk->prepare_count == 0); ?

Added later, but yes.

> 
> > +	if (clk->enable_count == 0 && clk->ops->enable)
> > +		ret = clk->ops->enable(clk);
> 
> Does it make sense to have a clock with no enable function which still
> returns success from clk_enable? Do we have any platforms which have
> NULL clk_enable functions?

It does, yes. Driver code should be always be calling clk_enable before using 
a clock, regardless of the implementation (which it shouldn't have to care 
abut), and should abort their initialisation if the clk_enable() fails.

Some clocks are always running, so the enable op will be empty. This is not an 
error, so the driver is free to continue.

> I think that for enable/disable at least we should require platforms to
> provide functions and oops if they have failed to do so. In the rare
> case that a platform doesn't need to do anything for enable/disable they
> can just supply empty functions.

Sounds like useless boilerplate - it's not an error to not need 
enable/disable, so I don't see why we need to add extra effort to handle this 
case.

> > +/**
> > + * __clk_get - acquire a reference to a clock
> > + *
> > + * @clk: The clock to refcount
> > + *
> > + * Before a clock is returned from clk_get, this function should be
> > called + * to update any clock-specific refcounting.
> 
> This is a bit misleading. It's not "should be called", it "is called". I
> think you should just remove the documentation for __clk_get/__clk_put
> or move it into clk.c since the functions are only used internally by
> the common clock code.

It'd be nice to remove this from the header, but this means we'll need extern 
prototypes in clkdev.c. Might be a reasonable compromise though.


> > +/**
> > + * clk_prepare - prepare clock for atomic enabling.
> > + *
> > + * @clk: The clock to prepare
> > + *
> > + * Do any blocking initialisation on @clk, allowing the clock to be
> > later + * enabled atomically (via clk_enable). This function may sleep.
> 
> "Possibly blocking" as below?

Yep, will unify these (and spell "possibly" correctly :) )

Cheers,


Jeremy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ