Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1719761ybh; Thu, 23 Jul 2020 16:23:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCT4uQGTIZc7VqRt+xV1rD/KD3RNIz29zBiLYCOsUiVbtMJWI007a/yKKWMURXVppIEAkw X-Received: by 2002:a17:906:c096:: with SMTP id f22mr6424690ejz.159.1595546636549; Thu, 23 Jul 2020 16:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595546636; cv=none; d=google.com; s=arc-20160816; b=0tkcIrUErwoSFFBrsXbm+wRl8scOt/9BTDrC8kd43U3z9hJq6Zk7PjpACBRnKspOzJ g/CBM1qyQ7Aema9Mw0wd3zE+9b4lIJ0pW7Jo2B5CwKfI7Zed31TFogc6Vp1RXRdTTcaS s6C+y2qbipXXDwwhIaW2Y7kyAX9A0PaD7vO+a8QQ5b4J+QPOCtmrjD0Z8ExwETZcXCcS +D+RGtH4Z4MaD29Ew81eQArRT5klTg7eqXbEaMj01AzohiusQrVCvehlRskkE65wy23W WtFWEQWJ9L3/EKn6FnDTVv/FV1M0uo2Tor+PBKlrryv7sgD523vr3BNeqi6KlsgLGbZD d0qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:wdcironportexception :ironport-sdr:ironport-sdr:ironport-sdr:dkim-signature; bh=6nm80u7I5Rtj9WgobUU8a5FaVkjROY7W3fvL1j8r4kE=; b=uWIBMTcls7vE/U8PoGpfoidY3mr2HuhqVEeWZQaH9iOyn4EiUTMPthUyJqtv/sET19 GNYTmWT1SCJAmzcjL4krvWuESb4edwbSxXeKBc5KTHDE1X6C+HiMW3OIx+QRQWLm0GNN blDdJsz69nxBXbvj+W2RED1QbezdQsqjIg28wOQEy5OFTYO/81ftohWcFL07XQ1ddCGL 4m94MJ5+hvP4BK79ImGtqwYEhareBH2KTkeFvZxFyVudCPO56Q90VjnA2ZttJFBx39In 6HXLfdnibK5fx+CDrQZ+UqjKsFy8vAJijKa8ATR4FyTDNR2hHUEcjTgd0idi+hgoe6HQ HSnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="X/yMRbfg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id me7si2697657ejb.716.2020.07.23.16.23.34; Thu, 23 Jul 2020 16:23:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="X/yMRbfg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728241AbgGWXWe (ORCPT + 99 others); Thu, 23 Jul 2020 19:22:34 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:1491 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726723AbgGWXWe (ORCPT ); Thu, 23 Jul 2020 19:22:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1595546553; x=1627082553; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=unRYGB3JD9VvX1/PIcQEqDOVGoOR6BJzAhuSTskpzt8=; b=X/yMRbfg6BPrnc3Jt3Gfgh+4A1G+YfssKfDoLtYwQIBiBybWTd6xCbAX xhqF2rnSDL3Jh3iu2MhU4Ek6gQaw9JmEwHuyjKDD+577VbCfbvCNrtBju lWk/QR0Nwk7GQT0YYPOpoy/vaqjMtrDhjSBqInoXsPFLFijdduHuMz80h qD7e3kO2miFxR3DI+JNYviCE/KvfIWpZPV50ZyMO6E3p3mMdrJUi1nLQy 4mfcKKR5ClCARIad8Xzc92YqVkU7VttPgmQoLK5V7NGTO0oFogwv6EvpP mWuvhTwK3SkCK/mnRSVvfgafan522jJoZTVZAcgXOX1Oa3/6EChPiOM0S w==; IronPort-SDR: lBenQvUOczxdl2dgCzJEJeYW9kIZGBE9ei0+1nXFTGiuP02Fd3SAM7ieS4SjiW60d7kDOuOfhi XF0o26CSEcFgGNEo/xe/pPu8Fnxp/Oh6MJXurKM1uP+YLQsgcp7gjW+0zD3lpOP10dEdcwrkto GdKTMiWAJrA4544rXfpzmSbNbC4m71S551zu74zVqzFxPAgvZ7p1O76tbFvuYLFOsQOAtaK02d Jms3Rv0+ykmxn8+BjA/Mk1YLQ2eiZPbC8aHu/6C+lh+A5tmfYKM+D6hYSSASIdoy9vjiN2Q6tt 7E8= X-IronPort-AV: E=Sophos;i="5.75,388,1589212800"; d="scan'208";a="147549744" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Jul 2020 07:22:33 +0800 IronPort-SDR: 1qT7NVjvQagALM5k50Wy6mDtAtm8WRMPrJIOtNX0tZ/6FeMjkb2yIoOf/m1XL1lcozEzlYYzb6 NCewQiF0dW2FEf+Ky1SjHJR6Qe3+7ed2A= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 16:10:12 -0700 IronPort-SDR: kn1K8tzOhML+h1sFQtgcxeTtQDCepy93j2k8G6/vZ7GpGpOfzi9q/EmKzgYoOtRZ0w97z92dm4 Z4SO0nqSzC0g== WDCIronportException: Internal Received: from unknown (HELO redsun52) ([10.149.66.28]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 16:22:32 -0700 Date: Fri, 24 Jul 2020 00:22:30 +0100 (BST) From: "Maciej W. Rozycki" To: linux-riscv@lists.infradead.org cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] riscv: ptrace: Improve the style in NT_PRFPREG regset handling In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use an auxiliary variable for the size taken by floating point general registers in `struct __riscv_d_ext_state' to improve the readability of code in the `riscv_fpr_get' and `riscv_fpr_set' handlers, by avoiding excessive line wrapping and extending beyond 80 columns. Also shuffle local variables in the reverse Christmas tree order. No functional change. Signed-off-by: Maciej W. Rozycki --- arch/riscv/kernel/ptrace.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) linux-riscv-ptrace-fpr-style.diff Index: linux-hv/arch/riscv/kernel/ptrace.c =================================================================== --- linux-hv.orig/arch/riscv/kernel/ptrace.c +++ linux-hv/arch/riscv/kernel/ptrace.c @@ -58,18 +58,16 @@ static int riscv_fpr_get(struct task_str unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) { - int ret; + const size_t fgr_size = offsetof(struct __riscv_d_ext_state, fcsr); struct __riscv_d_ext_state *fstate = &target->thread.fstate; + int ret; ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &fstate->f, 0, - offsetof(struct __riscv_d_ext_state, fcsr)); + fgr_size); if (!ret) { ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - &fstate->fcsr, - offsetof(struct __riscv_d_ext_state, - fcsr), - offsetof(struct __riscv_d_ext_state, fcsr) + - sizeof(fstate->fcsr)); + &fstate->fcsr, fgr_size, + fgr_size + sizeof(fstate->fcsr)); } return ret; @@ -80,18 +78,16 @@ static int riscv_fpr_set(struct task_str unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { - int ret; + const size_t fgr_size = offsetof(struct __riscv_d_ext_state, fcsr); struct __riscv_d_ext_state *fstate = &target->thread.fstate; + int ret; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &fstate->f, 0, - offsetof(struct __riscv_d_ext_state, fcsr)); + fgr_size); if (!ret) { ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - &fstate->fcsr, - offsetof(struct __riscv_d_ext_state, - fcsr), - offsetof(struct __riscv_d_ext_state, fcsr) + - sizeof(fstate->fcsr)); + &fstate->fcsr, fgr_size, + fgr_size + sizeof(fstate->fcsr)); } return ret;