On Tue, 2015-06-09 at 09:18 -0500, Steve Wise wrote:
> 

> > > > Why are you using a cast here at all?  bar2_pa is already u64...
> > > >
> > >
> > > So it should just have the (uintptr_t) cast?
> > 
> > No, it should be no cast at all.  The uintptr_t cast is only for casting
> > an int->ptr or ptr->int.  In those cases, if the size of an int != size
> > of ptr, you can loose data, and uintptr_t tells the compiler "I know I'm
> > casting between possibly lossy data sizes and either A) I've checked and
> > it's OK or B) I'm ok with ptr truncation and the loss won't hurt us".
> > It basically turns off size checks when sticking a ptr into an int.  You
> > should therefore use it only in those circumstances.  For example, when
> > storing a cookie that doesn't have a strict uniqueness requirement, the
> > loss due to truncation is probably OK.  Or if you know you are only
> > doing something like initially storing an int into a pointer, and then
> > later storing that pointer back into an int, so there can never be any
> > truncation because the source of the ptr was always int sized.  Those
> > are the times to use uintptr.  In this case, you have a real u64 going
> > into a real u64, there should be no casts.
> >
> 
> My bad.  I thought bar2_pa was a ptr...

I didn't look up the actual structure definition, but:

+       cq->bar2_va = c4iw_bar2_addrs(rdev, cq->cqid, T4_BAR2_QTYPE_INGRESS,
+                                     &cq->bar2_qid,
+                                     user ? &cq->bar2_pa : NULL);

+void __iomem *c4iw_bar2_addrs(struct c4iw_rdev *rdev, unsigned int qid,
+                             enum cxgb4_bar2_qtype qtype,
+                             unsigned int *pbar2_qid, u64 *pbar2_pa)

Looks like either it's a u64 or else there should be compiler warnings
about passing &cq->bar2_pa to c4iw_bar2_addrs.

-- 
Doug Ledford <dledf...@redhat.com>
              GPG KeyID: 0E572FDD

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to