* [PATCH] ide_scsi: allow it to be used for non CD only
@ 2006-11-29 14:46 Alan
2006-11-29 22:05 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 4+ messages in thread
From: Alan @ 2006-11-29 14:46 UTC (permalink / raw)
To: linux-kernel, linux-ide, akpm
Some people want to use ide_cd for CD-ROM but still dynamically load
ide-scsi for things like tape drives. If you compile in the CD driver
this works out but if you want them modular you need an option to ensure
that whoever loads first the right things happen.
This replaces the original draft patch which leaked a scsi host reference
Signed-off-by: Alan Cox <alan@redhat.com>
diff -u --exclude-from /usr/src/exclude --new-file --recursive linux.vanilla-2.6.19-rc6-mm1/drivers/scsi/ide-scsi.c linux-2.6.19-rc6-mm1/drivers/scsi/ide-scsi.c
--- linux.vanilla-2.6.19-rc6-mm1/drivers/scsi/ide-scsi.c 2006-11-24 13:58:08.000000000 +0000
+++ linux-2.6.19-rc6-mm1/drivers/scsi/ide-scsi.c 2006-11-29 14:18:12.000000000 +0000
@@ -110,6 +110,7 @@
} idescsi_scsi_t;
static DEFINE_MUTEX(idescsi_ref_mutex);
+static int idescsi_nocd; /* Set by module param to skip cd */
#define ide_scsi_g(disk) \
container_of((disk)->private_data, struct ide_scsi_obj, driver)
@@ -1127,11 +1128,14 @@
warned = 1;
}
+ if (idescsi_nocd && drive->media == ide_cdrom)
+ return -ENODEV;
+
if (!strstr("ide-scsi", drive->driver_req) ||
!drive->present ||
drive->media == ide_disk ||
!(host = scsi_host_alloc(&idescsi_template,sizeof(idescsi_scsi_t))))
return -ENODEV;
g = alloc_disk(1 << PARTN_BITS);
if (!g)
@@ -1187,6 +1192,7 @@
driver_unregister(&idescsi_driver.gen_driver);
}
+module_param(idescsi_nocd, int, 0600);
module_init(init_idescsi_module);
module_exit(exit_idescsi_module);
MODULE_LICENSE("GPL");
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ide_scsi: allow it to be used for non CD only
2006-11-29 14:46 [PATCH] ide_scsi: allow it to be used for non CD only Alan
@ 2006-11-29 22:05 ` Bartlomiej Zolnierkiewicz
2006-11-29 22:35 ` Alan
0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2006-11-29 22:05 UTC (permalink / raw)
To: Alan; +Cc: linux-kernel, linux-ide, akpm
Hi,
Nowadays, you can dynamically change driver bound to a device using
sysfs and it works just fine for IDE, ie:
echo -n "1.0" > /sys/bus/ide/drivers/ide-scsi/unbind
echo -n "1.0" > /sys/bus/ide/drivers/ide-cdrom/bind
to unbind /dev/hdc from ide-scsi and bind to ide-cdrom
That was one of the main goals behind my old patches to convert
IDE device drivers to device-model.
Please don't add another module parameter for controlling driver binding
and making it more complicated than already is:
* "hdx=scsi" kernel parameter
* "hdx=driver" kernel parameter
* /proc/ide/hd?/driver interface
* ide_cd and "ignore" parameter
(actually all the above can go away).
Bart
On 11/29/06, Alan <alan@lxorguk.ukuu.org.uk> wrote:
> Some people want to use ide_cd for CD-ROM but still dynamically load
> ide-scsi for things like tape drives. If you compile in the CD driver
> this works out but if you want them modular you need an option to ensure
> that whoever loads first the right things happen.
>
> This replaces the original draft patch which leaked a scsi host reference
>
> Signed-off-by: Alan Cox <alan@redhat.com>
>
> diff -u --exclude-from /usr/src/exclude --new-file --recursive linux.vanilla-2.6.19-rc6-mm1/drivers/scsi/ide-scsi.c linux-2.6.19-rc6-mm1/drivers/scsi/ide-scsi.c
> --- linux.vanilla-2.6.19-rc6-mm1/drivers/scsi/ide-scsi.c 2006-11-24 13:58:08.000000000 +0000
> +++ linux-2.6.19-rc6-mm1/drivers/scsi/ide-scsi.c 2006-11-29 14:18:12.000000000 +0000
> @@ -110,6 +110,7 @@
> } idescsi_scsi_t;
>
> static DEFINE_MUTEX(idescsi_ref_mutex);
> +static int idescsi_nocd; /* Set by module param to skip cd */
>
> #define ide_scsi_g(disk) \
> container_of((disk)->private_data, struct ide_scsi_obj, driver)
> @@ -1127,11 +1128,14 @@
> warned = 1;
> }
>
> + if (idescsi_nocd && drive->media == ide_cdrom)
> + return -ENODEV;
> +
> if (!strstr("ide-scsi", drive->driver_req) ||
> !drive->present ||
> drive->media == ide_disk ||
> !(host = scsi_host_alloc(&idescsi_template,sizeof(idescsi_scsi_t))))
> return -ENODEV;
>
> g = alloc_disk(1 << PARTN_BITS);
> if (!g)
> @@ -1187,6 +1192,7 @@
> driver_unregister(&idescsi_driver.gen_driver);
> }
>
> +module_param(idescsi_nocd, int, 0600);
> module_init(init_idescsi_module);
> module_exit(exit_idescsi_module);
> MODULE_LICENSE("GPL");
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ide_scsi: allow it to be used for non CD only
2006-11-29 22:05 ` Bartlomiej Zolnierkiewicz
@ 2006-11-29 22:35 ` Alan
2006-11-29 22:47 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 4+ messages in thread
From: Alan @ 2006-11-29 22:35 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-kernel, linux-ide, akpm
On Wed, 29 Nov 2006 23:05:56 +0100
"Bartlomiej Zolnierkiewicz" <bzolnier@gmail.com> wrote:
> Hi,
>
> Nowadays, you can dynamically change driver bound to a device using
> sysfs and it works just fine for IDE, ie:
This isn't the point of this change. The point is to do this at discovery
time. If you do it later then many horrible things happen as the device
names and renames itself while udev goes boom.
Its a small clean patch and it'll solve the problem nicely until
drivers/ide dies.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ide_scsi: allow it to be used for non CD only
2006-11-29 22:35 ` Alan
@ 2006-11-29 22:47 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2006-11-29 22:47 UTC (permalink / raw)
To: Alan; +Cc: linux-kernel, linux-ide, akpm
On 11/29/06, Alan <alan@lxorguk.ukuu.org.uk> wrote:
> On Wed, 29 Nov 2006 23:05:56 +0100
> "Bartlomiej Zolnierkiewicz" <bzolnier@gmail.com> wrote:
>
> > Hi,
> >
> > Nowadays, you can dynamically change driver bound to a device using
> > sysfs and it works just fine for IDE, ie:
>
> This isn't the point of this change. The point is to do this at discovery
> time. If you do it later then many horrible things happen as the device
then "hdc=ide-cdrom" at a boot time should keep ide-scsi from
binding to hdc for all cases (builtin/modular ide-cd/ide-scsi)
> names and renames itself while udev goes boom.
Uh? I hope that udev people are informed
about these horrible things...
/dev/hdc stays there all the time
/dev/sr? addition/removal should be handled
by udev otherwise it looks like a udev bug
> Its a small clean patch and it'll solve the problem nicely until
> drivers/ide dies.
No strong feelings here about the patch. It is indeed a clean hack. ;)
I just wanted to point out that there are already more flexible ways
to achieve the same thing.
Bart
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-11-29 22:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-29 14:46 [PATCH] ide_scsi: allow it to be used for non CD only Alan
2006-11-29 22:05 ` Bartlomiej Zolnierkiewicz
2006-11-29 22:35 ` Alan
2006-11-29 22:47 ` Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).