diff options
author | Thierry Reding <treding@nvidia.com> | 2015-08-12 10:32:07 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-08-12 11:11:58 -0400 |
commit | 5d90ccf908bd806f0767bc07310e4c25c8501369 (patch) | |
tree | 29f20831e047e1d1970339e636ed02e3fe399c97 | |
parent | 8b7e2e865fef94d6a46746c3b7f334b910814031 (diff) |
vgaarb: Fix a few checkpatch errors and warnings
Wrap overly long lines (offending lines were mostly comments, so trivial
to fix up) and a number of other coding style issues pointed out by the
checkpatch tool.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/vga/vgaarb.c | 102 |
1 files changed, 60 insertions, 42 deletions
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index 5f1bde5efc7f..a0b433456107 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -136,7 +136,6 @@ struct pci_dev *vga_default_device(void) | |||
136 | { | 136 | { |
137 | return vga_default; | 137 | return vga_default; |
138 | } | 138 | } |
139 | |||
140 | EXPORT_SYMBOL_GPL(vga_default_device); | 139 | EXPORT_SYMBOL_GPL(vga_default_device); |
141 | 140 | ||
142 | void vga_set_default_device(struct pci_dev *pdev) | 141 | void vga_set_default_device(struct pci_dev *pdev) |
@@ -300,9 +299,9 @@ enable_them: | |||
300 | 299 | ||
301 | pci_set_vga_state(vgadev->pdev, true, pci_bits, flags); | 300 | pci_set_vga_state(vgadev->pdev, true, pci_bits, flags); |
302 | 301 | ||
303 | if (!vgadev->bridge_has_one_vga) { | 302 | if (!vgadev->bridge_has_one_vga) |
304 | vga_irq_set_state(vgadev, true); | 303 | vga_irq_set_state(vgadev, true); |
305 | } | 304 | |
306 | vgadev->owns |= wants; | 305 | vgadev->owns |= wants; |
307 | lock_them: | 306 | lock_them: |
308 | vgadev->locks |= (rsrc & VGA_RSRC_LEGACY_MASK); | 307 | vgadev->locks |= (rsrc & VGA_RSRC_LEGACY_MASK); |
@@ -454,15 +453,15 @@ bail: | |||
454 | } | 453 | } |
455 | EXPORT_SYMBOL(vga_put); | 454 | EXPORT_SYMBOL(vga_put); |
456 | 455 | ||
457 | /* Rules for using a bridge to control a VGA descendant decoding: | 456 | /* |
458 | if a bridge has only one VGA descendant then it can be used | 457 | * Rules for using a bridge to control a VGA descendant decoding: if a bridge |
459 | to control the VGA routing for that device. | 458 | * has only one VGA descendant then it can be used to control the VGA routing |
460 | It should always use the bridge closest to the device to control it. | 459 | * for that device. It should always use the bridge closest to the device to |
461 | If a bridge has a direct VGA descendant, but also have a sub-bridge | 460 | * control it. If a bridge has a direct VGA descendant, but also have a sub- |
462 | VGA descendant then we cannot use that bridge to control the direct VGA descendant. | 461 | * bridge VGA descendant then we cannot use that bridge to control the direct |
463 | So for every device we register, we need to iterate all its parent bridges | 462 | * VGA descendant. So for every device we register, we need to iterate all |
464 | so we can invalidate any devices using them properly. | 463 | * its parent bridges so we can invalidate any devices using them properly. |
465 | */ | 464 | */ |
466 | static void vga_arbiter_check_bridge_sharing(struct vga_device *vgadev) | 465 | static void vga_arbiter_check_bridge_sharing(struct vga_device *vgadev) |
467 | { | 466 | { |
468 | struct vga_device *same_bridge_vgadev; | 467 | struct vga_device *same_bridge_vgadev; |
@@ -486,21 +485,26 @@ static void vga_arbiter_check_bridge_sharing(struct vga_device *vgadev) | |||
486 | 485 | ||
487 | /* see if the share a bridge with this device */ | 486 | /* see if the share a bridge with this device */ |
488 | if (new_bridge == bridge) { | 487 | if (new_bridge == bridge) { |
489 | /* if their direct parent bridge is the same | 488 | /* |
490 | as any bridge of this device then it can't be used | 489 | * If their direct parent bridge is the same |
491 | for that device */ | 490 | * as any bridge of this device then it can't |
491 | * be used for that device. | ||
492 | */ | ||
492 | same_bridge_vgadev->bridge_has_one_vga = false; | 493 | same_bridge_vgadev->bridge_has_one_vga = false; |
493 | } | 494 | } |
494 | 495 | ||
495 | /* now iterate the previous devices bridge hierarchy */ | 496 | /* |
496 | /* if the new devices parent bridge is in the other devices | 497 | * Now iterate the previous devices bridge hierarchy. |
497 | hierarchy then we can't use it to control this device */ | 498 | * If the new devices parent bridge is in the other |
499 | * devices hierarchy then we can't use it to control | ||
500 | * this device | ||
501 | */ | ||
498 | while (bus) { | 502 | while (bus) { |
499 | bridge = bus->self; | 503 | bridge = bus->self; |
500 | if (bridge) { | 504 | |
501 | if (bridge == vgadev->pdev->bus->self) | 505 | if (bridge && bridge == vgadev->pdev->bus->self) |
502 | vgadev->bridge_has_one_vga = false; | 506 | vgadev->bridge_has_one_vga = false; |
503 | } | 507 | |
504 | bus = bus->parent; | 508 | bus = bus->parent; |
505 | } | 509 | } |
506 | } | 510 | } |
@@ -530,9 +534,9 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) | |||
530 | vgadev = kmalloc(sizeof(struct vga_device), GFP_KERNEL); | 534 | vgadev = kmalloc(sizeof(struct vga_device), GFP_KERNEL); |
531 | if (vgadev == NULL) { | 535 | if (vgadev == NULL) { |
532 | pr_err("failed to allocate pci device\n"); | 536 | pr_err("failed to allocate pci device\n"); |
533 | /* What to do on allocation failure ? For now, let's | 537 | /* |
534 | * just do nothing, I'm not sure there is anything saner | 538 | * What to do on allocation failure ? For now, let's just do |
535 | * to be done | 539 | * nothing, I'm not sure there is anything saner to be done. |
536 | */ | 540 | */ |
537 | return false; | 541 | return false; |
538 | } | 542 | } |
@@ -568,8 +572,8 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) | |||
568 | bridge = bus->self; | 572 | bridge = bus->self; |
569 | if (bridge) { | 573 | if (bridge) { |
570 | u16 l; | 574 | u16 l; |
571 | pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, | 575 | |
572 | &l); | 576 | pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, &l); |
573 | if (!(l & PCI_BRIDGE_CTL_VGA)) { | 577 | if (!(l & PCI_BRIDGE_CTL_VGA)) { |
574 | vgadev->owns = 0; | 578 | vgadev->owns = 0; |
575 | break; | 579 | break; |
@@ -677,7 +681,9 @@ static inline void vga_update_device_decodes(struct vga_device *vgadev, | |||
677 | pr_debug("decoding count now is: %d\n", vga_decode_count); | 681 | pr_debug("decoding count now is: %d\n", vga_decode_count); |
678 | } | 682 | } |
679 | 683 | ||
680 | static void __vga_set_legacy_decoding(struct pci_dev *pdev, unsigned int decodes, bool userspace) | 684 | static void __vga_set_legacy_decoding(struct pci_dev *pdev, |
685 | unsigned int decodes, | ||
686 | bool userspace) | ||
681 | { | 687 | { |
682 | struct vga_device *vgadev; | 688 | struct vga_device *vgadev; |
683 | unsigned long flags; | 689 | unsigned long flags; |
@@ -713,7 +719,8 @@ EXPORT_SYMBOL(vga_set_legacy_decoding); | |||
713 | /* call with NULL to unregister */ | 719 | /* call with NULL to unregister */ |
714 | int vga_client_register(struct pci_dev *pdev, void *cookie, | 720 | int vga_client_register(struct pci_dev *pdev, void *cookie, |
715 | void (*irq_set_state)(void *cookie, bool state), | 721 | void (*irq_set_state)(void *cookie, bool state), |
716 | unsigned int (*set_vga_decode)(void *cookie, bool decode)) | 722 | unsigned int (*set_vga_decode)(void *cookie, |
723 | bool decode)) | ||
717 | { | 724 | { |
718 | int ret = -ENODEV; | 725 | int ret = -ENODEV; |
719 | struct vga_device *vgadev; | 726 | struct vga_device *vgadev; |
@@ -833,7 +840,7 @@ static int vga_pci_str_to_vars(char *buf, int count, unsigned int *domain, | |||
833 | return 1; | 840 | return 1; |
834 | } | 841 | } |
835 | 842 | ||
836 | static ssize_t vga_arb_read(struct file *file, char __user * buf, | 843 | static ssize_t vga_arb_read(struct file *file, char __user *buf, |
837 | size_t count, loff_t *ppos) | 844 | size_t count, loff_t *ppos) |
838 | { | 845 | { |
839 | struct vga_arb_private *priv = file->private_data; | 846 | struct vga_arb_private *priv = file->private_data; |
@@ -900,7 +907,7 @@ done: | |||
900 | * TODO: To avoid parsing inside kernel and to improve the speed we may | 907 | * TODO: To avoid parsing inside kernel and to improve the speed we may |
901 | * consider use ioctl here | 908 | * consider use ioctl here |
902 | */ | 909 | */ |
903 | static ssize_t vga_arb_write(struct file *file, const char __user * buf, | 910 | static ssize_t vga_arb_write(struct file *file, const char __user *buf, |
904 | size_t count, loff_t *ppos) | 911 | size_t count, loff_t *ppos) |
905 | { | 912 | { |
906 | struct vga_arb_private *priv = file->private_data; | 913 | struct vga_arb_private *priv = file->private_data; |
@@ -1154,7 +1161,7 @@ done: | |||
1154 | return ret_val; | 1161 | return ret_val; |
1155 | } | 1162 | } |
1156 | 1163 | ||
1157 | static unsigned int vga_arb_fpoll(struct file *file, poll_table * wait) | 1164 | static unsigned int vga_arb_fpoll(struct file *file, poll_table *wait) |
1158 | { | 1165 | { |
1159 | struct vga_arb_private *priv = file->private_data; | 1166 | struct vga_arb_private *priv = file->private_data; |
1160 | 1167 | ||
@@ -1250,7 +1257,8 @@ static void vga_arbiter_notify_clients(void) | |||
1250 | else | 1257 | else |
1251 | new_state = true; | 1258 | new_state = true; |
1252 | if (vgadev->set_vga_decode) { | 1259 | if (vgadev->set_vga_decode) { |
1253 | new_decodes = vgadev->set_vga_decode(vgadev->cookie, new_state); | 1260 | new_decodes = vgadev->set_vga_decode(vgadev->cookie, |
1261 | new_state); | ||
1254 | vga_update_device_decodes(vgadev, new_decodes); | 1262 | vga_update_device_decodes(vgadev, new_decodes); |
1255 | } | 1263 | } |
1256 | } | 1264 | } |
@@ -1320,17 +1328,25 @@ static int __init vga_arb_device_init(void) | |||
1320 | 1328 | ||
1321 | list_for_each_entry(vgadev, &vga_list, list) { | 1329 | list_for_each_entry(vgadev, &vga_list, list) { |
1322 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | 1330 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) |
1323 | /* Override I/O based detection done by vga_arbiter_add_pci_device() | 1331 | /* |
1324 | * as it may take the wrong device (e.g. on Apple system under EFI). | 1332 | * Override vga_arbiter_add_pci_device()'s I/O based detection |
1333 | * as it may take the wrong device (e.g. on Apple system under | ||
1334 | * EFI). | ||
1325 | * | 1335 | * |
1326 | * Select the device owning the boot framebuffer if there is one. | 1336 | * Select the device owning the boot framebuffer if there is |
1337 | * one. | ||
1327 | */ | 1338 | */ |
1328 | resource_size_t start, end; | 1339 | resource_size_t start, end, limit; |
1340 | unsigned long flags; | ||
1329 | int i; | 1341 | int i; |
1330 | 1342 | ||
1343 | limit = screen_info.lfb_base + screen_info.lfb_size; | ||
1344 | |||
1331 | /* Does firmware framebuffer belong to us? */ | 1345 | /* Does firmware framebuffer belong to us? */ |
1332 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | 1346 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
1333 | if (!(pci_resource_flags(vgadev->pdev, i) & IORESOURCE_MEM)) | 1347 | flags = pci_resource_flags(vgadev->pdev, i); |
1348 | |||
1349 | if ((flags & IORESOURCE_MEM) == 0) | ||
1334 | continue; | 1350 | continue; |
1335 | 1351 | ||
1336 | start = pci_resource_start(vgadev->pdev, i); | 1352 | start = pci_resource_start(vgadev->pdev, i); |
@@ -1339,9 +1355,9 @@ static int __init vga_arb_device_init(void) | |||
1339 | if (!start || !end) | 1355 | if (!start || !end) |
1340 | continue; | 1356 | continue; |
1341 | 1357 | ||
1342 | if (screen_info.lfb_base < start || | 1358 | if (screen_info.lfb_base < start || limit >= end) |
1343 | (screen_info.lfb_base + screen_info.lfb_size) >= end) | ||
1344 | continue; | 1359 | continue; |
1360 | |||
1345 | if (!vga_default_device()) | 1361 | if (!vga_default_device()) |
1346 | pr_info("setting as boot device: PCI:%s\n", | 1362 | pr_info("setting as boot device: PCI:%s\n", |
1347 | pci_name(vgadev->pdev)); | 1363 | pci_name(vgadev->pdev)); |
@@ -1352,9 +1368,11 @@ static int __init vga_arb_device_init(void) | |||
1352 | } | 1368 | } |
1353 | #endif | 1369 | #endif |
1354 | if (vgadev->bridge_has_one_vga) | 1370 | if (vgadev->bridge_has_one_vga) |
1355 | pr_info("bridge control possible %s\n", pci_name(vgadev->pdev)); | 1371 | pr_info("bridge control possible %s\n", |
1372 | pci_name(vgadev->pdev)); | ||
1356 | else | 1373 | else |
1357 | pr_info("no bridge control possible %s\n", pci_name(vgadev->pdev)); | 1374 | pr_info("no bridge control possible %s\n", |
1375 | pci_name(vgadev->pdev)); | ||
1358 | } | 1376 | } |
1359 | return rc; | 1377 | return rc; |
1360 | } | 1378 | } |