Willem Riede wrote: > On 2004.01.13 20:12, dougg@torque.net wrote: > >>Quoting Greg KH : >> >> >>>For scsi generic you should create a scsi generic class (scsi_generic?) >>>and create the individual sg devices in that directory (feel free to use >>>the simple_class.c code that is currently in the -mm tree if you want, >>>it makes it much simpler) >> >>Does any device use the simple_class.c code yet? > > > I did in osst, see > http://marc.theaimsgroup.com/?l=linux-kernel&m=107275923222124&w=2 Here is an sg patch against lk 2.6.1-mm2 that uses simple_add_class_device() as suggested by Greg and demonstrated by Willem in osst. The patch will apply clean against the sg driver in lk 2.6.1 but will not compile as the mm series defines simple_add_class_device(). So this patch is not meant to be placed in the mainline kernel yet. It is for Kai and Willem to consider and for others to critique. The cdev stuff is still in place (and I assume Greg will soon be removing its sysfs visibility). The symlinks that Greg objected to (in /sys/cdev/major/sg* directories) have been dropped. A reverse symlink called "generic" has been redirected from the scsi device to the corresponding /sys/class/scsi_generic/sg directory. To test it I modded scsi_debug to fake OnStream tape drives and ran a 2.6.1-mm2 kernel. The attached output of "cd /sys/class; tree scsi* osst" is instructive. Two peculiar entries are: scsi_generic/sg0/driver -> ../../../bus/scsi/drivers/osst scsi_generic/sg1/driver -> ../../../bus/scsi/drivers/osst This symlink only appears if the osst driver is loaded _before_ the sg driver! It is also left dangling by "rmmod osst". It seems that sysfs is still not happy with multiple drivers controlling the one device. The scsi subsystem solution to this is to relegate sg to be a sysfs "non" driver. Hence sg has no entry under /sys/bus/scsi/drivers and thus no obvious place to put its driver parameters. Sg driver parameters could be placed in the /sys/class/scsi_generic directory (with class_create_file() ). Suggestions? Doug Gilbert