All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Grundler <grundler@parisc-linux.org>
To: "James K. Love" <jlove@scires.com>
Cc: parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] [PATCH] sd: Adds flexible disk (TEAC FC-1, scsi-floppy) support to scsi disk driver
Date: Thu, 8 Mar 2007 11:26:01 -0700	[thread overview]
Message-ID: <20070308182601.GA18689__39193.1021622897$1416624322$gmane$org@colo.lackof.org> (raw)
In-Reply-To: <45F0260A.7080306@scires.com>

On Thu, Mar 08, 2007 at 10:04:42AM -0500, James K. Love wrote:
> Thanks for the comments, Grant.

welcome :)
kudos for chasing this.

...
> >> +		/* store the drive's geometry info we just read */
> >> +		sf_heads = page5->number_of_heads;
> >> +		sf_sectors = page5->sectors_per_track;
> >> +		sf_cylinders = page5->number_of_cylinders_msb << 8
> >> +		               | page5->number_of_cylinders_lsb;
> > 
> > I'm kinda nervous about the use of static globals to "return" the
> > result of the previous code. In case some whacko decided to
> > have two scsi floppies with different media types, would this break?
> 
> I also agree.  In retrospect, I shouldn't have done this the way I did.  I
> mentioned this to Helge earlier, and I've already changed these to static
> consts in my source, since I'm basically hard-coding the FC-1's geometry
> and consts allow me to sanity check the mode select that sets the geometry.
> Does that sound logical?

It sounds good but it's totally not obvious this was the intent.
If you are "hard coding" the geometry, then can't you just use #define?

I think it's ok to only support one geometry.
Just add a check, something like this:
	if (sf_heads) {
		/* make sure successive floppies have same geometry */
		if (sf_heads != page5->number_of_heads) {
			printk(KERN_ERR "Sorry, only support one geometry"
					" for SCSI floppy.\n");
			return -ENOMEDIA;
		} 
	} else {
		sf_heads =....
	}

And maybe think about a better error message and how to handle it. YKWIM.

>   Technically, it wouldn't have broken the way it is written
> because the geometry should always be the same for these drives,
> but it wasn't the best implementation.

ok. That makes sense. but "these drives" are a specific model of drive
with a specific type of media installed.  I don't see checks for that here.
I expect there are other "device->removable && !TYPE_MOD" devices.

> I'll wait a bit longer to see if I get any more comments, then I'll post an
> updated patch that will include your suggestions.

Sounds good - many thanks!

grant
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

  parent reply	other threads:[~2007-03-08 18:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <45B67554.6010208@scires.com>
2007-01-24 16:28 ` [parisc-linux] Floppy disk support for 9000 series (715, 755, etc.) workstations Grant Grundler
     [not found] ` <20070124162810.GA31075@colo.lackof.org>
2007-02-08 17:23   ` James K. Love
     [not found]   ` <45CB5C9D.1070601@scires.com>
2007-02-08 17:38     ` Matthew Wilcox
     [not found]     ` <20070208173808.GL13101@parisc-linux.org>
2007-02-08 20:08       ` James K. Love
     [not found]       ` <45CB8357.2050703@scires.com>
2007-02-08 20:11         ` Matthew Wilcox
2007-03-05 22:17       ` [parisc-linux] [PATCH] sd: Adds flexible disk (TEAC FC-1, scsi-floppy) support to scsi disk driver James K. Love
     [not found]       ` <45EC9702.9080107@scires.com>
2007-03-08  6:53         ` Grant Grundler
     [not found]         ` <20070308065323.GB26641@colo.lackof.org>
2007-03-08 15:04           ` James K. Love
     [not found]           ` <45F0260A.7080306@scires.com>
2007-03-08 18:26             ` Grant Grundler [this message]
     [not found]             ` <20070308182601.GA18689@colo.lackof.org>
2007-03-09 15:51               ` James K. Love

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='20070308182601.GA18689__39193.1021622897$1416624322$gmane$org@colo.lackof.org' \
    --to=grundler@parisc-linux.org \
    --cc=jlove@scires.com \
    --cc=parisc-linux@lists.parisc-linux.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 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.