[+cc Huacai and Kai-Heng as they are working in this area]Sorry, I haven't receive any reply about this email, so I resend this.
Hi,
Thank you for sending the patch over.
I assume this is simply a resend (rather than a v2), as I see no code
changes from the previous version you sent some time ago.
Xorg will detemine which graphics is prime output device according boot_vga, if there are two graphics card, and we want xorg output display to diffent graphics card, we can echo 1 to boot_vga.
Add writing attribute for boot_vga sys node,That's OK, but why are you adding this? What problem does it solve and
so we can config default video display
output dynamically when there are two video
cards on a machine.
what is the intended user here? Might be worth adding a little bit more
details about why this new sysfs attribute is needed.
I also need to ask, as I am not sure myself, whether this is OK to do after
booting during runtime? What do you think Bjorn, Huacai and Kai-Heng?
Also, please correctly capitalise the subject - have a look at previousAs I want restrict available value to 1, if we use kstrtobool(), it will be available when user input other value.
commit messages to see how it should look like.
+static ssize_t boot_vga_store(struct device *dev, struct device_attribute *attr,Since this is a completely new API have a look at kstrtobool() over
+ 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;
kstrtoul() as the former was created to handle user input more
consistently.
+ if (!capable(CAP_SYS_ADMIN))Check for CAP_SYS_ADMIN is a good idea, but it has to take place before you
+ return -EPERM;
+
attempt to accept and parse a input from the user.
Krzysztof