From: Greg KH <gregkh@suse.de>
To: Patrick Mochel <mochel@digitalimplant.org>, linux-kernel@vger.kernel.org
Subject: Re: [0/12] More Driver Model Locking Changes
Date: Fri, 25 Mar 2005 16:03:10 -0800 [thread overview]
Message-ID: <20050326000309.GB16602@kroah.com> (raw)
In-Reply-To: <20050325233952.GA16355@kroah.com>
On Fri, Mar 25, 2005 at 03:39:52PM -0800, Greg KH wrote:
> But can you take a look at drivers/scsi/scsi_transport_spi.c, line 265?
> That is also going to need fixing up somehow. Gotta love that FIXME
> comment...
Ok, the patch below seems to fix it, but I would like some validation I
did the correct thing.
Oh, looks like pci express now has problems too, I'll go hit that one
next...
thanks,
greg k-h
-------------
[scsi] use device_for_each_child() to properly access child devices.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff -Nru a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
--- a/drivers/scsi/scsi_transport_spi.c 2005-03-25 16:03:09 -08:00
+++ b/drivers/scsi/scsi_transport_spi.c 2005-03-25 16:03:09 -08:00
@@ -254,17 +254,21 @@
spi_transport_rd_attr(rti, "%d\n");
spi_transport_rd_attr(pcomp_en, "%d\n");
+/* we only care about the first child device so we return 1 */
+static int child_iter(struct device *dev, void *data)
+{
+ struct scsi_device *sdev = to_scsi_device(dev);
+
+ spi_dv_device(sdev);
+ return 1;
+}
+
static ssize_t
store_spi_revalidate(struct class_device *cdev, const char *buf, size_t count)
{
struct scsi_target *starget = transport_class_to_starget(cdev);
- /* FIXME: we're relying on an awful lot of device internals
- * here. We really need a function to get the first available
- * child */
- struct device *dev = container_of(starget->dev.children.next, struct device, node);
- struct scsi_device *sdev = to_scsi_device(dev);
- spi_dv_device(sdev);
+ device_for_each_child(&starget->dev, NULL, child_iter);
return count;
}
static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate);
next prev parent reply other threads:[~2005-03-26 0:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-25 5:54 [0/12] More Driver Model Locking Changes Patrick Mochel
2005-03-25 19:20 ` Greg KH
2005-03-25 23:39 ` Greg KH
2005-03-26 0:03 ` Greg KH [this message]
2005-03-26 2:24 ` Patrick Mochel
2005-03-26 3:54 ` Greg KH
2005-03-26 4:47 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050326000309.GB16602@kroah.com \
--to=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@digitalimplant.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox