From patchwork Thu Jul 26 10:05:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: aaron lu X-Patchwork-Id: 1241141 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DC7144025E for ; Thu, 26 Jul 2012 10:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752194Ab2GZKIn (ORCPT ); Thu, 26 Jul 2012 06:08:43 -0400 Received: from ch1ehsobe006.messaging.microsoft.com ([216.32.181.186]:12404 "EHLO ch1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751720Ab2GZKGS (ORCPT ); Thu, 26 Jul 2012 06:06:18 -0400 Received: from mail187-ch1-R.bigfish.com (10.43.68.248) by CH1EHSOBE002.bigfish.com (10.43.70.52) with Microsoft SMTP Server id 14.1.225.23; Thu, 26 Jul 2012 10:06:18 +0000 Received: from mail187-ch1 (localhost [127.0.0.1]) by mail187-ch1-R.bigfish.com (Postfix) with ESMTP id 4CB813C047B; Thu, 26 Jul 2012 10:06:18 +0000 (UTC) X-Forefront-Antispam-Report: CIP:163.181.249.109; KIP:(null); UIP:(null); IPV:NLI; H:ausb3twp02.amd.com; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VPS0(zzzz1202hzz8275bhz2dh668h839hd24he5bhf0ah107ah) Received: from mail187-ch1 (localhost.localdomain [127.0.0.1]) by mail187-ch1 (MessageSwitch) id 1343297176360804_26044; Thu, 26 Jul 2012 10:06:16 +0000 (UTC) Received: from CH1EHSMHS017.bigfish.com (snatpool2.int.messaging.microsoft.com [10.43.68.232]) by mail187-ch1.bigfish.com (Postfix) with ESMTP id 53AD7E0158; Thu, 26 Jul 2012 10:06:16 +0000 (UTC) Received: from ausb3twp02.amd.com (163.181.249.109) by CH1EHSMHS017.bigfish.com (10.43.70.17) with Microsoft SMTP Server id 14.1.225.23; Thu, 26 Jul 2012 10:06:16 +0000 X-WSS-ID: 0M7RIQD-02-3P0-02 X-M-MSG: Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Axway MailGate 3.8.1) with ESMTP id 207F9C80D1; Thu, 26 Jul 2012 05:06:13 -0500 (CDT) Received: from sausexhtp01.amd.com (163.181.3.165) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.192.1; Thu, 26 Jul 2012 05:06:29 -0500 Received: from sausexmb1.amd.com (163.181.3.156) by sausexhtp01.amd.com (163.181.3.165) with Microsoft SMTP Server id 8.3.213.0; Thu, 26 Jul 2012 05:06:13 -0500 Received: from storexbh1.amd.com ([10.1.1.17]) by sausexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 26 Jul 2012 05:06:14 -0500 Received: from sshaexmb1.amd.com ([10.237.2.11]) by storexbh1.amd.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 26 Jul 2012 06:06:12 -0400 Received: from aarontestpc.amd.com ([10.237.73.70]) by sshaexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 26 Jul 2012 18:05:58 +0800 From: Aaron Lu To: James Bottomley , Alan Stern CC: Jeff Garzik , Lin Ming , Jeff Wu , , , , , Aaron Lu , Aaron Lu Subject: [PATCH v3 2/7] scsi: pm: use autosuspend if device supports it Date: Thu, 26 Jul 2012 18:05:24 +0800 Message-ID: <1343297129-28174-3-git-send-email-aaron.lu@amd.com> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1343297129-28174-1-git-send-email-aaron.lu@amd.com> References: <1343297129-28174-1-git-send-email-aaron.lu@amd.com> X-OriginalArrivalTime: 26 Jul 2012 10:05:58.0472 (UTC) FILETIME=[40D44C80:01CD6B16] MIME-Version: 1.0 X-OriginatorOrg: amd.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org If the device is using autosuspend, when scsi_autopm_put_device is called for it, use autosuspend runtime pm calls instead of the sync call. Signed-off-by: Aaron Lu --- drivers/scsi/scsi_pm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c index dc0ad85..7c93723 100644 --- a/drivers/scsi/scsi_pm.c +++ b/drivers/scsi/scsi_pm.c @@ -197,7 +197,13 @@ EXPORT_SYMBOL_GPL(scsi_autopm_get_device); void scsi_autopm_put_device(struct scsi_device *sdev) { - pm_runtime_put_sync(&sdev->sdev_gendev); + if (sdev->sdev_gendev.power.use_autosuspend) { + pm_runtime_mark_last_busy(&sdev->sdev_gendev); + pm_runtime_put_autosuspend(&sdev->sdev_gendev); + } else { + pm_runtime_put_sync(&sdev->sdev_gendev); + } + } EXPORT_SYMBOL_GPL(scsi_autopm_put_device);