Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] raid_attrs: fix dependency problems

RAID attributes uses scsi_is_sdev_device() to gate some SCSI specific
checking code. This causes two problems. Firstly if SCSI == n just
defining scsi_is_sdev_device() to return false might not be enough to
prevent gcc from emitting the code (and thus referring to undefined
symbols), so this needs surrounding with an ifdef. Secondly, using
scsi_is_sdev_device() when SCSI is either y or m gives a subtle
problem in the m case: raid_attrs must also be m to use the symbol.
Do the usual Kconfig jiggery-pokery to fix this.

Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

+8
+6
drivers/scsi/Kconfig
··· 1 1 menu "SCSI device support" 2 2 3 + config SCSI_MOD 4 + tristate 5 + default y if SCSI=n || SCSI=y 6 + default m if SCSI=m 7 + 3 8 config RAID_ATTRS 4 9 tristate "RAID Transport Class" 5 10 default n 6 11 depends on BLOCK 12 + depends on SCSI_MOD 7 13 ---help--- 8 14 Provides RAID 9 15
+2
drivers/scsi/raid_class.c
··· 63 63 * emulated RAID devices, so start with SCSI */ 64 64 struct raid_internal *i = ac_to_raid_internal(cont); 65 65 66 + #if defined(CONFIG_SCSI) || defined(CONFIG_SCSI_MODULE) 66 67 if (scsi_is_sdev_device(dev)) { 67 68 struct scsi_device *sdev = to_scsi_device(dev); 68 69 ··· 72 71 73 72 return i->f->is_raid(dev); 74 73 } 74 + #endif 75 75 /* FIXME: look at other subsystems too */ 76 76 return 0; 77 77 }