From patchwork Thu Jun 13 14:20:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 2717061 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 61D8E9F3B5 for ; Thu, 13 Jun 2013 14:20:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4998720256 for ; Thu, 13 Jun 2013 14:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 85961202FA for ; Thu, 13 Jun 2013 14:20:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757494Ab3FMOUq (ORCPT ); Thu, 13 Jun 2013 10:20:46 -0400 Received: from www.linutronix.de ([62.245.132.108]:49488 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757460Ab3FMOUp (ORCPT ); Thu, 13 Jun 2013 10:20:45 -0400 Received: from localhost ([127.0.0.1] helo=localhost.localdomain) by Galois.linutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1Un8OJ-0004c2-2G; Thu, 13 Jun 2013 16:20:43 +0200 From: Sebastian Andrzej Siewior To: "Rafael J. Wysocki" Cc: Pavel Machek , Len Brown , linux-pm@vger.kernel.org, Sebastian Andrzej Siewior Subject: [RFC PATCH] pm: make device_prepare() use dpm_run_callback() Date: Thu, 13 Jun 2013 16:20:39 +0200 Message-Id: <1371133239-12054-1-git-send-email-bigeasy@linutronix.de> X-Mailer: git-send-email 1.7.10.4 X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1, SHORTCIRCUIT=-0.0001 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, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 After looking at device_prepare() I was curious why the info parameter isn't used. Then I noticed that others call dpm_run_callback() which takes the info parameter and is actually doing something with it and it does the same (cb) check as here. So maybe, maybe the intention here was to use the function in the first place. Signed-off-by: Sebastian Andrzej Siewior --- drivers/base/power/main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 5a9b656..521029e 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1223,7 +1223,7 @@ int dpm_suspend(pm_message_t state) */ static int device_prepare(struct device *dev, pm_message_t state) { - int (*callback)(struct device *) = NULL; + pm_callback_t callback = NULL; char *info = NULL; int error = 0; @@ -1261,10 +1261,7 @@ static int device_prepare(struct device *dev, pm_message_t state) callback = dev->driver->pm->prepare; } - if (callback) { - error = callback(dev); - suspend_report_result(callback, error); - } + error = dpm_run_callback(callback, dev, state, info); device_unlock(dev);