Skip to content

Commit

Permalink
[SCSI] raid_attrs: fix dependency problems
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
James Bottomley authored and James Bottomley committed Mar 3, 2010
1 parent 98e1e0f commit fac829f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/scsi/Kconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
menu "SCSI device support"

config SCSI_MOD
tristate
default y if SCSI=n || SCSI=y
default m if SCSI=m

config RAID_ATTRS
tristate "RAID Transport Class"
default n
depends on BLOCK
depends on SCSI_MOD
---help---
Provides RAID

Expand Down
2 changes: 2 additions & 0 deletions drivers/scsi/raid_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ static int raid_match(struct attribute_container *cont, struct device *dev)
* emulated RAID devices, so start with SCSI */
struct raid_internal *i = ac_to_raid_internal(cont);

#if defined(CONFIG_SCSI) || defined(CONFIG_SCSI_MODULE)
if (scsi_is_sdev_device(dev)) {
struct scsi_device *sdev = to_scsi_device(dev);

Expand All @@ -71,6 +72,7 @@ static int raid_match(struct attribute_container *cont, struct device *dev)

return i->f->is_raid(dev);
}
#endif
/* FIXME: look at other subsystems too */
return 0;
}
Expand Down

0 comments on commit fac829f

Please sign in to comment.