Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5437109ybe; Tue, 10 Sep 2019 03:46:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhXkTHxYoZ1rdo1nBNljSseqXld+sVC3kvpj91zXiOh7HF6foOlKoU1RJd7jsK4sOhkzrs X-Received: by 2002:a50:d096:: with SMTP id v22mr30023057edd.81.1568112389376; Tue, 10 Sep 2019 03:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568112389; cv=none; d=google.com; s=arc-20160816; b=NTmVodYVTQS5xcCxYqZdZKs073e+FD2qiurT+UWT91Gx4erDdoOPtmejFzn3QcvV97 WuLsvAogXZe1EeK6/Vd0nEhqOmrYETeH24DCApXtv1r6N2K4f3Mw1L22+v+HXH3a4X/o jikDgbt4C2lYTHxU3O8sw2H/Nzr8vkE/oVsM0AsklMxrO1I1HoN06SXAuA2rDAdwBBwr XDLGk2ofFn2DGr3N1pbc+Guw6oyMsXh7o/EiaNSHMXOsDtlzGdfWCzZnWjMV97GH7kqu h/4rOaW90KjQ6U6jN5P5zlCAnUrRvWCYoEdKVxxHROwsSBtMflexoHLN+XctFDEAsX47 NQLg== 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=qytnzbtk3+K9DplB7F4GNJfxTu14CCyEeG1gbCK85os=; b=MTHdSCJYcfSntVtALm2DpVi//PMf8hwch6ZavII1x4useOoRkXteYSlOr3etptpo8S 86V8PxIHPFmC3Y88sZ4rUxqYBdozulGJ9V7icWTh7vmQfUzdjZ3jzOS73bH1CbUS5f+F X2nm2E5mU3yRJZL8qdHhGFUZlYhO8gLPqjTb4Nk6e3l06fKYRKePPpTlIblnCLt06vye 1f6guHX/HNDzoRcWsgefvOsjvCsYJl7jvK9NocTc2KS+NlSZdVhG6YCWhX16jToScX09 59DFKyLcDXahbN099/EE+mhptu530AAAGMZtyswRc+0iiiu2nFh24Wy5fZb2lDV49FZF PTDA== 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 b1si8833971eje.185.2019.09.10.03.46.05; Tue, 10 Sep 2019 03:46:29 -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 S1730620AbfIJFGF (ORCPT + 99 others); Tue, 10 Sep 2019 01:06:05 -0400 Received: from mxout013.mail.hostpoint.ch ([217.26.49.173]:65021 "EHLO mxout013.mail.hostpoint.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729014AbfIJFGF (ORCPT ); Tue, 10 Sep 2019 01:06:05 -0400 Received: from [10.0.2.46] (helo=asmtp013.mail.hostpoint.ch) by mxout013.mail.hostpoint.ch with esmtp (Exim 4.92.2 (FreeBSD)) (envelope-from ) id 1i7YLn-000KPG-7A; Tue, 10 Sep 2019 07:05:59 +0200 Received: from pool1-72.cgn.as8758.net ([212.25.6.72] helo=volery) by asmtp013.mail.hostpoint.ch with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2 (FreeBSD)) (envelope-from ) id 1i7YLn-000MlS-3h; Tue, 10 Sep 2019 07:05:59 +0200 X-Authenticated-Sender-Id: sandro@volery.com Date: Tue, 10 Sep 2019 07:05:57 +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 v2] Staging: gasket: Use temporaries to reduce line length. Message-ID: <20190910050557.GA8338@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 --- 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..16ac4329d65f 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_simple_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