From patchwork Thu Aug 30 06:40:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lu X-Patchwork-Id: 1386631 Return-Path: X-Original-To: patchwork-linux-acpi@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 803DA3FC33 for ; Thu, 30 Aug 2012 06:42:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751858Ab2H3GmA (ORCPT ); Thu, 30 Aug 2012 02:42:00 -0400 Received: from mga14.intel.com ([143.182.124.37]:58631 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752173Ab2H3Gl7 (ORCPT ); Thu, 30 Aug 2012 02:41:59 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 29 Aug 2012 23:41:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,337,1344236400"; d="scan'208";a="139586787" Received: from aaronlu.sh.intel.com ([10.239.36.123]) by AZSMGA002.ch.intel.com with ESMTP; 29 Aug 2012 23:41:56 -0700 From: Aaron Lu To: Jeff Garzik , "James E.J. Bottomley" Cc: linux-ide@vger.kernel.org, linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, Aaron Lu , Aaron Lu Subject: [PATCH 3/4] scsi: pm: add may_power_off flag Date: Thu, 30 Aug 2012 14:40:17 +0800 Message-Id: <1346308818-27039-4-git-send-email-aaron.lu@intel.com> X-Mailer: git-send-email 1.7.11.5 In-Reply-To: <1346308818-27039-1-git-send-email-aaron.lu@intel.com> References: <1346308818-27039-1-git-send-email-aaron.lu@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add a new flag may_power_off for scsi device, it gives the user a chance to control when the device is runtime suspended, can we remove its power if possible. I'm planning using this flag for sr and sd. For sr, if user set 0 to may_power_off, we will disable runtime suspend for ODD, since runtime suspend for ODD is wholly for zero power ODD, if we can't power off the ODD, there is no meaning to do runtime PM on it. For sd, if user set 0 to may_power_off, we will not power off the device when it is runtime suspended. Signed-off-by: Aaron Lu --- include/scsi/scsi_device.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 9895f69..ad7cb68 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -156,6 +156,7 @@ struct scsi_device { unsigned is_visible:1; /* is the device visible in sysfs */ unsigned can_power_off:1; /* Device supports runtime power off */ unsigned wce_default_on:1; /* Cache is ON by default */ + unsigned may_power_off:1; /* power off is allowed by user */ DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ struct list_head event_list; /* asserted events */