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: 44247 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B4BDC2034D for ; Tue, 3 Feb 2015 15:02:42 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id m14sf21328319wev.3 for ; Tue, 03 Feb 2015 07:02:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=gb54/LFC70vSv7wNIBhgnNWfD9z8XmCSH4uQHNS5+VY=; b=aIeDC3WIoGH54f8yOxCX05PzWu2yVS8vZacI/lVgCs7aGL+Wl985ctFBXnBdQ3Pizl gEjPkmad+Cgk+VmaeOwq63egW3JPBIw1rN4WcUjnPKvpGN2tdHsjO9pLdfTy+40gPIpx +CndyJQffTCTFVFMAZjyG0OMfhuAJeRYE6/B5KrC1XPtP0jvLFM6QKCaUIE5L9PHXNli 2/HLKqnAwhcaYtM+doRCre7I58BNorih9zAiyeV1QlYc5JPfyTfQ+fk7kOzsusAAaCA6 w9oXn1YbcoJ0nuTm+xMrsHtacYOWQ3bXjmQWGiEVHjM1Dqe95VTNmgAJCi6mKFA+WZz3 4gzw== X-Gm-Message-State: ALoCoQl/srSMY3OybJR+rAfNtSzeIBJmEWpQKedY0j+jcESeNA3KZ6B4hMDa0gck660xfCLEj2tm X-Received: by 10.180.105.97 with SMTP id gl1mr2025851wib.7.1422975761997; Tue, 03 Feb 2015 07:02:41 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.234 with SMTP id bb10ls748941lab.90.gmail; Tue, 03 Feb 2015 07:02:41 -0800 (PST) X-Received: by 10.152.6.101 with SMTP id z5mr24915905laz.19.1422975761841; Tue, 03 Feb 2015 07:02:41 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id l4si19316014lam.134.2015.02.03.07.02.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 07:02:41 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id pn19so6549656lab.2 for ; Tue, 03 Feb 2015 07:02:41 -0800 (PST) X-Received: by 10.112.63.134 with SMTP id g6mr21091313lbs.52.1422975761536; Tue, 03 Feb 2015 07:02:41 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1992723lbj; Tue, 3 Feb 2015 07:02:40 -0800 (PST) X-Received: by 10.68.216.161 with SMTP id or1mr38086416pbc.120.1422975759697; Tue, 03 Feb 2015 07:02:39 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bf1si2783468pbb.88.2015.02.03.07.02.09; Tue, 03 Feb 2015 07:02:39 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755904AbbBCPCI (ORCPT + 11 others); 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-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: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: grygorii.strashko@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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,