From patchwork Wed Sep 11 15:32:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 2873061 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 65BB8BF43F for ; Wed, 11 Sep 2013 15:32:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D42E20461 for ; Wed, 11 Sep 2013 15:32:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1FB4202E8 for ; Wed, 11 Sep 2013 15:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755034Ab3IKPcs (ORCPT ); Wed, 11 Sep 2013 11:32:48 -0400 Received: from mga14.intel.com ([143.182.124.37]:13815 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754560Ab3IKPcr (ORCPT ); Wed, 11 Sep 2013 11:32:47 -0400 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="293584879" 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 EBE9CE0094; Wed, 11 Sep 2013 18:32:40 +0300 (EEST) From: Mika Westerberg To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Lv Zheng , Aaron Lu , linux-arm-kernel@lists.infradead.org, Mark Brown , Dmitry Torokhov , Mauro Carvalho Chehab , Samuel Ortiz , Lee Jones , Arnd Bergmann , Greg Kroah-Hartman , Liam Girdwood , Kyungmin Park , Mika Westerberg Subject: [PATCH v2 4/9] [media] s5p-tv: convert to use I2C core runtime PM Date: Wed, 11 Sep 2013 18:32:35 +0300 Message-Id: <1378913560-2752-5-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> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 its ->probe(). This patch converts s5p-tv driver to use this model. Signed-off-by: Mika Westerberg --- drivers/media/platform/s5p-tv/sii9234_drv.c | 30 ++++++----------------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/media/platform/s5p-tv/sii9234_drv.c b/drivers/media/platform/s5p-tv/sii9234_drv.c index 3dd762e..c0e8d42 100644 --- a/drivers/media/platform/s5p-tv/sii9234_drv.c +++ b/drivers/media/platform/s5p-tv/sii9234_drv.c @@ -325,8 +325,7 @@ static int sii9234_probe(struct i2c_client *client, ctx = devm_kzalloc(&client->dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) { dev_err(dev, "out of memory\n"); - ret = -ENOMEM; - goto fail; + return -ENOMEM; } ctx->client = client; @@ -345,42 +344,25 @@ static int sii9234_probe(struct i2c_client *client, v4l2_i2c_subdev_init(&ctx->sd, client, &sii9234_ops); - pm_runtime_enable(dev); - - /* enable device */ - ret = pm_runtime_get_sync(dev); - if (ret) - goto fail_pm; - /* verify chip version */ ret = sii9234_verify_version(client); - if (ret) - goto fail_pm_get; + if (ret) { + dev_err(dev, "failed to verify chip version\n"); + return ret; + } - /* stop processing */ pm_runtime_put(dev); dev_info(dev, "probe successful\n"); return 0; - -fail_pm_get: - pm_runtime_put_sync(dev); - -fail_pm: - pm_runtime_disable(dev); - -fail: - dev_err(dev, "probe failed\n"); - - return ret; } static int sii9234_remove(struct i2c_client *client) { struct device *dev = &client->dev; - pm_runtime_disable(dev); + pm_runtime_get(dev); dev_info(dev, "remove successful\n");