From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C78FDC433DF for ; Fri, 22 May 2020 17:54:09 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7EA2F206D5 for ; Fri, 22 May 2020 17:54:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7EA2F206D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 3169B824B0; Fri, 22 May 2020 17:54:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YW+A4rXfGESo; Fri, 22 May 2020 17:54:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id E7DBE880C6; Fri, 22 May 2020 17:54:06 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 489951BF3BC for ; Fri, 22 May 2020 17:54:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 45E4587A5F for ; Fri, 22 May 2020 17:54:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U99YqGzT2ovU for ; Fri, 22 May 2020 17:54:04 +0000 (UTC) X-Greylist: delayed 00:40:00 by SQLgrey-1.7.6 Received: from smtprelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 0BDCE87A55 for ; Fri, 22 May 2020 17:54:03 +0000 (UTC) Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave05.hostedemail.com (Postfix) with ESMTP id 7A65918028E8B for ; Fri, 22 May 2020 16:36:10 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id E613418028231; Fri, 22 May 2020 16:36:07 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: pan16_100eb4426d28 X-Filterd-Recvd-Size: 3024 Received: from XPS-9350.home (unknown [47.151.136.130]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Fri, 22 May 2020 16:36:06 +0000 (UTC) Message-ID: <6ab4139ec78928961a19e5fdbda139bb8cff9cb5.camel@perches.com> Subject: Re: [PATCH] taging: speakup: remove volatile From: Joe Perches To: Dan Carpenter , MugilRaj Date: Fri, 22 May 2020 09:36:05 -0700 In-Reply-To: <20200522103406.GK30374@kadam> References: <1590138989-6091-1-git-send-email-dmugil2000@gmail.com> <20200522103406.GK30374@kadam> User-Agent: Evolution 3.36.2-0ubuntu1 MIME-Version: 1.0 X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, Kirk Reiser , Greg Kroah-Hartman , speakup@linux-speakup.org, linux-kernel@vger.kernel.org, Samuel Thibault , Chris Brannon Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" On Fri, 2020-05-22 at 13:34 +0300, Dan Carpenter wrote: > On Fri, May 22, 2020 at 02:46:28PM +0530, MugilRaj wrote: > > fix checkpatch.pl warning, which is Use of volatile is usually wrong: see > > Documentation/process/volatile-considered-harmful.rst > > Signed-off-by: MugilRaj > > Please put a blank before the Signed-off-by line. > > Probably there should be a space between your first and last name. It's > supposed to your legal name like for signing a legal document so use > whatever is appropriate legal documents in your country. > > Also the Documentation/process/volatile-considered-harmful.rst explains > that people often use "volatile" when they should be using locking for > synchronization. That seems to be the case here. So the correct fix is > to add locking. That's a little bit complicated to do and requires > testing. > > If we apply this patch, then we have silenced the warning so now someone > will have to look for the bug. But if we leave it as-is, then everyone > will know that the code is buggy. So let's leave it as-is until we are > able to fix the bug. > > It's always better to have easy to find bugs, than hidden bugs. And better still to comment known opportunities to improve the code so the next time someone tries to remove this volatile, there's a comment right there showing what's necessary instead. Something like: --- drivers/staging/speakup/speakup_decext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c index 7408eb29cf38..e68e6046bb51 100644 --- a/drivers/staging/speakup/speakup_decext.c +++ b/drivers/staging/speakup/speakup_decext.c @@ -21,6 +21,7 @@ #define SYNTH_CLEAR 0x03 #define PROCSPEECH 0x0b +/* TODO: Remove volatile, maybe add locks to read_buff_add and synth_full() ? */ static volatile unsigned char last_char; static void read_buff_add(u_char ch) _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel