On Wed, 7 Mar 2018, Michael Schmitz wrote:

> The major obstacle now seems to be dynamic allocation of the driver 
> private data and storing a pointer to that in a way that it can be 
> retrieved using just the esp pointer. dev_set_drvdata(esp->dev, zep) 
> causes the module load to crash ...

I've just noticed that most esp drivers do this:

static int esp_foo_probe(struct platform_device *dev)
        esp->dev = dev;

But the esp->dev->dev dereferencing sometimes gets overlooked, resulting 
in a pointer to a struct platform_device being used where a pointer to a 
struct device should be used (i.e. dma_*() calls). I will look into fixing 
this up. sun_esp.c doesn't have this problem, but the other drivers do.

I don't think any of that applies to your zorro_esp code because the 
version you sent does this,

        esp->dev = &z->dev;

which seems fine to me. But it could end up more convenient to use the 
sun_esp approach and set esp->dev = z.

I suspect that the problem with zorro_esp is that sometimes you use the 
esp->dev->driver_data pointer as the struct Scsi_Host pointer, and at 
other times you use it for the struct zorro_driver_data pointer. (I think 
I see now why you put the esp pointer in struct zorro_driver_data.)

If you like, email the current version to me or push it to a repo 
somewhere and I'll take a look at it.


Reply via email to