All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -stable] fix USB_STORAGE_CYPRESS_ATACB
@ 2008-12-29 18:15 matthieu castet
  2008-12-29 19:24 ` Matthew Dharm
  0 siblings, 1 reply; 8+ messages in thread
From: matthieu castet @ 2008-12-29 18:15 UTC (permalink / raw)
  To: LKML, stable, linux-usb; +Cc: Matthew Dharm, Boaz Harrosh

[-- Attachment #1: Type: text/plain, Size: 142 bytes --]

Hi,

64a87b244b9297667ca80264aab849a36f494884 broke USB_STORAGE_CYPRESS_ATACB 
translation.

Could it be applied to kernel-stable ?

Matthieu

[-- Attachment #2: cypress_atacb_fix.diff --]
[-- Type: text/x-patch, Size: 894 bytes --]


64a87b244b9297667ca80264aab849a36f494884 commit change the scsi_eh_prep_cmnd logic by making it clear the ->cmnd buffer.

But the sat to cypress atacb translation supposed the ->cmnd buffer wasn't modified.

This patch makes it set the ->cmnd buffer after scsi_eh_prep_cmnd call.


Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
index 898e67d..526c9aa 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -143,6 +143,8 @@ void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 		 * the read taskfile bit, for not executing atacb command,
 		 * but reading register selected in srb->cmnd[4]
 		 */
+		srb->cmd_len = 16;
+		memcpy(srb->cmnd, ses.cmnd, srb->cmd_len);
 		srb->cmnd[2] = 1;
 
 		usb_stor_transparent_scsi_command(srb, us);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH -stable] fix USB_STORAGE_CYPRESS_ATACB
  2008-12-29 18:15 [PATCH -stable] fix USB_STORAGE_CYPRESS_ATACB matthieu castet
@ 2008-12-29 19:24 ` Matthew Dharm
  2008-12-30 16:07   ` Boaz Harrosh
  0 siblings, 1 reply; 8+ messages in thread
From: Matthew Dharm @ 2008-12-29 19:24 UTC (permalink / raw)
  To: matthieu castet; +Cc: LKML, stable, linux-usb, Boaz Harrosh

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

Boaz, what's your take on this?  It "feels" to me like this should be fixed
another way, rather than mucking directly with the srb structures.

Matt

On Mon, Dec 29, 2008 at 07:15:02PM +0100, matthieu castet wrote:
> Hi,
> 
> 64a87b244b9297667ca80264aab849a36f494884 broke USB_STORAGE_CYPRESS_ATACB 
> translation.
> 
> Could it be applied to kernel-stable ?
> 
> Matthieu



-- 
Matthew Dharm                              Home: mdharm-usb@one-eyed-alien.net 
Maintainer, Linux USB Mass Storage Driver

I think the problem is there's a nut loose on your keyboard.
					-- Greg to Customer
User Friendly, 1/5/1999 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -stable] fix USB_STORAGE_CYPRESS_ATACB
  2008-12-29 19:24 ` Matthew Dharm
@ 2008-12-30 16:07   ` Boaz Harrosh
  2008-12-31 10:35     ` Boaz Harrosh
  2009-02-11  7:54       ` Boaz Harrosh
  0 siblings, 2 replies; 8+ messages in thread
From: Boaz Harrosh @ 2008-12-30 16:07 UTC (permalink / raw)
  To: matthieu castet, LKML, stable, linux-usb, Boaz Harrosh

Matthew Dharm wrote:
> Boaz, what's your take on this?  It "feels" to me like this should be fixed
> another way, rather than mucking directly with the srb structures.
> 
> Matt
> 
> On Mon, Dec 29, 2008 at 07:15:02PM +0100, matthieu castet wrote:
>> Hi,
>>
>> 64a87b244b9297667ca80264aab849a36f494884 broke USB_STORAGE_CYPRESS_ATACB 
>> translation.
>>
>> Could it be applied to kernel-stable ?
>>
>> Matthieu
> 
> 
> 

You are right there is an easier way.

Sorry to only respond now, we've been moving our office, and were offline.
I'll send the proper fix first thing tomorrow ASAP

Thanks
Boaz


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH -stable] fix USB_STORAGE_CYPRESS_ATACB
  2008-12-30 16:07   ` Boaz Harrosh
@ 2008-12-31 10:35     ` Boaz Harrosh
  2009-01-01 22:47       ` matthieu castet
  2009-02-11  7:54       ` Boaz Harrosh
  1 sibling, 1 reply; 8+ messages in thread
From: Boaz Harrosh @ 2008-12-31 10:35 UTC (permalink / raw)
  To: matthieu castet, Matthew Dharm; +Cc: LKML, stable, linux-usb

Hi Matthieu, Matthew

I fixed lots of "mucking directly" with scsi_cmnd and scsi_eh_save
internal members but the actual set of srb->cmnd{,_len} is needed
still. Though we don't need the copy since we restore the original
command right after. If anyone can test this to verify it could
be grate.

Sorry for the mishap
Boaz
 
---
From: Boaz Harrosh <bharrosh@panasas.com>
Subject: [PATCH] fix USB_STORAGE_CYPRESS_ATACB

commit 64a87b24: [SCSI] Let scsi_cmnd->cmnd use request->cmd buffer
changed the scsi_eh_prep_cmnd logic by making it clear
the ->cmnd buffer. But the sat to cypress atacb translation supposed
the ->cmnd buffer wasn't modified.

This patch makes it set the ->cmnd buffer after scsi_eh_prep_cmnd call.
The problem and a fix was reported by Matthieu CASTET <castet.matthieu@free.fr>

It also removes all the hackery fiddling of scsi_cmnd and scsi_eh_save by
requesting from scsi_eh_prep_cmnd to prepare a read into ->sense_buffer,
which is much more suitable a buffer for HW transfers, then after the command
execution the regs read is copied into regs buffer before actual preparation
of sense_buffer.

Also fix an alien comment character to my utf-8 editor.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
---
 drivers/usb/storage/cypress_atacb.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
index 898e67d..9466a99 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -133,19 +133,18 @@ void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 
 		/* build the command for
 		 * reading the ATA registers */
-		scsi_eh_prep_cmnd(srb, &ses, NULL, 0, 0);
-		srb->sdb.length = sizeof(regs);
-		sg_init_one(&ses.sense_sgl, regs, srb->sdb.length);
-		srb->sdb.table.sgl = &ses.sense_sgl;
-		srb->sc_data_direction = DMA_FROM_DEVICE;
-		srb->sdb.table.nents = 1;
+		scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sizeof(regs));
+
 		/* we use the same command as before, but we set
 		 * the read taskfile bit, for not executing atacb command,
 		 * but reading register selected in srb->cmnd[4]
 		 */
+		srb->cmd_len = 16;
+		srb->cmnd = ses.cmnd;
 		srb->cmnd[2] = 1;
 
 		usb_stor_transparent_scsi_command(srb, us);
+		memcpy(regs, srb->sense_buffer, sizeof(regs));
 		tmp_result = srb->result;
 		scsi_eh_restore_cmnd(srb, &ses);
 		/* we fail to get registers, report invalid command */
@@ -162,8 +161,8 @@ void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 
 		/* XXX we should generate sk, asc, ascq from status and error
 		 * regs
-		 * (see 11.1 Error translation � ATA device error to SCSI error map)
-		 * and ata_to_sense_error from libata.
+		 * (see 11.1 Error translation ATA device error to SCSI error
+		 *  map, and ata_to_sense_error from libata.)
 		 */
 
 		/* Sense data is current and format is descriptor. */
-- 
1.6.0.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH -stable] fix USB_STORAGE_CYPRESS_ATACB
  2008-12-31 10:35     ` Boaz Harrosh
@ 2009-01-01 22:47       ` matthieu castet
  2009-02-09 19:49         ` matthieu castet
  0 siblings, 1 reply; 8+ messages in thread
From: matthieu castet @ 2009-01-01 22:47 UTC (permalink / raw)
  To: Boaz Harrosh; +Cc: Matthew Dharm, LKML, stable, linux-usb

Hi,

Boaz Harrosh wrote:
> Hi Matthieu, Matthew
> 
> I fixed lots of "mucking directly" with scsi_cmnd and scsi_eh_save
> internal members but the actual set of srb->cmnd{,_len} is needed
> still. Though we don't need the copy since we restore the original
> command right after. If anyone can test this to verify it could
> be grate.
> 
your patch works for me.

Thanks and happy new year


Matthieu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -stable] fix USB_STORAGE_CYPRESS_ATACB
  2009-01-01 22:47       ` matthieu castet
@ 2009-02-09 19:49         ` matthieu castet
  0 siblings, 0 replies; 8+ messages in thread
From: matthieu castet @ 2009-02-09 19:49 UTC (permalink / raw)
  To: Boaz Harrosh; +Cc: Matthew Dharm, LKML, stable, linux-usb, Greg KH

Hi,

matthieu castet wrote:
> Hi,
> 
> Boaz Harrosh wrote:
>> Hi Matthieu, Matthew
>>
>> I fixed lots of "mucking directly" with scsi_cmnd and scsi_eh_save
>> internal members but the actual set of srb->cmnd{,_len} is needed
>> still. Though we don't need the copy since we restore the original
>> command right after. If anyone can test this to verify it could
>> be grate.
>>
> your patch works for me.
> 
> Thanks and happy new year
> 
What's the status of that patch ?
I doesn't seem to be in stable nor master.


Matthieu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH -stable resend] fix USB_STORAGE_CYPRESS_ATACB
@ 2009-02-11  7:54       ` Boaz Harrosh
  0 siblings, 0 replies; 8+ messages in thread
From: Boaz Harrosh @ 2009-02-11  7:54 UTC (permalink / raw)
  To: James Bottomley, Matthew Dharm, matthieu castet
  Cc: LKML, stable, linux-usb, linux-scsi

James hi.

I'm resending a forgotten patch. See here:
http://lkml.indiana.edu/hypermail/linux/kernel/0812.3/01127.html

I'll need Matthew Dharm ACK or who ever maintains cypress_atacb

---
From: Boaz Harrosh <bharrosh@panasas.com>
Subject: [PATCH] fix USB_STORAGE_CYPRESS_ATACB

commit 64a87b24: [SCSI] Let scsi_cmnd->cmnd use request->cmd buffer
changed the scsi_eh_prep_cmnd logic by making it clear
the ->cmnd buffer. But the sat to cypress atacb translation supposed
the ->cmnd buffer wasn't modified.

This patch makes it set the ->cmnd buffer after scsi_eh_prep_cmnd call.
The problem and a fix was reported by Matthieu CASTET <castet.matthieu@free.fr>

It also removes all the hackery fiddling of scsi_cmnd and scsi_eh_save by
requesting from scsi_eh_prep_cmnd to prepare a read into ->sense_buffer,
which is much more suitable a buffer for HW transfers, then after the command
execution the regs read is copied into regs buffer before actual preparation
of sense_buffer.

Also fix an alien comment character to my utf-8 editor.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
CC: stable@kernel.org
---
 drivers/usb/storage/cypress_atacb.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
index 898e67d..9466a99 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -133,19 +133,18 @@ void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 
 		/* build the command for
 		 * reading the ATA registers */
-		scsi_eh_prep_cmnd(srb, &ses, NULL, 0, 0);
-		srb->sdb.length = sizeof(regs);
-		sg_init_one(&ses.sense_sgl, regs, srb->sdb.length);
-		srb->sdb.table.sgl = &ses.sense_sgl;
-		srb->sc_data_direction = DMA_FROM_DEVICE;
-		srb->sdb.table.nents = 1;
+		scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sizeof(regs));
+
 		/* we use the same command as before, but we set
 		 * the read taskfile bit, for not executing atacb command,
 		 * but reading register selected in srb->cmnd[4]
 		 */
+		srb->cmd_len = 16;
+		srb->cmnd = ses.cmnd;
 		srb->cmnd[2] = 1;
 
 		usb_stor_transparent_scsi_command(srb, us);
+		memcpy(regs, srb->sense_buffer, sizeof(regs));
 		tmp_result = srb->result;
 		scsi_eh_restore_cmnd(srb, &ses);
 		/* we fail to get registers, report invalid command */
@@ -162,8 +161,8 @@ void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 
 		/* XXX we should generate sk, asc, ascq from status and error
 		 * regs
-		 * (see 11.1 Error translation � ATA device error to SCSI error map)
-		 * and ata_to_sense_error from libata.
+		 * (see 11.1 Error translation ATA device error to SCSI error
+		 *  map, and ata_to_sense_error from libata.)
 		 */
 
 		/* Sense data is current and format is descriptor. */
-- 
1.6.0.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH -stable resend] fix USB_STORAGE_CYPRESS_ATACB
@ 2009-02-11  7:54       ` Boaz Harrosh
  0 siblings, 0 replies; 8+ messages in thread
From: Boaz Harrosh @ 2009-02-11  7:54 UTC (permalink / raw)
  To: James Bottomley, Matthew Dharm, matthieu castet
  Cc: LKML, stable-DgEjT+Ai2ygdnm+yROfE0A,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-scsi

James hi.

I'm resending a forgotten patch. See here:
http://lkml.indiana.edu/hypermail/linux/kernel/0812.3/01127.html

I'll need Matthew Dharm ACK or who ever maintains cypress_atacb

---
From: Boaz Harrosh <bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH] fix USB_STORAGE_CYPRESS_ATACB

commit 64a87b24: [SCSI] Let scsi_cmnd->cmnd use request->cmd buffer
changed the scsi_eh_prep_cmnd logic by making it clear
the ->cmnd buffer. But the sat to cypress atacb translation supposed
the ->cmnd buffer wasn't modified.

This patch makes it set the ->cmnd buffer after scsi_eh_prep_cmnd call.
The problem and a fix was reported by Matthieu CASTET <castet.matthieu@free.fr>

It also removes all the hackery fiddling of scsi_cmnd and scsi_eh_save by
requesting from scsi_eh_prep_cmnd to prepare a read into ->sense_buffer,
which is much more suitable a buffer for HW transfers, then after the command
execution the regs read is copied into regs buffer before actual preparation
of sense_buffer.

Also fix an alien comment character to my utf-8 editor.

Signed-off-by: Boaz Harrosh <bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Matthieu CASTET <castet.matthieu-GANU6spQydw@public.gmane.org>
CC: stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
---
 drivers/usb/storage/cypress_atacb.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
index 898e67d..9466a99 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -133,19 +133,18 @@ void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 
 		/* build the command for
 		 * reading the ATA registers */
-		scsi_eh_prep_cmnd(srb, &ses, NULL, 0, 0);
-		srb->sdb.length = sizeof(regs);
-		sg_init_one(&ses.sense_sgl, regs, srb->sdb.length);
-		srb->sdb.table.sgl = &ses.sense_sgl;
-		srb->sc_data_direction = DMA_FROM_DEVICE;
-		srb->sdb.table.nents = 1;
+		scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sizeof(regs));
+
 		/* we use the same command as before, but we set
 		 * the read taskfile bit, for not executing atacb command,
 		 * but reading register selected in srb->cmnd[4]
 		 */
+		srb->cmd_len = 16;
+		srb->cmnd = ses.cmnd;
 		srb->cmnd[2] = 1;
 
 		usb_stor_transparent_scsi_command(srb, us);
+		memcpy(regs, srb->sense_buffer, sizeof(regs));
 		tmp_result = srb->result;
 		scsi_eh_restore_cmnd(srb, &ses);
 		/* we fail to get registers, report invalid command */
@@ -162,8 +161,8 @@ void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 
 		/* XXX we should generate sk, asc, ascq from status and error
 		 * regs
-		 * (see 11.1 Error translation � ATA device error to SCSI error map)
-		 * and ata_to_sense_error from libata.
+		 * (see 11.1 Error translation ATA device error to SCSI error
+		 *  map, and ata_to_sense_error from libata.)
 		 */
 
 		/* Sense data is current and format is descriptor. */
-- 
1.6.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-02-11  7:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-29 18:15 [PATCH -stable] fix USB_STORAGE_CYPRESS_ATACB matthieu castet
2008-12-29 19:24 ` Matthew Dharm
2008-12-30 16:07   ` Boaz Harrosh
2008-12-31 10:35     ` Boaz Harrosh
2009-01-01 22:47       ` matthieu castet
2009-02-09 19:49         ` matthieu castet
2009-02-11  7:54     ` [PATCH -stable resend] " Boaz Harrosh
2009-02-11  7:54       ` Boaz Harrosh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.