Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5990544ybe; Tue, 10 Sep 2019 11:50:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhiXXTTCFrEuetI0yWr0r2pLhZ9xQGC2PQ3IemBJ/V37Rbd+qW7DKeFT29B/iU61pdv+dh X-Received: by 2002:a50:88c5:: with SMTP id d63mr32426330edd.122.1568141423388; Tue, 10 Sep 2019 11:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568141423; cv=none; d=google.com; s=arc-20160816; b=ASBPk2+xrcgXvH4wFXfAZlr+PviMY1i34mvkNUQ5Qc1rUlkJDAJLqt75WFk/zsh/dM BbRJKxdA3ESnSvJxSTkh1dT3rztFjsi8604JpoL3i51blRXtneyfPX0f9LjB6e501Om0 I0g7RLYTaYTFe+pWdEm1uKVUC0Hv8Hl3/rCNiL3CPBbEJiDlotpxqWD3Bc/WFd033Liu uAVQ5WmXlztQ5rSbt8+Y8Fm48ck3O7X2q16q2iiBZ7O7NkgAt/fWo8uo6OSsLOPUUjga omTjXcXwQPUqQNjGJKZ0tTrSaSq3cqfZLNOXFv2vZwuzAfv3tR4Ft2DOWZZ88fruxi5i QZ8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=B6lOWvvtmovdxPRWAnX0luBY/el1DYjU3czo/SYc5oQ=; b=MXcdxWF7Fk0S3HN1fx0jyJ8ZjbeOSHpg8nFgB4u4VL5ocmOxQTQ3HwkVHEVRBG+KmZ 5pQdy7iqHQXA689KS1tWokJWdp6byQ1paQiyWKajeu0KpQbKxSMaf01+j8aU0EdtkeSs I9HNWEhzn6xzQLTkJ0BrvlSz6wmx5Kcm80lYJZanvq6kH+WuQSeuy6Ci10+q34ob0f0O 8UB6NboUBHbDiehIb6BO0+Pc/5w7ek28YHekyRdX+DxHmIe2vggVh71YX/EmTWzoel+Z ae5r+/ai6dq/b9fUi9fCy+NkjqvuSVgtgB/sUcQW0/lksxJOVlBR9WEtls5yL+YmeJky resg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pg18si9659890ejb.122.2019.09.10.11.49.59; Tue, 10 Sep 2019 11:50:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393408AbfIJGTh (ORCPT + 99 others); Tue, 10 Sep 2019 02:19:37 -0400 Received: from mxout017.mail.hostpoint.ch ([217.26.49.177]:31811 "EHLO mxout017.mail.hostpoint.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730336AbfIJGTh (ORCPT ); Tue, 10 Sep 2019 02:19:37 -0400 Received: from [10.0.2.45] (helo=asmtp012.mail.hostpoint.ch) by mxout017.mail.hostpoint.ch with esmtp (Exim 4.92.2 (FreeBSD)) (envelope-from ) id 1i7ZUw-000CyG-0M; Tue, 10 Sep 2019 08:19:30 +0200 Received: from 8.28.150.83.ftth.ewwwb.as8758.net ([83.150.28.8] helo=volery) by asmtp012.mail.hostpoint.ch with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2 (FreeBSD)) (envelope-from ) id 1i7ZUv-000IZx-TV; Tue, 10 Sep 2019 08:19:29 +0200 X-Authenticated-Sender-Id: sandro@volery.com Date: Tue, 10 Sep 2019 08:19:28 +0200 From: Sandro Volery To: rspringer@google.com, toddpoynor@google.com, benchan@chromium.org, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: joe@perches.com Subject: [PATCH v3] Staging: gasket: Use temporaries to reduce line length. Message-ID: <20190910061928.GA9623@volery> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using temporaries for gasket_page_table entries to remove scnprintf() statements and reduce line length, as suggested by Joe Perches. Thanks! Signed-off-by: Sandro Volery --- v3: Fixed faulty copy/paste of function v2: Attempt to fix v1: Original patch drivers/staging/gasket/apex_driver.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c index 2973bb920a26..46199c8ca441 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,25 @@ 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; -- 2.23.0