From patchwork Fri Nov 1 15:07:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3126131 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8FD4F9F3C4 for ; Fri, 1 Nov 2013 15:14:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4AA7E2020E for ; Fri, 1 Nov 2013 15:14:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B08732015E for ; Fri, 1 Nov 2013 15:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751693Ab3KAPOS (ORCPT ); Fri, 1 Nov 2013 11:14:18 -0400 Received: from qmta03.emeryville.ca.mail.comcast.net ([76.96.30.32]:45275 "EHLO qmta03.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750976Ab3KAPOR (ORCPT ); Fri, 1 Nov 2013 11:14:17 -0400 X-Greylist: delayed 426 seconds by postgrey-1.27 at vger.kernel.org; Fri, 01 Nov 2013 11:14:17 EDT Received: from omta10.emeryville.ca.mail.comcast.net ([76.96.30.28]) by qmta03.emeryville.ca.mail.comcast.net with comcast id kEuF1m0010cQ2SLA3F7AZi; Fri, 01 Nov 2013 15:07:10 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta10.emeryville.ca.mail.comcast.net with comcast id kF771m00V0MU7Qa8WF78fo; Fri, 01 Nov 2013 15:07:09 +0000 Received: from orthanc.internal (orthanc.internal [192.168.1.24]) by mail.gonehiking.org (Postfix) with ESMTP id 97E58806B7; Fri, 1 Nov 2013 09:07:07 -0600 (MDT) From: Shuah Khan To: pavel@ucw.cz, rjw@rjwysocki.net, len.brown@intel.com, gregkh@linuxfoundation.org Cc: Shuah Khan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, shuahkhan@gmail.com Subject: [PATCH] power: Add legacy pm ops usage warning Date: Fri, 1 Nov 2013 09:07:04 -0600 Message-Id: <1383318424-4072-1-git-send-email-shuah.kh@samsung.com> X-Mailer: git-send-email 1.8.1.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1383318430; bh=k5DVDdI0gJ+PXA6lkksEOIke4zN7G5DqCEbTmE6be1E=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=aiCwG0CD0Kc57ldv/asTHpoGIZf02dp5y7KpuzKc9mGNOBU6YQaaMUT1peXkpF+Vn XQBDvIxQkH5oOQcLUWSAee0U+dsAENSSW4CvYA0qviE1ket9Gg7dxJPLM3l1qOCyjC a/h8ko/UweWag2Quh8pFFVenUub/3drWpBuOCtml+iJC+MJybS22RXqq1z3Wn5iwcZ XARzh/X9Rigm+cSeGYZN1XGNwcrDJFABA+6Wiz/Z1Fpa5PXFxa9TCFWtFfiOR/kSIk LLjtCU/hPBZsALabcgL6mgmtlgwBcjCUN526qXfgAOUZhXtcHu8JgiCGyaKkKTH7M5 8cCFCErjYIcDw== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Add legacy pm_ops usage checks to device_pm_add() when a device gets added to PM core's list of active devices. If legacy pm_ops usage is found at its class, bus, driver level, print warning message to indicate the driver code needs updating to use dev pm ops interfaces. This will help serve as a way to track drivers that still use legacy pm ops and fix them. Signed-off-by: Shuah Khan --- drivers/base/power/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 9f098a8..4dc26dc 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -112,6 +112,23 @@ void device_pm_unlock(void) } /** + * check for lgeacy pm_ops usage and warn + */ +static void device_legacy_pm_ops_check(struct device *dev) +{ + char *info = "Please update driver to use dev pm_ops"; + + if (dev->class && (dev->class->suspend || dev->class->resume)) + dev_warn(dev, "Driver uses legacy class pm ops - %s\n", info); + + if (dev->bus && (dev->bus->suspend || dev->bus->resume)) + dev_warn(dev, "Driver uses legacy bus pm ops - %s\n", info); + + if (dev->driver && (dev->driver->suspend || dev->driver->resume)) + dev_warn(dev, "Driver uses legacy pm ops - %s\n", info); +} + +/** * device_pm_add - Add a device to the PM core's list of active devices. * @dev: Device to add to the list. */ @@ -123,6 +140,7 @@ void device_pm_add(struct device *dev) if (dev->parent && dev->parent->power.is_prepared) dev_warn(dev, "parent %s should not be sleeping\n", dev_name(dev->parent)); + device_legacy_pm_ops_check(dev); list_add_tail(&dev->power.entry, &dpm_list); mutex_unlock(&dpm_list_mtx); }