public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Rolf Eike Beer <eike-kernel@sf-tec.de>
Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com>,
	linux-scsi@vger.kernel.org, gregkh@suse.de
Subject: Re: PATCH: PMC-Sierra MaxRAID driver to support 6Gb/s SAS RAID controller
Date: Thu, 11 Jun 2009 09:08:12 -0500	[thread overview]
Message-ID: <1244729292.3998.9.camel@mulgrave.site> (raw)
In-Reply-To: <200906111348.02029.eike-kernel@sf-tec.de>

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



  parent reply	other threads:[~2009-06-11 14:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-10 20:07 PATCH: PMC-Sierra MaxRAID driver to support 6Gb/s SAS RAID controller Anil Ravindranath
2009-06-11  1:23 ` Greg KH
2009-06-11  5:54   ` Anil Ravindranath
2009-06-13  7:04     ` Anil Ravindranath
2009-06-11  3:14 ` Grant Grundler
2009-06-11 13:11   ` Anil Ravindranath
2009-06-13  7:18   ` Anil Ravindranath
2009-06-11 11:47 ` Rolf Eike Beer
2009-06-11 13:25   ` Anil Ravindranath
2009-06-11 14:08   ` James Bottomley [this message]
2009-06-13  8:50   ` Anil Ravindranath
2009-06-11 16:32 ` Brian King
2009-06-12  6:06   ` Anil Ravindranath
2009-06-12 15:08   ` Grant Grundler
2009-06-12 15:23     ` Brian King
2009-06-12 16:17       ` Brian King
2009-06-12 16:20       ` Grant Grundler
2009-06-12 16:43         ` James Bottomley
2009-06-12 15:24     ` James Bottomley
2009-06-16 14:10   ` Anil Ravindranath
2009-06-16 17:08     ` Greg KH
2009-06-17 15:09     ` Brian King
2009-06-18 18:08       ` Anil Ravindranath
  -- strict thread matches above, loose matches on Subject: below --
2009-06-16 17:37 Anil Ravindranath
2009-06-16 18:48 ` Randy Dunlap
2009-06-17 11:04 ` Anil Ravindranath
2009-08-07  0:16 Anil Ravindranath
2009-08-18 21:44 ` Anil Ravindranath
2009-08-19  2:02 ` James Bottomley
2009-08-24 17:24   ` Anil Ravindranath
2009-08-26  0:35 Anil Ravindranath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244729292.3998.9.camel@mulgrave.site \
    --to=james.bottomley@hansenpartnership.com \
    --cc=anil_ravindranath@pmc-sierra.com \
    --cc=eike-kernel@sf-tec.de \
    --cc=gregkh@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox