From: Mike Anderson <andmike@us.ibm.com>
To: "Adam J. Richter" <adam@yggdrasil.com>
Cc: hch@lst.de, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] get rid of ->detect for upper layer drivers
Date: Thu, 7 Nov 2002 06:25:25 -0800 [thread overview]
Message-ID: <20021107142525.GA1292@beaverton.ibm.com> (raw)
In-Reply-To: <200211071225.EAA29497@adam.yggdrasil.com>
Adam J. Richter [adam@yggdrasil.com] wrote:
> I think we can get cleaner code by *not* doing that.
>
> If we keep Scsi_Device_Template.detect and just change it so
> that it has no side effects like incrementing a counter, then we can
> shrink scsi_bus_match, previously a list of special cases, like so
> (just typed this code in, haven't tried to compile it):
>
>
> static int scsi_bus_match(struct device *dev, struct device_driver *drv)
> {
> struct Scsi_Device_Template *scsi_dev_tmpl =
> container_of(drv, struct Scsi_Device_Template,
> scsi_driverfs_driver);
> struct Scsi_Device_Template *scsi_dev =
> container_of(dev, struct Scsi_Device, sdev_driverfs_dev);
>
> return (*scsi_dev_templ->detect)(scsi_dev);
> }
I believe the second container_of should be assigned to a struct scsi_device*.
If you got it to compile it should result in some unexpected behavior.
The reason scsi_bus_match is not clean is that scsi currently does not
follow the device model correctly. We currently allow multiple object
types on the scsi bus device list. This means your second container_of
may not be operating on a struct scsi_device object.
The multiple objects in the scsi bus device list is the result of some
mis-placed nodes and trying to work around the one driver to one device
binding issue. In scsi if sg is loaded a scsi device can have up to 2
drivers (i.e. sg + sd, etc).
The removal of detect should eventually result in other reductions /
cleaner code (If the sg binding issue can be resolved cleanly). Scsi can
then move to device model probe and remove routines and the elimination
of the scsi_devicelist.
I have ran a patch on top of Christoph's previous set that renamed
sd_attach and sd_detect to sd_probe and sd_remove. The old sd_attach and
sd_detect need to just take a struct device *dev and do a
to_scsi_device.
-andmike
--
Michael Anderson
andmike@us.ibm.com
next prev parent reply other threads:[~2002-11-07 14:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-07 12:25 [PATCH] get rid of ->detect for upper layer drivers Adam J. Richter
2002-11-07 14:25 ` Mike Anderson [this message]
2002-11-07 15:39 ` Christoph Hellwig
2002-11-07 15:50 ` J.E.J. Bottomley
2002-11-07 15:53 ` Christoph Hellwig
2002-11-07 19:44 ` Patrick Mansfield
2002-11-07 15:36 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2002-11-07 18:42 Adam J. Richter
2002-11-07 19:02 ` J.E.J. Bottomley
2002-11-07 18:30 Adam J. Richter
2002-11-07 17:47 Adam J. Richter
2002-11-07 18:08 ` J.E.J. Bottomley
2002-11-07 18:56 ` Mike Anderson
[not found] <200211071532.HAA21625@freya.yggdrasil.com>
2002-11-07 15:42 ` Christoph Hellwig
2002-11-07 16:27 ` Mike Anderson
2002-11-07 16:22 Adam J. Richter
2002-11-07 16:16 Adam J. Richter
2002-11-07 2:49 Christoph Hellwig
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=20021107142525.GA1292@beaverton.ibm.com \
--to=andmike@us.ibm.com \
--cc=adam@yggdrasil.com \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.