Message ID | 20230711134354.755966-5-sui.jingfeng@linux.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp510887vqm; Tue, 11 Jul 2023 07:13:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlFiBFekVwK9fpCluDu2CHGR8N5qaoYdyca56BZVX8nPh0kghWQJgcNd11DzkcTPBjZ3hxC7 X-Received: by 2002:a05:6512:3d0f:b0:4f8:7503:203f with SMTP id d15-20020a0565123d0f00b004f87503203fmr15443054lfv.48.1689084831762; Tue, 11 Jul 2023 07:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689084831; cv=none; d=google.com; s=arc-20160816; b=YYyb+gzTtX55ixupkIADX9EGyro31qfbVSLaE4voJF2y6GUISqb07UZSvybEz8U6Di +gG6hz+9Drb3o4XnfzfQAYVQK+1s2H8CFnshSQmu/Nlu/qEwaFAWf6LyjGCHC1zo64d+ 8xXIZLqFz84tSYxCElHjgAcVVWF9BG2xLim4F+E13W+5btZXq4toQ0hItmnpjgN2Y1md LFqX4C+PJ8wRvakHHlQSEQPt+cp08yuwCQyFuleJ/8n/5ScktKsiHSJxOBbZqIdeqlXR po9bsbDU+I1h7frHubPhvnwDiR71Rk3XQH21FhitdS7K2YfLXU8d5+PxJLHR2PD1gBMC brdA== 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 :dkim-signature; bh=NIy4iyC9nuH2OGqIfvEGjD1H7yPmKE3hN2OnCkSSwos=; fh=m90o3XbD+v5PtjaouMLofHD7GJu3dEeCXnfOfzea/Og=; b=kktT4I+IZrWPZsQESveyTHrxBwbt5NJg2sfX+Tke3jl4SZ1gSh6BkFLgmtjm1doyEh WUW556t8OvDdRcVCofzBPF1iofz/RLLZC3LVyiKSz7sgJ+MFTICwNEk+UvcwESaabZ5T h6PaaI60qGKfXQOYkDeK4h6zpii3pJ1zdnYMwPOqxSwClKhbnd1nZ2Crf8TRpXdcP/N/ rk+GttXrvieXUK6eB80CaSQJOLfD6gulDxnrV5YmOiB0+fC2LMKY835jXGV+BbhDrmEy swzwmVBkuB94ysIfrYVD+LClOirtDF5F0yeLVThGxn71r3igkHZq/96UOxQoy3gAxvlH uA9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linux.dev header.s=key1 header.b=M5PbJsEa; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a05640214c300b0051e23edcddcsi2015563edx.122.2023.07.11.07.13.26; Tue, 11 Jul 2023 07:13:51 -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; dkim=fail header.i=@linux.dev header.s=key1 header.b=M5PbJsEa; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233046AbjGKNoi (ORCPT <rfc822;gnulinuxfreebsd@gmail.com> + 99 others); Tue, 11 Jul 2023 09:44:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232223AbjGKNod (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 11 Jul 2023 09:44:33 -0400 Received: from out-5.mta0.migadu.com (out-5.mta0.migadu.com [91.218.175.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D6D11702; Tue, 11 Jul 2023 06:44:25 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689083063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NIy4iyC9nuH2OGqIfvEGjD1H7yPmKE3hN2OnCkSSwos=; b=M5PbJsEas/pXLhY4bwrSzQ/fEGUVORpMVmQVcHLy3OjgNETQPgCHeJLRfbT1A5TZr4ofaV dciq2+E7wwBjI1+3/pnGDRSITsSwsg8a3lf3w7+pXO+C1xXKSp248NOmqPKXo1bWwUIb/l Vf2D+/G31gJ7u+EAJbM2VTSEsHDQm6s= From: Sui Jingfeng <sui.jingfeng@linux.dev> To: Bjorn Helgaas <bhelgaas@google.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Sui@vger.kernel.org, Jingfeng@loongson.cn Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, loongson-kernel@lists.loongnix.cn, Sui Jingfeng <suijingfeng@loongson.cn> Subject: [PATCH 4/6] PCI/VGA: Move the new_state assignment out the loop Date: Tue, 11 Jul 2023 21:43:52 +0800 Message-Id: <20230711134354.755966-5-sui.jingfeng@linux.dev> In-Reply-To: <20230711134354.755966-1-sui.jingfeng@linux.dev> References: <20230711134354.755966-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771133816239444354 X-GMAIL-MSGID: 1771133816239444354 |
Series |
PCI/VGA: Fix typos, comments and copyright
|
|
Commit Message
Sui Jingfeng
July 11, 2023, 1:43 p.m. UTC
From: Sui Jingfeng <suijingfeng@loongson.cn> In the vga_arbiter_notify_clients() function, the value of the 'new_state' variable will be 'false' on systems that have more than one PCI VGA card. Its value will be 'true' on systems that have one or no PCI VGA compatible card. In other words, its value is not relevant to the iteration, so move the assignment () out of the loop. For a system with multiple video cards, this patch saves the redundant assignment. Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> --- drivers/pci/vgaarb.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
Comments
PING, please ! On 2023/7/11 21:43, Sui Jingfeng wrote: > From: Sui Jingfeng <suijingfeng@loongson.cn> > > In the vga_arbiter_notify_clients() function, the value of the 'new_state' > variable will be 'false' on systems that have more than one PCI VGA card. > Its value will be 'true' on systems that have one or no PCI VGA compatible > card. In other words, its value is not relevant to the iteration, so move > the assignment () out of the loop. > > For a system with multiple video cards, this patch saves the redundant > assignment. > > Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> > --- > drivers/pci/vgaarb.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c > index 668139f7c247..4c448c758bab 100644 > --- a/drivers/pci/vgaarb.c > +++ b/drivers/pci/vgaarb.c > @@ -1468,22 +1468,20 @@ static void vga_arbiter_notify_clients(void) > { > struct vga_device *vgadev; > unsigned long flags; > - uint32_t new_decodes; > - bool new_state; > + bool state; > > if (!vga_arbiter_used) > return; > > + state = (vga_count > 1) ? false : true; > + > spin_lock_irqsave(&vga_lock, flags); > list_for_each_entry(vgadev, &vga_list, list) { > - if (vga_count > 1) > - new_state = false; > - else > - new_state = true; > if (vgadev->set_decode) { > - new_decodes = vgadev->set_decode(vgadev->pdev, > - new_state); > - vga_update_device_decodes(vgadev, new_decodes); > + unsigned int decodes; > + > + decodes = vgadev->set_decode(vgadev->pdev, state); > + vga_update_device_decodes(vgadev, decodes); > } > } > spin_unlock_irqrestore(&vga_lock, flags);
On Mon, Jul 24, 2023 at 09:02:14PM +0800, suijingfeng wrote: > PING, please ! Don't worry, these are not forgotten. Your other series seems more important, so that's what I've been paying attention to. > On 2023/7/11 21:43, Sui Jingfeng wrote: > > From: Sui Jingfeng <suijingfeng@loongson.cn> > > > > In the vga_arbiter_notify_clients() function, the value of the 'new_state' > > variable will be 'false' on systems that have more than one PCI VGA card. > > Its value will be 'true' on systems that have one or no PCI VGA compatible > > card. In other words, its value is not relevant to the iteration, so move > > the assignment () out of the loop. > > > > For a system with multiple video cards, this patch saves the redundant > > assignment. > > > > Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> > > --- > > drivers/pci/vgaarb.c | 16 +++++++--------- > > 1 file changed, 7 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c > > index 668139f7c247..4c448c758bab 100644 > > --- a/drivers/pci/vgaarb.c > > +++ b/drivers/pci/vgaarb.c > > @@ -1468,22 +1468,20 @@ static void vga_arbiter_notify_clients(void) > > { > > struct vga_device *vgadev; > > unsigned long flags; > > - uint32_t new_decodes; > > - bool new_state; > > + bool state; > > if (!vga_arbiter_used) > > return; > > + state = (vga_count > 1) ? false : true; > > + > > spin_lock_irqsave(&vga_lock, flags); > > list_for_each_entry(vgadev, &vga_list, list) { > > - if (vga_count > 1) > > - new_state = false; > > - else > > - new_state = true; > > if (vgadev->set_decode) { > > - new_decodes = vgadev->set_decode(vgadev->pdev, > > - new_state); > > - vga_update_device_decodes(vgadev, new_decodes); > > + unsigned int decodes; > > + > > + decodes = vgadev->set_decode(vgadev->pdev, state); > > + vga_update_device_decodes(vgadev, decodes); > > } > > } > > spin_unlock_irqrestore(&vga_lock, flags); >
diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index 668139f7c247..4c448c758bab 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -1468,22 +1468,20 @@ static void vga_arbiter_notify_clients(void) { struct vga_device *vgadev; unsigned long flags; - uint32_t new_decodes; - bool new_state; + bool state; if (!vga_arbiter_used) return; + state = (vga_count > 1) ? false : true; + spin_lock_irqsave(&vga_lock, flags); list_for_each_entry(vgadev, &vga_list, list) { - if (vga_count > 1) - new_state = false; - else - new_state = true; if (vgadev->set_decode) { - new_decodes = vgadev->set_decode(vgadev->pdev, - new_state); - vga_update_device_decodes(vgadev, new_decodes); + unsigned int decodes; + + decodes = vgadev->set_decode(vgadev->pdev, state); + vga_update_device_decodes(vgadev, decodes); } } spin_unlock_irqrestore(&vga_lock, flags);