Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp135981pxa; Tue, 4 Aug 2020 19:04:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVvc8NOv3ApJqkIjAZKjDYPxKs15cem59ZIHYg9BWfRWcX+LEYkMa5/dnwFdhAI0xrVtYc X-Received: by 2002:a05:6402:28f:: with SMTP id l15mr702270edv.233.1596593088110; Tue, 04 Aug 2020 19:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596593088; cv=none; d=google.com; s=arc-20160816; b=Es57UxfEpioko4QKzXkF+xV75rCTM+f+AgA9HUpa+CXVK38/ZFJ/FIMrTVbzm7fBV/ zchp28R6zxR1CyYRLggNP+YwtrOPJ2X9OK/rwe3IsdbVsizCFNyjxCapXXld16mkucCX ffyBlMmCkYjQbU7iXWPmHcs/ME94/4BBcISqfH6yv9MMMYUINcdM8VKYpVqoZQ6TH/iR xuaoLXV0xe7XHEc3+V5hvoqT04hpPHCt+mH+uh5Wk+7Dq41a+W/nthDI5nNRyC5xYob8 B3BVUinVzwR6Ej+U1YPOKmYRGv7To8MXEPR9Ua0xYHd5wht7+XVBvKbRQqCc+Pqy/k4C LgRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=kJcpV3FFFfsD2l55JahUfRW8uq2TSc6p0u2YdLtfElo=; b=B7+dNyHAqjZ0egemVKUEvZrigsVEuWEjg4UijWPs0w7dzg5DVBtzGHCcQkvt14ykBI KCJTeEQx7cXiRR0DEGrMqcCnc4wRqEoIzy9H9BHwpvPkaTdElYual/m7/S6MY8BAcixg 8Eoo/+xwko1C3dtiEumKFN7pyO1CwZyIAYQqq9tO8R9rn3hPUMYHw3DYhpkKB43ubBqf nuNp2EU/CwliAV+LJV8ZJEDz2wj/PXsK3nSHGSCfNL+mOjsaLyTF+oPlMB0Ox7RGTCFY Ecj0F3QR5KjoL7gvz+GHUqd+JCTFykWiPP0CzgLGceAqAX9ExkFeZ2/6y8EpG696luyy gkGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=sI+hqjvR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd9si341268edb.340.2020.08.04.19.04.26; Tue, 04 Aug 2020 19:04:48 -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=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=sI+hqjvR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726726AbgHECB2 (ORCPT + 99 others); Tue, 4 Aug 2020 22:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726104AbgHECBE (ORCPT ); Tue, 4 Aug 2020 22:01:04 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 078A1C061757 for ; Tue, 4 Aug 2020 19:01:03 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id c6so3651033pje.1 for ; Tue, 04 Aug 2020 19:01:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=kJcpV3FFFfsD2l55JahUfRW8uq2TSc6p0u2YdLtfElo=; b=sI+hqjvRrwWh582aNgQiqkG2hjMhJaMuduojBE29+CtdYVAKWZMeahFLnr+VsDAHDj xyXqs7tqdRfi2Ie4zFfZwIWY0i7jezrHbCxDvha1AVTrngUAe19Io2J2+OWApT93in/d 4WVezYpqJOdMNKiL/Us16O0iLMBd2B4ewCuxjm/2PTNeaK2vcXTRFYrVMAiBmcFgFA0F Kd9QWJtrcYnsW3U+3Aq301UK+FyWwT5xuqfy+Qn3QTMip8DBK20tP7at0G4UuyI5bYYJ TaQhgyLoYB5IJ7LViGAHAYVNPbDKMRYgAMAQAmA6+AVYh8rl4vltO0+OKUTSF80tZEIx KsNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=kJcpV3FFFfsD2l55JahUfRW8uq2TSc6p0u2YdLtfElo=; b=M8X4qZoSaxHGih9q3prhZQWnwFZwLL/kMMC1m4fm2UR+YXEacpKwJCWT2mYAV7UF+y kyVFU4nwgw4xMtRq+2cguoMXNA6bc7Y05jv8QOxiKNTTk0jPxdeFshT/d03WZWXAUmdg xLkxynEr8nf3zPehX9r4iqQclRKOAvWTbydoiDn2hf12VKGEscNoKVHNwp/yGqU2PMpr 8kj6SyFIBoYXiQoJ0sTaJ+xh7/9lR9imMEaq9D2tfHfbmruNfQj364TEuhIeM137Vsft rzomPqkBFXuIHqQTH+N9W4KtLujfKp1iVdE/uzx3vtuBxUnaHsg9TJGX4WrnkyWmG0gi Cvaw== X-Gm-Message-State: AOAM5323e8u5qATMJfv2dFy26EQfkazuwEB69s5Lqofu9QRe4+YlzxLp 3AxNTQjDl7iVBoxyPnhEtfhy2A== X-Received: by 2002:a17:90a:ff85:: with SMTP id hf5mr934567pjb.79.1596592863295; Tue, 04 Aug 2020 19:01:03 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id t11sm541305pjo.41.2020.08.04.19.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2020 19:01:02 -0700 (PDT) Date: Tue, 04 Aug 2020 19:01:02 -0700 (PDT) X-Google-Original-Date: Tue, 04 Aug 2020 19:00:52 PDT (-0700) Subject: Re: [PATCH 2/2] riscv: ptrace: Improve the style in NT_PRFPREG regset handling In-Reply-To: CC: linux-riscv@lists.infradead.org, Paul Walmsley , aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: macro@wdc.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Jul 2020 16:22:30 PDT (-0700), macro@wdc.com wrote: > 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; Reviewed-by: Palmer Dabbelt (Though the comments in the first patch apply here) Thanks!