Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1258058lqa; Mon, 29 Apr 2024 03:15:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVgaaWor/pj7gdaA2/JI7WB2dyoazssGm6nR74eYL9gKFKUHPsQEnjU8rlhll4Dg+QE7GPys+MpdEXGpu7mYA5qkbrShoQyVZEWVxUh0w== X-Google-Smtp-Source: AGHT+IE1HlWRukZ7HfGTqnkl4mJXSp33zrb+feU7Z/YvcEFGYZ/lkh8/5FhHbd7qxMzFhkioFzm5 X-Received: by 2002:a17:902:e809:b0:1e7:e7ed:777e with SMTP id u9-20020a170902e80900b001e7e7ed777emr13024690plg.20.1714385729413; Mon, 29 Apr 2024 03:15:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714385729; cv=pass; d=google.com; s=arc-20160816; b=bNZ2GqU+26N8AbYfA+rQ8MCCVZKGZsCRc2dVtqTI2mNUnxBA9W8kiuJk6sXpEjWvFX 2Bhyex7C69ct/4vFNIwIylQcVW9TMTMVOfHJM74MjsJAFBUfFGru9HFAXDwgdxDP5aOm OHwBzVjGHiyxxcSgC7eoNtEK+lm5rlgHPscBe6GZaXGf285RmQKPGRWhPgeqsoKCKolO 7bXTKrts6P5l5R+kDM8xwe3QKT2mhCfisGDErOzcuBktfFzZOoMAmLeXACluIq0eyhi9 EuYPgskX3OVbZdNiAtOSW+bR2wFrZwNUGwHDOuQWOOsXY9ydYtPJSb9iuwG4yy51Qe1e wrig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UVxg8KMA7vvgaacJi4UzbU3rBDHOjF9aejTpYpkSnrY=; fh=J257D8fwb/+62Vcgdn9VfjMZXjRl80a3qN/eoi5IJQE=; b=ny9cyhlqMffese3/C8oc4h6nMVuDYyobqK/NLJtOwNMSqBGDaDQa/kaDulItbQpg1T b0f0ABv3mKaFKVg+OQCTGfKUV4VUAOc5R/XQSdh8ZhrMWfidDFlrfyPsxCPSkD1rKXc9 uzqxipiorcobJK5faNZ/hVIUkhXbXAA2lD1AxWGzG94Xv9pbnuKO3ARhioU9Fd5YhW5X mPj7TzNjFVUd03xZhi4eaNif7bkU6Amn4ZdwtPKGquvQesUsmX0jA7BrFBBHgXghAalL F5s0j06LBcrIQzW0tbSSdO2vAKFcQRQi44XM7DFHzxlHSxo7g5xrAi/0r/N+8sxvlvkn pbiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PC6N8eHw; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-162027-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c2-20020a170902d48200b001e23723701fsi4477642plg.515.2024.04.29.03.15.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 03:15:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162027-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PC6N8eHw; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-162027-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0B99A282BD2 for ; Mon, 29 Apr 2024 10:15:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3FB32D05D; Mon, 29 Apr 2024 10:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PC6N8eHw" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 959413BBFA for ; Mon, 29 Apr 2024 10:14:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714385669; cv=none; b=q3fa/4RORAq2UUyhwUZ4hsM/OqyNfNAKiT1o6KIckYE7XqbfFueswAUUvTT0NZdwveGyEWBgBbel5XJQebvrSJJDv7Qb4QcgK5h5iEnnN/kb7cNU4od7/GWxoCLJzTD1NkBOYA4nF5JkXct2QY6nsVM2pawgS4KjpbCZt/ENWx0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714385669; c=relaxed/simple; bh=wPCxHih6c1vg4MIhCKlt1UClyyDOfohtXqvQUkMZ+Pk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dKggz63TADapmTzuE5O0yDbW5B5CCXfkKEvtrVmHq6J1TXTxHqkiUjZAPoVuYOmR1Qh88Hss26VoieVp6L5GEvniFxuk52gAxv13gbki5etX0uYZ1jsD0RRP3e7e0m2AAy0yQJNqWZY4DuQbfCWCaf4wFApIxY9JTj9KqM2HsKw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PC6N8eHw; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714385666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UVxg8KMA7vvgaacJi4UzbU3rBDHOjF9aejTpYpkSnrY=; b=PC6N8eHwBdmfvUKIZ35oM+mWK5CNsHqfFHdH9Esincmu6zttsp1Hlabxycot+POCBR+jt0 VpBJMfNiQLl8ogO+SMZijOlMlJQS/c8HKFJU50pHsBnUeLcD7ADccrxv7EkJOV1r8GKQRi aH+kTrmTNZ8qVJYQvZLnJQIaZH1AVos= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-17-1Oyf9mrDPxefgbDRlG6VsQ-1; Mon, 29 Apr 2024 06:14:24 -0400 X-MC-Unique: 1Oyf9mrDPxefgbDRlG6VsQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 75E8F8032FA; Mon, 29 Apr 2024 10:14:24 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.remote.csb (unknown [10.64.136.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A6111C060D0; Mon, 29 Apr 2024 10:14:22 +0000 (UTC) From: Gavin Shan To: virtualization@lists.linux.dev Cc: linux-kernel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, shan.gavin@gmail.com Subject: [PATCH v2 4/4] vhost: Reformat vhost_{get, put}_user() Date: Mon, 29 Apr 2024 20:14:00 +1000 Message-ID: <20240429101400.617007-5-gshan@redhat.com> In-Reply-To: <20240429101400.617007-1-gshan@redhat.com> References: <20240429101400.617007-1-gshan@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 Reformat the macros to use tab as the terminator for each line so that it looks clean. No functional change intended. Signed-off-by: Gavin Shan --- drivers/vhost/vhost.c | 60 +++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 4ddb9ec2fe46..c1ed5e750521 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -1207,21 +1207,22 @@ static inline void __user *__vhost_get_user(struct vhost_virtqueue *vq, return __vhost_get_user_slow(vq, addr, size, type); } -#define vhost_put_user(vq, x, ptr) \ -({ \ - int ret; \ - if (!vq->iotlb) { \ - ret = __put_user(x, ptr); \ - } else { \ - __typeof__(ptr) to = \ +#define vhost_put_user(vq, x, ptr) \ +({ \ + int ret; \ + if (!vq->iotlb) { \ + ret = __put_user(x, ptr); \ + } else { \ + __typeof__(ptr) to = \ (__typeof__(ptr)) __vhost_get_user(vq, ptr, \ - sizeof(*ptr), VHOST_ADDR_USED); \ - if (to != NULL) \ - ret = __put_user(x, to); \ - else \ - ret = -EFAULT; \ - } \ - ret; \ + sizeof(*ptr), \ + VHOST_ADDR_USED); \ + if (to != NULL) \ + ret = __put_user(x, to); \ + else \ + ret = -EFAULT; \ + } \ + ret; \ }) static inline int vhost_put_avail_event(struct vhost_virtqueue *vq) @@ -1252,22 +1253,21 @@ static inline int vhost_put_used_idx(struct vhost_virtqueue *vq) &vq->used->idx); } -#define vhost_get_user(vq, x, ptr, type) \ -({ \ - int ret; \ - if (!vq->iotlb) { \ - ret = __get_user(x, ptr); \ - } else { \ - __typeof__(ptr) from = \ - (__typeof__(ptr)) __vhost_get_user(vq, ptr, \ - sizeof(*ptr), \ - type); \ - if (from != NULL) \ - ret = __get_user(x, from); \ - else \ - ret = -EFAULT; \ - } \ - ret; \ +#define vhost_get_user(vq, x, ptr, type) \ +({ \ + int ret; \ + if (!vq->iotlb) { \ + ret = __get_user(x, ptr); \ + } else { \ + __typeof__(ptr) from = \ + (__typeof__(ptr)) __vhost_get_user(vq, ptr, \ + sizeof(*ptr), type); \ + if (from != NULL) \ + ret = __get_user(x, from); \ + else \ + ret = -EFAULT; \ + } \ + ret; \ }) #define vhost_get_avail(vq, x, ptr) \ -- 2.44.0