From patchwork Sat Oct 24 19:53:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 7481101 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AC0819F36A for ; Sat, 24 Oct 2015 19:57:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9AD120763 for ; Sat, 24 Oct 2015 19:57:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C531A20762 for ; Sat, 24 Oct 2015 19:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752585AbbJXT5Q (ORCPT ); Sat, 24 Oct 2015 15:57:16 -0400 Received: from bby1mta02.pmc-sierra.com ([216.241.235.117]:51385 "EHLO bby1mta02.pmc-sierra.bc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752336AbbJXT5P (ORCPT ); Sat, 24 Oct 2015 15:57:15 -0400 Received: from bby1mta02.pmc-sierra.bc.ca (localhost.pmc-sierra.bc.ca [127.0.0.1]) by localhost (Postfix) with SMTP id 432438E0495; Sat, 24 Oct 2015 12:57:15 -0700 (PDT) Received: from bby1uinfra02-temp.pmc-sierra.bc.ca (bby1uinfra02-temp.pmc-sierra.bc.ca [216.241.226.204]) by bby1mta02.pmc-sierra.bc.ca (Postfix) with ESMTP id 1CFAB8E049A; Sat, 24 Oct 2015 12:57:15 -0700 (PDT) Received: from [127.0.1.1] (kirk.hou.lab.pmc-sierra.bc.ca [10.238.32.34]) by bby1uinfra02-temp.pmc-sierra.bc.ca (Postfix) with ESMTP id 74BC9E06DF; Sat, 24 Oct 2015 12:57:14 -0700 (PDT) Subject: [PATCH 11/21] hpsa: add function is_logical_device From: Don Brace To: scott.teel@pmcs.com, Kevin.Barnett@pmcs.com, scott.benesh@pmcs.com, james.bottomley@parallels.com, hch@infradead.org, Justin.Lindley@pmcs.com, elliott@hpe.com Cc: linux-scsi@vger.kernel.org Date: Sat, 24 Oct 2015 14:53:33 -0500 Message-ID: <20151024195333.17127.91753.stgit@brunhilda> In-Reply-To: <20151024193306.17127.7819.stgit@brunhilda> References: <20151024193306.17127.7819.stgit@brunhilda> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmcs.com; h=subject:from:to:cc:date:message-id:in-reply-to:references:mime-version:content-type:content-transfer-encoding; s=default; bh=vXxtoXE6TuSM9UBShHjy+zmGwDodl6aZFKQwzqZ5DSY=; b=MTBfniXZ/VBpPVdGNZxAKE57dKgcPuKUl9tipgu8JO7mNED6VnqX/EpND7g5NDy2jCkcB7BD12m2niHZcaXwwYPrK6XOheWEz8YIvkBTxCU8+ClaV8XKPqWl0kNUnJzTg6LFH7fCXDHp1o22mgPf0PNroKRiovuqV9/o/9RBPFg= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 From: Kevin Barnett simplify checking for logical/physical devices Reviewed-by: Scott Teel Reviewed-by: Justin Lindley Reviewed-by: Kevin Barnett Signed-off-by: Don Brace --- drivers/scsi/hpsa.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 1598573..40770b8 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -617,6 +617,11 @@ static const char * const raid_label[] = { "0", "4", "1(+0)", "5", "5+1", "6", #define HPSA_RAID_ADM 6 /* also used for RAID 1+0 ADM */ #define RAID_UNKNOWN (ARRAY_SIZE(raid_label) - 1) +static inline bool is_logical_device(struct hpsa_scsi_dev_t *device) +{ + return !device->physical_device; +} + static ssize_t raid_level_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -637,7 +642,7 @@ static ssize_t raid_level_show(struct device *dev, } /* Is this even a logical drive? */ - if (!is_logical_dev_addr_mode(hdev->scsi3addr)) { + if (!is_logical_device(hdev)) { spin_unlock_irqrestore(&h->lock, flags); l = snprintf(buf, PAGE_SIZE, "N/A\n"); return l; @@ -771,8 +776,8 @@ static ssize_t path_info_show(struct device *dev, scsi_device_type(hdev->devtype)); if (is_ext_target(h, hdev) || - (hdev->devtype == TYPE_RAID) || - is_logical_dev_addr_mode(hdev->scsi3addr)) { + hdev->devtype == TYPE_RAID || + is_logical_device(hdev)) { output_len += snprintf(path[i] + output_len, PATH_STRING_LEN, "%s\n", active); @@ -1582,7 +1587,7 @@ static void hpsa_figure_phys_disk_ptrs(struct ctlr_info *h, for (j = 0; j < ndevices; j++) { if (dev[j]->devtype != TYPE_DISK) continue; - if (is_logical_dev_addr_mode(dev[j]->scsi3addr)) + if (is_logical_device(dev[j])) continue; if (dev[j]->ioaccel_handle != dd[i].ioaccel_handle) continue; @@ -1625,7 +1630,7 @@ static void hpsa_update_log_drive_phys_drive_ptrs(struct ctlr_info *h, for (i = 0; i < ndevices; i++) { if (dev[i]->devtype != TYPE_DISK) continue; - if (!is_logical_dev_addr_mode(dev[i]->scsi3addr)) + if (!is_logical_device(dev[i])) continue; /* @@ -2228,7 +2233,7 @@ static void process_ioaccel2_completion(struct ctlr_info *h, * the normal I/O path so the controller can handle whatever's * wrong. */ - if (is_logical_dev_addr_mode(dev->scsi3addr) && + if (is_logical_device(dev) && c2->error_data.serv_response == IOACCEL2_SERV_RESPONSE_FAILURE) { if (c2->error_data.status == @@ -2348,7 +2353,7 @@ static void complete_scsi_command(struct CommandList *cp) * the normal I/O path so the controller can handle whatever's * wrong. */ - if (is_logical_dev_addr_mode(dev->scsi3addr)) { + if (is_logical_device(dev)) { if (ei->CommandStatus == CMD_IOACCEL_DISABLED) dev->offload_enabled = 0; return hpsa_retry_cmd(h, cp);