Re: [PATCH 05/31] Constify struct dma_map_ops for 2.6.32 v1

From: Stephen Rothwell
Date: Fri Dec 04 2009 - 20:20:30 EST


Hi Emese,

On Sat, 5 Dec 2009 11:59:36 +1100 Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>
> On Fri, 04 Dec 2009 23:14:08 +0100 Emese Revfy <re.emese@xxxxxxxxx> wrote:
> >
> > --- a/arch/powerpc/kernel/vio.c
> > +++ b/arch/powerpc/kernel/vio.c
> > @@ -601,6 +601,7 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,
> > vio_cmo_dealloc(viodev, alloc_size);
> > }
> >
> > +/* cannot be const */
> > struct dma_map_ops vio_dma_mapping_ops = {
>
> The problem with leaving this not const is that a pointer to it is later
> assigned to an archdata::dma_ops which you have made into a const pointer
> earlier in this patch. This will generate a warning which is fatal in
> arch/powerpc as we compile that directory with -Werror.

Actually with a little more work, it can be made const. The only
assignment to it can be put in the initialiser instead ... As an aside,
it should also be made static.

--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx
http://www.canb.auug.org.au/~sfr/

Attachment: pgp00000.pgp
Description: PGP signature