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: <201104292229.56518.rjw@sisk.pl>
Date:	Fri, 29 Apr 2011 22:29:56 +0200
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Stephen Boyd <sboyd@...eaurora.org>
Cc:	Linux PM mailing list <linux-pm@...ts.linux-foundation.org>,
	Colin Cross <ccross@...gle.com>, Kevin Hilman <khilman@...com>,
	LKML <linux-kernel@...r.kernel.org>,
	Grant Likely <grant.likely@...retlab.ca>,
	Len Brown <lenb@...nel.org>, linux-sh@...r.kernel.org,
	lethal@...ux-sh.org, Magnus Damm <magnus.damm@...il.com>,
	Alan Stern <stern@...land.harvard.edu>,
	Greg KH <gregkh@...e.de>
Subject: Re: [Update x2][PATCH 7/9] PM / Runtime: Generic clock manipulation rountines for runtime PM (v5)

On Friday, April 29, 2011, Stephen Boyd wrote:
> On 04/28/2011 12:36 PM, Rafael J. Wysocki wrote:
> > +/**
> > + * pm_runtime_clk_add - Start using a device clock for runtime PM.
> > + * @dev: Device whose clock is going to be used for runtime PM.
> > + * @con_id: Connection ID of the clock.
> > + *
> > + * Add the clock represented by @con_id to the list of clocks used for
> > + * the runtime PM of @dev.
> > + */
> > +int pm_runtime_clk_add(struct device *dev, const char *con_id)
> > +{
> > +	struct pm_runtime_clk_data *prd = __to_prd(dev);
> > +	struct pm_clock_entry *ce;
> > +
> > +	if (!prd)
> > +		return -EINVAL;
> > +
> > +	ce = kzalloc(sizeof(*ce), GFP_KERNEL);
> > +	if (!ce) {
> > +		dev_err(dev, "Not enough memory for clock entry.\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	if (con_id) {
> > +		ce->con_id = kstrdup(con_id, GFP_KERNEL);
> > +		if (!ce->con_id) {
> > +			dev_err(dev,
> > +				"Not enough memory for clock conection ID.\n");
> 
> Missing an 'n' in connection.

Right, thanks!

> > +			kfree(ce);
> > +			return -ENOMEM;
> > +		}
> > +	}
> > +
> > +	mutex_lock(&prd->lock);
> > +	list_add_tail(&ce->node, &prd->clock_list);
> > +	mutex_unlock(&prd->lock);
> > +	return 0;
> > +}
> > +
> > +/**
> > + * __pm_runtime_clk_remove - Destroy runtime PM clock entry.
> > + * @ce: Runtime PM clock entry to destroy.
> > + *
> > + * This routine must be called under the mutex protecting the runtime PM list
> > + * of clocks corresponding the the @ce's device.
> > + */
> > +static void __pm_runtime_clk_remove(struct pm_clock_entry *ce)
> > +{
> > +	if (!ce)
> > +		return;
> > +
> > +	list_del(&ce->node);
> > +
> > +	if (!IS_ERR_OR_NULL(ce->clk)) {
> 
> NULL is a valid clock so you'll need to figure out some way to handle
> that throughout this code.

Well, I didn't know that, thanks!  I'll need to add the "active" flag
back, then, after all.  In addition to that, I'll need to distinguish between
the "clk == NULL because it's not initialized" and "clk == NULL becuase it's
a valid clock" cases. 

I guess I'll use combinations of two flags.

Thanks,
Rafael
--
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