RE: [PATCHv2 2/3] iovmm: add superpages support to fixed da address

From: Guzman Lugo, Fernando
Date: Tue Oct 12 2010 - 10:10:26 EST




> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@xxxxxxxxx]
> Sent: Tuesday, October 12, 2010 6:09 AM
> To: Guzman Lugo, Fernando
> Cc: Hiroshi.DOYU@xxxxxxxxx; david.cohen@xxxxxxxxx;
> felipe.contreras@xxxxxxxxx; ameya.palande@xxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; andy.shevchenko@xxxxxxxxx;
> linux-omap@xxxxxxxxxxxxxxx
> Subject: Re: [PATCHv2 2/3] iovmm: add superpages support to
> fixed da address
>
> On Mon, Oct 11, 2010 at 6:33 PM, Guzman Lugo, Fernando
> <fernando.lugo@xxxxxx> wrote:
> >> > @@ -420,7 +431,8 @@ static void sgtable_fill_kmalloc(struct
> >> sg_table
> >> > *sgt, u32 pa, size_t len)
> >> >        for_each_sg(sgt->sgl, sg, sgt->nents, i) {
> >> >                size_t bytes;
> >> >
> >> > -               bytes = iopgsz_max(len);
> >> > +               bytes = max_alignment(da | pa);
> >> > +               bytes = min(bytes, (size_t)iopgsz_max(len));
> >>
> >> Why the size_t casting?
> >
> > To void this warning:
> > arch/arm/plat-omap/iovmm.c:440: warning: comparison of distinct
> > pointer types lacks a cast
>
> But how is that possible? iopgsz_max is returning constants,
> like SZ_1M, so they should not need casts, if anything, the
> cast should be done in iopgsz_max itself.

The min macro make a "typeof" of the parameter, so the typeof of a
Constants should be int I think and that's the reason of the warning.

I can use min_t instead to avoid the warning, something like this:

bytes = min_t(size_t, bytes, iopgsz_max(len));

What do you think?

Regards,
Fernando.

>
> --
> Felipe Contreras
> --
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/