Re: PATCH: PMC-Sierra MaxRAID driver to support 6Gb/s SAS RAID controller

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

 



On Thu, 2009-06-11 at 13:47 +0200, Rolf Eike Beer wrote:
> Anil Ravindranath wrote:
> > +static int pmcraid_slave_alloc(struct scsi_device *scsi_dev)
> > +{
> > +	struct pmcraid_resource_entry *temp, *res = NULL;
> > +	struct pmcraid_instance *pinstance;
> > +	u8 target, bus, lun;
> > +	unsigned long lock_flags;
> > +	int rc = -ENXIO;
> > +
> > +	pinstance = (struct pmcraid_instance *)scsi_dev->host->hostdata;
> 
> hostdata is void* AFAIR so there is no need to cast. It's C, there is no need 
> to cast to or from void* anywhere if the other thing is a pointer.

Then please read the actual source *before* commenting.  hostdata is an
unsigned long hostdata[0] in struct Scsi_Host because we elongate the
allocation area by howmuch extra space is requested.

The above statement is technically correct; however, since so many
people get this slightly wrong, we have an inline function shost_priv()
which takes the host and returns a void* pointer to the hostdata area,
so it's much better framed as

pinstance = shost_priv(scsi_dev->host);

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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