[{"id":1769465,"web_url":"http://patchwork.ozlabs.org/comment/1769465/","msgid":"<1505511108.27581.16.camel@perches.com>","list_archive_url":null,"date":"2017-09-15T21:31:48","subject":"Re: [PATCH 2/2] Staging: irda: Remove parentheses on the right of\n\tassignment","submitter":{"id":771,"url":"http://patchwork.ozlabs.org/api/people/771/","name":"Joe Perches","email":"joe@perches.com"},"content":"On Sat, 2017-09-16 at 02:36 +0530, Srishti Sharma wrote:\n> Parentheses are not needed on the right hand side of assignment\n> statement in most cases. Done using the following semantic\n> patch by coccinelle.\n[]\n> @@\n> identifier E,F,G,f;\n> expression e,r;\n> @@\n> \n> (\n> E = (G == F);\n> > \n> \n> E = (e == r);\n> > \n> \n> E =\n> -(\n> ...\n> -)\n> ;\n> )\n[]\n> diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c\n[]\n> @@ -605,7 +605,7 @@ static int mcs_speed_change(struct mcs_cb *mcs)\n>  \tif (mcs->new_speed <= 115200) {\n>  \t\trval &= ~MCS_FIR;\n>  \n> -\t\trst = (mcs->speed > 115200);\n> +\t\trst = mcs->speed > 115200;\n>  \t\tif (rst)\n>  \t\t\tmcs_set_reg(mcs, MCS_MINRXPW_REG, 0);\n\nCoccinelle is a good tool, but its output is limited to\nthe correctness\nand completeness of its input script.\n\nPlease look at the suggested modifications of the script\nand examine the code for other similar uses.\n\nThe else if block immediately below this is:\n\n\t} else if (mcs->new_speed <= 1152000) {\n\t\trval &= ~MCS_FIR;\n\n\t\tif ((rst = !(mcs->speed == 576000 || mcs->speed == 11520\n00)))\n\t\t\tmcs_set_reg(mcs, MCS_MINRXPW_REG, 5);\n\nwhich should also be corrected by this patch.","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xv7rq6c4tz9sNr\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 16 Sep 2017 07:31:55 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751513AbdIOVby (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 15 Sep 2017 17:31:54 -0400","from smtprelay0175.hostedemail.com ([216.40.44.175]:53951 \"EHLO\n\tsmtprelay.hostedemail.com\" rhost-flags-OK-OK-OK-FAIL)\n\tby vger.kernel.org with ESMTP id S1750873AbdIOVbw (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 15 Sep 2017 17:31:52 -0400","from filter.hostedemail.com (clb03-v110.bra.tucows.net\n\t[216.40.38.60])\n\tby smtprelay04.hostedemail.com (Postfix) with ESMTP id 5B60D180A68B4; \n\tFri, 15 Sep 2017 21:31:51 +0000 (UTC)","from XPS-9350 (unknown [47.151.132.55])\n\t(Authenticated sender: joe@perches.com)\n\tby omf03.hostedemail.com (Postfix) with ESMTPA;\n\tFri, 15 Sep 2017 21:31:49 +0000 (UTC)"],"X-Session-Marker":"6A6F6540706572636865732E636F6D","X-Spam-Summary":"2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::::::::::,\n\tRULES_HIT:41:355:379:541:599:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:4321:5007:6119:7903:10004:10400:10848:11026:11232:11473:11657:11658:11914:12043:12295:12296:12555:12740:12760:12895:13069:13161:13229:13311:13357:13439:14659:14721:21080:21611:21627:30012:30054:30091,\n\t0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5,\n\tNetcheck:none, DomainCache:0, MSF:not bulk, SPF:, MSBL:0,\n\tDNSBL:none, Custom_rules:0:0:0, LFtime:15, LUA_SUMMARY:none","X-HE-Tag":"sort48_100690bd5ff5e","X-Filterd-Recvd-Size":"2225","Message-ID":"<1505511108.27581.16.camel@perches.com>","Subject":"Re: [PATCH 2/2] Staging: irda: Remove parentheses on the right of\n\tassignment","From":"Joe Perches <joe@perches.com>","To":"Srishti Sharma <srishtishar@gmail.com>, samuel@sortiz.org","Cc":"gregkh@linuxfoundation.org, netdev@vger.kernel.org,\n\tdevel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,\n\toutreachy-kernel@googlegroups.com","Date":"Fri, 15 Sep 2017 14:31:48 -0700","In-Reply-To":"<9380189edb2722544981c868699ade29ab5c297d.1505508423.git.srishtishar@gmail.com>","References":"<cover.1505508423.git.srishtishar@gmail.com>\n\t<9380189edb2722544981c868699ade29ab5c297d.1505508423.git.srishtishar@gmail.com>","Content-Type":"text/plain; charset=\"ISO-8859-1\"","X-Mailer":"Evolution 3.22.6-1ubuntu1 ","Mime-Version":"1.0","Content-Transfer-Encoding":"7bit","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1769476,"web_url":"http://patchwork.ozlabs.org/comment/1769476/","msgid":"<alpine.DEB.2.20.1709152348360.2533@hadrien>","list_archive_url":null,"date":"2017-09-15T21:50:29","subject":"Re: [Outreachy kernel] Re: [PATCH 2/2] Staging: irda: Remove\n\tparentheses on the right of assignment","submitter":{"id":10041,"url":"http://patchwork.ozlabs.org/api/people/10041/","name":"Julia Lawall","email":"julia.lawall@lip6.fr"},"content":"On Fri, 15 Sep 2017, Joe Perches wrote:\n\n> On Sat, 2017-09-16 at 02:36 +0530, Srishti Sharma wrote:\n> > Parentheses are not needed on the right hand side of assignment\n> > statement in most cases. Done using the following semantic\n> > patch by coccinelle.\n> []\n> > @@\n> > identifier E,F,G,f;\n> > expression e,r;\n> > @@\n> >\n> > (\n> > E = (G == F);\n> > >\n> >\n> > E = (e == r);\n> > >\n> >\n> > E =\n> > -(\n> > ...\n> > -)\n> > ;\n> > )\n> []\n> > diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c\n> []\n> > @@ -605,7 +605,7 @@ static int mcs_speed_change(struct mcs_cb *mcs)\n> >  \tif (mcs->new_speed <= 115200) {\n> >  \t\trval &= ~MCS_FIR;\n> >\n> > -\t\trst = (mcs->speed > 115200);\n> > +\t\trst = mcs->speed > 115200;\n> >  \t\tif (rst)\n> >  \t\t\tmcs_set_reg(mcs, MCS_MINRXPW_REG, 0);\n>\n> Coccinelle is a good tool, but its output is limited to\n> the correctness\n> and completeness of its input script.\n>\n> Please look at the suggested modifications of the script\n> and examine the code for other similar uses.\n>\n> The else if block immediately below this is:\n>\n> \t} else if (mcs->new_speed <= 1152000) {\n> \t\trval &= ~MCS_FIR;\n>\n> \t\tif ((rst = !(mcs->speed == 576000 || mcs->speed == 11520\n> 00)))\n> \t\t\tmcs_set_reg(mcs, MCS_MINRXPW_REG, 5);\n>\n> which should also be corrected by this patch.\n\nYou're concerned about the assignment in the if header?  Because that was\nin 1/2.  One could also push the ! under the ||, but I'm not sure that\nwould be much of an improvement.\n\njulia\n\n>\n> --\n> You received this message because you are subscribed to the Google Groups \"outreachy-kernel\" group.\n> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.\n> To post to this group, send email to outreachy-kernel@googlegroups.com.\n> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1505511108.27581.16.camel%40perches.com.\n> For more options, visit https://groups.google.com/d/optout.\n>","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xv8GX2PpRz9s3T\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 16 Sep 2017 07:50:44 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751509AbdIOVuc (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 15 Sep 2017 17:50:32 -0400","from mail2-relais-roc.national.inria.fr ([192.134.164.83]:46374\n\t\"EHLO mail2-relais-roc.national.inria.fr\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1751184AbdIOVub (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 15 Sep 2017 17:50:31 -0400","from 85-171-60-79.rev.numericable.fr (HELO [192.168.0.15])\n\t([85.171.60.79]) by mail2-relais-roc.national.inria.fr with\n\tESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Sep 2017 23:50:30 +0200"],"X-IronPort-AV":"E=Sophos;i=\"5.42,399,1500933600\"; d=\"scan'208\";a=\"291333327\"","Date":"Fri, 15 Sep 2017 23:50:29 +0200 (CEST)","From":"Julia Lawall <julia.lawall@lip6.fr>","X-X-Sender":"jll@hadrien","To":"Joe Perches <joe@perches.com>","cc":"Srishti Sharma <srishtishar@gmail.com>, samuel@sortiz.org,\n\tgregkh@linuxfoundation.org, netdev@vger.kernel.org,\n\tdevel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,\n\toutreachy-kernel@googlegroups.com","Subject":"Re: [Outreachy kernel] Re: [PATCH 2/2] Staging: irda: Remove\n\tparentheses on the right of assignment","In-Reply-To":"<1505511108.27581.16.camel@perches.com>","Message-ID":"<alpine.DEB.2.20.1709152348360.2533@hadrien>","References":"<cover.1505508423.git.srishtishar@gmail.com>\n\t<9380189edb2722544981c868699ade29ab5c297d.1505508423.git.srishtishar@gmail.com>\n\t<1505511108.27581.16.camel@perches.com>","User-Agent":"Alpine 2.20 (DEB 67 2015-01-07)","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}}]