From patchwork Thu Jan 6 12:10:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 459111 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 p06CC4hn029471 for ; Thu, 6 Jan 2011 12:12:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753324Ab1AFMMD (ORCPT ); Thu, 6 Jan 2011 07:12:03 -0500 Received: from opensource.wolfsonmicro.com ([80.75.67.52]:37419 "EHLO opensource2.wolfsonmicro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753201Ab1AFMMC (ORCPT ); Thu, 6 Jan 2011 07:12:02 -0500 Received: from rakim.wolfsonmicro.main (lumison.wolfsonmicro.com [87.246.78.27]) by opensource2.wolfsonmicro.com (Postfix) with ESMTPSA id 788EA114812; Thu, 6 Jan 2011 12:12:00 +0000 (GMT) Received: by rakim.wolfsonmicro.main (Postfix, from userid 1000) id 9C63823B6561; Thu, 6 Jan 2011 12:10:21 +0000 (GMT) From: Mark Brown To: Dmitry Torokhov , Michael Hennerich Cc: linux-input@vger.kernel.org, Mark Brown Subject: [PATCH v2] Input: ad7879 - Convert I2C to dev_pm_ops Date: Thu, 6 Jan 2011 12:10:20 +0000 Message-Id: <1294315820-9463-1-git-send-email-broonie@opensource.wolfsonmciro.com> X-Mailer: git-send-email 1.7.2.3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 06 Jan 2011 12:12:05 +0000 (UTC) diff --git a/drivers/input/touchscreen/ad7879-i2c.c b/drivers/input/touchscreen/ad7879-i2c.c index d82a38e..4e4e58c 100644 --- a/drivers/input/touchscreen/ad7879-i2c.c +++ b/drivers/input/touchscreen/ad7879-i2c.c @@ -10,14 +10,16 @@ #include #include #include +#include #include "ad7879.h" #define AD7879_DEVID 0x79 /* AD7879-1/AD7889-1 */ #ifdef CONFIG_PM -static int ad7879_i2c_suspend(struct i2c_client *client, pm_message_t message) +static int ad7879_i2c_suspend(struct device *dev) { + struct i2c_client *client = to_i2c_client(dev); struct ad7879 *ts = i2c_get_clientdata(client); ad7879_suspend(ts); @@ -25,17 +27,17 @@ static int ad7879_i2c_suspend(struct i2c_client *client, pm_message_t message) return 0; } -static int ad7879_i2c_resume(struct i2c_client *client) +static int ad7879_i2c_resume(struct device *dev) { + struct i2c_client *client = to_i2c_client(dev); struct ad7879 *ts = i2c_get_clientdata(client); ad7879_resume(ts); return 0; } -#else -# define ad7879_i2c_suspend NULL -# define ad7879_i2c_resume NULL + +static SIMPLE_DEV_PM_OPS(ad7879_i2c_pm, ad7879_i2c_suspend, ad7879_i2c_resume); #endif /* All registers are word-sized. @@ -117,11 +119,12 @@ static struct i2c_driver ad7879_i2c_driver = { .driver = { .name = "ad7879", .owner = THIS_MODULE, +#ifdef CONFIG_PM + .pm = &ad7879_i2c_pm, +#endif }, .probe = ad7879_i2c_probe, .remove = __devexit_p(ad7879_i2c_remove), - .suspend = ad7879_i2c_suspend, - .resume = ad7879_i2c_resume, .id_table = ad7879_id, };