From nobody Mon Jun 15 10:50:59 2026 Received: from nick.sneptech.io (nick.sneptech.io [178.62.38.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 409352FA0C6; Thu, 9 Apr 2026 21:06:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.62.38.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775768771; cv=none; b=I9qMl66tLw/VPR17kC/EWUAunoXRy7/ZKbIzoyIOIEvOlXJXcvtHeU0RhpBt94VAbcIJ/DTBWC46tW2zAUWbCAsaPgm+lCCEDHlxVD1L9aKzeOGOZkRJLQ0r+rR/AAjpIJPu8dz/d7TjuTO1REXxaYYGItytLfOjj7qao6nXh0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775768771; c=relaxed/simple; bh=dMHae3B3WHNdkgQmBXXItgY26TRoUjtY/leLghC1CEM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rf9P5zYYYmWFFFkUlj5tEPLSV4n8qUzpe7rvAJKWfvIb1dPuVcZoypWX7RFLg4pqxoVbc8GAolLSSuHAoqlcqfcu5eNWjL3fypuzymap0M3hBIyTOrS9YNl8Wbr7gXS8Q24GWaQvefH4m4JrB+fcuxv64xy27bNpxEueb0YFGFo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=philpem.me.uk; spf=pass smtp.mailfrom=philpem.me.uk; dkim=pass (1024-bit key) header.d=philpem.me.uk header.i=@philpem.me.uk header.b=FBQ+ztlR; arc=none smtp.client-ip=178.62.38.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=philpem.me.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=philpem.me.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=philpem.me.uk header.i=@philpem.me.uk header.b="FBQ+ztlR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=philpem.me.uk; s=mail; t=1775768768; bh=dMHae3B3WHNdkgQmBXXItgY26TRoUjtY/leLghC1CEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FBQ+ztlRg//tc1fWRO/CQDAEzRmF6n0+wv8jOlXphICUB4CGL7JyadlC46+Ptrak4 8fPSVl461R4jv8WCQngEJW8DYA/05msuFr2tzAlVcNBMbcd4YFgZbLWHXAgORw/YoQ W6shLnzAOO7M2a7sRIejIBoskPPwYLz/PrSXHNSk= Received: from wolf.philpem.me.uk (81-187-163-148.ip4.reverse-dns.uk [81.187.163.148]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) (Authenticated sender: mailrelay_wolf@philpem.me.uk) by nick.sneptech.io (Postfix) with ESMTPSA id C73F5BE5E4; Thu, 9 Apr 2026 21:06:08 +0000 (UTC) Received: from cheetah.homenet.philpem.me.uk (cheetah.homenet.philpem.me.uk [10.0.0.32]) by wolf.philpem.me.uk (Postfix) with ESMTPSA id 4D9495FC3F; Thu, 9 Apr 2026 22:06:08 +0100 (BST) From: Phil Pemberton To: dlemoal@kernel.org, cassel@kernel.org, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Phil Pemberton Subject: [PATCH 1/3] scsi: scsi_devinfo: add COMPAQ PD-1 multi-LUN ATAPI device quirk Date: Thu, 9 Apr 2026 22:05:57 +0100 Message-ID: <20260409210559.155864-2-philpem@philpem.me.uk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409210559.155864-1-philpem@philpem.me.uk> References: <20260409210559.155864-1-philpem@philpem.me.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The Compaq-branded variant of the Panasonic/Matsushita LF-1195C PD/CD combo drive is a multi-LUN ATAPI device that exposes the CD-ROM on LUN 0 and a PD optical drive on LUN 1. An entry already exists for the "MATSHITA PD-1" variant with OEM firmware. Add the Compaq-branded variant with the same BLIST_FORCELUN | BLIST_SINGLELUN flags so that additional LUNs are scanned and commands are serialised, matching the existing entries. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Phil Pemberton --- drivers/scsi/scsi_devinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 68a992494b12..06b211b93567 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c @@ -150,6 +150,7 @@ static struct { {"COMPAQ", "MSA1000", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD}, {"COMPAQ", "MSA1000 VOLUME", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD}, {"COMPAQ", "HSV110", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD}, + {"COMPAQ", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, {"DDN", "SAN DataDirector", "*", BLIST_SPARSELUN}, {"DEC", "HSG80", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD}, {"DELL", "PV660F", NULL, BLIST_SPARSELUN}, --=20 2.39.5 From nobody Mon Jun 15 10:50:59 2026 Received: from nick.sneptech.io (nick.sneptech.io [178.62.38.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 408BA29992A; Thu, 9 Apr 2026 21:06:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.62.38.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775768771; cv=none; b=iXJW30kti5tqWm7RIr/42+C1XX7YYXI9T7fz6toME0Q9164WLwYkSKoBOd31OXFbVTASZtIo9h4SyJ8Pq8PrBjM0bpaKz7J/SfmLFeI1RG4j3r7owClN5qE74JoSSryQ4XtmziXfMPsFtNQfN3+QpcM496MvIVQ2MlRWy2dQ7yA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775768771; c=relaxed/simple; bh=rtFbVp8/UJ4Lu7BUwpQ9HQdvekknIbl/+cNf7dMuamo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kRgIp2AvulpxWOGJTXNvqBPwLcAZ1jkfamE3W//6o5RdlZbocTT9lSeK9t55ofvDUx9fUFYAXZTWNWLGsCRRe7qvu2eM2tYqjra2j/z9cGYgHR6g29LnFx28cNQc6PdUHyUIhoDPeQ6t6vAJ1c3xOpx/Kth86e/f/0u4kmX/m1I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=philpem.me.uk; spf=pass smtp.mailfrom=philpem.me.uk; dkim=pass (1024-bit key) header.d=philpem.me.uk header.i=@philpem.me.uk header.b=pWkacvkm; arc=none smtp.client-ip=178.62.38.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=philpem.me.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=philpem.me.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=philpem.me.uk header.i=@philpem.me.uk header.b="pWkacvkm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=philpem.me.uk; s=mail; t=1775768768; bh=rtFbVp8/UJ4Lu7BUwpQ9HQdvekknIbl/+cNf7dMuamo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pWkacvkm9gHK+bBO0ON7i9XVI6LUSeIwdC5mfyeSw5a0S/fGF1zgLySXKquO4FGl9 8QvLtL+XOUtBhBdA2jZoDaA87kXI0lwENzYXtG9aNhltwyWkUKIZKWvNKqXUscurh6 qZMOdvEo39HKfb0glitRBk/CL+pVlArcMxIz+P+0= Received: from wolf.philpem.me.uk (81-187-163-148.ip4.reverse-dns.uk [81.187.163.148]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mailrelay_wolf@philpem.me.uk) by nick.sneptech.io (Postfix) with ESMTPSA id B5EE7BE5E2; Thu, 9 Apr 2026 21:06:08 +0000 (UTC) Received: from cheetah.homenet.philpem.me.uk (cheetah.homenet.philpem.me.uk [10.0.0.32]) by wolf.philpem.me.uk (Postfix) with ESMTPSA id 55FCB5FC51; Thu, 9 Apr 2026 22:06:08 +0100 (BST) From: Phil Pemberton To: dlemoal@kernel.org, cassel@kernel.org, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Phil Pemberton Subject: [PATCH 2/3] ata: libata-scsi: enable multi-LUN support for ATAPI devices Date: Thu, 9 Apr 2026 22:05:58 +0100 Message-ID: <20260409210559.155864-3-philpem@philpem.me.uk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409210559.155864-1-philpem@philpem.me.uk> References: <20260409210559.155864-1-philpem@philpem.me.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" libata has never supported multi-LUN ATAPI devices like the Panasonic and NEC PD/CD combo drives due to three limitations: - shost->max_lun is hardcoded to 1 in ata_scsi_add_hosts(), which stops the SCSI layer from probing any LUN other than 0. - __ata_scsi_find_dev() rejects all commands where scsidev->lun !=3D 0, returning NULL which causes DID_BAD_TARGET. - The SCSI-2 CDB LUN field (byte 1, bits 7:5) is never set. Older multi-LUN ATAPI devices rely on this field to route commands to the correct LUN, as transport-layer LUN addressing (per SPC-3+) is not available over the ATA PACKET interface. To fix all three, this change: - Raises max_lun from 1 to 8 (matching the SCSI host default). Sequential LUN scanning stops at the first non-responding LUN, so single-LUN devices are unaffected. - In __ata_scsi_find_dev(), allow non-zero LUNs for ATAPI devices by routing them to the same ata_device as LUN 0. - In atapi_xlat(), encode the target LUN into CDB byte 1 bits 7:5 before passing the command packet to the device. These changes are prerequisites for probing additional LUNs during host scanning, which is done in a subsequent patch. Additionally, fix two related issues exposed by multi-LUN scanning: - ata_scsi_dev_config() previously assigned dev->sdev =3D sdev for every LUN configured. With multiple LUNs sharing one ata_device, this caused dev->sdev to be overwritten by each non-LUN-0 sdev. Restrict the assignment to LUN 0 so that dev->sdev always tracks the canonical scsi_device for the underlying ATA device. - ata_scsi_sdev_destroy() detached the entire ATA device whenever dev->sdev was non-NULL. When a spurious multi-LUN scan result was removed, this incorrectly tore down the underlying device. Detach only when the canonical (LUN 0) sdev is being destroyed. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Phil Pemberton --- drivers/ata/libata-scsi.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 3b65df914ebb..dc6829e60fb3 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1131,7 +1132,14 @@ int ata_scsi_dev_config(struct scsi_device *sdev, st= ruct queue_limits *lim, if (dev->flags & ATA_DFLAG_TRUSTED) sdev->security_supported =3D 1; =20 - dev->sdev =3D sdev; + /* + * Only LUN 0 is treated as the canonical scsi_device for the ATA + * device. Multi-LUN ATAPI devices share a single ata_device, so + * dev->sdev must continue to track LUN 0 even when additional LUNs + * are added or removed. + */ + if (sdev->lun =3D=3D 0) + dev->sdev =3D sdev; return 0; } =20 @@ -1220,7 +1228,12 @@ void ata_scsi_sdev_destroy(struct scsi_device *sdev) =20 spin_lock_irqsave(ap->lock, flags); dev =3D __ata_scsi_find_dev(ap, sdev); - if (dev && dev->sdev) { + /* + * Only detach when the canonical (LUN 0) scsi_device is going away. + * Removing a non-LUN-0 sdev (e.g. a spurious multi-LUN scan result) + * must not tear down the underlying ATA device. + */ + if (dev && dev->sdev =3D=3D sdev) { /* SCSI device already in CANCEL state, no need to offline it */ dev->sdev =3D NULL; dev->flags |=3D ATA_DFLAG_DETACH; @@ -2950,6 +2963,15 @@ static unsigned int atapi_xlat(struct ata_queued_cmd= *qc) memset(qc->cdb, 0, dev->cdb_len); memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len); =20 + /* + * Encode LUN in CDB byte 1 bits 7:5 for multi-LUN ATAPI devices + * that use the SCSI-2 CDB LUN convention (e.g. Panasonic PD/CD + * combo drives). + */ + if (scmd->device->lun) + qc->cdb[1] =3D (qc->cdb[1] & 0x1f) | + ((scmd->device->lun & 0x7) << 5); + qc->complete_fn =3D atapi_qc_complete; =20 qc->tf.flags |=3D ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; @@ -3062,9 +3084,17 @@ static struct ata_device *__ata_scsi_find_dev(struct= ata_port *ap, =20 /* skip commands not addressed to targets we simulate */ if (!sata_pmp_attached(ap)) { - if (unlikely(scsidev->channel || scsidev->lun)) + if (unlikely(scsidev->channel)) return NULL; devno =3D scsidev->id; + /* Allow non-zero LUNs for ATAPI devices (e.g. PD/CD combos) */ + if (unlikely(scsidev->lun)) { + struct ata_device *dev =3D ata_find_dev(ap, devno); + + if (!dev || dev->class !=3D ATA_DEV_ATAPI) + return NULL; + return dev; + } } else { if (unlikely(scsidev->id || scsidev->lun)) return NULL; @@ -4620,7 +4650,7 @@ int ata_scsi_add_hosts(struct ata_host *host, const s= truct scsi_host_template *s shost->transportt =3D ata_scsi_transport_template; shost->unique_id =3D ap->print_id; shost->max_id =3D 16; - shost->max_lun =3D 1; + shost->max_lun =3D 8; shost->max_channel =3D 1; shost->max_cmd_len =3D 32; =20 --=20 2.39.5 From nobody Mon Jun 15 10:50:59 2026 Received: from nick.sneptech.io (nick.sneptech.io [178.62.38.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 409B8324B2D; Thu, 9 Apr 2026 21:06:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.62.38.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775768772; cv=none; b=HWjZV7cgtcdTHIHIzJSXiFx5dLb28G23HhC7DTc35xh4Qug7DuMgUVj2JCAznsajZH9PX6HEqbfy4CWKIJa5PIWxn52jSrhEkV6rvwaV30wGtPX4b7XWT7K8sTCy18Cn+lPhhLqcY/DvJi/WousvSKt5j7hAyQQkfZLVz4OWXPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775768772; c=relaxed/simple; bh=MlOIDuUdpcyW/0eVakGVWxRBBujqmvqNJ1Tze0LcJ9s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RGGezC24OT7tk/K0WNTKqOwnoEF+CcxcTbygRXUYB26uxArFohyK3FFOkNCV1SdXxPtDmgW8S3FEF6qKjQ41H8gS1XDrhSTcYkd2ZzOAS44utWOnCqcWWo5pFpITrBr1po5Gy7t2YiZfn4fjQmJb9xMMSqPHcmM8W2O0x6FloMQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=philpem.me.uk; spf=pass smtp.mailfrom=philpem.me.uk; dkim=pass (1024-bit key) header.d=philpem.me.uk header.i=@philpem.me.uk header.b=ftTqES+2; arc=none smtp.client-ip=178.62.38.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=philpem.me.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=philpem.me.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=philpem.me.uk header.i=@philpem.me.uk header.b="ftTqES+2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=philpem.me.uk; s=mail; t=1775768768; bh=MlOIDuUdpcyW/0eVakGVWxRBBujqmvqNJ1Tze0LcJ9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ftTqES+2Not+gEuuu3vOrfk6vfc3c25AxbDSOhl9c0RT0L1/TqQxIXaUwNp2jFRrT g+pbguHiVr0gs721OKrIjKfwvwLtEUNQzqFTl7n98TIkhVgQof1vb/Nh1E/AhZc8uB TvmRf4mLSiSzRq4nIu+jFzt2XlHJXn/QJY8BS6zA= Received: from wolf.philpem.me.uk (81-187-163-148.ip4.reverse-dns.uk [81.187.163.148]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mailrelay_wolf@philpem.me.uk) by nick.sneptech.io (Postfix) with ESMTPSA id B1651BE599; Thu, 9 Apr 2026 21:06:08 +0000 (UTC) Received: from cheetah.homenet.philpem.me.uk (cheetah.homenet.philpem.me.uk [10.0.0.32]) by wolf.philpem.me.uk (Postfix) with ESMTPSA id 66FB05FC52; Thu, 9 Apr 2026 22:06:08 +0100 (BST) From: Phil Pemberton To: dlemoal@kernel.org, cassel@kernel.org, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Phil Pemberton Subject: [PATCH 3/3] ata: libata-scsi: probe additional LUNs for multi-LUN ATAPI devices Date: Thu, 9 Apr 2026 22:05:59 +0100 Message-ID: <20260409210559.155864-4-philpem@philpem.me.uk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409210559.155864-1-philpem@philpem.me.uk> References: <20260409210559.155864-1-philpem@philpem.me.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some ATAPI devices (e.g. the Panasonic PD/CD combo drives) implement multiple logical units. For instance the aforementioned PD/CD has a CD drive on LUN 0 and the rewritable Phase-change Dual (PD) block device on LUN 1. ata_scsi_scan_host() previously only scanned LUN 0 via __scsi_add_device(). With the multi-LUN work now in place, extend this scan to probe for additional LUNs on devices which have BLIST_FORCELUN set in the SCSI device info table. Scanning stops when __scsi_add_device() fails, or the device reports device type 0x1f (unknown or no device type). The PD drive returns this for unimplemented LUNs. The aforementioned BLIST_FORCELUN guard prevents non-multilun devices from being affected. Tested with a Panasonic LF-1195C PD/CD with Compaq firmware, which now correctly enumerates as a CD drive (sr) and PD optical drive (sd). Also tested with a LITE-ON iHAS124 DVD drive, which has a single LUN and ignores the LUN parameter in the CDB. As a result, without the BLIST_FORCELUN guard, this drive would pop up as eight separate devices. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Phil Pemberton --- drivers/ata/libata-scsi.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index dc6829e60fb3..0a7ce44118fe 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -4732,6 +4732,35 @@ void ata_scsi_scan_host(struct ata_port *ap, int syn= c) if (!IS_ERR(sdev)) { dev->sdev =3D sdev; ata_scsi_assign_ofnode(dev, ap); + /* + * Multi-LUN ATAPI devices (e.g. PD/CD combo + * drives) are flagged BLIST_FORCELUN in + * scsi_devinfo. Probe additional LUNs when + * the flag is set. + */ + if (dev->class =3D=3D ATA_DEV_ATAPI && + (sdev->sdev_bflags & BLIST_FORCELUN)) { + u64 lun; + + for (lun =3D 1; lun < ap->scsi_host->max_lun; + lun++) { + struct scsi_device *extra; + + extra =3D __scsi_add_device( + ap->scsi_host, + channel, id, lun, + NULL); + if (IS_ERR(extra)) + break; + /* PDT 0x1f: no device type */ + if (extra->type =3D=3D 0x1f) { + scsi_remove_device(extra); + scsi_device_put(extra); + break; + } + scsi_device_put(extra); + } + } scsi_device_put(sdev); } else { dev->sdev =3D NULL; --=20 2.39.5