From: Lucas Stach <l.stach@pengutronix.de>
To: Bhumika Goyal <bhumirks@gmail.com>
Cc: julia.lawall@lip6.fr, etnaviv@armlinux.org.uk,
christian.gmeiner@gmail.com, airlied@linux.ie,
etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm: etnaviv: constify etnaviv_iommu_ops structures
Date: Mon, 16 Jan 2017 10:34:08 +0100 [thread overview]
Message-ID: <1484559248.30810.71.camel@pengutronix.de> (raw)
In-Reply-To: <1484506228-16777-1-git-send-email-bhumirks@gmail.com>
Am Montag, den 16.01.2017, 00:20 +0530 schrieb Bhumika Goyal:
> Declare etnaviv_iommu_ops structure as const as it is only used when
> the reference of one of its field is stored in the ops field of a
> iommu_domain structure. This ops field is of type const, so
> etnaviv_iommu_ops structures having similar properties can be declared
> const too.
> Done using Coccinelle:
>
> @r1 disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct etnaviv_iommu_ops i@p={...};
>
> @ok1@
> identifier r1.i;
> position p;
> struct etnaviv_iommu_domain x;
> @@
> x.domain.ops=&i@p.ops;
>
> @bad@
> position p!={r1.p,ok1.p};
> identifier r1.i;
> @@
> i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> +const
> struct etnaviv_iommu_ops i;
>
> Before and after size details of .o file remains the same after
> cross compiling for arm architecture.
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Thanks, I've applied this patch to my tree.
> ---
> drivers/gpu/drm/etnaviv/etnaviv_iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
> index 81f1583..7a7c97f 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
> @@ -184,7 +184,7 @@ static void etnaviv_iommuv1_dump(struct iommu_domain *domain, void *buf)
> memcpy(buf, etnaviv_domain->pgtable.pgtable, PT_SIZE);
> }
>
> -static struct etnaviv_iommu_ops etnaviv_iommu_ops = {
> +static const struct etnaviv_iommu_ops etnaviv_iommu_ops = {
> .ops = {
> .domain_free = etnaviv_domain_free,
> .map = etnaviv_iommuv1_map,
prev parent reply other threads:[~2017-01-16 9:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-15 18:50 [PATCH] drm: etnaviv: constify etnaviv_iommu_ops structures Bhumika Goyal
2017-01-16 9:34 ` Lucas Stach [this message]
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=1484559248.30810.71.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=airlied@linux.ie \
--cc=bhumirks@gmail.com \
--cc=christian.gmeiner@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=etnaviv@armlinux.org.uk \
--cc=etnaviv@lists.freedesktop.org \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).