Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3377407pxb; Sun, 26 Sep 2021 13:22:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOdoNE3CF6qojUZWOXmu+eh1nOMXw76b5eMPkkrtiJLBi+hDUi34p2oABR34m4C+Tupj0B X-Received: by 2002:a17:906:7811:: with SMTP id u17mr23031123ejm.562.1632687768327; Sun, 26 Sep 2021 13:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632687768; cv=none; d=google.com; s=arc-20160816; b=BF/icHf62iSCIfZqSdvoNWMmWuUGQFUDQLs/WmPrDzuzwn1IgHDCWb34+V0g4ji6Rj 8SCg9DBqnlObTsGXgllUDGvh/7c88GX+ZUKYnbslaABV+yvAhfluleeiN8EvfJRAJXOK gW9xOxE4QVNXPQW9YRfVGw95fHMPt9GmNEucsyonNA3cUm9WSyw0LtVIbCUjMJhcG/44 C4ScdWsfANSra7lNb0YgsfIdJP4wRYiTC/qkjzJbJJib7crYsHPpAwfCJgpnvzyuFYQs 4A2ITD7b2HP/XXVsGTZLj0946A1G9LoZCW1LH/BN0H9dN0PrsrvQJBGUzTdyUf3LBEq5 n3qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=KjIvx8wYhWLUKN9Lh5La8S5lj1z+GxagmSBLiyq4pkw=; b=IIQuNVz82wvI2YlWbwxgMRtEbLZW+5HWxaV3ADfwW50sHmBAN1dqIRB6bmTM3x5oWT k99Tq9GpuDPIWS8iHnlKSqzrG7Khv3VzZLJhUY2OemsQdvh8QrAMzE62MnBaDyOUvZfj 8xLb60a/2cUR8UrRCgQ0CFZe4tfgPKHtWNjKsY8xIqR8OeGhzn5EZmN33obQ9MNybmoA p5OJWIUw4V+evTdG8bR3VN2rvU807Ym2lC25JwvTg+/3b281e8jjs/teRsiGuDMookNR Mwv4wmDnqIsoHFzUpZBEHuraMXsNKhdZKzSNc/0E6oCjdblJPd9aVWAnACt3z0KY/DBf bcYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=abhuI3VQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v27si6758161edi.391.2021.09.26.13.22.25; Sun, 26 Sep 2021 13:22: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=@kernel.org header.s=k20201202 header.b=abhuI3VQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbhIZUWH (ORCPT + 99 others); Sun, 26 Sep 2021 16:22:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:50888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbhIZUWG (ORCPT ); Sun, 26 Sep 2021 16:22:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6B0E260EE4; Sun, 26 Sep 2021 20:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632687629; bh=fYActKnvqIC6C0UMKyCJGxHn3OhDINtVGdhnfr6ur2M=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=abhuI3VQ1tNOuIx30bg2goY/rh+objBay00QU0OCi7QRGPpuWR7v3cky/PY3MVt2Y sUYZ5GkYphogzHYIVsoUKQgLzSM1GPo+7Awvq7wQHJq6GLMUj6lZH3ZHDUoCa5i411 83mtA43kqeWKoIr7wFLgqC+zsGVeJD5kMxMPpBE68AGp2Cu5+7gqyoJttu5WP3p9/F h48sLNA/9m97XuHeB4xlShmTHk9W42yV4EP3yRAKadaJQ0f1S6UvEPPKmIv62+D3K+ ZbkIMuUtzNgxfDofh+jJyuqcuO6I0gwX2qFsWx3EpnxanF7DDCPt7DCSgTjTjdZIEq DFJPJJCalmw/g== Date: Sun, 26 Sep 2021 15:20:27 -0500 From: Bjorn Helgaas To: Zhenneng Li Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI/sysfs: add write attribute for boot_vga Message-ID: <20210926202027.GA588220@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210926071539.636644-1-lizhenneng@kylinos.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 26, 2021 at 03:15:39PM +0800, Zhenneng Li wrote: > Add writing attribute for boot_vga sys node, > so we can config default video display > output dynamically when there are two video > cards on a machine. > > Xorg server will determine running on which > video card based on boot_vga node's value. When you repost this, please take a look at the git commit log history and make yours similar. Specifically, the subject should start with a capital letter, and the body should be rewrapped to fill 75 characters. Please contrast this with the existing VGA arbiter. See Documentation/gpu/vgaarbiter.rst. It sounds like this may overlap with the VGA arbiter functionality, so this should explain why we need both and how they interact. > Signed-off-by: Zhenneng Li > --- > drivers/pci/pci-sysfs.c | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c > index 7bbf2673c7f2..a6ba19ce7adb 100644 > --- a/drivers/pci/pci-sysfs.c > +++ b/drivers/pci/pci-sysfs.c > @@ -664,7 +664,29 @@ static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr, > !!(pdev->resource[PCI_ROM_RESOURCE].flags & > IORESOURCE_ROM_SHADOW)); > } > -static DEVICE_ATTR_RO(boot_vga); > + > +static ssize_t boot_vga_store(struct device *dev, struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + unsigned long val; > + struct pci_dev *pdev = to_pci_dev(dev); > + struct pci_dev *vga_dev = vga_default_device(); > + > + if (kstrtoul(buf, 0, &val) < 0) > + return -EINVAL; > + > + if (val != 1) > + return -EINVAL; > + > + if (!capable(CAP_SYS_ADMIN)) > + return -EPERM; > + > + if (pdev != vga_dev) > + vga_set_default_device(pdev); > + > + return count; > +} > +static DEVICE_ATTR_RW(boot_vga); > > static ssize_t pci_read_config(struct file *filp, struct kobject *kobj, > struct bin_attribute *bin_attr, char *buf, > -- > 2.25.1 > > > No virus found > Checked by Hillstone Network AntiVirus