From patchwork Tue Aug 31 01:50:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sripathy, Vishwanath" X-Patchwork-Id: 141921 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o7UCJM1d015789 for ; Mon, 30 Aug 2010 12:19:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755505Ab0H3MRm (ORCPT ); Mon, 30 Aug 2010 08:17:42 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:33400 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755311Ab0H3MRl (ORCPT ); Mon, 30 Aug 2010 08:17:41 -0400 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o7UCGv4o007041 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 30 Aug 2010 07:16:59 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o7UCGtGm020474; Mon, 30 Aug 2010 17:46:55 +0530 (IST) From: Vishwanath BS To: linux-i2c@vger.kernel.org Cc: linux-omap@vger.kernel.org, Vishwanath BS , Partha Basak , "Rafael J. Wysocki" , Kevin Hilman , Ben Dooks Subject: [PATCH] I2C: Fix for suspend/resume issue in i2c-core Date: Tue, 31 Aug 2010 07:20:14 +0530 Message-Id: <1283219414-8798-1-git-send-email-vishwanath.bs@ti.com> X-Mailer: git-send-email 1.7.0.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 30 Aug 2010 12:19:26 +0000 (UTC) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 6649176..3146bff --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -196,14 +196,22 @@ static int i2c_legacy_resume(struct device *dev) static int i2c_device_pm_suspend(struct device *dev) { const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; + int ret; if (pm_runtime_suspended(dev)) return 0; if (pm) - return pm->suspend ? pm->suspend(dev) : 0; + ret = pm->suspend ? pm->suspend(dev) : 0; + else + ret = i2c_legacy_suspend(dev, PMSG_SUSPEND); - return i2c_legacy_suspend(dev, PMSG_SUSPEND); + if (!ret) { + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_enable(dev); + } + return ret; } static int i2c_device_pm_resume(struct device *dev)