From patchwork Wed Sep 11 15:32:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 2873301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 901039F495 for ; Wed, 11 Sep 2013 15:40:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F47C20284 for ; Wed, 11 Sep 2013 15:40:25 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 220A42025D for ; Wed, 11 Sep 2013 15:40:24 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJmVO-0005Yw-Ek; Wed, 11 Sep 2013 15:38:59 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJmQU-0000jJ-1T; Wed, 11 Sep 2013 15:33:54 +0000 Received: from mga14.intel.com ([143.182.124.37]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJmPp-0000bn-LZ for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2013 15:33:16 +0000 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 11 Sep 2013 08:32:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,885,1371106800"; d="scan'208";a="293584883" Received: from blue.fi.intel.com ([10.237.72.156]) by AZSMGA002.ch.intel.com with ESMTP; 11 Sep 2013 08:32:41 -0700 Received: by blue.fi.intel.com (Postfix, from userid 1004) id DF80FE0093; Wed, 11 Sep 2013 18:32:40 +0300 (EEST) From: Mika Westerberg To: linux-i2c@vger.kernel.org Subject: [PATCH v2 3/9] Input: misc - convert existing I2C client drivers to use I2C core runtime PM Date: Wed, 11 Sep 2013 18:32:34 +0300 Message-Id: <1378913560-2752-4-git-send-email-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1378913560-2752-1-git-send-email-mika.westerberg@linux.intel.com> References: <1378913560-2752-1-git-send-email-mika.westerberg@linux.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130911_113313_870659_7A490DA9 X-CRM114-Status: GOOD ( 15.61 ) X-Spam-Score: -7.7 (-------) Cc: Aaron Lu , Dmitry Torokhov , Mika Westerberg , Samuel Ortiz , Arnd Bergmann , Wolfram Sang , Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Liam Girdwood , linux-acpi@vger.kernel.org, Kyungmin Park , Mark Brown , Lv Zheng , Lee Jones , linux-arm-kernel@lists.infradead.org, Mauro Carvalho Chehab X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);