From patchwork Thu Aug 30 06:43:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lu X-Patchwork-Id: 1386661 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 93B88DF264 for ; Thu, 30 Aug 2012 06:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752027Ab2H3Goh (ORCPT ); Thu, 30 Aug 2012 02:44:37 -0400 Received: from mga03.intel.com ([143.182.124.21]:58762 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751944Ab2H3Gog (ORCPT ); Thu, 30 Aug 2012 02:44:36 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 29 Aug 2012 23:44:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,337,1344236400"; d="scan'208";a="139587901" Received: from aaronlu.sh.intel.com ([10.239.36.123]) by AZSMGA002.ch.intel.com with ESMTP; 29 Aug 2012 23:44:34 -0700 From: Aaron Lu To: "James E.J. Bottomley" , Alan Stern , Jeff Garzik Cc: linux-scsi@vger.kernel.org, linux-pm@vger.kernel.org, Aaron Lu , Aaron Lu Subject: [PATCH 1/3] scsi: pm: add may_power_off flag Date: Thu, 30 Aug 2012 14:43:58 +0800 Message-Id: <1346309040-27112-2-git-send-email-aaron.lu@intel.com> X-Mailer: git-send-email 1.7.11.5 In-Reply-To: <1346309040-27112-1-git-send-email-aaron.lu@intel.com> References: <1346309040-27112-1-git-send-email-aaron.lu@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 4bc4ac4..0bfc17f 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -157,6 +157,7 @@ struct scsi_device { unsigned can_power_off:1; /* Device supports runtime power off */ unsigned wakeup_by_user:1; /* User wakes up the ODD */ 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 */