2013-04-26 22:09:29

by Seoras Macdonald

[permalink] [raw]
Subject: [PATCH] gpu: vga: vgaarb: Ran checkpatch, fixed some warnings

Fixed some warnings generated by checkpatch and
adjusted some comment blocks to match the coding style.

Signed-off-by: Seoras Macdonald <[email protected]>
---
drivers/gpu/vga/vgaarb.c | 67 +++++++++++++++++++++++++++-------------------
1 file changed, 39 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index e893f6e..b3350ba 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -136,7 +136,6 @@ struct pci_dev *vga_default_device(void)
{
return vga_default;
}
-
EXPORT_SYMBOL_GPL(vga_default_device);

void vga_set_default_device(struct pci_dev *pdev)
@@ -296,9 +295,8 @@ enable_them:

pci_set_vga_state(vgadev->pdev, true, pci_bits, flags);

- if (!vgadev->bridge_has_one_vga) {
+ if (!vgadev->bridge_has_one_vga)
vga_irq_set_state(vgadev, true);
- }
vgadev->owns |= (wants & vgadev->decodes);
lock_them:
vgadev->locks |= (rsrc & VGA_RSRC_LEGACY_MASK);
@@ -483,15 +481,20 @@ static void vga_arbiter_check_bridge_sharing(struct vga_device *vgadev)

/* see if the share a bridge with this device */
if (new_bridge == bridge) {
- /* if their direct parent bridge is the same
- as any bridge of this device then it can't be used
- for that device */
+ /*
+ * if their direct parent bridge is the same
+ * as any bridge of this device then it can't
+ * be used for that device
+ */
same_bridge_vgadev->bridge_has_one_vga = false;
}

/* now iterate the previous devices bridge hierarchy */
- /* if the new devices parent bridge is in the other devices
- hierarchy then we can't use it to control this device */
+ /*
+ * if the new devices parent bridge is in the other
+ * devices hierarchy then we can't use it to control
+ * this device
+ */
while (bus) {
bridge = bus->self;
if (bridge) {
@@ -840,7 +843,7 @@ static int vga_pci_str_to_vars(char *buf, int count, unsigned int *domain,
return 1;
}

-static ssize_t vga_arb_read(struct file *file, char __user * buf,
+static ssize_t vga_arb_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct vga_arb_private *priv = file->private_data;
@@ -855,7 +858,8 @@ static ssize_t vga_arb_read(struct file *file, char __user * buf,
if (lbuf == NULL)
return -ENOMEM;

- /* Shields against vga_arb_device_card_gone (pci_dev going
+ /*
+ * Shields against vga_arb_device_card_gone (pci_dev going
* away), and allows access to vga list
*/
spin_lock_irqsave(&vga_lock, flags);
@@ -871,7 +875,8 @@ static ssize_t vga_arb_read(struct file *file, char __user * buf,
/* Find card vgadev structure */
vgadev = vgadev_find(pdev);
if (vgadev == NULL) {
- /* Wow, it's not in the list, that shouldn't happen,
+ /*
+ * Wow, it's not in the list, that shouldn't happen,
* let's fix us up and return invalid card
*/
if (pdev == priv->target)
@@ -907,7 +912,7 @@ done:
* TODO: To avoid parsing inside kernel and to improve the speed we may
* consider use ioctl here
*/
-static ssize_t vga_arb_write(struct file *file, const char __user * buf,
+static ssize_t vga_arb_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct vga_arb_private *priv = file->private_data;
@@ -984,12 +989,13 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
ret_val = -EPROTO;
goto done;
}
- /* TODO: Add this?
- if (io_state == VGA_RSRC_NONE) {
- ret_val = -EPROTO;
- goto done;
- }
- */
+ /*
+ * TODO: Add this?
+ * if (io_state == VGA_RSRC_NONE) {
+ * ret_val = -EPROTO;
+ * goto done;
+ * }
+ */
}

pdev = priv->target;
@@ -1036,11 +1042,12 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
ret_val = -EPROTO;
goto done;
}
- /* TODO: Add this?
- if (io_state == VGA_RSRC_NONE) {
- ret_val = -EPROTO;
- goto done;
- }
+ /*
+ * TODO: Add this?
+ * if (io_state == VGA_RSRC_NONE) {
+ * ret_val = -EPROTO;
+ * goto done;
+ * }
*/

pdev = priv->target;
@@ -1158,7 +1165,7 @@ done:
return ret_val;
}

-static unsigned int vga_arb_fpoll(struct file *file, poll_table * wait)
+static unsigned int vga_arb_fpoll(struct file *file, poll_table *wait)
{
struct vga_arb_private *priv = file->private_data;

@@ -1270,9 +1277,11 @@ static int pci_notify(struct notifier_block *nb, unsigned long action,

pr_debug("%s\n", __func__);

- /* For now we're only intereted in devices added and removed. I didn't
+ /*
+ * For now we're only intereted in devices added and removed. I didn't
* test this thing here, so someone needs to double check for the
- * cases of hotplugable vga cards. */
+ * cases of hotplugable vga cards.
+ */
if (action == BUS_NOTIFY_ADD_DEVICE)
notify = vga_arbiter_add_pci_device(pdev);
else if (action == BUS_NOTIFY_DEL_DEVICE)
@@ -1312,8 +1321,10 @@ static int __init vga_arb_device_init(void)

bus_register_notifier(&pci_bus_type, &pci_notifier);

- /* We add all pci devices satisfying vga class in the arbiter by
- * default */
+ /*
+ * We add all pci devices satisfying vga class in the arbiter by
+ * default
+ */
pdev = NULL;
while ((pdev =
pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
--
1.7.10.4


2013-04-26 22:26:28

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH] gpu: vga: vgaarb: Ran checkpatch, fixed some warnings

[+cc Dave]

I don't maintain this file, regardless of what scripts/get_maintainer.pl says :)

On Fri, Apr 26, 2013 at 4:08 PM, Seoras Macdonald <[email protected]> wrote:
> Fixed some warnings generated by checkpatch and
> adjusted some comment blocks to match the coding style.
>
> Signed-off-by: Seoras Macdonald <[email protected]>
> ---
> drivers/gpu/vga/vgaarb.c | 67 +++++++++++++++++++++++++++-------------------
> 1 file changed, 39 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
> index e893f6e..b3350ba 100644
> --- a/drivers/gpu/vga/vgaarb.c
> +++ b/drivers/gpu/vga/vgaarb.c
> @@ -136,7 +136,6 @@ struct pci_dev *vga_default_device(void)
> {
> return vga_default;
> }
> -
> EXPORT_SYMBOL_GPL(vga_default_device);
>
> void vga_set_default_device(struct pci_dev *pdev)
> @@ -296,9 +295,8 @@ enable_them:
>
> pci_set_vga_state(vgadev->pdev, true, pci_bits, flags);
>
> - if (!vgadev->bridge_has_one_vga) {
> + if (!vgadev->bridge_has_one_vga)
> vga_irq_set_state(vgadev, true);
> - }
> vgadev->owns |= (wants & vgadev->decodes);
> lock_them:
> vgadev->locks |= (rsrc & VGA_RSRC_LEGACY_MASK);
> @@ -483,15 +481,20 @@ static void vga_arbiter_check_bridge_sharing(struct vga_device *vgadev)
>
> /* see if the share a bridge with this device */
> if (new_bridge == bridge) {
> - /* if their direct parent bridge is the same
> - as any bridge of this device then it can't be used
> - for that device */
> + /*
> + * if their direct parent bridge is the same
> + * as any bridge of this device then it can't
> + * be used for that device
> + */
> same_bridge_vgadev->bridge_has_one_vga = false;
> }
>
> /* now iterate the previous devices bridge hierarchy */
> - /* if the new devices parent bridge is in the other devices
> - hierarchy then we can't use it to control this device */
> + /*
> + * if the new devices parent bridge is in the other
> + * devices hierarchy then we can't use it to control
> + * this device
> + */
> while (bus) {
> bridge = bus->self;
> if (bridge) {
> @@ -840,7 +843,7 @@ static int vga_pci_str_to_vars(char *buf, int count, unsigned int *domain,
> return 1;
> }
>
> -static ssize_t vga_arb_read(struct file *file, char __user * buf,
> +static ssize_t vga_arb_read(struct file *file, char __user *buf,
> size_t count, loff_t *ppos)
> {
> struct vga_arb_private *priv = file->private_data;
> @@ -855,7 +858,8 @@ static ssize_t vga_arb_read(struct file *file, char __user * buf,
> if (lbuf == NULL)
> return -ENOMEM;
>
> - /* Shields against vga_arb_device_card_gone (pci_dev going
> + /*
> + * Shields against vga_arb_device_card_gone (pci_dev going
> * away), and allows access to vga list
> */
> spin_lock_irqsave(&vga_lock, flags);
> @@ -871,7 +875,8 @@ static ssize_t vga_arb_read(struct file *file, char __user * buf,
> /* Find card vgadev structure */
> vgadev = vgadev_find(pdev);
> if (vgadev == NULL) {
> - /* Wow, it's not in the list, that shouldn't happen,
> + /*
> + * Wow, it's not in the list, that shouldn't happen,
> * let's fix us up and return invalid card
> */
> if (pdev == priv->target)
> @@ -907,7 +912,7 @@ done:
> * TODO: To avoid parsing inside kernel and to improve the speed we may
> * consider use ioctl here
> */
> -static ssize_t vga_arb_write(struct file *file, const char __user * buf,
> +static ssize_t vga_arb_write(struct file *file, const char __user *buf,
> size_t count, loff_t *ppos)
> {
> struct vga_arb_private *priv = file->private_data;
> @@ -984,12 +989,13 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
> ret_val = -EPROTO;
> goto done;
> }
> - /* TODO: Add this?
> - if (io_state == VGA_RSRC_NONE) {
> - ret_val = -EPROTO;
> - goto done;
> - }
> - */
> + /*
> + * TODO: Add this?
> + * if (io_state == VGA_RSRC_NONE) {
> + * ret_val = -EPROTO;
> + * goto done;
> + * }
> + */
> }
>
> pdev = priv->target;
> @@ -1036,11 +1042,12 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
> ret_val = -EPROTO;
> goto done;
> }
> - /* TODO: Add this?
> - if (io_state == VGA_RSRC_NONE) {
> - ret_val = -EPROTO;
> - goto done;
> - }
> + /*
> + * TODO: Add this?
> + * if (io_state == VGA_RSRC_NONE) {
> + * ret_val = -EPROTO;
> + * goto done;
> + * }
> */
>
> pdev = priv->target;
> @@ -1158,7 +1165,7 @@ done:
> return ret_val;
> }
>
> -static unsigned int vga_arb_fpoll(struct file *file, poll_table * wait)
> +static unsigned int vga_arb_fpoll(struct file *file, poll_table *wait)
> {
> struct vga_arb_private *priv = file->private_data;
>
> @@ -1270,9 +1277,11 @@ static int pci_notify(struct notifier_block *nb, unsigned long action,
>
> pr_debug("%s\n", __func__);
>
> - /* For now we're only intereted in devices added and removed. I didn't
> + /*
> + * For now we're only intereted in devices added and removed. I didn't
> * test this thing here, so someone needs to double check for the
> - * cases of hotplugable vga cards. */
> + * cases of hotplugable vga cards.
> + */
> if (action == BUS_NOTIFY_ADD_DEVICE)
> notify = vga_arbiter_add_pci_device(pdev);
> else if (action == BUS_NOTIFY_DEL_DEVICE)
> @@ -1312,8 +1321,10 @@ static int __init vga_arb_device_init(void)
>
> bus_register_notifier(&pci_bus_type, &pci_notifier);
>
> - /* We add all pci devices satisfying vga class in the arbiter by
> - * default */
> + /*
> + * We add all pci devices satisfying vga class in the arbiter by
> + * default
> + */
> pdev = NULL;
> while ((pdev =
> pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
> --
> 1.7.10.4
>