From patchwork Thu Sep 25 12:32:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dolev Raviv X-Patchwork-Id: 4974401 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DA96C9F32B for ; Thu, 25 Sep 2014 12:33:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3B36202AE for ; Thu, 25 Sep 2014 12:33:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13BD120274 for ; Thu, 25 Sep 2014 12:32:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751872AbaIYMc5 (ORCPT ); Thu, 25 Sep 2014 08:32:57 -0400 Received: from smtp.codeaurora.org ([198.145.11.231]:52594 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751572AbaIYMcz (ORCPT ); Thu, 25 Sep 2014 08:32:55 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id ED86413F74D; Thu, 25 Sep 2014 12:32:54 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id E0B7113F764; Thu, 25 Sep 2014 12:32:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from lx-draviv2.mea.qualcomm.com (unknown [185.23.60.4]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: draviv@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 89BF613F74D; Thu, 25 Sep 2014 12:32:52 +0000 (UTC) From: Dolev Raviv To: James.Bottomley@HansenPartnership.com, hch@infradead.org Cc: linux-scsi@vger.kernel.org, linux-scsi-owner@vger.kernel.org, linux-arm-msm@vger.kernel.org, santoshsy@gmail.com, Subhash Jadavani , Sujit Reddy Thumma , Dolev Raviv Subject: [PATCH V6 01/18] scsi: fixing the "type" for well known LUs Date: Thu, 25 Sep 2014 15:32:19 +0300 Message-Id: <1411648356-3883-2-git-send-email-draviv@codeaurora.org> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1411648356-3883-1-git-send-email-draviv@codeaurora.org> References: <1411648356-3883-1-git-send-email-draviv@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Subhash Jadavani Some devices may respond with wrong type for well-known logical units. This patch forces well-known type for devices which doesn't report it correct. Signed-off-by: Subhash Jadavani Signed-off-by: Sujit Reddy Thumma Signed-off-by: Dolev Raviv Reviewed-by: Robert Elliott diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 56675db..1095d5a 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -805,6 +805,19 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, } else { sdev->type = (inq_result[0] & 0x1f); sdev->removable = (inq_result[1] & 0x80) >> 7; + + /* + * some devices may respond with wrong type for + * well-known logical units. Force well-known type + * to enumerate them correctly. + */ + if (scsi_is_wlun(sdev->lun) && sdev->type != TYPE_WLUN) { + sdev_printk(KERN_WARNING, sdev, + "%s: correcting incorrect peripheral device type 0x%x for W-LUN 0x%16phN\n", + __func__, sdev->type, sdev->lun); + sdev->type = TYPE_WLUN; + } + } if (sdev->type == TYPE_RBC || sdev->type == TYPE_ROM) { diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 261e708..d17178e 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -333,6 +333,7 @@ static inline int scsi_status_is_good(int status) #define TYPE_RBC 0x0e #define TYPE_OSD 0x11 #define TYPE_ZBC 0x14 +#define TYPE_WLUN 0x1e /* well-known logical unit */ #define TYPE_NO_LUN 0x7f /* SCSI protocols; these are taken from SPC-3 section 7.5 */