From patchwork Sun Jun 4 20:55:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 103043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2312303vqr; Sun, 4 Jun 2023 13:59:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ73P1zdjZcCmUE/pr40sOSVysqlL524Fa3ctBQ+/KflJsJQ6c7CyI3TUW6jWB40X6p/ez2K X-Received: by 2002:a17:903:1cf:b0:1b1:9d3c:66c9 with SMTP id e15-20020a17090301cf00b001b19d3c66c9mr2459623plh.5.1685912379291; Sun, 04 Jun 2023 13:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685912379; cv=none; d=google.com; s=arc-20160816; b=zSprs8z15V1t0Kr8PiL+1AHa15QyS9aM0T/jgoIv/4CdFuU8PSt006tTONGMsusopR q1eGngqtx177nriKdu+hyDjszoBtarsH5T5co7CRt7ikXNWbvtlOjLbhruJGli4sbmy5 U+NRwfHM23AIJPkeIQa7elcfME8pLmc5vI+qvLGFiKCViU54XAuUCQu9AHII3vsGJ0na aEb9D1iVXyqavhvLni/DGsSGbtwFtcVo8oakshBL9Y1SKB3RQdr5sU0V2sW2d+t1UhDu yZerZfmqD7seW6SXRYwP2X10bHHooecVET/G2orx1J8F/SbkF1LGkZexNsRX/aGQyBmf tK1A== 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 :message-id:date:subject:cc:to:from; bh=lTo+LpgSwKYBFqCdFqKTVeXBCrkzuE9AVaYUyTidKeI=; b=W64QQpEouf2RMeqai6pOyN2MyKBqI/BaLw4eS4dK/uhK0LMnKzxQXauiOlEbRJmL2W UswD3PYGIHYLQEhg51NE/oyVZMFe8NgA9e3oUu8VqZSKJ3JRwK/OkgqpnmCGCx0eLgtT PLc90yvkrdDaNjvz+vY7N3l/XUeYz1R/xarazj2NnIibq0FTpVT8wsq+WnPbWpl8ncWg Yr69GOj7RD5wNHokHivQPUOE6SPZab9TT/yV92BxH9+qN2xu8DeVjpKOQk0kLR1hwN49 QQ5hOhmyAWqAlKUSAfZudez3rZ8IV0iNzRVic8jm7sMzLWQ+KACKwOfwVsKLevcWLjXm Pqtg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020a170902a71700b001b01242b3fdsi4186498plq.652.2023.06.04.13.59.16; Sun, 04 Jun 2023 13:59:39 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232191AbjFDUzn (ORCPT + 99 others); Sun, 4 Jun 2023 16:55:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231754AbjFDUzl (ORCPT ); Sun, 4 Jun 2023 16:55:41 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DB9C1CF; Sun, 4 Jun 2023 13:55:38 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8AxyfFJ+nxkXGgEAA--.9295S3; Mon, 05 Jun 2023 04:55:37 +0800 (CST) Received: from openarena.loongson.cn (unknown [10.20.42.43]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxLL5I+nxkF7SJAA--.24647S2; Mon, 05 Jun 2023 04:55:36 +0800 (CST) From: Sui Jingfeng To: Alex Deucher , Christian Konig , Pan Xinhui , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Ben Skeggs , Karol Herbst , Lyude Paul , Bjorn Helgaas , Alex Williamson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Hawking Zhang , Mario Limonciello , Lijo Lazar , YiPeng Chai , Andrey Grodzovsky , Somalapuram Amaranath , Bokun Zhang , Ville Syrjala , Li Yi , Sui Jingfeng , Jason Gunthorpe , Kevin Tian , Cornelia Huck , Yishai Hadas , Abhishek Sahu , Yi Liu Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v2 1/2] vgaarb: various coding style and comments fix Date: Mon, 5 Jun 2023 04:55:35 +0800 Message-Id: <20230604205536.3357439-1-suijingfeng@loongson.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxLL5I+nxkF7SJAA--.24647S2 X-CM-SenderInfo: xvxlyxpqjiv03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxXw4kur1fXFWrtrW3ZrWDurg_yoWrKw1Upr Zakas8CrW8XFs7ZrsrXF4rGF1Y9393CFyfArWakwn3AF15JFn2qF9YyryYv3yfJ392kF4I qan8tF4UuF4UJFJanT9S1TB71UUUUbDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bS8YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UM2kK e7AKxVWUtVW8ZwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI 0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUtVWrXwAv7VC2z280 aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxkF7I0En4 kS14v26r4a6rW5MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI 1I0E14v26r1q6r43MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_Jr Wlx4CE17CEb7AF67AKxVWrXVW8Jr1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVW8 JVW5JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r 1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1U YxBIdaVFxhVjvjDU0xZFpf9x07jCMKZUUUUU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767807258966353039?= X-GMAIL-MSGID: =?utf-8?q?1767807258966353039?= To keep consistent with vga_iostate_to_str() function, the third argument of vga_str_to_iostate() function should be 'unsigned int *'. Signed-off-by: Sui Jingfeng --- drivers/pci/vgaarb.c | 29 +++++++++++++++-------------- include/linux/vgaarb.h | 8 +++----- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index 5a696078b382..e40e6e5e5f03 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -61,7 +61,6 @@ static bool vga_arbiter_used; static DEFINE_SPINLOCK(vga_lock); static DECLARE_WAIT_QUEUE_HEAD(vga_wait_queue); - static const char *vga_iostate_to_str(unsigned int iostate) { /* Ignore VGA_RSRC_IO and VGA_RSRC_MEM */ @@ -77,10 +76,12 @@ static const char *vga_iostate_to_str(unsigned int iostate) return "none"; } -static int vga_str_to_iostate(char *buf, int str_size, int *io_state) +static int vga_str_to_iostate(char *buf, int str_size, unsigned int *io_state) { - /* we could in theory hand out locks on IO and mem - * separately to userspace but it can cause deadlocks */ + /* + * we could in theory hand out locks on IO and mem + * separately to userspace but it can cause deadlocks + */ if (strncmp(buf, "none", 4) == 0) { *io_state = VGA_RSRC_NONE; return 1; @@ -99,7 +100,7 @@ static int vga_str_to_iostate(char *buf, int str_size, int *io_state) return 1; } -/* this is only used a cookie - it should not be dereferenced */ +/* This is only used as cookie, it should not be dereferenced */ static struct pci_dev *vga_default; /* Find somebody in our list */ @@ -194,13 +195,15 @@ int vga_remove_vgacon(struct pci_dev *pdev) EXPORT_SYMBOL(vga_remove_vgacon); /* If we don't ever use VGA arb we should avoid - turning off anything anywhere due to old X servers getting - confused about the boot device not being VGA */ + * turning off anything anywhere due to old X servers getting + * confused about the boot device not being VGA + */ static void vga_check_first_use(void) { /* we should inform all GPUs in the system that * VGA arb has occurred and to try and disable resources - * if they can */ + * if they can + */ if (!vga_arbiter_used) { vga_arbiter_used = true; vga_arbiter_notify_clients(); @@ -865,8 +868,7 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev) } /* this is called with the lock */ -static inline void vga_update_device_decodes(struct vga_device *vgadev, - int new_decodes) +static void vga_update_device_decodes(struct vga_device *vgadev, int new_decodes) { struct device *dev = &vgadev->pdev->dev; int old_decodes, decodes_removed, decodes_unlocked; @@ -956,9 +958,9 @@ EXPORT_SYMBOL(vga_set_legacy_decoding); * @set_decode callback: If a client can disable its GPU VGA resource, it * will get a callback from this to set the encode/decode state. * - * Rationale: we cannot disable VGA decode resources unconditionally some single - * GPU laptops seem to require ACPI or BIOS access to the VGA registers to - * control things like backlights etc. Hopefully newer multi-GPU laptops do + * Rationale: we cannot disable VGA decode resources unconditionally, some + * single GPU laptops seem to require ACPI or BIOS access to the VGA registers + * to control things like backlights etc. Hopefully newer multi-GPU laptops do * something saner, and desktops won't have any special ACPI for this. The * driver will get a callback when VGA arbitration is first used by userspace * since some older X servers have issues. @@ -988,7 +990,6 @@ int vga_client_register(struct pci_dev *pdev, bail: spin_unlock_irqrestore(&vga_lock, flags); return ret; - } EXPORT_SYMBOL(vga_client_register); diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h index b4b9137f9792..d36225c582ee 100644 --- a/include/linux/vgaarb.h +++ b/include/linux/vgaarb.h @@ -23,9 +23,7 @@ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS - * IN THE SOFTWARE. - * + * DEALINGS IN THE SOFTWARE. */ #ifndef LINUX_VGA_H @@ -96,7 +94,7 @@ static inline int vga_client_register(struct pci_dev *pdev, static inline int vga_get_interruptible(struct pci_dev *pdev, unsigned int rsrc) { - return vga_get(pdev, rsrc, 1); + return vga_get(pdev, rsrc, 1); } /** @@ -111,7 +109,7 @@ static inline int vga_get_interruptible(struct pci_dev *pdev, static inline int vga_get_uninterruptible(struct pci_dev *pdev, unsigned int rsrc) { - return vga_get(pdev, rsrc, 0); + return vga_get(pdev, rsrc, 0); } static inline void vga_client_unregister(struct pci_dev *pdev)