From patchwork Wed Jul 15 23:43:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 29834 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by bilbo.ozlabs.org (Postfix) with ESMTP id E1ED8B7334 for ; Thu, 16 Jul 2009 09:44:17 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756381AbZGOXoO (ORCPT ); Wed, 15 Jul 2009 19:44:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756507AbZGOXoO (ORCPT ); Wed, 15 Jul 2009 19:44:14 -0400 Received: from cavan.codon.org.uk ([93.93.128.6]:46551 "EHLO cavan.codon.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756381AbZGOXoN (ORCPT ); Wed, 15 Jul 2009 19:44:13 -0400 Received: from 78-86-230-144.zone2.bethere.co.uk ([78.86.230.144] helo=localhost.localdomain) by cavan.codon.org.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1MRE8y-0008NQ-3K; Thu, 16 Jul 2009 00:44:12 +0100 From: Matthew Garrett To: linux-kernel@vger.kernel.org Cc: linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org, Matthew Garrett Subject: [PATCH 1/4] scsi: Allow hosts to be flagged as hotpluggable Date: Thu, 16 Jul 2009 00:43:55 +0100 Message-Id: <1247701438-18266-1-git-send-email-mjg@redhat.com> X-Mailer: git-send-email 1.6.2.5 X-SA-Do-Not-Run: Yes X-SA-Exim-Connect-IP: 78.86.230.144 X-SA-Exim-Mail-From: mjg@redhat.com X-SA-Exim-Scanned: No (on cavan.codon.org.uk); SAEximRunCond expanded to false Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Userspace may wish to make policy decisions based on whether a host supports device hotplug or not - for example, AHCI link power management disables hotplug, so may only be desirable on hotplug ports. Add support for marking hosts as hotpluggable in order to allow userspace to treat them appropriately. Signed-off-by: Matthew Garrett --- drivers/scsi/hosts.c | 1 + drivers/scsi/scsi_sysfs.c | 2 ++ include/scsi/scsi_host.h | 9 +++++++++ 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 5fd2da4..5a48bac 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -363,6 +363,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->unchecked_isa_dma = sht->unchecked_isa_dma; shost->use_clustering = sht->use_clustering; shost->ordered_tag = sht->ordered_tag; + shost->hotpluggable = sht->hotpluggable; if (sht->supported_mode == MODE_UNKNOWN) /* means we didn't set it ... default to INITIATOR */ diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 91482f2..7669cbf 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -246,6 +246,7 @@ static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL) shost_rd_attr(unique_id, "%u\n"); shost_rd_attr(host_busy, "%hu\n"); +shost_rd_attr(hotpluggable, "%d\n"); shost_rd_attr(cmd_per_lun, "%hd\n"); shost_rd_attr(can_queue, "%hd\n"); shost_rd_attr(sg_tablesize, "%hu\n"); @@ -257,6 +258,7 @@ shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); static struct attribute *scsi_sysfs_shost_attrs[] = { &dev_attr_unique_id.attr, &dev_attr_host_busy.attr, + &dev_attr_hotpluggable.attr, &dev_attr_cmd_per_lun.attr, &dev_attr_can_queue.attr, &dev_attr_sg_tablesize.attr, diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index b62a097..b099493 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -421,6 +421,7 @@ struct scsi_host_template { */ unsigned unchecked_isa_dma:1; + /* * True if this host adapter can make good use of clustering. * I originally thought that if the tablesize was large that it @@ -447,6 +448,11 @@ struct scsi_host_template { unsigned ordered_tag:1; /* + * True if host supports hotplugging + */ + unsigned hotpluggable:1; + + /* * Countdown for host blocking with no commands outstanding. */ unsigned int max_host_blocked; @@ -622,6 +628,9 @@ struct Scsi_Host { /* Asynchronous scan in progress */ unsigned async_scan:1; + /* 1 if hotpluggable, 0 if not */ + unsigned hotpluggable:1; + /* * Optional work queue to be utilized by the transport */