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

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

 



> On Fri, 12 Oct 2018, Christoph Hellwig wrote:
> 
> > 
> > > diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c
> > > index eb551f3cc471..85d067889a9b 100644
> > > --- a/drivers/scsi/mac_esp.c
> > > +++ b/drivers/scsi/mac_esp.c
> > > @@ -58,8 +58,7 @@ static struct esp *esp_chips[2];
> > >  static DEFINE_SPINLOCK(esp_chips_lock);
> > >
> > >  #define MAC_ESP_GET_PRIV(esp) ((struct mac_esp_priv *) \
> > > -                            platform_get_drvdata((struct platform_device *) \
> > > -                                                 (esp->dev)))
> > > +                            dev_get_drvdata((esp)->dev))
> > >
> > >  static inline void mac_esp_write8(struct esp *esp, u8 val, unsigned long reg)
> > >  {
> > > @@ -508,7 +507,7 @@ static int esp_mac_probe(struct platform_device *dev)
> > >       esp = shost_priv(host);
> > >
> > >       esp->host = host;
> > > -     esp->dev = dev;
> > > +     esp->dev = &dev->dev;
> > >
> > >       esp->command_block = kzalloc(16, GFP_KERNEL);
> > >       if (!esp->command_block)
> > 
> > 
> > Isn't this missing the corresponding dev_set_drvdata() in esp_mac_probe()?
> > Also conversion to dev_get_drvdata() in esp_mac_remove()?
> > 
> 
> I don't think it matters at all, as nothing in the core esp_scsi.c code 
> looks into the driver data to start with, but even if it did, 
> platform_set_drvdata and platform_get_drvdata and just trivial wrappers 
> around dev_set_drvdata and dev_get_drvdata and we rely on that fact all 
> over the kernel.
> 

Sorry, I got confused by the mix of dev_get_drvdata() and 
platform_get_drvdata() but I see now that they all refer to the same 
struct device.

> That being said if you want them converted I can throw in another patch 
> at the end of the series.
> 

No need. Thanks.

-- 



[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