[Intel-gfx] [PATCH v7 3/8] PCI/VGA: Tidy up the code and comment format

2023-06-12 Thread Sui Jingfeng
From: Sui Jingfeng 

This patch replaces the leading space with a tab and removes the double
blank line, no functional change.

Cc: Bjorn Helgaas 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Thomas Zimmermann 
Cc: David Airlie 
Cc: Daniel Vetter 
Signed-off-by: Sui Jingfeng 
Reviewed-by: Andi Shyti 
---
 drivers/pci/vgaarb.c   | 108 -
 include/linux/vgaarb.h |   4 +-
 2 files changed, 65 insertions(+), 47 deletions(-)

diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
index 22a505e877dc..ceb914245383 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 */
@@ -79,8 +78,10 @@ static const char *vga_iostate_to_str(unsigned int iostate)
 
 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, 
unsigned 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 */
@@ -193,14 +194,17 @@ int vga_remove_vgacon(struct pci_dev *pdev)
 #endif
 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 */
+/*
+ * 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
+ */
 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 */
+   /*
+* We should inform all GPUs in the system that
+* vgaarb has occurred and to try and disable resources if they can
+*/
if (!vga_arbiter_used) {
vga_arbiter_used = true;
vga_arbiter_notify_clients();
@@ -216,7 +220,8 @@ static struct vga_device *__vga_tryget(struct vga_device 
*vgadev,
unsigned int pci_bits;
u32 flags = 0;
 
-   /* Account for "normal" resources to lock. If we decode the legacy,
+   /*
+* Account for "normal" resources to lock. If we decode the legacy,
 * counterpart, we need to request it as well
 */
if ((rsrc & VGA_RSRC_NORMAL_IO) &&
@@ -236,7 +241,8 @@ static struct vga_device *__vga_tryget(struct vga_device 
*vgadev,
if (wants == 0)
goto lock_them;
 
-   /* We don't need to request a legacy resource, we just enable
+   /*
+* We don't need to request a legacy resource, we just enable
 * appropriate decoding and go
 */
legacy_wants = wants & VGA_RSRC_LEGACY_MASK;
@@ -252,7 +258,8 @@ static struct vga_device *__vga_tryget(struct vga_device 
*vgadev,
if (vgadev == conflict)
continue;
 
-   /* We have a possible conflict. before we go further, we must
+   /*
+* We have a possible conflict. before we go further, we must
 * check if we sit on the same bus as the conflicting device.
 * if we don't, then we must tie both IO and MEM resources
 * together since there is only a single bit controlling
@@ -263,13 +270,15 @@ static struct vga_device *__vga_tryget(struct vga_device 
*vgadev,
lwants = VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM;
}
 
-   /* Check if the guy has a lock on the resource. If he does,
+   /*
+* Check if the guy has a lock on the resource. If he does,
 * return the conflicting entry
 */
if (conflict->locks & lwants)
return conflict;
 
-   /* Ok, now check if it owns the resource we want.  We can
+   /*
+* Ok, now check if it owns the resource we want.  We can
 * lock resources that are not decoded, therefore a device
 * can own resources it doesn't decode.
 */
@@ -277,14 +286,16 @@ static struct vga_device *__vga_tryget(struct vga_device 
*vgadev,
if (!match)
con

[Intel-gfx] [PATCH v7 3/8] PCI/VGA: Tidy up the code and comment format

2023-06-12 Thread Sui Jingfeng
This patch replaces the leading space with a tab and removes the double
blank line, no functional change.

Cc: Bjorn Helgaas 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Thomas Zimmermann 
Cc: David Airlie 
Cc: Daniel Vetter 
Signed-off-by: Sui Jingfeng 
Reviewed-by: Andi Shyti 
---
 drivers/pci/vgaarb.c   | 108 -
 include/linux/vgaarb.h |   4 +-
 2 files changed, 65 insertions(+), 47 deletions(-)

diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
index 22a505e877dc..ceb914245383 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 */
@@ -79,8 +78,10 @@ static const char *vga_iostate_to_str(unsigned int iostate)
 
 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, 
unsigned 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 */
@@ -193,14 +194,17 @@ int vga_remove_vgacon(struct pci_dev *pdev)
 #endif
 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 */
+/*
+ * 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
+ */
 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 */
+   /*
+* We should inform all GPUs in the system that
+* vgaarb has occurred and to try and disable resources if they can
+*/
if (!vga_arbiter_used) {
vga_arbiter_used = true;
vga_arbiter_notify_clients();
@@ -216,7 +220,8 @@ static struct vga_device *__vga_tryget(struct vga_device 
*vgadev,
unsigned int pci_bits;
u32 flags = 0;
 
-   /* Account for "normal" resources to lock. If we decode the legacy,
+   /*
+* Account for "normal" resources to lock. If we decode the legacy,
 * counterpart, we need to request it as well
 */
if ((rsrc & VGA_RSRC_NORMAL_IO) &&
@@ -236,7 +241,8 @@ static struct vga_device *__vga_tryget(struct vga_device 
*vgadev,
if (wants == 0)
goto lock_them;
 
-   /* We don't need to request a legacy resource, we just enable
+   /*
+* We don't need to request a legacy resource, we just enable
 * appropriate decoding and go
 */
legacy_wants = wants & VGA_RSRC_LEGACY_MASK;
@@ -252,7 +258,8 @@ static struct vga_device *__vga_tryget(struct vga_device 
*vgadev,
if (vgadev == conflict)
continue;
 
-   /* We have a possible conflict. before we go further, we must
+   /*
+* We have a possible conflict. before we go further, we must
 * check if we sit on the same bus as the conflicting device.
 * if we don't, then we must tie both IO and MEM resources
 * together since there is only a single bit controlling
@@ -263,13 +270,15 @@ static struct vga_device *__vga_tryget(struct vga_device 
*vgadev,
lwants = VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM;
}
 
-   /* Check if the guy has a lock on the resource. If he does,
+   /*
+* Check if the guy has a lock on the resource. If he does,
 * return the conflicting entry
 */
if (conflict->locks & lwants)
return conflict;
 
-   /* Ok, now check if it owns the resource we want.  We can
+   /*
+* Ok, now check if it owns the resource we want.  We can
 * lock resources that are not decoded, therefore a device
 * can own resources it doesn't decode.
 */
@@ -277,14 +286,16 @@ static struct vga_device *__vga_tryget(struct vga_device 
*vgadev,
if (!match)
continue;
 
-