mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Dharm <mdharm-kernel@one-eyed-alien.net>
To: matthieu castet <castet.matthieu@free.fr>
Cc: linux-usb@vger.kernel.org,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH]  mass storage : emulation of sat scsi_pass_thru with ATACB
Date: Sat, 8 Mar 2008 13:21:48 -0800	[thread overview]
Message-ID: <20080308212148.GC2820@one-eyed-alien.net> (raw)
In-Reply-To: <47D2F23A.4020103@free.fr>

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

On Sat, Mar 08, 2008 at 09:08:26PM +0100, matthieu castet wrote:
> Hi Matthew,
> 
> thanks for your comments
> 
> Matthew Dharm wrote:
> >Why are you using an initializer instead of a new protocol code?
> Because using a new protocol code means I need to patch all the place 
> where there is a comparison between us->subclass and US_SC_SCSI.
> After all I am US_SC_SCSI with a special case for ATA12 & ATA16 commands.
> I don't translate all scsi to atacb (that's what does US_SC_ISD200).

Yet, you call invoke_transport directly, just like any other protocol
handler.

The proper way to do this is as a separate protocol handler.  If you want
to make it clear that you are only intercepting a couple of command types,
then don't call invoke_transport() directly, call the transparent scsi
protocol handler (which, of course, does the same thing but provides
clearer layering).

Oh, and you should add some "unlikely" tags to these if() conditionals.

> >Actually, why do you even have a separate 'dispatcher' function?  Why not
> >just one protocol handler function which checks the command at the top and
> >calls invoke_transport there?
> What do you means by having a separate 'dispatcher' function?
> You means why I have 2 functions emulate_pass_thru_with_atacb and 
> usb_stor_transparent_scsi_command_atacb ?
> I did 2 functions for having a code more clean.
> 
> You suggest something like
> void usb_stor_transparent_scsi_command_atacb(struct scsi_cmnd *srb,
>                        struct us_data *us)
> {
>     if (srb->cmnd[0] != ATA_16 && srb->cmnd[0] != ATA_12) {
>         usb_stor_invoke_transport(srb, us);
>         return;
>     }
>     copy emulate_pass_thru_with_atacb code here
> }

Yes, modulo my comment above about calling the transparent scsi protocol
handler instead of invoke_transport directly.

> >Also, unless ATACB is a new standard (and I don't think it is, as the
> >Cypress datasheet uses the term 'vendor specific'), then your functions
> >need renaming.  Instead of 'emulate_pass_thru_with_atacb', how about
> >something like 'cypress_atacb' --  since it's already a protocol handler,
> >everyone already knows it's for passing commands.
> But 'emulate_pass_thru_with_atacb' only handle ATA pass_thru scsi 
> commands. It doesn't translate all scsi commands to atacb like 
> 'cypress_atacb' could suggest.
> That's why I put 'usb_stor_transparent_scsi_command_atacb' saying it is 
> transparent_scsi_command + atacb support.

Yes, but your name suggests that ATACB is a new industry standard which is
implemented by more than a few chips from one specific vendor.  That's not
acceptable.

Try 'cypress_atacb_passthrough' instead?

Matt

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

P:  Nine more messages in admin.policy.
M: I know, I'm typing as fast as I can!
					-- Pitr and Mike
User Friendly, 11/27/97

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

  reply	other threads:[~2008-03-08 21:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-08 17:32 matthieu castet
2008-03-08 18:31 ` Matthew Dharm
2008-03-08 20:08   ` matthieu castet
2008-03-08 21:21     ` Matthew Dharm [this message]
2008-03-09  8:21       ` matthieu castet
2008-03-09 18:45         ` Matthew Dharm
2008-03-09 21:42           ` matthieu castet
2008-03-10  1:20             ` Matthew Dharm
2008-03-13 21:22               ` matthieu castet
2008-03-14  0:51                 ` Matthew Dharm
     [not found]                   ` <20080318221207.GY2820@one-eyed-alien.net>
2008-03-19 18:40                     ` matthieu castet
2008-03-19 20:02                       ` Matthew Dharm
2008-03-20 21:39                       ` patch usb-mass-storage-emulation-of-sat-scsi_pass_thru-with-atacb.patch added to gregkh-2.6 tree gregkh
2008-03-09 10:13   ` [PATCH] mass storage : emulation of sat scsi_pass_thru with ATACB Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080308212148.GC2820@one-eyed-alien.net \
    --to=mdharm-kernel@one-eyed-alien.net \
    --cc=castet.matthieu@free.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome