diff for duplicates of <1267073067-23117-3-git-send-email-airlied@gmail.com> diff --git a/a/1.txt b/N1/1.txt index 9fb295b..34fc261 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -39,7 +39,7 @@ index 2e70292..3fb32fd 100644 + bool can_switch; + + spin_lock(&dev->count_lock); -+ can_switch = (dev->open_count = 0); ++ can_switch = (dev->open_count == 0); + spin_unlock(&dev->count_lock); + return can_switch; +} @@ -80,7 +80,7 @@ index 940fdd3..afddcca 100644 + bool can_switch; + + spin_lock(&dev->count_lock); -+ can_switch = (dev->open_count = 0); ++ can_switch = (dev->open_count == 0); + spin_unlock(&dev->count_lock); + return can_switch; +} @@ -148,7 +148,7 @@ index 3ad4aba..a9b87b4 100644 struct drm_device *dev = pci_get_drvdata(pdev); + struct radeon_device *rdev = dev->dev_private; pm_message_t pmm = { .event = PM_EVENT_SUSPEND }; - if (state = VGA_SWITCHEROO_ON) { + if (state == VGA_SWITCHEROO_ON) { printk(KERN_ERR "VGA switched radeon on\n"); radeon_resume_kms(dev); + r600_audio_init(rdev); @@ -167,7 +167,7 @@ index 3ad4aba..a9b87b4 100644 + bool can_switch; + + spin_lock(&dev->count_lock); -+ can_switch = (dev->open_count = 0); ++ can_switch = (dev->open_count == 0); + spin_unlock(&dev->count_lock); + return can_switch; } @@ -293,7 +293,7 @@ index c4779ab..6b4781a 100644 + /* pwr off the device not in use */ - if (strncmp(pci_id, "OFF", 3) = 0) { + if (strncmp(pci_id, "OFF", 3) == 0) { for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) { @@ -336,17 +341,60 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf, } @@ -302,25 +302,25 @@ index c4779ab..6b4781a 100644 - /* switch devices */ + + /* request a delayed switch - test can we switch now */ -+ if (strncmp(pci_id, "DIGD", 4) = 0) { ++ if (strncmp(pci_id, "DIGD", 4) == 0) { + client_id = VGA_SWITCHEROO_IGD; + delay = true; + } + -+ if (strncmp(pci_id, "DDIS", 4) = 0) { ++ if (strncmp(pci_id, "DDIS", 4) == 0) { + client_id = VGA_SWITCHEROO_DIS; + delay = true; + } + -+ if (strncmp(pci_id, "IGD", 3) = 0) { ++ if (strncmp(pci_id, "IGD", 3) == 0) { + client_id = VGA_SWITCHEROO_IGD; + } + -+ if (strncmp(pci_id, "DIS", 3) = 0) { ++ if (strncmp(pci_id, "DIS", 3) == 0) { + client_id = VGA_SWITCHEROO_DIS; + } + -+ if (client_id = -1) ++ if (client_id == -1) + goto out; + + vgasr_priv.delayed_switch_active = false; @@ -328,22 +328,22 @@ index c4779ab..6b4781a 100644 + can_switch = true; for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) { - pdev_name = pci_name(vgasr_priv.clients[i].pdev); -- if (strncmp(pci_id, pdev_name, strlen(pdev_name)) = 0) { +- if (strncmp(pci_id, pdev_name, strlen(pdev_name)) == 0) { - printk("switching to %d %s\n", i, pdev_name); - ret = vga_switchto(i); - if (ret) - printk("switching failed %d\n", ret); + can_switch = vgasr_priv.clients[i].can_switch(vgasr_priv.clients[i].pdev); -+ if (can_switch = false) { ++ if (can_switch == false) { + printk(KERN_ERR "Client %d refused switch\n", i); break; } } + -+ if (can_switch = false && delay = false) ++ if (can_switch == false && delay == false) + goto out; + -+ if (can_switch = true) { ++ if (can_switch == true) { + pdev_name = pci_name(vgasr_priv.clients[client_id].pdev); + printk("switching to %s\n", pdev_name); + ret = vga_switchto(client_id); @@ -356,7 +356,7 @@ index c4779ab..6b4781a 100644 + + /* we should at least power up the card to + make the switch faster */ -+ if (vgasr_priv.clients[client_id].pwr_state = VGA_SWITCHEROO_OFF) ++ if (vgasr_priv.clients[client_id].pwr_state == VGA_SWITCHEROO_OFF) + vga_switchon(client_id); + } + @@ -382,13 +382,13 @@ index c4779ab..6b4781a 100644 + + for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) { + can_switch = vgasr_priv.clients[i].can_switch(vgasr_priv.clients[i].pdev); -+ if (can_switch = false) { ++ if (can_switch == false) { + printk(KERN_ERR "Client %d refused switch\n", i); + break; + } + } + -+ if (can_switch = false) ++ if (can_switch == false) + return -EINVAL; + + pdev_name = pci_name(vgasr_priv.clients[vgasr_priv.delayed_client_id].pdev); diff --git a/a/content_digest b/N1/content_digest index 0e263d3..9afc93e 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -2,7 +2,7 @@ "ref\01267073067-23117-2-git-send-email-airlied@gmail.com\0" "From\0Dave Airlie <airlied@gmail.com>\0" "Subject\0[PATCH 2/2] vga switch: hi my name is race condition\0" - "Date\0Thu, 25 Feb 2010 04:44:27 +0000\0" + "Date\0Thu, 25 Feb 2010 14:44:27 +1000\0" "To\0linux-fbdev@vger.kernel.org\0" "Cc\0dri-devel@lists.sf.net" linux-kernel@vger.kernel.org @@ -50,7 +50,7 @@ "+\tbool can_switch;\n" "+\n" "+\tspin_lock(&dev->count_lock);\n" - "+\tcan_switch = (dev->open_count = 0);\n" + "+\tcan_switch = (dev->open_count == 0);\n" "+\tspin_unlock(&dev->count_lock);\n" "+\treturn can_switch;\n" "+}\n" @@ -91,7 +91,7 @@ "+\tbool can_switch;\n" "+\n" "+\tspin_lock(&dev->count_lock);\n" - "+\tcan_switch = (dev->open_count = 0);\n" + "+\tcan_switch = (dev->open_count == 0);\n" "+\tspin_unlock(&dev->count_lock);\n" "+\treturn can_switch;\n" "+}\n" @@ -159,7 +159,7 @@ " \tstruct drm_device *dev = pci_get_drvdata(pdev);\n" "+\tstruct radeon_device *rdev = dev->dev_private;\n" " \tpm_message_t pmm = { .event = PM_EVENT_SUSPEND };\n" - " \tif (state = VGA_SWITCHEROO_ON) {\n" + " \tif (state == VGA_SWITCHEROO_ON) {\n" " \t\tprintk(KERN_ERR \"VGA switched radeon on\\n\");\n" " \t\tradeon_resume_kms(dev);\n" "+\t\tr600_audio_init(rdev);\n" @@ -178,7 +178,7 @@ "+\tbool can_switch;\n" "+\n" "+\tspin_lock(&dev->count_lock);\n" - "+\tcan_switch = (dev->open_count = 0);\n" + "+\tcan_switch = (dev->open_count == 0);\n" "+\tspin_unlock(&dev->count_lock);\n" "+\treturn can_switch;\n" " }\n" @@ -304,7 +304,7 @@ " \n" "+\n" " \t/* pwr off the device not in use */\n" - " \tif (strncmp(pci_id, \"OFF\", 3) = 0) {\n" + " \tif (strncmp(pci_id, \"OFF\", 3) == 0) {\n" " \t\tfor (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {\n" "@@ -336,17 +341,60 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf,\n" " \t\t}\n" @@ -313,25 +313,25 @@ "-\t/* switch devices */\n" "+\n" "+\t/* request a delayed switch - test can we switch now */\n" - "+\tif (strncmp(pci_id, \"DIGD\", 4) = 0) {\n" + "+\tif (strncmp(pci_id, \"DIGD\", 4) == 0) {\n" "+\t\tclient_id = VGA_SWITCHEROO_IGD;\n" "+\t\tdelay = true;\n" "+\t}\n" "+\n" - "+\tif (strncmp(pci_id, \"DDIS\", 4) = 0) {\n" + "+\tif (strncmp(pci_id, \"DDIS\", 4) == 0) {\n" "+\t\tclient_id = VGA_SWITCHEROO_DIS;\n" "+\t\tdelay = true;\n" "+\t}\n" "+\n" - "+\tif (strncmp(pci_id, \"IGD\", 3) = 0) {\n" + "+\tif (strncmp(pci_id, \"IGD\", 3) == 0) {\n" "+\t\tclient_id = VGA_SWITCHEROO_IGD;\n" "+\t}\n" "+\n" - "+\tif (strncmp(pci_id, \"DIS\", 3) = 0) {\n" + "+\tif (strncmp(pci_id, \"DIS\", 3) == 0) {\n" "+\t\tclient_id = VGA_SWITCHEROO_DIS;\n" "+\t}\n" "+\n" - "+\tif (client_id = -1)\n" + "+\tif (client_id == -1)\n" "+\t\tgoto out;\n" "+\n" "+\tvgasr_priv.delayed_switch_active = false;\n" @@ -339,22 +339,22 @@ "+\tcan_switch = true;\n" " \tfor (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {\n" "-\t\tpdev_name = pci_name(vgasr_priv.clients[i].pdev);\n" - "-\t\tif (strncmp(pci_id, pdev_name, strlen(pdev_name)) = 0) {\n" + "-\t\tif (strncmp(pci_id, pdev_name, strlen(pdev_name)) == 0) {\n" "-\t\t\tprintk(\"switching to %d %s\\n\", i, pdev_name);\n" "-\t\t\tret = vga_switchto(i);\n" "-\t\t\tif (ret)\n" "-\t\t\t\tprintk(\"switching failed %d\\n\", ret);\n" "+\t\tcan_switch = vgasr_priv.clients[i].can_switch(vgasr_priv.clients[i].pdev);\n" - "+\t\tif (can_switch = false) {\n" + "+\t\tif (can_switch == false) {\n" "+\t\t\tprintk(KERN_ERR \"Client %d refused switch\\n\", i);\n" " \t\t\tbreak;\n" " \t\t}\n" " \t}\n" "+\n" - "+\tif (can_switch = false && delay = false)\n" + "+\tif (can_switch == false && delay == false)\n" "+\t\tgoto out;\n" "+\n" - "+\tif (can_switch = true) {\n" + "+\tif (can_switch == true) {\n" "+\t\tpdev_name = pci_name(vgasr_priv.clients[client_id].pdev);\n" "+\t\tprintk(\"switching to %s\\n\", pdev_name);\n" "+\t\tret = vga_switchto(client_id);\n" @@ -367,7 +367,7 @@ "+\n" "+\t\t/* we should at least power up the card to\n" "+\t\t make the switch faster */\n" - "+\t\tif (vgasr_priv.clients[client_id].pwr_state = VGA_SWITCHEROO_OFF)\n" + "+\t\tif (vgasr_priv.clients[client_id].pwr_state == VGA_SWITCHEROO_OFF)\n" "+\t\t\tvga_switchon(client_id);\n" "+\t}\n" "+\n" @@ -393,13 +393,13 @@ "+\n" "+\tfor (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {\n" "+\t\tcan_switch = vgasr_priv.clients[i].can_switch(vgasr_priv.clients[i].pdev);\n" - "+\t\tif (can_switch = false) {\n" + "+\t\tif (can_switch == false) {\n" "+\t\t\tprintk(KERN_ERR \"Client %d refused switch\\n\", i);\n" "+\t\t\tbreak;\n" "+\t\t}\n" "+\t}\n" "+\n" - "+\tif (can_switch = false)\n" + "+\tif (can_switch == false)\n" "+\t\treturn -EINVAL;\n" "+\n" "+\tpdev_name = pci_name(vgasr_priv.clients[vgasr_priv.delayed_client_id].pdev);\n" @@ -435,4 +435,4 @@ "-- \n" 1.6.5.2 -35bf42d42c4e1d0b83ebaa6303cb6ffa203f066378e1c75c228fc4627d598da5 +9ef6e1575a559c3f285d4e92b8323a16d3ea060857c4101cdb9c7277e059900d
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.