Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2069867rwb; Sun, 14 Aug 2022 20:36:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR7KRR+wowPFucpbI01UcspMu8nSQ+/QnjaxEMuFggEil0+DbMQyLtcdPeoN2Oh7NfsuW368 X-Received: by 2002:a17:906:4fd6:b0:70c:9284:cc01 with SMTP id i22-20020a1709064fd600b0070c9284cc01mr9194314ejw.553.1660534580524; Sun, 14 Aug 2022 20:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660534580; cv=none; d=google.com; s=arc-20160816; b=YsLYtvAFirEXn+112KBXK/oGVch75dwQFjXvMtCm/j/aCMqHb+0/CmO8xPhvhEpCBl Ygak0pBY51uQ10FJUzKCDUqwt1LIrqgupOSeFV7j4ma/F7iTOBHwFaBo+o+AdtFW/M40 /6hur5pZ+VHZKKoXsRHSvB0ztDsGF4yAOtTm9wlzF6++xrElMpl3zrb5JAH6FasMejW9 FnPiWxkpk+mmrSA9xBwAj2bSOf3Ti7yCvZ6VOXM852B7RFU+unKodAvLfkhcTBrWyvLH QS67AuVTHbtqWP9SUqadUP1VMFc74rns/XZh3Fa5WKMJEKxKsRW/3M/heAc9fPXwdtCZ zF2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xr+CJdXwwu8zu4rWtxG8Jsfv89A9p42YAg1ul0bSsGM=; b=K0HB/SeuT6YyKZ3mU54sByGhZW5cBZI8zIzPDFFWnFB1yOrqFwOjc5931U+2P3uKk6 2DWll6sJBdt/L1//nofz6EGVGTTGQLvHoWBpv/wVJ/6bkos84eI+RJeeRanZ0Q7HEXc8 KdBZFI66jWSENVkVSXj2UbNONhLe8o5huEmvQ5qMoeRiW2tlWtA8x/+k+pw707hpsU8u VeOzzK1TDrCibaQXzwPuWcy5+wrfiljQvAWcl1LEQqiRbC2N0o4PQxsvhQYiY39Kfglm eI3FujtFfe3ET3pMowQExpxhCGc1W/W1iOh5XFVxSC5KcWHqaMpZVmzuLV0lRT9J0BE/ RFrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a5099cc000000b0043bb6a22af3si6282706edb.387.2022.08.14.20.35.54; Sun, 14 Aug 2022 20:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbiHODVB (ORCPT + 99 others); Sun, 14 Aug 2022 23:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbiHODU4 (ORCPT ); Sun, 14 Aug 2022 23:20:56 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F497A1A7 for ; Sun, 14 Aug 2022 20:20:55 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4M5fd03nfxzmVjX; Mon, 15 Aug 2022 11:18:44 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 15 Aug 2022 11:20:53 +0800 Received: from localhost.localdomain (10.175.112.125) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 15 Aug 2022 11:20:52 +0800 From: Tong Tiangen To: Paul Walmsley , Palmer Dabbelt , Palmer Dabbelt , Albert Ou , CC: , , "Tong Tiangen" , , Guohanjun Subject: [PATCH -next v2 1/2] riscv: uaccess: rename __get/put_user_nocheck to __get/put_mem_nocheck Date: Mon, 15 Aug 2022 03:20:24 +0000 Message-ID: <20220815032025.2685516-2-tongtiangen@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815032025.2685516-1-tongtiangen@huawei.com> References: <20220815032025.2685516-1-tongtiangen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current, The helpers __get/put_user_nocheck() is used by get/put_user() and __get/put_kernel_nofault(), which is not always uaccess, so the name with *user* is not appropriate. Also rename xxx_user_xxx to xxx_mem_xx on the call path of __get/put_user_nocheck() Only refactor code without any functional changes. Signed-off-by: Tong Tiangen --- arch/riscv/include/asm/uaccess.h | 48 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h index 855450bed9f5..1370da055b44 100644 --- a/arch/riscv/include/asm/uaccess.h +++ b/arch/riscv/include/asm/uaccess.h @@ -50,7 +50,7 @@ * call. */ -#define __get_user_asm(insn, x, ptr, err) \ +#define __get_mem_asm(insn, x, ptr, err) \ do { \ __typeof__(x) __x; \ __asm__ __volatile__ ( \ @@ -64,12 +64,12 @@ do { \ } while (0) #ifdef CONFIG_64BIT -#define __get_user_8(x, ptr, err) \ - __get_user_asm("ld", x, ptr, err) +#define __get_mem_8(x, ptr, err) \ + __get_mem_asm("ld", x, ptr, err) #else /* !CONFIG_64BIT */ -#define __get_user_8(x, ptr, err) \ +#define __get_mem_8(x, ptr, err) \ do { \ - u32 __user *__ptr = (u32 __user *)(ptr); \ + u32 *__ptr = (u32 *)(ptr); \ u32 __lo, __hi; \ __asm__ __volatile__ ( \ "1:\n" \ @@ -88,20 +88,20 @@ do { \ } while (0) #endif /* CONFIG_64BIT */ -#define __get_user_nocheck(x, __gu_ptr, __gu_err) \ +#define __get_mem_nocheck(x, __gu_ptr, __gu_err) \ do { \ switch (sizeof(*__gu_ptr)) { \ case 1: \ - __get_user_asm("lb", (x), __gu_ptr, __gu_err); \ + __get_mem_asm("lb", (x), __gu_ptr, __gu_err); \ break; \ case 2: \ - __get_user_asm("lh", (x), __gu_ptr, __gu_err); \ + __get_mem_asm("lh", (x), __gu_ptr, __gu_err); \ break; \ case 4: \ - __get_user_asm("lw", (x), __gu_ptr, __gu_err); \ + __get_mem_asm("lw", (x), __gu_ptr, __gu_err); \ break; \ case 8: \ - __get_user_8((x), __gu_ptr, __gu_err); \ + __get_mem_8((x), __gu_ptr, __gu_err); \ break; \ default: \ BUILD_BUG(); \ @@ -136,7 +136,7 @@ do { \ __chk_user_ptr(__gu_ptr); \ \ __enable_user_access(); \ - __get_user_nocheck(x, __gu_ptr, __gu_err); \ + __get_mem_nocheck(x, __gu_ptr, __gu_err); \ __disable_user_access(); \ \ __gu_err; \ @@ -168,7 +168,7 @@ do { \ ((x) = 0, -EFAULT); \ }) -#define __put_user_asm(insn, x, ptr, err) \ +#define __put_mem_asm(insn, x, ptr, err) \ do { \ __typeof__(*(ptr)) __x = x; \ __asm__ __volatile__ ( \ @@ -181,12 +181,12 @@ do { \ } while (0) #ifdef CONFIG_64BIT -#define __put_user_8(x, ptr, err) \ - __put_user_asm("sd", x, ptr, err) +#define __put_mem_8(x, ptr, err) \ + __put_mem_asm("sd", x, ptr, err) #else /* !CONFIG_64BIT */ -#define __put_user_8(x, ptr, err) \ +#define __put_mem_8(x, ptr, err) \ do { \ - u32 __user *__ptr = (u32 __user *)(ptr); \ + u32 *__ptr = (u32 *)(ptr); \ u64 __x = (__typeof__((x)-(x)))(x); \ __asm__ __volatile__ ( \ "1:\n" \ @@ -203,20 +203,20 @@ do { \ } while (0) #endif /* CONFIG_64BIT */ -#define __put_user_nocheck(x, __gu_ptr, __pu_err) \ +#define __put_mem_nocheck(x, __gu_ptr, __pu_err) \ do { \ switch (sizeof(*__gu_ptr)) { \ case 1: \ - __put_user_asm("sb", (x), __gu_ptr, __pu_err); \ + __put_mem_asm("sb", (x), __gu_ptr, __pu_err); \ break; \ case 2: \ - __put_user_asm("sh", (x), __gu_ptr, __pu_err); \ + __put_mem_asm("sh", (x), __gu_ptr, __pu_err); \ break; \ case 4: \ - __put_user_asm("sw", (x), __gu_ptr, __pu_err); \ + __put_mem_asm("sw", (x), __gu_ptr, __pu_err); \ break; \ case 8: \ - __put_user_8((x), __gu_ptr, __pu_err); \ + __put_mem_8((x), __gu_ptr, __pu_err); \ break; \ default: \ BUILD_BUG(); \ @@ -253,7 +253,7 @@ do { \ __chk_user_ptr(__gu_ptr); \ \ __enable_user_access(); \ - __put_user_nocheck(__val, __gu_ptr, __pu_err); \ + __put_mem_nocheck(__val, __gu_ptr, __pu_err); \ __disable_user_access(); \ \ __pu_err; \ @@ -321,7 +321,7 @@ unsigned long __must_check clear_user(void __user *to, unsigned long n) do { \ long __kr_err; \ \ - __get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \ + __get_mem_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \ if (unlikely(__kr_err)) \ goto err_label; \ } while (0) @@ -330,7 +330,7 @@ do { \ do { \ long __kr_err; \ \ - __put_user_nocheck(*((type *)(src)), (type *)(dst), __kr_err); \ + __put_mem_nocheck(*((type *)(src)), (type *)(dst), __kr_err); \ if (unlikely(__kr_err)) \ goto err_label; \ } while (0) -- 2.25.1