Andries --

I don't mean to sound as if you're inventing functions... I just mean that,
if you're going to reduce 5 copies to 2, why not reduce 5 copies to one
instead?

I don't quite understand your reasoning for not completing the code
consolidation.

Matt

On Tue, May 21, 2002 at 09:07:44PM +0200, [EMAIL PROTECTED] wrote:
>       Okay, now I'm seeing where you are headed...
> 
>       So why are you creating all these new functions and not just using the
>       control/bulk messaging functions in transport.c, which do all the
>       scatter-gather management for you?
> 
>       Matt
> 
> Well, you see, in my own tree I have very small drivers.
> In usb-storage the drivers are many times larger.
> The reason is that everyone who writes a driver starts
> by taking a copy of a previous driver.
> Consequently much code duplication occurs.
> 
> This is bad in itself, but as people discover small flaws in
> the code, these flaws get corrected in one driver, and live
> on in other drivers. Also this divergence is bad.
> 
> Your question sounds as if I invent functions.
> But I do not claim such originality. Everywhere I saw five
> copies of a function, I made a single copy and made these
> five places use the single copy.
> For example, datafab_raw_bulk() and jumpshot_raw_bulk() and
> sddr09_raw_bulk() and sddr55_raw_bulk() and usbat_raw_bulk()
> now become usb_storage_raw_bulk().
> 
> You ask: what silly code - why write things that way?
> I agree entirely. But this silly code occurred five times,
> and after the patch it occurs once. That is a much better
> starting point if one wants to improve this code.
> 
> 
> And this raw_bulk business is an uninteresting part.
> The knowledge about smartmedia now also lies embedded many places.
> Some drivers have more details than others. And this knowledge
> is needed not only by a handful of drivers in usb/storage.c
> but also by mtd. So, the next patch, or a next patch,
> is the extraction of all smartmedia stuff and the creation
> of smartmedia.c. You have already seen it, or at least,
> I already send some version last week. Probably there also is
> some version at ftp.kernel.org.
> 
> 
> Both changes are changes that do no touch USB or SCSI.
> A third change does touch the SCSI part of things, namely
> the patch that makes all drivers return correct or at least
> reasonable sense codes.
> 
> 
> Hope that you see what I am doing. And that although it seems
> as if most of usb-storage is changed, in reality almost nowhere
> the usb side of things is touched.
> 
> 
> Andries

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

Sir, for the hundreth time, we do NOT carry 600-round boxes of belt-fed 
suction darts!
                                        -- Salesperson to Greg
User Friendly, 12/30/1997

Attachment: msg06660/pgp00000.pgp
Description: PGP signature

Reply via email to