public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: cocci <cocci@systeme.lip6.fr>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: cocci: remove unnecessary casts of void * while avoiding casts with __user or __force ?
Date: Mon, 28 Aug 2017 09:49:19 -0700	[thread overview]
Message-ID: <1503938959.2040.6.camel@perches.com> (raw)

A simple cocci script that removes unnecessary casts of
a void * will also remove casts with __force or __user

e.g.:

-       xemaclite_aligned_write(address_ptr, (u32 __force *) addr, ETH_ALEN);
+       xemaclite_aligned_write(address_ptr, addr, ETH_ALEN);

Is there a simple mechanism to avoid converting those?

$ cat void.cocci
@@
type T;
void *v;
expression e;
@@

-	e = (T *)v;
+	e = v;

@@
identifier f;
type T;
void *v;
@@

	f(...,
-	(T *)v,
+	v,
	...)

$

             reply	other threads:[~2017-08-28 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-28 16:49 Joe Perches [this message]
2017-08-29  5:17 ` [Cocci] cocci: remove unnecessary casts of void * while avoiding casts with __user or __force ? Julia Lawall

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=1503938959.2040.6.camel@perches.com \
    --to=joe@perches.com \
    --cc=cocci@systeme.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