Re: [PATCH] sym53c8xx PPR negotiation fix

Doug Ledford
2003-11-01T03:11:37Z

On Fri, 2003-10-31 at 21:34, James Bottomley wrote:
> On Fri, 2003-10-31 at 19:22, Mike Anderson wrote:
> > It is called from scsi_remove_device.
>
> But that's only called for configured devices. The original intent was
> to call slave_destroy for all slave_alloc'd devices (whether configured
> or not).
>
> It originally was in scsi_free_sdev, but was moved with
>
> ChangeSet 1.1046.597.3 2003/08/02 12:17:19 andmike@us.ibm.com
> [PATCH] scsi host / scsi device ref counting take 2 [3/3]
>
> The changelog isn't very explicit about why this was done, what was the
> particular reason?

It really should be called on all devices, not just configured devices.
The assumption that a device driver doesn't need to allocate local
storage to even do something as simple as INQUIRY and can wait until
slave_configure() to allocate anything is an invalid assumption. In
fact, when I originally was working on this I think I modified the
aic7xxx_old driver to get rid of as much static array type data as
possible and move it to a struct allocated in slave_alloc. Whether the
device is kept or not, it still has to alloc to work. At one point
there was also another optimization in there so that if a driver didn't
do anything besides simply kfree() the memory pointed to by
sdptr->hostdata then you could skip defining a slave_destroy() function
and instead just let scsi_free_sdev do a simple kmalloc for you. I
think that was argued against as a special case just confuses people,
can't remember.

--
Doug Ledford <dledford@redhat.com> 919-754-3700 x44233
Red Hat, Inc.
1801 Varsity Dr.
Raleigh, NC 27606