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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 31 Jul 2011 00:49:17 +0200
From:	Eric Andersson <eric.andersson@...xphere.com>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	zhengguang.guo@...ch-sensortec.com, stefan.nilsson@...xphere.com,
	alan@...rguk.ukuu.org.uk, jic23@....ac.uk,
	Albert Zhang <xu.zhang@...ch-sensortec.com>
Subject: Re: [PATCH v6 1/1] input: add driver for Bosch Sensortec's BMA150
 accelerometer

> > +static int bma150_open(struct bma150_data *bma150)
> > +{
> > +	int ret;
> > +
> > +	ret = pm_runtime_set_active(&bma150->client->dev);
> > +	if (ret < 0)
> > +		return ret;
> > +
> > +	pm_runtime_enable(&bma150->client->dev);
> 
> I am pretty sure you want to call pm_runtime_enable() in bma150_probe()
> so that parent controller can be suspended until somebody calls
> bma150_open() and we mark the device as active (which, in turn, should
> wake up its parent).

If I call pm_runtime_enable() I cannot use pm_runtime_set_active() later
according to the comment in __pm_runtime_set_status (runtime.c):
"If runtime PM of the device is disabled or its power.runtime_error
field is different from zero, the status may be changed either to
RPM_ACTIVE, or to RPM_SUSPENDED..."

If the PM of the device is enabled it will return -EAGAIN. Of course, we
could enable() in probe, then disable(); set_active(); enable(); in
open, but that seems a bit confused, right?

> > +
> > +	return bma150_set_mode(bma150->client, BMA150_MODE_NORMAL);
> > +}
> > +
> > +static void bma150_close(struct bma150_data *bma150)
> > +{
> > +	pm_runtime_disable(&bma150->client->dev);
> 
> And disable should go into bma150_remove() unless I misunderstand
> runtime PM framework.

This is once again to make sure the PM is disabled when changing status.

I am not entirely familiar with the details of runtime PM, but either
the above works or we have to revert back to using #ifdefs which I would
prefer not to.

-- 
Best regards,
 Eric

http://www.unixphere.com
--
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