From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: torvalds@linux-foundation.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [GIT PATCH] firs round of SCSI bug fixes for 2.6.29-rc1
Date: Fri, 16 Jan 2009 15:28:37 -0500 [thread overview]
Message-ID: <1232137717.3224.54.camel@localhost.localdomain> (raw)
In-Reply-To: <20090116110708.75c5828d.akpm@linux-foundation.org>
On Fri, 2009-01-16 at 11:07 -0800, Andrew Morton wrote:
> On Fri, 16 Jan 2009 13:48:53 -0500
> James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
>
> > > > +++ b/drivers/scsi/qla2xxx/qla_init.c
> > > > @@ -1258,35 +1258,48 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
> > > > {
> > > > int rval;
> > > > unsigned long flags = 0;
> > > > - int cnt;
> > > > + int cnt, que;
> > > > struct qla_hw_data *ha = vha->hw;
> > > > - struct req_que *req = ha->req_q_map[0];
> > > > - struct rsp_que *rsp = ha->rsp_q_map[0];
> > > > + struct req_que *req;
> > > > + struct rsp_que *rsp;
> > > > + struct scsi_qla_host *vp;
> > > > struct mid_init_cb_24xx *mid_init_cb =
> > > > (struct mid_init_cb_24xx *) ha->init_cb;
> > >
> > > This cast worries me. It's a cast between two complex data structures
> > > which appear to have nothing to do with each other.
> >
> > Actually, it's a C++ type construct. ha->init_cb is of type init_cb_t,
> > mid_init_cb actually contains this (via a second indirection) as the
> > first element, so what it's doing is dynamically casting out based on
> > the board type.
>
> Ah, OK, I got lost amongst the typedefs and pointers.
>
> This code could/should use container_of() for this operation?
It could, but since it's a double cast out it would get a lot uglier. We
don't really pick up any safety from this because the FW structure is
shared with the device, so no-one can move the first element anyway.
James
next prev parent reply other threads:[~2009-01-16 20:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-16 14:56 [GIT PATCH] firs round of SCSI bug fixes for 2.6.29-rc1 James Bottomley
2009-01-16 17:09 ` Andrew Morton
2009-01-16 18:48 ` James Bottomley
2009-01-16 19:07 ` Andrew Morton
2009-01-16 20:28 ` James Bottomley [this message]
2009-01-16 19:09 ` David Miller
2009-01-16 19:02 ` Grant Grundler
2009-01-16 19:10 ` David Miller
2009-01-16 20:09 ` Grant Grundler
2009-01-16 20:15 ` James Bottomley
2009-01-17 21:17 ` Matthew Wilcox
2009-02-11 4:08 ` Matthew Wilcox
2009-02-11 12:42 ` James Bottomley
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=1232137717.3224.54.camel@localhost.localdomain \
--to=james.bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.