aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/scsi_transport_spi.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index c87ae469d707..2918b9600db7 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -348,17 +348,21 @@ spi_transport_rd_attr(rd_strm, "%d\n");
348spi_transport_rd_attr(rti, "%d\n"); 348spi_transport_rd_attr(rti, "%d\n");
349spi_transport_rd_attr(pcomp_en, "%d\n"); 349spi_transport_rd_attr(pcomp_en, "%d\n");
350 350
351/* we only care about the first child device so we return 1 */
352static int child_iter(struct device *dev, void *data)
353{
354 struct scsi_device *sdev = to_scsi_device(dev);
355
356 spi_dv_device(sdev);
357 return 1;
358}
359
351static ssize_t 360static ssize_t
352store_spi_revalidate(struct class_device *cdev, const char *buf, size_t count) 361store_spi_revalidate(struct class_device *cdev, const char *buf, size_t count)
353{ 362{
354 struct scsi_target *starget = transport_class_to_starget(cdev); 363 struct scsi_target *starget = transport_class_to_starget(cdev);
355 364
356 /* FIXME: we're relying on an awful lot of device internals 365 device_for_each_child(&starget->dev, NULL, child_iter);
357 * here. We really need a function to get the first available
358 * child */
359 struct device *dev = container_of(starget->dev.children.next, struct device, node);
360 struct scsi_device *sdev = to_scsi_device(dev);
361 spi_dv_device(sdev);
362 return count; 366 return count;
363} 367}
364static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); 368static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate);