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=-3.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 4B5B4C43331 for ; Fri, 6 Sep 2019 21:11:14 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 1876F20650 for ; Fri, 6 Sep 2019 21:11:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1876F20650 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 fraxinus.osuosl.org (Postfix) with ESMTP id E5891869E1; Fri, 6 Sep 2019 21:11:13 +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 HokW9VYpmGbr; Fri, 6 Sep 2019 21:11:10 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 66D49864AB; Fri, 6 Sep 2019 21:11:10 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 79E0A1BF3FE for ; Fri, 6 Sep 2019 21:11:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 760B188253 for ; Fri, 6 Sep 2019 21:11:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l6cMAMCQOzhM for ; Fri, 6 Sep 2019 21:11:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtprelay.hostedemail.com (smtprelay0214.hostedemail.com [216.40.44.214]) by hemlock.osuosl.org (Postfix) with ESMTPS id 6F6858822A for ; Fri, 6 Sep 2019 21:11:08 +0000 (UTC) Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave06.hostedemail.com (Postfix) with ESMTP id BEA8580181A2 for ; Fri, 6 Sep 2019 20:55:30 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 16215182CF669; Fri, 6 Sep 2019 20:55:28 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: crib41_2f8de0bcaf609 X-Filterd-Recvd-Size: 3286 Received: from XPS-9350.home (unknown [47.151.152.152]) (Authenticated sender: joe@perches.com) by omf01.hostedemail.com (Postfix) with ESMTPA; Fri, 6 Sep 2019 20:55:26 +0000 (UTC) Message-ID: Subject: Re: [PATCH] Fixed parentheses malpractice in apex_driver.c From: Joe Perches To: volery , rspringer@google.com, toddpoynor@google.com, benchan@chromium.org, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Fri, 06 Sep 2019 13:55:24 -0700 In-Reply-To: <20190906183801.GA2456@volery> References: <20190906183801.GA2456@volery> User-Agent: Evolution 3.32.1-2 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" On Fri, 2019-09-06 at 20:38 +0200, volery wrote: > There were some parentheses at the end of lines, which I took care of. Not every instance of this checkpatch warning should be changed. This specific instance is because it uses very long identifiers and really maybe should just be left alone. > This is my first patch. Welcome, try again though. If you really want to do something here maybe do something like use temporaries to reduce line length and remove multiple scnprintf statements. This would also reduce object size. --- drivers/staging/gasket/apex_driver.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c index 2973bb920a26..ae1a3a14dde6 100644 --- a/drivers/staging/gasket/apex_driver.c +++ b/drivers/staging/gasket/apex_driver.c @@ -509,6 +509,8 @@ static ssize_t sysfs_show(struct device *device, struct device_attribute *attr, struct gasket_dev *gasket_dev; struct gasket_sysfs_attribute *gasket_attr; enum sysfs_attribute_type type; + struct gasket_page_table *gpt; + uint val; gasket_dev = gasket_sysfs_get_device_data(device); if (!gasket_dev) { @@ -524,29 +526,27 @@ static ssize_t sysfs_show(struct device *device, struct device_attribute *attr, } type = (enum sysfs_attribute_type)gasket_attr->data.attr_type; + gpt = gasket_dev->page_table[0]; switch (type) { case ATTR_KERNEL_HIB_PAGE_TABLE_SIZE: - ret = scnprintf(buf, PAGE_SIZE, "%u\n", - gasket_page_table_num_entries( - gasket_dev->page_table[0])); + val = gasket_page_table_num_entries(gpt); break; case ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE: - ret = scnprintf(buf, PAGE_SIZE, "%u\n", - gasket_page_table_num_simple_entries( - gasket_dev->page_table[0])); + val = gasket_page_table_num_simple_entries(gpt); break; case ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES: - ret = scnprintf(buf, PAGE_SIZE, "%u\n", - gasket_page_table_num_active_pages( - gasket_dev->page_table[0])); + val = gasket_page_table_num_active_pages(gpt); break; default: dev_dbg(gasket_dev->dev, "Unknown attribute: %s\n", attr->attr.name); ret = 0; - break; + goto exit; } + ret = scnprintf(buf, PAGE_SIZE, "%u\n", val); + +exit: gasket_sysfs_put_attr(device, gasket_attr); gasket_sysfs_put_device_data(device, gasket_dev); return ret; _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel