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]
Date:	Wed, 11 Sep 2013 18:32:34 +0300
From:	Mika Westerberg <mika.westerberg@...ux.intel.com>
To:	linux-i2c@...r.kernel.org
Cc:	Wolfram Sang <wsa@...-dreams.de>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
	Lv Zheng <lv.zheng@...el.com>, Aaron Lu <aaron.lu@...el.com>,
	linux-arm-kernel@...ts.infradead.org,
	Mark Brown <broonie@...nel.org>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Mauro Carvalho Chehab <m.chehab@...sung.com>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Lee Jones <lee.jones@...aro.org>,
	Arnd Bergmann <arnd@...db.de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Liam Girdwood <lgirdwood@...il.com>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	Mika Westerberg <mika.westerberg@...ux.intel.com>
Subject: [PATCH v2 3/9] Input: misc - convert existing I2C client drivers to use I2C core runtime PM

The I2C core now prepares runtime PM on behalf of the I2C client device, so
only thing the driver needs to do is to call pm_runtime_put() at the end of
->probe().

This patch converts bma150 and mpu3050 input drivers to use this model.

While we are there remove call to pm_runtime_set_autosuspend_delay() in
mpu3050 driver because the driver doesn't seem to use autosuspend anyway.

Signed-off-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
---
 drivers/input/misc/bma150.c  |  4 ++--
 drivers/input/misc/mpu3050.c | 16 ++++------------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c
index 865c2f9..f1bf5e9 100644
--- a/drivers/input/misc/bma150.c
+++ b/drivers/input/misc/bma150.c
@@ -592,7 +592,7 @@ static int bma150_probe(struct i2c_client *client,
 
 	i2c_set_clientdata(client, bma150);
 
-	pm_runtime_enable(&client->dev);
+	pm_runtime_put(&client->dev);
 
 	return 0;
 
@@ -605,7 +605,7 @@ static int bma150_remove(struct i2c_client *client)
 {
 	struct bma150_data *bma150 = i2c_get_clientdata(client);
 
-	pm_runtime_disable(&client->dev);
+	pm_runtime_get(&client->dev);
 
 	if (client->irq > 0) {
 		free_irq(client->irq, bma150);
diff --git a/drivers/input/misc/mpu3050.c b/drivers/input/misc/mpu3050.c
index dce0d95..9f2ead5 100644
--- a/drivers/input/misc/mpu3050.c
+++ b/drivers/input/misc/mpu3050.c
@@ -43,8 +43,6 @@
 
 #define MPU3050_CHIP_ID		0x69
 
-#define MPU3050_AUTO_DELAY	1000
-
 #define MPU3050_MIN_VALUE	-32768
 #define MPU3050_MAX_VALUE	32767
 
@@ -359,11 +357,9 @@ static int mpu3050_probe(struct i2c_client *client,
 
 	input_set_drvdata(idev, sensor);
 
-	pm_runtime_set_active(&client->dev);
-
 	error = mpu3050_hw_init(sensor);
 	if (error)
-		goto err_pm_set_suspended;
+		goto err_free_mem;
 
 	error = request_threaded_irq(client->irq,
 				     NULL, mpu3050_interrupt_thread,
@@ -372,7 +368,7 @@ static int mpu3050_probe(struct i2c_client *client,
 	if (error) {
 		dev_err(&client->dev,
 			"can't get IRQ %d, error %d\n", client->irq, error);
-		goto err_pm_set_suspended;
+		goto err_free_mem;
 	}
 
 	error = input_register_device(idev);
@@ -381,15 +377,12 @@ static int mpu3050_probe(struct i2c_client *client,
 		goto err_free_irq;
 	}
 
-	pm_runtime_enable(&client->dev);
-	pm_runtime_set_autosuspend_delay(&client->dev, MPU3050_AUTO_DELAY);
+	pm_runtime_put(&client->dev);
 
 	return 0;
 
 err_free_irq:
 	free_irq(client->irq, sensor);
-err_pm_set_suspended:
-	pm_runtime_set_suspended(&client->dev);
 err_free_mem:
 	input_free_device(idev);
 	kfree(sensor);
@@ -406,8 +399,7 @@ static int mpu3050_remove(struct i2c_client *client)
 {
 	struct mpu3050_sensor *sensor = i2c_get_clientdata(client);
 
-	pm_runtime_disable(&client->dev);
-	pm_runtime_set_suspended(&client->dev);
+	pm_runtime_get(&client->dev);
 
 	free_irq(client->irq, sensor);
 	input_unregister_device(sensor->idev);
-- 
1.8.4.rc3

--
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