From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751808AbdH1QtX (ORCPT ); Mon, 28 Aug 2017 12:49:23 -0400 Received: from smtprelay0198.hostedemail.com ([216.40.44.198]:36802 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751349AbdH1QtW (ORCPT ); Mon, 28 Aug 2017 12:49:22 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::,RULES_HIT:41:355:379:541:968:982:988:989:1260:1277:1311:1313:1314:1345:1373:1437:1515:1516:1518:1534:1538:1568:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2693:2828:3138:3139:3140:3141:3142:3866:3867:3871:3874:5007:10004:10400:10848:11026:11658:11783:11914:12043:12438:13069:13255:13311:13357:13439:13894:14181:14659:14721:21080:21433:21627:30051:30054,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: dog73_8bd6eced3f33b X-Filterd-Recvd-Size: 1127 Message-ID: <1503938959.2040.6.camel@perches.com> Subject: cocci: remove unnecessary casts of void * while avoiding casts with __user or __force ? From: Joe Perches To: cocci Cc: LKML Date: Mon, 28 Aug 2017 09:49:19 -0700 Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, ...) $