Re: [PATCH 3/4] esp_scsi: use strong typing for the dev field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 10 Oct 2018, Christoph Hellwig wrote:

> esp->dev is a void pointer that points either to a struct device, or a
> struct platform_device.  As we can easily get from the device to the
> platform_device if needed change it to always point to a struct device
> and properly type the pointer to avoid errors.
> 

If you do so, can you also eliminate the dev argument to 
scsi_esp_register()?


> ...
> diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
> index c7b60ed61c38..c025f7ddaeb0 100644
> --- a/drivers/scsi/sun_esp.c
> +++ b/drivers/scsi/sun_esp.c
> @@ -80,7 +80,7 @@ static int esp_sbus_setup_dma(struct esp *esp, struct platform_device *dma_of)
>  
>  static int esp_sbus_map_regs(struct esp *esp, int hme)
>  {
> -	struct platform_device *op = esp->dev;
> +	struct platform_device *op = to_platform_device(esp->dev);
>  	struct resource *res;
>  
>  	/* On HME, two reg sets exist, first is DVMA,
> @@ -100,9 +100,9 @@ static int esp_sbus_map_regs(struct esp *esp, int hme)
>  
>  static int esp_sbus_map_command_block(struct esp *esp)
>  {
> -	struct platform_device *op = esp->dev;
> +	struct platform_device *op = to_platform_device(esp->dev);
>  
> -	esp->command_block = dma_alloc_coherent(&op->dev, 16,
> +	esp->command_block = dma_alloc_coherent(dev, 16,

Shouldn't that be esp->dev?

-- 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux