From patchwork Tue Feb 3 15:01:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Grygorii.Strashko@linaro.org" X-Patchwork-Id: 5769021 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 927569F269 for ; Tue, 3 Feb 2015 15:02:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 955312017D for ; Tue, 3 Feb 2015 15:02:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 874EE200E6 for ; Tue, 3 Feb 2015 15:02:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755904AbbBCPCI (ORCPT ); Tue, 3 Feb 2015 10:02:08 -0500 Received: from mail-la0-f46.google.com ([209.85.215.46]:41443 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753198AbbBCPCH (ORCPT ); Tue, 3 Feb 2015 10:02:07 -0500 Received: by mail-la0-f46.google.com with SMTP id s18so52717490lam.5 for ; Tue, 03 Feb 2015 07:02:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=E24i4D/lFPV2iCFj44eQ60YDP5dmQ4vuMEwhpbtRgWQ=; b=MYnfi77S+uyiS/LCOSxNC9e+gH7NXJrsY4t0WKfbTsDv2qEbqWwY7pgTJ/JHDRv5k5 ZfkBw58MZkMCyKkRuKkrE5q61MjBM6UgjGqOZLN886ybwB8vsI1FfWbR82cuu+hYTrXj d/VL6brVWFGRsKpPFlf8PI/qVZ5HiHY9CN/oXZuX/AhkElkQFysn+ood+MOVY0VYXPyK 7WHdUl1xmO+YkP/3E+yBWvdlhw4o3OqNQJIUPwF3no5dIwPfo9E0b8lh6IO6S3zu69Ge CyFTQ89AOk7VD71QJ524xEdUHI08LLn3JSgRt2tE6IfdtRwiw3Jes1pp419Yyz12kuSW pcJQ== X-Gm-Message-State: ALoCoQn5AT3L9ANkG0+bYArpQkdleUeGWrcok9yVAcWjYXSJuIbOM8GE/xoc86o4jO07dtZ1b314 X-Received: by 10.152.203.230 with SMTP id kt6mr24199392lac.38.1422975725404; Tue, 03 Feb 2015 07:02:05 -0800 (PST) Received: from localhost ([195.238.92.128]) by mx.google.com with ESMTPSA id pn7sm5095301lbb.6.2015.02.03.07.02.03 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 07:02:04 -0800 (PST) From: To: Jean Delvare , Guenter Roeck , lm-sensors@lm-sensors.org Cc: sumit.semwal@linaro.org, linux-arm-kernel@lists.infradead.org, , linux-pm@vger.kernel.org, Grygorii Strashko Subject: [PATCH v2] hwmon: tmp102: add hibernation callbacks Date: Tue, 3 Feb 2015 17:01:58 +0200 Message-Id: <1422975718-871-1-git-send-email-grygorii.strashko@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 From: Grygorii Strashko Setting a dev_pm_ops suspend/resume pair but not a set of hibernation functions means those pm functions will not be called upon hibernation. Fix this by using SIMPLE_DEV_PM_OPS, which appropriately assigns the suspend and hibernation handlers and move mp102_suspend/tmp102_resume under CONFIG_PM_SLEEP to avoid build warnings. Signed-off-by: Grygorii Strashko --- V1: - https://lkml.org/lkml/2015/2/2/509 drivers/hwmon/tmp102.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c index ba9f478..565df47 100644 --- a/drivers/hwmon/tmp102.c +++ b/drivers/hwmon/tmp102.c @@ -253,7 +253,7 @@ static int tmp102_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int tmp102_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -279,17 +279,10 @@ static int tmp102_resume(struct device *dev) config &= ~TMP102_CONF_SD; return i2c_smbus_write_word_swapped(client, TMP102_CONF_REG, config); } - -static const struct dev_pm_ops tmp102_dev_pm_ops = { - .suspend = tmp102_suspend, - .resume = tmp102_resume, -}; - -#define TMP102_DEV_PM_OPS (&tmp102_dev_pm_ops) -#else -#define TMP102_DEV_PM_OPS NULL #endif /* CONFIG_PM */ +SIMPLE_DEV_PM_OPS(tmp102_dev_pm_ops, tmp102_suspend, tmp102_resume); + static const struct i2c_device_id tmp102_id[] = { { "tmp102", 0 }, { } @@ -298,7 +291,7 @@ MODULE_DEVICE_TABLE(i2c, tmp102_id); static struct i2c_driver tmp102_driver = { .driver.name = DRIVER_NAME, - .driver.pm = TMP102_DEV_PM_OPS, + .driver.pm = &tmp102_dev_pm_ops, .probe = tmp102_probe, .remove = tmp102_remove, .id_table = tmp102_id,