diff options
Diffstat (limited to 'drivers')
158 files changed, 3216 insertions, 2142 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 70b77e0899a8..dbf6ca781f66 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -118,8 +118,8 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap) | |||
118 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; | 118 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; |
119 | } | 119 | } |
120 | 120 | ||
121 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | 121 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device |
122 | u32 event) | 122 | *dev, u32 event) |
123 | { | 123 | { |
124 | char event_string[12]; | 124 | char event_string[12]; |
125 | char *envp[] = { event_string, NULL }; | 125 | char *envp[] = { event_string, NULL }; |
@@ -127,6 +127,9 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | |||
127 | struct kobject *kobj = NULL; | 127 | struct kobject *kobj = NULL; |
128 | int wait = 0; | 128 | int wait = 0; |
129 | unsigned long flags; | 129 | unsigned long flags; |
130 | acpi_handle handle, tmphandle; | ||
131 | unsigned long sta; | ||
132 | acpi_status status; | ||
130 | 133 | ||
131 | if (!ap) | 134 | if (!ap) |
132 | ap = dev->link->ap; | 135 | ap = dev->link->ap; |
@@ -134,32 +137,57 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | |||
134 | 137 | ||
135 | spin_lock_irqsave(ap->lock, flags); | 138 | spin_lock_irqsave(ap->lock, flags); |
136 | 139 | ||
140 | if (dev) | ||
141 | handle = dev->acpi_handle; | ||
142 | else | ||
143 | handle = ap->acpi_handle; | ||
144 | |||
145 | status = acpi_get_handle(handle, "_EJ0", &tmphandle); | ||
146 | if (ACPI_FAILURE(status)) { | ||
147 | /* This device is not ejectable */ | ||
148 | spin_unlock_irqrestore(ap->lock, flags); | ||
149 | return; | ||
150 | } | ||
151 | |||
152 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | ||
153 | if (ACPI_FAILURE(status)) { | ||
154 | printk ("Unable to determine bay status\n"); | ||
155 | spin_unlock_irqrestore(ap->lock, flags); | ||
156 | return; | ||
157 | } | ||
158 | |||
137 | switch (event) { | 159 | switch (event) { |
138 | case ACPI_NOTIFY_BUS_CHECK: | 160 | case ACPI_NOTIFY_BUS_CHECK: |
139 | case ACPI_NOTIFY_DEVICE_CHECK: | 161 | case ACPI_NOTIFY_DEVICE_CHECK: |
140 | ata_ehi_push_desc(ehi, "ACPI event"); | 162 | ata_ehi_push_desc(ehi, "ACPI event"); |
141 | ata_ehi_hotplugged(ehi); | 163 | if (!sta) { |
142 | ata_port_freeze(ap); | 164 | /* Device has been unplugged */ |
143 | break; | 165 | if (dev) |
144 | 166 | dev->flags |= ATA_DFLAG_DETACH; | |
145 | case ACPI_NOTIFY_EJECT_REQUEST: | 167 | else { |
146 | ata_ehi_push_desc(ehi, "ACPI event"); | 168 | struct ata_link *tlink; |
147 | if (dev) | 169 | struct ata_device *tdev; |
148 | dev->flags |= ATA_DFLAG_DETACH; | 170 | |
149 | else { | 171 | ata_port_for_each_link(tlink, ap) { |
150 | struct ata_link *tlink; | 172 | ata_link_for_each_dev(tdev, tlink) { |
151 | struct ata_device *tdev; | 173 | tdev->flags |= |
152 | 174 | ATA_DFLAG_DETACH; | |
153 | ata_port_for_each_link(tlink, ap) | 175 | } |
154 | ata_link_for_each_dev(tdev, tlink) | 176 | } |
155 | tdev->flags |= ATA_DFLAG_DETACH; | 177 | } |
178 | ata_port_schedule_eh(ap); | ||
179 | wait = 1; | ||
180 | } else { | ||
181 | ata_ehi_hotplugged(ehi); | ||
182 | ata_port_freeze(ap); | ||
156 | } | 183 | } |
157 | |||
158 | ata_port_schedule_eh(ap); | ||
159 | wait = 1; | ||
160 | break; | ||
161 | } | 184 | } |
162 | 185 | ||
186 | spin_unlock_irqrestore(ap->lock, flags); | ||
187 | |||
188 | if (wait) | ||
189 | ata_port_wait_eh(ap); | ||
190 | |||
163 | if (dev) { | 191 | if (dev) { |
164 | if (dev->sdev) | 192 | if (dev->sdev) |
165 | kobj = &dev->sdev->sdev_gendev.kobj; | 193 | kobj = &dev->sdev->sdev_gendev.kobj; |
@@ -170,11 +198,6 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | |||
170 | sprintf(event_string, "BAY_EVENT=%d", event); | 198 | sprintf(event_string, "BAY_EVENT=%d", event); |
171 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); | 199 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); |
172 | } | 200 | } |
173 | |||
174 | spin_unlock_irqrestore(ap->lock, flags); | ||
175 | |||
176 | if (wait) | ||
177 | ata_port_wait_eh(ap); | ||
178 | } | 201 | } |
179 | 202 | ||
180 | static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) | 203 | static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 927b692d723c..3c89f205c83f 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -2126,6 +2126,13 @@ int ata_dev_configure(struct ata_device *dev) | |||
2126 | dev->horkage |= ata_dev_blacklisted(dev); | 2126 | dev->horkage |= ata_dev_blacklisted(dev); |
2127 | ata_force_horkage(dev); | 2127 | ata_force_horkage(dev); |
2128 | 2128 | ||
2129 | if (dev->horkage & ATA_HORKAGE_DISABLE) { | ||
2130 | ata_dev_printk(dev, KERN_INFO, | ||
2131 | "unsupported device, disabling\n"); | ||
2132 | ata_dev_disable(dev); | ||
2133 | return 0; | ||
2134 | } | ||
2135 | |||
2129 | /* let ACPI work its magic */ | 2136 | /* let ACPI work its magic */ |
2130 | rc = ata_acpi_on_devcfg(dev); | 2137 | rc = ata_acpi_on_devcfg(dev); |
2131 | if (rc) | 2138 | if (rc) |
@@ -3490,22 +3497,11 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params, | |||
3490 | if ((rc = sata_link_debounce(link, params, deadline))) | 3497 | if ((rc = sata_link_debounce(link, params, deadline))) |
3491 | return rc; | 3498 | return rc; |
3492 | 3499 | ||
3493 | /* Clear SError. PMP and some host PHYs require this to | 3500 | /* clear SError, some PHYs require this even for SRST to work */ |
3494 | * operate and clearing should be done before checking PHY | ||
3495 | * online status to avoid race condition (hotplugging between | ||
3496 | * link resume and status check). | ||
3497 | */ | ||
3498 | if (!(rc = sata_scr_read(link, SCR_ERROR, &serror))) | 3501 | if (!(rc = sata_scr_read(link, SCR_ERROR, &serror))) |
3499 | rc = sata_scr_write(link, SCR_ERROR, serror); | 3502 | rc = sata_scr_write(link, SCR_ERROR, serror); |
3500 | if (rc == 0 || rc == -EINVAL) { | ||
3501 | unsigned long flags; | ||
3502 | 3503 | ||
3503 | spin_lock_irqsave(link->ap->lock, flags); | 3504 | return rc != -EINVAL ? rc : 0; |
3504 | link->eh_info.serror = 0; | ||
3505 | spin_unlock_irqrestore(link->ap->lock, flags); | ||
3506 | rc = 0; | ||
3507 | } | ||
3508 | return rc; | ||
3509 | } | 3505 | } |
3510 | 3506 | ||
3511 | /** | 3507 | /** |
@@ -3653,9 +3649,13 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, | |||
3653 | if (check_ready) | 3649 | if (check_ready) |
3654 | rc = ata_wait_ready(link, deadline, check_ready); | 3650 | rc = ata_wait_ready(link, deadline, check_ready); |
3655 | out: | 3651 | out: |
3656 | if (rc && rc != -EAGAIN) | 3652 | if (rc && rc != -EAGAIN) { |
3653 | /* online is set iff link is online && reset succeeded */ | ||
3654 | if (online) | ||
3655 | *online = false; | ||
3657 | ata_link_printk(link, KERN_ERR, | 3656 | ata_link_printk(link, KERN_ERR, |
3658 | "COMRESET failed (errno=%d)\n", rc); | 3657 | "COMRESET failed (errno=%d)\n", rc); |
3658 | } | ||
3659 | DPRINTK("EXIT, rc=%d\n", rc); | 3659 | DPRINTK("EXIT, rc=%d\n", rc); |
3660 | return rc; | 3660 | return rc; |
3661 | } | 3661 | } |
@@ -3700,8 +3700,14 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class, | |||
3700 | */ | 3700 | */ |
3701 | void ata_std_postreset(struct ata_link *link, unsigned int *classes) | 3701 | void ata_std_postreset(struct ata_link *link, unsigned int *classes) |
3702 | { | 3702 | { |
3703 | u32 serror; | ||
3704 | |||
3703 | DPRINTK("ENTER\n"); | 3705 | DPRINTK("ENTER\n"); |
3704 | 3706 | ||
3707 | /* reset complete, clear SError */ | ||
3708 | if (!sata_scr_read(link, SCR_ERROR, &serror)) | ||
3709 | sata_scr_write(link, SCR_ERROR, serror); | ||
3710 | |||
3705 | /* print link status */ | 3711 | /* print link status */ |
3706 | sata_print_link_status(link); | 3712 | sata_print_link_status(link); |
3707 | 3713 | ||
@@ -3894,8 +3900,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3894 | { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA }, | 3900 | { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA }, |
3895 | { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, | 3901 | { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, |
3896 | /* Odd clown on sil3726/4726 PMPs */ | 3902 | /* Odd clown on sil3726/4726 PMPs */ |
3897 | { "Config Disk", NULL, ATA_HORKAGE_NODMA | | 3903 | { "Config Disk", NULL, ATA_HORKAGE_DISABLE }, |
3898 | ATA_HORKAGE_SKIP_PM }, | ||
3899 | 3904 | ||
3900 | /* Weird ATAPI devices */ | 3905 | /* Weird ATAPI devices */ |
3901 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, | 3906 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, |
@@ -5616,7 +5621,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
5616 | spin_lock_irqsave(ap->lock, flags); | 5621 | spin_lock_irqsave(ap->lock, flags); |
5617 | 5622 | ||
5618 | ehi->probe_mask |= ATA_ALL_DEVICES; | 5623 | ehi->probe_mask |= ATA_ALL_DEVICES; |
5619 | ehi->action |= ATA_EH_RESET; | 5624 | ehi->action |= ATA_EH_RESET | ATA_EH_LPM; |
5620 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; | 5625 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; |
5621 | 5626 | ||
5622 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; | 5627 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; |
@@ -5649,7 +5654,6 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
5649 | struct ata_port *ap = host->ports[i]; | 5654 | struct ata_port *ap = host->ports[i]; |
5650 | 5655 | ||
5651 | ata_scsi_scan_host(ap, 1); | 5656 | ata_scsi_scan_host(ap, 1); |
5652 | ata_lpm_schedule(ap, ap->pm_policy); | ||
5653 | } | 5657 | } |
5654 | 5658 | ||
5655 | return 0; | 5659 | return 0; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 62e033146bed..7894d83ea1eb 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1308,12 +1308,7 @@ static void ata_eh_analyze_serror(struct ata_link *link) | |||
1308 | unsigned int err_mask = 0, action = 0; | 1308 | unsigned int err_mask = 0, action = 0; |
1309 | u32 hotplug_mask; | 1309 | u32 hotplug_mask; |
1310 | 1310 | ||
1311 | if (serror & SERR_PERSISTENT) { | 1311 | if (serror & (SERR_PERSISTENT | SERR_DATA)) { |
1312 | err_mask |= AC_ERR_ATA_BUS; | ||
1313 | action |= ATA_EH_RESET; | ||
1314 | } | ||
1315 | if (serror & | ||
1316 | (SERR_DATA_RECOVERED | SERR_COMM_RECOVERED | SERR_DATA)) { | ||
1317 | err_mask |= AC_ERR_ATA_BUS; | 1312 | err_mask |= AC_ERR_ATA_BUS; |
1318 | action |= ATA_EH_RESET; | 1313 | action |= ATA_EH_RESET; |
1319 | } | 1314 | } |
@@ -2047,19 +2042,11 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, | |||
2047 | unsigned int *classes, unsigned long deadline) | 2042 | unsigned int *classes, unsigned long deadline) |
2048 | { | 2043 | { |
2049 | struct ata_device *dev; | 2044 | struct ata_device *dev; |
2050 | int rc; | ||
2051 | 2045 | ||
2052 | ata_link_for_each_dev(dev, link) | 2046 | ata_link_for_each_dev(dev, link) |
2053 | classes[dev->devno] = ATA_DEV_UNKNOWN; | 2047 | classes[dev->devno] = ATA_DEV_UNKNOWN; |
2054 | 2048 | ||
2055 | rc = reset(link, classes, deadline); | 2049 | return reset(link, classes, deadline); |
2056 | |||
2057 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ | ||
2058 | ata_link_for_each_dev(dev, link) | ||
2059 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) | ||
2060 | classes[dev->devno] = ATA_DEV_NONE; | ||
2061 | |||
2062 | return rc; | ||
2063 | } | 2050 | } |
2064 | 2051 | ||
2065 | static int ata_eh_followup_srst_needed(struct ata_link *link, | 2052 | static int ata_eh_followup_srst_needed(struct ata_link *link, |
@@ -2096,9 +2083,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2096 | ata_reset_fn_t reset; | 2083 | ata_reset_fn_t reset; |
2097 | unsigned long flags; | 2084 | unsigned long flags; |
2098 | u32 sstatus; | 2085 | u32 sstatus; |
2099 | int rc; | 2086 | int nr_known, rc; |
2100 | 2087 | ||
2101 | /* about to reset */ | 2088 | /* |
2089 | * Prepare to reset | ||
2090 | */ | ||
2102 | spin_lock_irqsave(ap->lock, flags); | 2091 | spin_lock_irqsave(ap->lock, flags); |
2103 | ap->pflags |= ATA_PFLAG_RESETTING; | 2092 | ap->pflags |= ATA_PFLAG_RESETTING; |
2104 | spin_unlock_irqrestore(ap->lock, flags); | 2093 | spin_unlock_irqrestore(ap->lock, flags); |
@@ -2124,16 +2113,8 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2124 | ap->ops->set_piomode(ap, dev); | 2113 | ap->ops->set_piomode(ap, dev); |
2125 | } | 2114 | } |
2126 | 2115 | ||
2127 | if (!softreset && !hardreset) { | ||
2128 | if (verbose) | ||
2129 | ata_link_printk(link, KERN_INFO, "no reset method " | ||
2130 | "available, skipping reset\n"); | ||
2131 | if (!(lflags & ATA_LFLAG_ASSUME_CLASS)) | ||
2132 | lflags |= ATA_LFLAG_ASSUME_ATA; | ||
2133 | goto done; | ||
2134 | } | ||
2135 | |||
2136 | /* prefer hardreset */ | 2116 | /* prefer hardreset */ |
2117 | reset = NULL; | ||
2137 | ehc->i.action &= ~ATA_EH_RESET; | 2118 | ehc->i.action &= ~ATA_EH_RESET; |
2138 | if (hardreset) { | 2119 | if (hardreset) { |
2139 | reset = hardreset; | 2120 | reset = hardreset; |
@@ -2141,11 +2122,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2141 | } else if (softreset) { | 2122 | } else if (softreset) { |
2142 | reset = softreset; | 2123 | reset = softreset; |
2143 | ehc->i.action = ATA_EH_SOFTRESET; | 2124 | ehc->i.action = ATA_EH_SOFTRESET; |
2144 | } else { | ||
2145 | ata_link_printk(link, KERN_ERR, "BUG: no reset method, " | ||
2146 | "please report to linux-ide@vger.kernel.org\n"); | ||
2147 | dump_stack(); | ||
2148 | return -EINVAL; | ||
2149 | } | 2125 | } |
2150 | 2126 | ||
2151 | if (prereset) { | 2127 | if (prereset) { |
@@ -2165,55 +2141,71 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2165 | "prereset failed (errno=%d)\n", rc); | 2141 | "prereset failed (errno=%d)\n", rc); |
2166 | goto out; | 2142 | goto out; |
2167 | } | 2143 | } |
2168 | } | ||
2169 | 2144 | ||
2170 | /* prereset() might have cleared ATA_EH_RESET */ | 2145 | /* prereset() might have cleared ATA_EH_RESET. If so, |
2171 | if (!(ehc->i.action & ATA_EH_RESET)) { | 2146 | * bang classes and return. |
2172 | /* prereset told us not to reset, bang classes and return */ | 2147 | */ |
2173 | ata_link_for_each_dev(dev, link) | 2148 | if (reset && !(ehc->i.action & ATA_EH_RESET)) { |
2174 | classes[dev->devno] = ATA_DEV_NONE; | 2149 | ata_link_for_each_dev(dev, link) |
2175 | rc = 0; | 2150 | classes[dev->devno] = ATA_DEV_NONE; |
2176 | goto out; | 2151 | rc = 0; |
2152 | goto out; | ||
2153 | } | ||
2177 | } | 2154 | } |
2178 | 2155 | ||
2179 | retry: | 2156 | retry: |
2157 | /* | ||
2158 | * Perform reset | ||
2159 | */ | ||
2160 | if (ata_is_host_link(link)) | ||
2161 | ata_eh_freeze_port(ap); | ||
2162 | |||
2180 | deadline = jiffies + ata_eh_reset_timeouts[try++]; | 2163 | deadline = jiffies + ata_eh_reset_timeouts[try++]; |
2181 | 2164 | ||
2182 | /* shut up during boot probing */ | 2165 | if (reset) { |
2183 | if (verbose) | 2166 | if (verbose) |
2184 | ata_link_printk(link, KERN_INFO, "%s resetting link\n", | 2167 | ata_link_printk(link, KERN_INFO, "%s resetting link\n", |
2185 | reset == softreset ? "soft" : "hard"); | 2168 | reset == softreset ? "soft" : "hard"); |
2186 | 2169 | ||
2187 | /* mark that this EH session started with reset */ | 2170 | /* mark that this EH session started with reset */ |
2188 | if (reset == hardreset) | 2171 | if (reset == hardreset) |
2189 | ehc->i.flags |= ATA_EHI_DID_HARDRESET; | 2172 | ehc->i.flags |= ATA_EHI_DID_HARDRESET; |
2190 | else | 2173 | else |
2191 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; | 2174 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; |
2192 | 2175 | ||
2193 | rc = ata_do_reset(link, reset, classes, deadline); | 2176 | rc = ata_do_reset(link, reset, classes, deadline); |
2194 | 2177 | ||
2195 | if (reset == hardreset && | 2178 | if (reset == hardreset && |
2196 | ata_eh_followup_srst_needed(link, rc, classify, classes)) { | 2179 | ata_eh_followup_srst_needed(link, rc, classify, classes)) { |
2197 | /* okay, let's do follow-up softreset */ | 2180 | /* okay, let's do follow-up softreset */ |
2198 | reset = softreset; | 2181 | reset = softreset; |
2199 | 2182 | ||
2200 | if (!reset) { | 2183 | if (!reset) { |
2201 | ata_link_printk(link, KERN_ERR, | 2184 | ata_link_printk(link, KERN_ERR, |
2202 | "follow-up softreset required " | 2185 | "follow-up softreset required " |
2203 | "but no softreset avaliable\n"); | 2186 | "but no softreset avaliable\n"); |
2204 | rc = -EINVAL; | 2187 | rc = -EINVAL; |
2205 | goto fail; | 2188 | goto fail; |
2189 | } | ||
2190 | |||
2191 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | ||
2192 | rc = ata_do_reset(link, reset, classes, deadline); | ||
2206 | } | 2193 | } |
2207 | 2194 | ||
2208 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2195 | /* -EAGAIN can happen if we skipped followup SRST */ |
2209 | rc = ata_do_reset(link, reset, classes, deadline); | 2196 | if (rc && rc != -EAGAIN) |
2197 | goto fail; | ||
2198 | } else { | ||
2199 | if (verbose) | ||
2200 | ata_link_printk(link, KERN_INFO, "no reset method " | ||
2201 | "available, skipping reset\n"); | ||
2202 | if (!(lflags & ATA_LFLAG_ASSUME_CLASS)) | ||
2203 | lflags |= ATA_LFLAG_ASSUME_ATA; | ||
2210 | } | 2204 | } |
2211 | 2205 | ||
2212 | /* -EAGAIN can happen if we skipped followup SRST */ | 2206 | /* |
2213 | if (rc && rc != -EAGAIN) | 2207 | * Post-reset processing |
2214 | goto fail; | 2208 | */ |
2215 | |||
2216 | done: | ||
2217 | ata_link_for_each_dev(dev, link) { | 2209 | ata_link_for_each_dev(dev, link) { |
2218 | /* After the reset, the device state is PIO 0 and the | 2210 | /* After the reset, the device state is PIO 0 and the |
2219 | * controller state is undefined. Reset also wakes up | 2211 | * controller state is undefined. Reset also wakes up |
@@ -2236,9 +2228,53 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2236 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) | 2228 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) |
2237 | link->sata_spd = (sstatus >> 4) & 0xf; | 2229 | link->sata_spd = (sstatus >> 4) & 0xf; |
2238 | 2230 | ||
2231 | /* thaw the port */ | ||
2232 | if (ata_is_host_link(link)) | ||
2233 | ata_eh_thaw_port(ap); | ||
2234 | |||
2235 | /* postreset() should clear hardware SError. Although SError | ||
2236 | * is cleared during link resume, clearing SError here is | ||
2237 | * necessary as some PHYs raise hotplug events after SRST. | ||
2238 | * This introduces race condition where hotplug occurs between | ||
2239 | * reset and here. This race is mediated by cross checking | ||
2240 | * link onlineness and classification result later. | ||
2241 | */ | ||
2239 | if (postreset) | 2242 | if (postreset) |
2240 | postreset(link, classes); | 2243 | postreset(link, classes); |
2241 | 2244 | ||
2245 | /* clear cached SError */ | ||
2246 | spin_lock_irqsave(link->ap->lock, flags); | ||
2247 | link->eh_info.serror = 0; | ||
2248 | spin_unlock_irqrestore(link->ap->lock, flags); | ||
2249 | |||
2250 | /* Make sure onlineness and classification result correspond. | ||
2251 | * Hotplug could have happened during reset and some | ||
2252 | * controllers fail to wait while a drive is spinning up after | ||
2253 | * being hotplugged causing misdetection. By cross checking | ||
2254 | * link onlineness and classification result, those conditions | ||
2255 | * can be reliably detected and retried. | ||
2256 | */ | ||
2257 | nr_known = 0; | ||
2258 | ata_link_for_each_dev(dev, link) { | ||
2259 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ | ||
2260 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) | ||
2261 | classes[dev->devno] = ATA_DEV_NONE; | ||
2262 | else | ||
2263 | nr_known++; | ||
2264 | } | ||
2265 | |||
2266 | if (classify && !nr_known && ata_link_online(link)) { | ||
2267 | if (try < max_tries) { | ||
2268 | ata_link_printk(link, KERN_WARNING, "link online but " | ||
2269 | "device misclassified, retrying\n"); | ||
2270 | rc = -EAGAIN; | ||
2271 | goto fail; | ||
2272 | } | ||
2273 | ata_link_printk(link, KERN_WARNING, | ||
2274 | "link online but device misclassified, " | ||
2275 | "device detection might fail\n"); | ||
2276 | } | ||
2277 | |||
2242 | /* reset successful, schedule revalidation */ | 2278 | /* reset successful, schedule revalidation */ |
2243 | ata_eh_done(link, NULL, ATA_EH_RESET); | 2279 | ata_eh_done(link, NULL, ATA_EH_RESET); |
2244 | ehc->i.action |= ATA_EH_REVALIDATE; | 2280 | ehc->i.action |= ATA_EH_REVALIDATE; |
@@ -2587,7 +2623,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2587 | struct ata_link *link; | 2623 | struct ata_link *link; |
2588 | struct ata_device *dev; | 2624 | struct ata_device *dev; |
2589 | int nr_failed_devs, nr_disabled_devs; | 2625 | int nr_failed_devs, nr_disabled_devs; |
2590 | int reset, rc; | 2626 | int rc; |
2591 | unsigned long flags; | 2627 | unsigned long flags; |
2592 | 2628 | ||
2593 | DPRINTK("ENTER\n"); | 2629 | DPRINTK("ENTER\n"); |
@@ -2630,7 +2666,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2630 | rc = 0; | 2666 | rc = 0; |
2631 | nr_failed_devs = 0; | 2667 | nr_failed_devs = 0; |
2632 | nr_disabled_devs = 0; | 2668 | nr_disabled_devs = 0; |
2633 | reset = 0; | ||
2634 | 2669 | ||
2635 | /* if UNLOADING, finish immediately */ | 2670 | /* if UNLOADING, finish immediately */ |
2636 | if (ap->pflags & ATA_PFLAG_UNLOADING) | 2671 | if (ap->pflags & ATA_PFLAG_UNLOADING) |
@@ -2644,40 +2679,24 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2644 | if (ata_eh_skip_recovery(link)) | 2679 | if (ata_eh_skip_recovery(link)) |
2645 | ehc->i.action = 0; | 2680 | ehc->i.action = 0; |
2646 | 2681 | ||
2647 | /* do we need to reset? */ | ||
2648 | if (ehc->i.action & ATA_EH_RESET) | ||
2649 | reset = 1; | ||
2650 | |||
2651 | ata_link_for_each_dev(dev, link) | 2682 | ata_link_for_each_dev(dev, link) |
2652 | ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; | 2683 | ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; |
2653 | } | 2684 | } |
2654 | 2685 | ||
2655 | /* reset */ | 2686 | /* reset */ |
2656 | if (reset) { | 2687 | ata_port_for_each_link(link, ap) { |
2657 | /* if PMP is attached, this function only deals with | 2688 | struct ata_eh_context *ehc = &link->eh_context; |
2658 | * downstream links, port should stay thawed. | ||
2659 | */ | ||
2660 | if (!sata_pmp_attached(ap)) | ||
2661 | ata_eh_freeze_port(ap); | ||
2662 | |||
2663 | ata_port_for_each_link(link, ap) { | ||
2664 | struct ata_eh_context *ehc = &link->eh_context; | ||
2665 | 2689 | ||
2666 | if (!(ehc->i.action & ATA_EH_RESET)) | 2690 | if (!(ehc->i.action & ATA_EH_RESET)) |
2667 | continue; | 2691 | continue; |
2668 | 2692 | ||
2669 | rc = ata_eh_reset(link, ata_link_nr_vacant(link), | 2693 | rc = ata_eh_reset(link, ata_link_nr_vacant(link), |
2670 | prereset, softreset, hardreset, | 2694 | prereset, softreset, hardreset, postreset); |
2671 | postreset); | 2695 | if (rc) { |
2672 | if (rc) { | 2696 | ata_link_printk(link, KERN_ERR, |
2673 | ata_link_printk(link, KERN_ERR, | 2697 | "reset failed, giving up\n"); |
2674 | "reset failed, giving up\n"); | 2698 | goto out; |
2675 | goto out; | ||
2676 | } | ||
2677 | } | 2699 | } |
2678 | |||
2679 | if (!sata_pmp_attached(ap)) | ||
2680 | ata_eh_thaw_port(ap); | ||
2681 | } | 2700 | } |
2682 | 2701 | ||
2683 | /* the rest */ | 2702 | /* the rest */ |
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index ff1822a7da38..0f9386d4a5a0 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
@@ -48,7 +48,7 @@ static unsigned int sata_pmp_read(struct ata_link *link, int reg, u32 *r_val) | |||
48 | tf.device = link->pmp; | 48 | tf.device = link->pmp; |
49 | 49 | ||
50 | err_mask = ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, | 50 | err_mask = ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, |
51 | SATA_PMP_SCR_TIMEOUT); | 51 | SATA_PMP_RW_TIMEOUT); |
52 | if (err_mask) | 52 | if (err_mask) |
53 | return err_mask; | 53 | return err_mask; |
54 | 54 | ||
@@ -88,7 +88,7 @@ static unsigned int sata_pmp_write(struct ata_link *link, int reg, u32 val) | |||
88 | tf.lbah = (val >> 24) & 0xff; | 88 | tf.lbah = (val >> 24) & 0xff; |
89 | 89 | ||
90 | return ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, | 90 | return ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, |
91 | SATA_PMP_SCR_TIMEOUT); | 91 | SATA_PMP_RW_TIMEOUT); |
92 | } | 92 | } |
93 | 93 | ||
94 | /** | 94 | /** |
@@ -257,19 +257,6 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info) | |||
257 | goto fail; | 257 | goto fail; |
258 | } | 258 | } |
259 | 259 | ||
260 | /* turn off notification till fan-out ports are reset and configured */ | ||
261 | if (gscr[SATA_PMP_GSCR_FEAT_EN] & SATA_PMP_FEAT_NOTIFY) { | ||
262 | gscr[SATA_PMP_GSCR_FEAT_EN] &= ~SATA_PMP_FEAT_NOTIFY; | ||
263 | |||
264 | err_mask = sata_pmp_write(dev->link, SATA_PMP_GSCR_FEAT_EN, | ||
265 | gscr[SATA_PMP_GSCR_FEAT_EN]); | ||
266 | if (err_mask) { | ||
267 | rc = -EIO; | ||
268 | reason = "failed to write GSCR_FEAT_EN"; | ||
269 | goto fail; | ||
270 | } | ||
271 | } | ||
272 | |||
273 | if (print_info) { | 260 | if (print_info) { |
274 | ata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, " | 261 | ata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, " |
275 | "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n", | 262 | "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n", |
@@ -700,8 +687,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, | |||
700 | if (ehc->i.action & ATA_EH_RESET) { | 687 | if (ehc->i.action & ATA_EH_RESET) { |
701 | struct ata_link *tlink; | 688 | struct ata_link *tlink; |
702 | 689 | ||
703 | ata_eh_freeze_port(ap); | ||
704 | |||
705 | /* reset */ | 690 | /* reset */ |
706 | rc = ata_eh_reset(link, 0, prereset, softreset, hardreset, | 691 | rc = ata_eh_reset(link, 0, prereset, softreset, hardreset, |
707 | postreset); | 692 | postreset); |
@@ -711,8 +696,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, | |||
711 | goto fail; | 696 | goto fail; |
712 | } | 697 | } |
713 | 698 | ||
714 | ata_eh_thaw_port(ap); | ||
715 | |||
716 | /* PMP is reset, SErrors cannot be trusted, scan all */ | 699 | /* PMP is reset, SErrors cannot be trusted, scan all */ |
717 | ata_port_for_each_link(tlink, ap) { | 700 | ata_port_for_each_link(tlink, ap) { |
718 | struct ata_eh_context *ehc = &tlink->eh_context; | 701 | struct ata_eh_context *ehc = &tlink->eh_context; |
@@ -864,6 +847,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap) | |||
864 | struct ata_link *pmp_link = &ap->link; | 847 | struct ata_link *pmp_link = &ap->link; |
865 | struct ata_device *pmp_dev = pmp_link->device; | 848 | struct ata_device *pmp_dev = pmp_link->device; |
866 | struct ata_eh_context *pmp_ehc = &pmp_link->eh_context; | 849 | struct ata_eh_context *pmp_ehc = &pmp_link->eh_context; |
850 | u32 *gscr = pmp_dev->gscr; | ||
867 | struct ata_link *link; | 851 | struct ata_link *link; |
868 | struct ata_device *dev; | 852 | struct ata_device *dev; |
869 | unsigned int err_mask; | 853 | unsigned int err_mask; |
@@ -901,6 +885,22 @@ static int sata_pmp_eh_recover(struct ata_port *ap) | |||
901 | if (rc) | 885 | if (rc) |
902 | goto pmp_fail; | 886 | goto pmp_fail; |
903 | 887 | ||
888 | /* PHY event notification can disturb reset and other recovery | ||
889 | * operations. Turn it off. | ||
890 | */ | ||
891 | if (gscr[SATA_PMP_GSCR_FEAT_EN] & SATA_PMP_FEAT_NOTIFY) { | ||
892 | gscr[SATA_PMP_GSCR_FEAT_EN] &= ~SATA_PMP_FEAT_NOTIFY; | ||
893 | |||
894 | err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN, | ||
895 | gscr[SATA_PMP_GSCR_FEAT_EN]); | ||
896 | if (err_mask) { | ||
897 | ata_link_printk(pmp_link, KERN_WARNING, | ||
898 | "failed to disable NOTIFY (err_mask=0x%x)\n", | ||
899 | err_mask); | ||
900 | goto pmp_fail; | ||
901 | } | ||
902 | } | ||
903 | |||
904 | /* handle disabled links */ | 904 | /* handle disabled links */ |
905 | rc = sata_pmp_eh_handle_disabled_links(ap); | 905 | rc = sata_pmp_eh_handle_disabled_links(ap); |
906 | if (rc) | 906 | if (rc) |
@@ -923,10 +923,10 @@ static int sata_pmp_eh_recover(struct ata_port *ap) | |||
923 | 923 | ||
924 | /* enable notification */ | 924 | /* enable notification */ |
925 | if (pmp_dev->flags & ATA_DFLAG_AN) { | 925 | if (pmp_dev->flags & ATA_DFLAG_AN) { |
926 | pmp_dev->gscr[SATA_PMP_GSCR_FEAT_EN] |= SATA_PMP_FEAT_NOTIFY; | 926 | gscr[SATA_PMP_GSCR_FEAT_EN] |= SATA_PMP_FEAT_NOTIFY; |
927 | 927 | ||
928 | err_mask = sata_pmp_write(pmp_dev->link, SATA_PMP_GSCR_FEAT_EN, | 928 | err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN, |
929 | pmp_dev->gscr[SATA_PMP_GSCR_FEAT_EN]); | 929 | gscr[SATA_PMP_GSCR_FEAT_EN]); |
930 | if (err_mask) { | 930 | if (err_mask) { |
931 | ata_dev_printk(pmp_dev, KERN_ERR, "failed to write " | 931 | ata_dev_printk(pmp_dev, KERN_ERR, "failed to write " |
932 | "PMP_FEAT_EN (Emask=0x%x)\n", err_mask); | 932 | "PMP_FEAT_EN (Emask=0x%x)\n", err_mask); |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 3ce43920e459..aeb6e01d82ce 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1082,12 +1082,6 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) | |||
1082 | if (((cdb[4] >> 4) & 0xf) != 0) | 1082 | if (((cdb[4] >> 4) & 0xf) != 0) |
1083 | goto invalid_fld; /* power conditions not supported */ | 1083 | goto invalid_fld; /* power conditions not supported */ |
1084 | 1084 | ||
1085 | if (qc->dev->horkage & ATA_HORKAGE_SKIP_PM) { | ||
1086 | /* the device lacks PM support, finish without doing anything */ | ||
1087 | scmd->result = SAM_STAT_GOOD; | ||
1088 | return 1; | ||
1089 | } | ||
1090 | |||
1091 | if (cdb[4] & 0x1) { | 1085 | if (cdb[4] & 0x1) { |
1092 | tf->nsect = 1; /* 1 sector, lba=0 */ | 1086 | tf->nsect = 1; /* 1 sector, lba=0 */ |
1093 | 1087 | ||
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index fcabe46f262b..0f3e659db99a 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -177,11 +177,11 @@ static void ali_program_modes(struct ata_port *ap, struct ata_device *adev, stru | |||
177 | u8 udma; | 177 | u8 udma; |
178 | 178 | ||
179 | if (t != NULL) { | 179 | if (t != NULL) { |
180 | t->setup = FIT(t->setup, 1, 8) & 7; | 180 | t->setup = clamp_val(t->setup, 1, 8) & 7; |
181 | t->act8b = FIT(t->act8b, 1, 8) & 7; | 181 | t->act8b = clamp_val(t->act8b, 1, 8) & 7; |
182 | t->rec8b = FIT(t->rec8b, 1, 16) & 15; | 182 | t->rec8b = clamp_val(t->rec8b, 1, 16) & 15; |
183 | t->active = FIT(t->active, 1, 8) & 7; | 183 | t->active = clamp_val(t->active, 1, 8) & 7; |
184 | t->recover = FIT(t->recover, 1, 16) & 15; | 184 | t->recover = clamp_val(t->recover, 1, 16) & 15; |
185 | 185 | ||
186 | pci_write_config_byte(pdev, cas, t->setup); | 186 | pci_write_config_byte(pdev, cas, t->setup); |
187 | pci_write_config_byte(pdev, cbt, (t->act8b << 4) | t->rec8b); | 187 | pci_write_config_byte(pdev, cbt, (t->act8b << 4) | t->rec8b); |
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 26665c396485..57dd00f463d3 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -84,32 +84,32 @@ static void timing_setup(struct ata_port *ap, struct ata_device *adev, int offse | |||
84 | 84 | ||
85 | /* Configure the address set up timing */ | 85 | /* Configure the address set up timing */ |
86 | pci_read_config_byte(pdev, offset + 0x0C, &t); | 86 | pci_read_config_byte(pdev, offset + 0x0C, &t); |
87 | t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(at.setup, 1, 4) - 1) << ((3 - dn) << 1)); | 87 | t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(at.setup, 1, 4) - 1) << ((3 - dn) << 1)); |
88 | pci_write_config_byte(pdev, offset + 0x0C , t); | 88 | pci_write_config_byte(pdev, offset + 0x0C , t); |
89 | 89 | ||
90 | /* Configure the 8bit I/O timing */ | 90 | /* Configure the 8bit I/O timing */ |
91 | pci_write_config_byte(pdev, offset + 0x0E + (1 - (dn >> 1)), | 91 | pci_write_config_byte(pdev, offset + 0x0E + (1 - (dn >> 1)), |
92 | ((FIT(at.act8b, 1, 16) - 1) << 4) | (FIT(at.rec8b, 1, 16) - 1)); | 92 | ((clamp_val(at.act8b, 1, 16) - 1) << 4) | (clamp_val(at.rec8b, 1, 16) - 1)); |
93 | 93 | ||
94 | /* Drive timing */ | 94 | /* Drive timing */ |
95 | pci_write_config_byte(pdev, offset + 0x08 + (3 - dn), | 95 | pci_write_config_byte(pdev, offset + 0x08 + (3 - dn), |
96 | ((FIT(at.active, 1, 16) - 1) << 4) | (FIT(at.recover, 1, 16) - 1)); | 96 | ((clamp_val(at.active, 1, 16) - 1) << 4) | (clamp_val(at.recover, 1, 16) - 1)); |
97 | 97 | ||
98 | switch (clock) { | 98 | switch (clock) { |
99 | case 1: | 99 | case 1: |
100 | t = at.udma ? (0xc0 | (FIT(at.udma, 2, 5) - 2)) : 0x03; | 100 | t = at.udma ? (0xc0 | (clamp_val(at.udma, 2, 5) - 2)) : 0x03; |
101 | break; | 101 | break; |
102 | 102 | ||
103 | case 2: | 103 | case 2: |
104 | t = at.udma ? (0xc0 | amd_cyc2udma[FIT(at.udma, 2, 10)]) : 0x03; | 104 | t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 2, 10)]) : 0x03; |
105 | break; | 105 | break; |
106 | 106 | ||
107 | case 3: | 107 | case 3: |
108 | t = at.udma ? (0xc0 | amd_cyc2udma[FIT(at.udma, 1, 10)]) : 0x03; | 108 | t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 10)]) : 0x03; |
109 | break; | 109 | break; |
110 | 110 | ||
111 | case 4: | 111 | case 4: |
112 | t = at.udma ? (0xc0 | amd_cyc2udma[FIT(at.udma, 1, 15)]) : 0x03; | 112 | t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 15)]) : 0x03; |
113 | break; | 113 | break; |
114 | 114 | ||
115 | default: | 115 | default: |
diff --git a/drivers/ata/pata_at32.c b/drivers/ata/pata_at32.c index 5e104385d6a3..82fb6e273169 100644 --- a/drivers/ata/pata_at32.c +++ b/drivers/ata/pata_at32.c | |||
@@ -291,8 +291,6 @@ static int __init pata_at32_probe(struct platform_device *pdev) | |||
291 | if (!info) | 291 | if (!info) |
292 | return -ENOMEM; | 292 | return -ENOMEM; |
293 | 293 | ||
294 | memset(info, 0, sizeof(struct at32_ide_info)); | ||
295 | |||
296 | info->irq = irq; | 294 | info->irq = irq; |
297 | info->cs = board->cs; | 295 | info->cs = board->cs; |
298 | 296 | ||
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index 9ab89732cf94..55516103626a 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -911,7 +911,10 @@ static void bfin_bmdma_start(struct ata_queued_cmd *qc) | |||
911 | /* Reset all transfer count */ | 911 | /* Reset all transfer count */ |
912 | ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) | TFRCNT_RST); | 912 | ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) | TFRCNT_RST); |
913 | 913 | ||
914 | /* Set transfer length to buffer len */ | 914 | /* Set ATAPI state machine contorl in terminate sequence */ |
915 | ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) | END_ON_TERM); | ||
916 | |||
917 | /* Set transfer length to buffer len */ | ||
915 | for_each_sg(qc->sg, sg, qc->n_elem, si) { | 918 | for_each_sg(qc->sg, sg, qc->n_elem, si) { |
916 | ATAPI_SET_XFER_LEN(base, (sg_dma_len(sg) >> 1)); | 919 | ATAPI_SET_XFER_LEN(base, (sg_dma_len(sg) >> 1)); |
917 | } | 920 | } |
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c index a9c3218e22fd..2ff62608ae37 100644 --- a/drivers/ata/pata_cypress.c +++ b/drivers/ata/pata_cypress.c | |||
@@ -62,14 +62,14 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
62 | return; | 62 | return; |
63 | } | 63 | } |
64 | 64 | ||
65 | time_16 = FIT(t.recover, 0, 15) | (FIT(t.active, 0, 15) << 4); | 65 | time_16 = clamp_val(t.recover, 0, 15) | (clamp_val(t.active, 0, 15) << 4); |
66 | time_8 = FIT(t.act8b, 0, 15) | (FIT(t.rec8b, 0, 15) << 4); | 66 | time_8 = clamp_val(t.act8b, 0, 15) | (clamp_val(t.rec8b, 0, 15) << 4); |
67 | 67 | ||
68 | if (adev->devno == 0) { | 68 | if (adev->devno == 0) { |
69 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); | 69 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); |
70 | 70 | ||
71 | addr &= ~0x0F; /* Mask bits */ | 71 | addr &= ~0x0F; /* Mask bits */ |
72 | addr |= FIT(t.setup, 0, 15); | 72 | addr |= clamp_val(t.setup, 0, 15); |
73 | 73 | ||
74 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); | 74 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); |
75 | pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16); | 75 | pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16); |
@@ -79,7 +79,7 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
79 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); | 79 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); |
80 | 80 | ||
81 | addr &= ~0xF0; /* Mask bits */ | 81 | addr &= ~0xF0; /* Mask bits */ |
82 | addr |= (FIT(t.setup, 0, 15) << 4); | 82 | addr |= (clamp_val(t.setup, 0, 15) << 4); |
83 | 83 | ||
84 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); | 84 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); |
85 | pci_write_config_byte(pdev, CY82_IDE_SLAVE_IOR, time_16); | 85 | pci_write_config_byte(pdev, CY82_IDE_SLAVE_IOR, time_16); |
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index 7af4b29cc422..fe7cc8ed4ea4 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
@@ -343,8 +343,8 @@ static void ht6560a_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
343 | /* Get the timing data in cycles. For now play safe at 50Mhz */ | 343 | /* Get the timing data in cycles. For now play safe at 50Mhz */ |
344 | ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); | 344 | ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); |
345 | 345 | ||
346 | active = FIT(t.active, 2, 15); | 346 | active = clamp_val(t.active, 2, 15); |
347 | recover = FIT(t.recover, 4, 15); | 347 | recover = clamp_val(t.recover, 4, 15); |
348 | 348 | ||
349 | inb(0x3E6); | 349 | inb(0x3E6); |
350 | inb(0x3E6); | 350 | inb(0x3E6); |
@@ -377,8 +377,8 @@ static void ht6560b_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
377 | /* Get the timing data in cycles. For now play safe at 50Mhz */ | 377 | /* Get the timing data in cycles. For now play safe at 50Mhz */ |
378 | ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); | 378 | ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); |
379 | 379 | ||
380 | active = FIT(t.active, 2, 15); | 380 | active = clamp_val(t.active, 2, 15); |
381 | recover = FIT(t.recover, 2, 16); | 381 | recover = clamp_val(t.recover, 2, 16); |
382 | recover &= 0x15; | 382 | recover &= 0x15; |
383 | 383 | ||
384 | inb(0x3E6); | 384 | inb(0x3E6); |
@@ -462,9 +462,9 @@ static void opti82c611a_set_piomode(struct ata_port *ap, | |||
462 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); | 462 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); |
463 | } | 463 | } |
464 | 464 | ||
465 | active = FIT(t.active, 2, 17) - 2; | 465 | active = clamp_val(t.active, 2, 17) - 2; |
466 | recover = FIT(t.recover, 1, 16) - 1; | 466 | recover = clamp_val(t.recover, 1, 16) - 1; |
467 | setup = FIT(t.setup, 1, 4) - 1; | 467 | setup = clamp_val(t.setup, 1, 4) - 1; |
468 | 468 | ||
469 | /* Select the right timing bank for write timing */ | 469 | /* Select the right timing bank for write timing */ |
470 | rc = ioread8(ap->ioaddr.lbal_addr); | 470 | rc = ioread8(ap->ioaddr.lbal_addr); |
@@ -541,9 +541,9 @@ static void opti82c46x_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
541 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); | 541 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); |
542 | } | 542 | } |
543 | 543 | ||
544 | active = FIT(t.active, 2, 17) - 2; | 544 | active = clamp_val(t.active, 2, 17) - 2; |
545 | recover = FIT(t.recover, 1, 16) - 1; | 545 | recover = clamp_val(t.recover, 1, 16) - 1; |
546 | setup = FIT(t.setup, 1, 4) - 1; | 546 | setup = clamp_val(t.setup, 1, 4) - 1; |
547 | 547 | ||
548 | /* Select the right timing bank for write timing */ | 548 | /* Select the right timing bank for write timing */ |
549 | rc = ioread8(ap->ioaddr.lbal_addr); | 549 | rc = ioread8(ap->ioaddr.lbal_addr); |
@@ -624,11 +624,11 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
624 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 624 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
625 | 625 | ||
626 | if (ld_qdi->fast) { | 626 | if (ld_qdi->fast) { |
627 | active = 8 - FIT(t.active, 1, 8); | 627 | active = 8 - clamp_val(t.active, 1, 8); |
628 | recovery = 18 - FIT(t.recover, 3, 18); | 628 | recovery = 18 - clamp_val(t.recover, 3, 18); |
629 | } else { | 629 | } else { |
630 | active = 9 - FIT(t.active, 2, 9); | 630 | active = 9 - clamp_val(t.active, 2, 9); |
631 | recovery = 15 - FIT(t.recover, 0, 15); | 631 | recovery = 15 - clamp_val(t.recover, 0, 15); |
632 | } | 632 | } |
633 | timing = (recovery << 4) | active | 0x08; | 633 | timing = (recovery << 4) | active | 0x08; |
634 | 634 | ||
@@ -658,11 +658,11 @@ static void qdi6580dp_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
658 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 658 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
659 | 659 | ||
660 | if (ld_qdi->fast) { | 660 | if (ld_qdi->fast) { |
661 | active = 8 - FIT(t.active, 1, 8); | 661 | active = 8 - clamp_val(t.active, 1, 8); |
662 | recovery = 18 - FIT(t.recover, 3, 18); | 662 | recovery = 18 - clamp_val(t.recover, 3, 18); |
663 | } else { | 663 | } else { |
664 | active = 9 - FIT(t.active, 2, 9); | 664 | active = 9 - clamp_val(t.active, 2, 9); |
665 | recovery = 15 - FIT(t.recover, 0, 15); | 665 | recovery = 15 - clamp_val(t.recover, 0, 15); |
666 | } | 666 | } |
667 | timing = (recovery << 4) | active | 0x08; | 667 | timing = (recovery << 4) | active | 0x08; |
668 | 668 | ||
@@ -695,11 +695,11 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
695 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 695 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
696 | 696 | ||
697 | if (ld_qdi->fast) { | 697 | if (ld_qdi->fast) { |
698 | active = 8 - FIT(t.active, 1, 8); | 698 | active = 8 - clamp_val(t.active, 1, 8); |
699 | recovery = 18 - FIT(t.recover, 3, 18); | 699 | recovery = 18 - clamp_val(t.recover, 3, 18); |
700 | } else { | 700 | } else { |
701 | active = 9 - FIT(t.active, 2, 9); | 701 | active = 9 - clamp_val(t.active, 2, 9); |
702 | recovery = 15 - FIT(t.recover, 0, 15); | 702 | recovery = 15 - clamp_val(t.recover, 0, 15); |
703 | } | 703 | } |
704 | timing = (recovery << 4) | active | 0x08; | 704 | timing = (recovery << 4) | active | 0x08; |
705 | ld_qdi->clock[adev->devno] = timing; | 705 | ld_qdi->clock[adev->devno] = timing; |
@@ -830,8 +830,8 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
830 | else | 830 | else |
831 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 831 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
832 | 832 | ||
833 | active = (FIT(t.active, 3, 17) - 1) & 0x0F; | 833 | active = (clamp_val(t.active, 3, 17) - 1) & 0x0F; |
834 | recovery = (FIT(t.recover, 1, 15) + 1) & 0x0F; | 834 | recovery = (clamp_val(t.recover, 1, 15) + 1) & 0x0F; |
835 | timing = (active << 4) | recovery; | 835 | timing = (active << 4) | recovery; |
836 | winbond_writecfg(ld_winbond->timing, timing, reg); | 836 | winbond_writecfg(ld_winbond->timing, timing, reg); |
837 | 837 | ||
@@ -842,7 +842,7 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
842 | reg |= 0x08; /* FIFO off */ | 842 | reg |= 0x08; /* FIFO off */ |
843 | if (!ata_pio_need_iordy(adev)) | 843 | if (!ata_pio_need_iordy(adev)) |
844 | reg |= 0x02; /* IORDY off */ | 844 | reg |= 0x02; /* IORDY off */ |
845 | reg |= (FIT(t.setup, 0, 3) << 6); | 845 | reg |= (clamp_val(t.setup, 0, 3) << 6); |
846 | winbond_writecfg(ld_winbond->timing, timing + 1, reg); | 846 | winbond_writecfg(ld_winbond->timing, timing + 1, reg); |
847 | } | 847 | } |
848 | 848 | ||
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c index 76d2455bc453..be756b7ef07e 100644 --- a/drivers/ata/pata_ns87410.c +++ b/drivers/ata/pata_ns87410.c | |||
@@ -91,9 +91,9 @@ static void ns87410_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
91 | return; | 91 | return; |
92 | } | 92 | } |
93 | 93 | ||
94 | at.active = FIT(at.active, 2, 16) - 2; | 94 | at.active = clamp_val(at.active, 2, 16) - 2; |
95 | at.setup = FIT(at.setup, 1, 4) - 1; | 95 | at.setup = clamp_val(at.setup, 1, 4) - 1; |
96 | at.recover = FIT(at.recover, 1, 12) - 1; | 96 | at.recover = clamp_val(at.recover, 1, 12) - 1; |
97 | 97 | ||
98 | idetcr = (at.setup << 6) | (recoverbits[at.recover] << 3) | activebits[at.active]; | 98 | idetcr = (at.setup << 6) | (recoverbits[at.recover] << 3) | activebits[at.active]; |
99 | 99 | ||
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c index ae92b0049bd5..e0aa7eaaee0a 100644 --- a/drivers/ata/pata_ns87415.c +++ b/drivers/ata/pata_ns87415.c | |||
@@ -66,8 +66,8 @@ static void ns87415_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo | |||
66 | 66 | ||
67 | ata_timing_compute(adev, adev->pio_mode, &t, T, 0); | 67 | ata_timing_compute(adev, adev->pio_mode, &t, T, 0); |
68 | 68 | ||
69 | clocking = 17 - FIT(t.active, 2, 17); | 69 | clocking = 17 - clamp_val(t.active, 2, 17); |
70 | clocking |= (16 - FIT(t.recover, 1, 16)) << 4; | 70 | clocking |= (16 - clamp_val(t.recover, 1, 16)) << 4; |
71 | /* Use the same timing for read and write bytes */ | 71 | /* Use the same timing for read and write bytes */ |
72 | clocking |= (clocking << 8); | 72 | clocking |= (clocking << 8); |
73 | pci_write_config_word(dev, timing, clocking); | 73 | pci_write_config_word(dev, timing, clocking); |
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c index bf45cf017753..97e5b090d7c2 100644 --- a/drivers/ata/pata_qdi.c +++ b/drivers/ata/pata_qdi.c | |||
@@ -60,11 +60,11 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
60 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 60 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
61 | 61 | ||
62 | if (qdi->fast) { | 62 | if (qdi->fast) { |
63 | active = 8 - FIT(t.active, 1, 8); | 63 | active = 8 - clamp_val(t.active, 1, 8); |
64 | recovery = 18 - FIT(t.recover, 3, 18); | 64 | recovery = 18 - clamp_val(t.recover, 3, 18); |
65 | } else { | 65 | } else { |
66 | active = 9 - FIT(t.active, 2, 9); | 66 | active = 9 - clamp_val(t.active, 2, 9); |
67 | recovery = 15 - FIT(t.recover, 0, 15); | 67 | recovery = 15 - clamp_val(t.recover, 0, 15); |
68 | } | 68 | } |
69 | timing = (recovery << 4) | active | 0x08; | 69 | timing = (recovery << 4) | active | 0x08; |
70 | 70 | ||
@@ -84,11 +84,11 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
84 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 84 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
85 | 85 | ||
86 | if (qdi->fast) { | 86 | if (qdi->fast) { |
87 | active = 8 - FIT(t.active, 1, 8); | 87 | active = 8 - clamp_val(t.active, 1, 8); |
88 | recovery = 18 - FIT(t.recover, 3, 18); | 88 | recovery = 18 - clamp_val(t.recover, 3, 18); |
89 | } else { | 89 | } else { |
90 | active = 9 - FIT(t.active, 2, 9); | 90 | active = 9 - clamp_val(t.active, 2, 9); |
91 | recovery = 15 - FIT(t.recover, 0, 15); | 91 | recovery = 15 - clamp_val(t.recover, 0, 15); |
92 | } | 92 | } |
93 | timing = (recovery << 4) | active | 0x08; | 93 | timing = (recovery << 4) | active | 0x08; |
94 | 94 | ||
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index 70d94fb28a5f..69877bd81815 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c | |||
@@ -216,7 +216,7 @@ static int sl82c105_qc_defer(struct ata_queued_cmd *qc) | |||
216 | struct ata_port *alt = host->ports[1 ^ qc->ap->port_no]; | 216 | struct ata_port *alt = host->ports[1 ^ qc->ap->port_no]; |
217 | int rc; | 217 | int rc; |
218 | 218 | ||
219 | /* First apply the usual rules */ | 219 | /* First apply the usual rules */ |
220 | rc = ata_std_qc_defer(qc); | 220 | rc = ata_std_qc_defer(qc); |
221 | if (rc != 0) | 221 | if (rc != 0) |
222 | return rc; | 222 | return rc; |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 2fea6cbe7755..708ed144ede9 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -259,15 +259,15 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo | |||
259 | 259 | ||
260 | pci_read_config_byte(pdev, 0x4C, &setup); | 260 | pci_read_config_byte(pdev, 0x4C, &setup); |
261 | setup &= ~(3 << shift); | 261 | setup &= ~(3 << shift); |
262 | setup |= FIT(t.setup, 1, 4) << shift; /* 1,4 or 1,4 - 1 FIXME */ | 262 | setup |= clamp_val(t.setup, 1, 4) << shift; /* 1,4 or 1,4 - 1 FIXME */ |
263 | pci_write_config_byte(pdev, 0x4C, setup); | 263 | pci_write_config_byte(pdev, 0x4C, setup); |
264 | } | 264 | } |
265 | 265 | ||
266 | /* Load the PIO mode bits */ | 266 | /* Load the PIO mode bits */ |
267 | pci_write_config_byte(pdev, 0x4F - ap->port_no, | 267 | pci_write_config_byte(pdev, 0x4F - ap->port_no, |
268 | ((FIT(t.act8b, 1, 16) - 1) << 4) | (FIT(t.rec8b, 1, 16) - 1)); | 268 | ((clamp_val(t.act8b, 1, 16) - 1) << 4) | (clamp_val(t.rec8b, 1, 16) - 1)); |
269 | pci_write_config_byte(pdev, 0x48 + offset, | 269 | pci_write_config_byte(pdev, 0x48 + offset, |
270 | ((FIT(t.active, 1, 16) - 1) << 4) | (FIT(t.recover, 1, 16) - 1)); | 270 | ((clamp_val(t.active, 1, 16) - 1) << 4) | (clamp_val(t.recover, 1, 16) - 1)); |
271 | 271 | ||
272 | /* Load the UDMA bits according to type */ | 272 | /* Load the UDMA bits according to type */ |
273 | switch(udma_type) { | 273 | switch(udma_type) { |
@@ -275,16 +275,16 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo | |||
275 | /* BUG() ? */ | 275 | /* BUG() ? */ |
276 | /* fall through */ | 276 | /* fall through */ |
277 | case 33: | 277 | case 33: |
278 | ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 5) - 2)) : 0x03; | 278 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 5) - 2)) : 0x03; |
279 | break; | 279 | break; |
280 | case 66: | 280 | case 66: |
281 | ut = t.udma ? (0xe8 | (FIT(t.udma, 2, 9) - 2)) : 0x0f; | 281 | ut = t.udma ? (0xe8 | (clamp_val(t.udma, 2, 9) - 2)) : 0x0f; |
282 | break; | 282 | break; |
283 | case 100: | 283 | case 100: |
284 | ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 9) - 2)) : 0x07; | 284 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; |
285 | break; | 285 | break; |
286 | case 133: | 286 | case 133: |
287 | ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 9) - 2)) : 0x07; | 287 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; |
288 | break; | 288 | break; |
289 | } | 289 | } |
290 | 290 | ||
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c index 6e52a3573fbf..474528f8fe3d 100644 --- a/drivers/ata/pata_winbond.c +++ b/drivers/ata/pata_winbond.c | |||
@@ -75,8 +75,8 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
75 | else | 75 | else |
76 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 76 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
77 | 77 | ||
78 | active = (FIT(t.active, 3, 17) - 1) & 0x0F; | 78 | active = (clamp_val(t.active, 3, 17) - 1) & 0x0F; |
79 | recovery = (FIT(t.recover, 1, 15) + 1) & 0x0F; | 79 | recovery = (clamp_val(t.recover, 1, 15) + 1) & 0x0F; |
80 | timing = (active << 4) | recovery; | 80 | timing = (active << 4) | recovery; |
81 | winbond_writecfg(winbond->config, timing, reg); | 81 | winbond_writecfg(winbond->config, timing, reg); |
82 | 82 | ||
@@ -87,7 +87,7 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
87 | reg |= 0x08; /* FIFO off */ | 87 | reg |= 0x08; /* FIFO off */ |
88 | if (!ata_pio_need_iordy(adev)) | 88 | if (!ata_pio_need_iordy(adev)) |
89 | reg |= 0x02; /* IORDY off */ | 89 | reg |= 0x02; /* IORDY off */ |
90 | reg |= (FIT(t.setup, 0, 3) << 6); | 90 | reg |= (clamp_val(t.setup, 0, 3) << 6); |
91 | winbond_writecfg(winbond->config, timing + 1, reg); | 91 | winbond_writecfg(winbond->config, timing + 1, reg); |
92 | } | 92 | } |
93 | 93 | ||
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index bb73b2222627..fb81f0c7a8c2 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -72,7 +72,7 @@ | |||
72 | #include <linux/libata.h> | 72 | #include <linux/libata.h> |
73 | 73 | ||
74 | #define DRV_NAME "sata_mv" | 74 | #define DRV_NAME "sata_mv" |
75 | #define DRV_VERSION "1.20" | 75 | #define DRV_VERSION "1.21" |
76 | 76 | ||
77 | enum { | 77 | enum { |
78 | /* BAR's are enumerated in terms of pci_resource_start() terms */ | 78 | /* BAR's are enumerated in terms of pci_resource_start() terms */ |
@@ -128,8 +128,13 @@ enum { | |||
128 | MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 128 | MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
129 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | | 129 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | |
130 | ATA_FLAG_PIO_POLLING, | 130 | ATA_FLAG_PIO_POLLING, |
131 | |||
131 | MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, | 132 | MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, |
132 | 133 | ||
134 | MV_GENIIE_FLAGS = MV_COMMON_FLAGS | MV_6XXX_FLAGS | | ||
135 | ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA | | ||
136 | ATA_FLAG_NCQ | ATA_FLAG_AN, | ||
137 | |||
133 | CRQB_FLAG_READ = (1 << 0), | 138 | CRQB_FLAG_READ = (1 << 0), |
134 | CRQB_TAG_SHIFT = 1, | 139 | CRQB_TAG_SHIFT = 1, |
135 | CRQB_IOID_SHIFT = 6, /* CRQB Gen-II/IIE IO Id shift */ | 140 | CRQB_IOID_SHIFT = 6, /* CRQB Gen-II/IIE IO Id shift */ |
@@ -197,13 +202,6 @@ enum { | |||
197 | HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ | 202 | HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ |
198 | HC_MAIN_RSVD_5 = (0x1fff << 19), /* bits 31-19 */ | 203 | HC_MAIN_RSVD_5 = (0x1fff << 19), /* bits 31-19 */ |
199 | HC_MAIN_RSVD_SOC = (0x3fffffb << 6), /* bits 31-9, 7-6 */ | 204 | HC_MAIN_RSVD_SOC = (0x3fffffb << 6), /* bits 31-9, 7-6 */ |
200 | HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE | | ||
201 | PORTS_0_3_COAL_DONE | PORTS_4_7_COAL_DONE | | ||
202 | PORTS_0_7_COAL_DONE | GPIO_INT | TWSI_INT | | ||
203 | HC_MAIN_RSVD), | ||
204 | HC_MAIN_MASKED_IRQS_5 = (PORTS_0_3_COAL_DONE | PORTS_4_7_COAL_DONE | | ||
205 | HC_MAIN_RSVD_5), | ||
206 | HC_MAIN_MASKED_IRQS_SOC = (PORTS_0_3_COAL_DONE | HC_MAIN_RSVD_SOC), | ||
207 | 205 | ||
208 | /* SATAHC registers */ | 206 | /* SATAHC registers */ |
209 | HC_CFG_OFS = 0, | 207 | HC_CFG_OFS = 0, |
@@ -221,6 +219,7 @@ enum { | |||
221 | SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ | 219 | SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ |
222 | SATA_ACTIVE_OFS = 0x350, | 220 | SATA_ACTIVE_OFS = 0x350, |
223 | SATA_FIS_IRQ_CAUSE_OFS = 0x364, | 221 | SATA_FIS_IRQ_CAUSE_OFS = 0x364, |
222 | SATA_FIS_IRQ_AN = (1 << 9), /* async notification */ | ||
224 | 223 | ||
225 | LTMODE_OFS = 0x30c, | 224 | LTMODE_OFS = 0x30c, |
226 | LTMODE_BIT8 = (1 << 8), /* unknown, but necessary */ | 225 | LTMODE_BIT8 = (1 << 8), /* unknown, but necessary */ |
@@ -459,6 +458,7 @@ struct mv_port_signal { | |||
459 | 458 | ||
460 | struct mv_host_priv { | 459 | struct mv_host_priv { |
461 | u32 hp_flags; | 460 | u32 hp_flags; |
461 | u32 main_irq_mask; | ||
462 | struct mv_port_signal signal[8]; | 462 | struct mv_port_signal signal[8]; |
463 | const struct mv_hw_ops *ops; | 463 | const struct mv_hw_ops *ops; |
464 | int n_ports; | 464 | int n_ports; |
@@ -640,25 +640,19 @@ static const struct ata_port_info mv_port_info[] = { | |||
640 | .port_ops = &mv6_ops, | 640 | .port_ops = &mv6_ops, |
641 | }, | 641 | }, |
642 | { /* chip_6042 */ | 642 | { /* chip_6042 */ |
643 | .flags = MV_COMMON_FLAGS | MV_6XXX_FLAGS | | 643 | .flags = MV_GENIIE_FLAGS, |
644 | ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA | | ||
645 | ATA_FLAG_NCQ, | ||
646 | .pio_mask = 0x1f, /* pio0-4 */ | 644 | .pio_mask = 0x1f, /* pio0-4 */ |
647 | .udma_mask = ATA_UDMA6, | 645 | .udma_mask = ATA_UDMA6, |
648 | .port_ops = &mv_iie_ops, | 646 | .port_ops = &mv_iie_ops, |
649 | }, | 647 | }, |
650 | { /* chip_7042 */ | 648 | { /* chip_7042 */ |
651 | .flags = MV_COMMON_FLAGS | MV_6XXX_FLAGS | | 649 | .flags = MV_GENIIE_FLAGS, |
652 | ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA | | ||
653 | ATA_FLAG_NCQ, | ||
654 | .pio_mask = 0x1f, /* pio0-4 */ | 650 | .pio_mask = 0x1f, /* pio0-4 */ |
655 | .udma_mask = ATA_UDMA6, | 651 | .udma_mask = ATA_UDMA6, |
656 | .port_ops = &mv_iie_ops, | 652 | .port_ops = &mv_iie_ops, |
657 | }, | 653 | }, |
658 | { /* chip_soc */ | 654 | { /* chip_soc */ |
659 | .flags = MV_COMMON_FLAGS | MV_6XXX_FLAGS | | 655 | .flags = MV_GENIIE_FLAGS | MV_FLAG_SOC, |
660 | ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA | | ||
661 | ATA_FLAG_NCQ | MV_FLAG_SOC, | ||
662 | .pio_mask = 0x1f, /* pio0-4 */ | 656 | .pio_mask = 0x1f, /* pio0-4 */ |
663 | .udma_mask = ATA_UDMA6, | 657 | .udma_mask = ATA_UDMA6, |
664 | .port_ops = &mv_iie_ops, | 658 | .port_ops = &mv_iie_ops, |
@@ -844,6 +838,33 @@ static void mv_set_edma_ptrs(void __iomem *port_mmio, | |||
844 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 838 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
845 | } | 839 | } |
846 | 840 | ||
841 | static void mv_set_main_irq_mask(struct ata_host *host, | ||
842 | u32 disable_bits, u32 enable_bits) | ||
843 | { | ||
844 | struct mv_host_priv *hpriv = host->private_data; | ||
845 | u32 old_mask, new_mask; | ||
846 | |||
847 | old_mask = hpriv->main_irq_mask; | ||
848 | new_mask = (old_mask & ~disable_bits) | enable_bits; | ||
849 | if (new_mask != old_mask) { | ||
850 | hpriv->main_irq_mask = new_mask; | ||
851 | writelfl(new_mask, hpriv->main_irq_mask_addr); | ||
852 | } | ||
853 | } | ||
854 | |||
855 | static void mv_enable_port_irqs(struct ata_port *ap, | ||
856 | unsigned int port_bits) | ||
857 | { | ||
858 | unsigned int shift, hardport, port = ap->port_no; | ||
859 | u32 disable_bits, enable_bits; | ||
860 | |||
861 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | ||
862 | |||
863 | disable_bits = (DONE_IRQ | ERR_IRQ) << shift; | ||
864 | enable_bits = port_bits << shift; | ||
865 | mv_set_main_irq_mask(ap->host, disable_bits, enable_bits); | ||
866 | } | ||
867 | |||
847 | /** | 868 | /** |
848 | * mv_start_dma - Enable eDMA engine | 869 | * mv_start_dma - Enable eDMA engine |
849 | * @base: port base address | 870 | * @base: port base address |
@@ -886,9 +907,11 @@ static void mv_start_dma(struct ata_port *ap, void __iomem *port_mmio, | |||
886 | mv_edma_cfg(ap, want_ncq); | 907 | mv_edma_cfg(ap, want_ncq); |
887 | 908 | ||
888 | /* clear FIS IRQ Cause */ | 909 | /* clear FIS IRQ Cause */ |
889 | writelfl(0, port_mmio + SATA_FIS_IRQ_CAUSE_OFS); | 910 | if (IS_GEN_IIE(hpriv)) |
911 | writelfl(0, port_mmio + SATA_FIS_IRQ_CAUSE_OFS); | ||
890 | 912 | ||
891 | mv_set_edma_ptrs(port_mmio, hpriv, pp); | 913 | mv_set_edma_ptrs(port_mmio, hpriv, pp); |
914 | mv_enable_port_irqs(ap, DONE_IRQ|ERR_IRQ); | ||
892 | 915 | ||
893 | writelfl(EDMA_EN, port_mmio + EDMA_CMD_OFS); | 916 | writelfl(EDMA_EN, port_mmio + EDMA_CMD_OFS); |
894 | pp->pp_flags |= MV_PP_FLAG_EDMA_EN; | 917 | pp->pp_flags |= MV_PP_FLAG_EDMA_EN; |
@@ -1341,6 +1364,7 @@ out_port_free_dma_mem: | |||
1341 | static void mv_port_stop(struct ata_port *ap) | 1364 | static void mv_port_stop(struct ata_port *ap) |
1342 | { | 1365 | { |
1343 | mv_stop_edma(ap); | 1366 | mv_stop_edma(ap); |
1367 | mv_enable_port_irqs(ap, 0); | ||
1344 | mv_port_free_dma_mem(ap); | 1368 | mv_port_free_dma_mem(ap); |
1345 | } | 1369 | } |
1346 | 1370 | ||
@@ -1582,6 +1606,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc) | |||
1582 | * shadow block, etc registers. | 1606 | * shadow block, etc registers. |
1583 | */ | 1607 | */ |
1584 | mv_stop_edma(ap); | 1608 | mv_stop_edma(ap); |
1609 | mv_enable_port_irqs(ap, ERR_IRQ); | ||
1585 | mv_pmp_select(ap, qc->dev->link->pmp); | 1610 | mv_pmp_select(ap, qc->dev->link->pmp); |
1586 | return ata_sff_qc_issue(qc); | 1611 | return ata_sff_qc_issue(qc); |
1587 | } | 1612 | } |
@@ -1670,6 +1695,18 @@ static void mv_pmp_eh_prep(struct ata_port *ap, unsigned int pmp_map) | |||
1670 | } | 1695 | } |
1671 | } | 1696 | } |
1672 | 1697 | ||
1698 | static int mv_req_q_empty(struct ata_port *ap) | ||
1699 | { | ||
1700 | void __iomem *port_mmio = mv_ap_base(ap); | ||
1701 | u32 in_ptr, out_ptr; | ||
1702 | |||
1703 | in_ptr = (readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS) | ||
1704 | >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | ||
1705 | out_ptr = (readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) | ||
1706 | >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | ||
1707 | return (in_ptr == out_ptr); /* 1 == queue_is_empty */ | ||
1708 | } | ||
1709 | |||
1673 | static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap) | 1710 | static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap) |
1674 | { | 1711 | { |
1675 | struct mv_port_priv *pp = ap->private_data; | 1712 | struct mv_port_priv *pp = ap->private_data; |
@@ -1703,7 +1740,7 @@ static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap) | |||
1703 | ap->qc_active, failed_links, | 1740 | ap->qc_active, failed_links, |
1704 | ap->nr_active_links); | 1741 | ap->nr_active_links); |
1705 | 1742 | ||
1706 | if (ap->nr_active_links <= failed_links) { | 1743 | if (ap->nr_active_links <= failed_links && mv_req_q_empty(ap)) { |
1707 | mv_process_crpb_entries(ap, pp); | 1744 | mv_process_crpb_entries(ap, pp); |
1708 | mv_stop_edma(ap); | 1745 | mv_stop_edma(ap); |
1709 | mv_eh_freeze(ap); | 1746 | mv_eh_freeze(ap); |
@@ -1812,6 +1849,7 @@ static void mv_err_intr(struct ata_port *ap) | |||
1812 | { | 1849 | { |
1813 | void __iomem *port_mmio = mv_ap_base(ap); | 1850 | void __iomem *port_mmio = mv_ap_base(ap); |
1814 | u32 edma_err_cause, eh_freeze_mask, serr = 0; | 1851 | u32 edma_err_cause, eh_freeze_mask, serr = 0; |
1852 | u32 fis_cause = 0; | ||
1815 | struct mv_port_priv *pp = ap->private_data; | 1853 | struct mv_port_priv *pp = ap->private_data; |
1816 | struct mv_host_priv *hpriv = ap->host->private_data; | 1854 | struct mv_host_priv *hpriv = ap->host->private_data; |
1817 | unsigned int action = 0, err_mask = 0; | 1855 | unsigned int action = 0, err_mask = 0; |
@@ -1821,16 +1859,19 @@ static void mv_err_intr(struct ata_port *ap) | |||
1821 | 1859 | ||
1822 | /* | 1860 | /* |
1823 | * Read and clear the SError and err_cause bits. | 1861 | * Read and clear the SError and err_cause bits. |
1862 | * For GenIIe, if EDMA_ERR_TRANS_IRQ_7 is set, we also must read/clear | ||
1863 | * the FIS_IRQ_CAUSE register before clearing edma_err_cause. | ||
1824 | */ | 1864 | */ |
1825 | sata_scr_read(&ap->link, SCR_ERROR, &serr); | 1865 | sata_scr_read(&ap->link, SCR_ERROR, &serr); |
1826 | sata_scr_write_flush(&ap->link, SCR_ERROR, serr); | 1866 | sata_scr_write_flush(&ap->link, SCR_ERROR, serr); |
1827 | 1867 | ||
1828 | edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 1868 | edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
1869 | if (IS_GEN_IIE(hpriv) && (edma_err_cause & EDMA_ERR_TRANS_IRQ_7)) { | ||
1870 | fis_cause = readl(port_mmio + SATA_FIS_IRQ_CAUSE_OFS); | ||
1871 | writelfl(~fis_cause, port_mmio + SATA_FIS_IRQ_CAUSE_OFS); | ||
1872 | } | ||
1829 | writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 1873 | writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
1830 | 1874 | ||
1831 | ata_port_printk(ap, KERN_INFO, "%s: err_cause=%08x pp_flags=0x%x\n", | ||
1832 | __func__, edma_err_cause, pp->pp_flags); | ||
1833 | |||
1834 | if (edma_err_cause & EDMA_ERR_DEV) { | 1875 | if (edma_err_cause & EDMA_ERR_DEV) { |
1835 | /* | 1876 | /* |
1836 | * Device errors during FIS-based switching operation | 1877 | * Device errors during FIS-based switching operation |
@@ -1844,6 +1885,18 @@ static void mv_err_intr(struct ata_port *ap) | |||
1844 | ata_ehi_clear_desc(ehi); | 1885 | ata_ehi_clear_desc(ehi); |
1845 | ata_ehi_push_desc(ehi, "edma_err_cause=%08x pp_flags=%08x", | 1886 | ata_ehi_push_desc(ehi, "edma_err_cause=%08x pp_flags=%08x", |
1846 | edma_err_cause, pp->pp_flags); | 1887 | edma_err_cause, pp->pp_flags); |
1888 | |||
1889 | if (IS_GEN_IIE(hpriv) && (edma_err_cause & EDMA_ERR_TRANS_IRQ_7)) { | ||
1890 | ata_ehi_push_desc(ehi, "fis_cause=%08x", fis_cause); | ||
1891 | if (fis_cause & SATA_FIS_IRQ_AN) { | ||
1892 | u32 ec = edma_err_cause & | ||
1893 | ~(EDMA_ERR_TRANS_IRQ_7 | EDMA_ERR_IRQ_TRANSIENT); | ||
1894 | sata_async_notification(ap); | ||
1895 | if (!ec) | ||
1896 | return; /* Just an AN; no need for the nukes */ | ||
1897 | ata_ehi_push_desc(ehi, "SDB notify"); | ||
1898 | } | ||
1899 | } | ||
1847 | /* | 1900 | /* |
1848 | * All generations share these EDMA error cause bits: | 1901 | * All generations share these EDMA error cause bits: |
1849 | */ | 1902 | */ |
@@ -2162,20 +2215,20 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance) | |||
2162 | struct ata_host *host = dev_instance; | 2215 | struct ata_host *host = dev_instance; |
2163 | struct mv_host_priv *hpriv = host->private_data; | 2216 | struct mv_host_priv *hpriv = host->private_data; |
2164 | unsigned int handled = 0; | 2217 | unsigned int handled = 0; |
2165 | u32 main_irq_cause, main_irq_mask; | 2218 | u32 main_irq_cause, pending_irqs; |
2166 | 2219 | ||
2167 | spin_lock(&host->lock); | 2220 | spin_lock(&host->lock); |
2168 | main_irq_cause = readl(hpriv->main_irq_cause_addr); | 2221 | main_irq_cause = readl(hpriv->main_irq_cause_addr); |
2169 | main_irq_mask = readl(hpriv->main_irq_mask_addr); | 2222 | pending_irqs = main_irq_cause & hpriv->main_irq_mask; |
2170 | /* | 2223 | /* |
2171 | * Deal with cases where we either have nothing pending, or have read | 2224 | * Deal with cases where we either have nothing pending, or have read |
2172 | * a bogus register value which can indicate HW removal or PCI fault. | 2225 | * a bogus register value which can indicate HW removal or PCI fault. |
2173 | */ | 2226 | */ |
2174 | if ((main_irq_cause & main_irq_mask) && (main_irq_cause != 0xffffffffU)) { | 2227 | if (pending_irqs && main_irq_cause != 0xffffffffU) { |
2175 | if (unlikely((main_irq_cause & PCI_ERR) && HAS_PCI(host))) | 2228 | if (unlikely((pending_irqs & PCI_ERR) && HAS_PCI(host))) |
2176 | handled = mv_pci_error(host, hpriv->base); | 2229 | handled = mv_pci_error(host, hpriv->base); |
2177 | else | 2230 | else |
2178 | handled = mv_host_intr(host, main_irq_cause); | 2231 | handled = mv_host_intr(host, pending_irqs); |
2179 | } | 2232 | } |
2180 | spin_unlock(&host->lock); | 2233 | spin_unlock(&host->lock); |
2181 | return IRQ_RETVAL(handled); | 2234 | return IRQ_RETVAL(handled); |
@@ -2373,7 +2426,6 @@ static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio) | |||
2373 | ZERO(MV_PCI_DISC_TIMER); | 2426 | ZERO(MV_PCI_DISC_TIMER); |
2374 | ZERO(MV_PCI_MSI_TRIGGER); | 2427 | ZERO(MV_PCI_MSI_TRIGGER); |
2375 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT_OFS); | 2428 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT_OFS); |
2376 | ZERO(PCI_HC_MAIN_IRQ_MASK_OFS); | ||
2377 | ZERO(MV_PCI_SERR_MASK); | 2429 | ZERO(MV_PCI_SERR_MASK); |
2378 | ZERO(hpriv->irq_cause_ofs); | 2430 | ZERO(hpriv->irq_cause_ofs); |
2379 | ZERO(hpriv->irq_mask_ofs); | 2431 | ZERO(hpriv->irq_mask_ofs); |
@@ -2728,6 +2780,7 @@ static int mv_hardreset(struct ata_link *link, unsigned int *class, | |||
2728 | 2780 | ||
2729 | rc = sata_link_hardreset(link, timing, deadline + extra, | 2781 | rc = sata_link_hardreset(link, timing, deadline + extra, |
2730 | &online, NULL); | 2782 | &online, NULL); |
2783 | rc = online ? -EAGAIN : rc; | ||
2731 | if (rc) | 2784 | if (rc) |
2732 | return rc; | 2785 | return rc; |
2733 | sata_scr_read(link, SCR_STATUS, &sstatus); | 2786 | sata_scr_read(link, SCR_STATUS, &sstatus); |
@@ -2744,32 +2797,18 @@ static int mv_hardreset(struct ata_link *link, unsigned int *class, | |||
2744 | 2797 | ||
2745 | static void mv_eh_freeze(struct ata_port *ap) | 2798 | static void mv_eh_freeze(struct ata_port *ap) |
2746 | { | 2799 | { |
2747 | struct mv_host_priv *hpriv = ap->host->private_data; | ||
2748 | unsigned int shift, hardport, port = ap->port_no; | ||
2749 | u32 main_irq_mask; | ||
2750 | |||
2751 | /* FIXME: handle coalescing completion events properly */ | ||
2752 | |||
2753 | mv_stop_edma(ap); | 2800 | mv_stop_edma(ap); |
2754 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | 2801 | mv_enable_port_irqs(ap, 0); |
2755 | |||
2756 | /* disable assertion of portN err, done events */ | ||
2757 | main_irq_mask = readl(hpriv->main_irq_mask_addr); | ||
2758 | main_irq_mask &= ~((DONE_IRQ | ERR_IRQ) << shift); | ||
2759 | writelfl(main_irq_mask, hpriv->main_irq_mask_addr); | ||
2760 | } | 2802 | } |
2761 | 2803 | ||
2762 | static void mv_eh_thaw(struct ata_port *ap) | 2804 | static void mv_eh_thaw(struct ata_port *ap) |
2763 | { | 2805 | { |
2764 | struct mv_host_priv *hpriv = ap->host->private_data; | 2806 | struct mv_host_priv *hpriv = ap->host->private_data; |
2765 | unsigned int shift, hardport, port = ap->port_no; | 2807 | unsigned int port = ap->port_no; |
2808 | unsigned int hardport = mv_hardport_from_port(port); | ||
2766 | void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port); | 2809 | void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port); |
2767 | void __iomem *port_mmio = mv_ap_base(ap); | 2810 | void __iomem *port_mmio = mv_ap_base(ap); |
2768 | u32 main_irq_mask, hc_irq_cause; | 2811 | u32 hc_irq_cause; |
2769 | |||
2770 | /* FIXME: handle coalescing completion events properly */ | ||
2771 | |||
2772 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | ||
2773 | 2812 | ||
2774 | /* clear EDMA errors on this port */ | 2813 | /* clear EDMA errors on this port */ |
2775 | writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 2814 | writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
@@ -2779,10 +2818,7 @@ static void mv_eh_thaw(struct ata_port *ap) | |||
2779 | hc_irq_cause &= ~((DEV_IRQ | DMA_IRQ) << hardport); | 2818 | hc_irq_cause &= ~((DEV_IRQ | DMA_IRQ) << hardport); |
2780 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); | 2819 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); |
2781 | 2820 | ||
2782 | /* enable assertion of portN err, done events */ | 2821 | mv_enable_port_irqs(ap, ERR_IRQ); |
2783 | main_irq_mask = readl(hpriv->main_irq_mask_addr); | ||
2784 | main_irq_mask |= ((DONE_IRQ | ERR_IRQ) << shift); | ||
2785 | writelfl(main_irq_mask, hpriv->main_irq_mask_addr); | ||
2786 | } | 2822 | } |
2787 | 2823 | ||
2788 | /** | 2824 | /** |
@@ -3035,7 +3071,7 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
3035 | } | 3071 | } |
3036 | 3072 | ||
3037 | /* global interrupt mask: 0 == mask everything */ | 3073 | /* global interrupt mask: 0 == mask everything */ |
3038 | writel(0, hpriv->main_irq_mask_addr); | 3074 | mv_set_main_irq_mask(host, ~0, 0); |
3039 | 3075 | ||
3040 | n_hc = mv_get_hc_count(host->ports[0]->flags); | 3076 | n_hc = mv_get_hc_count(host->ports[0]->flags); |
3041 | 3077 | ||
@@ -3083,25 +3119,12 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
3083 | 3119 | ||
3084 | /* and unmask interrupt generation for host regs */ | 3120 | /* and unmask interrupt generation for host regs */ |
3085 | writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); | 3121 | writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); |
3086 | if (IS_GEN_I(hpriv)) | 3122 | |
3087 | writelfl(~HC_MAIN_MASKED_IRQS_5, | 3123 | /* |
3088 | hpriv->main_irq_mask_addr); | 3124 | * enable only global host interrupts for now. |
3089 | else | 3125 | * The per-port interrupts get done later as ports are set up. |
3090 | writelfl(~HC_MAIN_MASKED_IRQS, | 3126 | */ |
3091 | hpriv->main_irq_mask_addr); | 3127 | mv_set_main_irq_mask(host, 0, PCI_ERR); |
3092 | |||
3093 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " | ||
3094 | "PCI int cause/mask=0x%08x/0x%08x\n", | ||
3095 | readl(hpriv->main_irq_cause_addr), | ||
3096 | readl(hpriv->main_irq_mask_addr), | ||
3097 | readl(mmio + hpriv->irq_cause_ofs), | ||
3098 | readl(mmio + hpriv->irq_mask_ofs)); | ||
3099 | } else { | ||
3100 | writelfl(~HC_MAIN_MASKED_IRQS_SOC, | ||
3101 | hpriv->main_irq_mask_addr); | ||
3102 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x\n", | ||
3103 | readl(hpriv->main_irq_cause_addr), | ||
3104 | readl(hpriv->main_irq_mask_addr)); | ||
3105 | } | 3128 | } |
3106 | done: | 3129 | done: |
3107 | return rc; | 3130 | return rc; |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 5a10dc5048ad..030665ba76b7 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -53,7 +53,15 @@ enum { | |||
53 | PDC_MMIO_BAR = 3, | 53 | PDC_MMIO_BAR = 3, |
54 | PDC_MAX_PRD = LIBATA_MAX_PRD - 1, /* -1 for ASIC PRD bug workaround */ | 54 | PDC_MAX_PRD = LIBATA_MAX_PRD - 1, /* -1 for ASIC PRD bug workaround */ |
55 | 55 | ||
56 | /* register offsets */ | 56 | /* host register offsets (from host->iomap[PDC_MMIO_BAR]) */ |
57 | PDC_INT_SEQMASK = 0x40, /* Mask of asserted SEQ INTs */ | ||
58 | PDC_FLASH_CTL = 0x44, /* Flash control register */ | ||
59 | PDC_SATA_PLUG_CSR = 0x6C, /* SATA Plug control/status reg */ | ||
60 | PDC2_SATA_PLUG_CSR = 0x60, /* SATAII Plug control/status reg */ | ||
61 | PDC_TBG_MODE = 0x41C, /* TBG mode (not SATAII) */ | ||
62 | PDC_SLEW_CTL = 0x470, /* slew rate control reg (not SATAII) */ | ||
63 | |||
64 | /* per-port ATA register offsets (from ap->ioaddr.cmd_addr) */ | ||
57 | PDC_FEATURE = 0x04, /* Feature/Error reg (per port) */ | 65 | PDC_FEATURE = 0x04, /* Feature/Error reg (per port) */ |
58 | PDC_SECTOR_COUNT = 0x08, /* Sector count reg (per port) */ | 66 | PDC_SECTOR_COUNT = 0x08, /* Sector count reg (per port) */ |
59 | PDC_SECTOR_NUMBER = 0x0C, /* Sector number reg (per port) */ | 67 | PDC_SECTOR_NUMBER = 0x0C, /* Sector number reg (per port) */ |
@@ -63,14 +71,11 @@ enum { | |||
63 | PDC_COMMAND = 0x1C, /* Command/status reg (per port) */ | 71 | PDC_COMMAND = 0x1C, /* Command/status reg (per port) */ |
64 | PDC_ALTSTATUS = 0x38, /* Alternate-status/device-control reg (per port) */ | 72 | PDC_ALTSTATUS = 0x38, /* Alternate-status/device-control reg (per port) */ |
65 | PDC_PKT_SUBMIT = 0x40, /* Command packet pointer addr */ | 73 | PDC_PKT_SUBMIT = 0x40, /* Command packet pointer addr */ |
66 | PDC_INT_SEQMASK = 0x40, /* Mask of asserted SEQ INTs */ | ||
67 | PDC_FLASH_CTL = 0x44, /* Flash control register */ | ||
68 | PDC_GLOBAL_CTL = 0x48, /* Global control/status (per port) */ | 74 | PDC_GLOBAL_CTL = 0x48, /* Global control/status (per port) */ |
69 | PDC_CTLSTAT = 0x60, /* IDE control and status (per port) */ | 75 | PDC_CTLSTAT = 0x60, /* IDE control and status (per port) */ |
70 | PDC_SATA_PLUG_CSR = 0x6C, /* SATA Plug control/status reg */ | 76 | |
71 | PDC2_SATA_PLUG_CSR = 0x60, /* SATAII Plug control/status reg */ | 77 | /* per-port SATA register offsets (from ap->ioaddr.scr_addr) */ |
72 | PDC_TBG_MODE = 0x41C, /* TBG mode (not SATAII) */ | 78 | PDC_PHYMODE4 = 0x14, |
73 | PDC_SLEW_CTL = 0x470, /* slew rate control reg (not SATAII) */ | ||
74 | 79 | ||
75 | /* PDC_GLOBAL_CTL bit definitions */ | 80 | /* PDC_GLOBAL_CTL bit definitions */ |
76 | PDC_PH_ERR = (1 << 8), /* PCI error while loading packet */ | 81 | PDC_PH_ERR = (1 << 8), /* PCI error while loading packet */ |
@@ -134,7 +139,7 @@ struct pdc_port_priv { | |||
134 | 139 | ||
135 | static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); | 140 | static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); |
136 | static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); | 141 | static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); |
137 | static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 142 | static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
138 | static int pdc_common_port_start(struct ata_port *ap); | 143 | static int pdc_common_port_start(struct ata_port *ap); |
139 | static int pdc_sata_port_start(struct ata_port *ap); | 144 | static int pdc_sata_port_start(struct ata_port *ap); |
140 | static void pdc_qc_prep(struct ata_queued_cmd *qc); | 145 | static void pdc_qc_prep(struct ata_queued_cmd *qc); |
@@ -332,12 +337,12 @@ static int pdc_sata_port_start(struct ata_port *ap) | |||
332 | 337 | ||
333 | /* fix up PHYMODE4 align timing */ | 338 | /* fix up PHYMODE4 align timing */ |
334 | if (ap->flags & PDC_FLAG_GEN_II) { | 339 | if (ap->flags & PDC_FLAG_GEN_II) { |
335 | void __iomem *mmio = ap->ioaddr.scr_addr; | 340 | void __iomem *sata_mmio = ap->ioaddr.scr_addr; |
336 | unsigned int tmp; | 341 | unsigned int tmp; |
337 | 342 | ||
338 | tmp = readl(mmio + 0x014); | 343 | tmp = readl(sata_mmio + PDC_PHYMODE4); |
339 | tmp = (tmp & ~3) | 1; /* set bits 1:0 = 0:1 */ | 344 | tmp = (tmp & ~3) | 1; /* set bits 1:0 = 0:1 */ |
340 | writel(tmp, mmio + 0x014); | 345 | writel(tmp, sata_mmio + PDC_PHYMODE4); |
341 | } | 346 | } |
342 | 347 | ||
343 | return 0; | 348 | return 0; |
@@ -345,32 +350,32 @@ static int pdc_sata_port_start(struct ata_port *ap) | |||
345 | 350 | ||
346 | static void pdc_reset_port(struct ata_port *ap) | 351 | static void pdc_reset_port(struct ata_port *ap) |
347 | { | 352 | { |
348 | void __iomem *mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT; | 353 | void __iomem *ata_ctlstat_mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT; |
349 | unsigned int i; | 354 | unsigned int i; |
350 | u32 tmp; | 355 | u32 tmp; |
351 | 356 | ||
352 | for (i = 11; i > 0; i--) { | 357 | for (i = 11; i > 0; i--) { |
353 | tmp = readl(mmio); | 358 | tmp = readl(ata_ctlstat_mmio); |
354 | if (tmp & PDC_RESET) | 359 | if (tmp & PDC_RESET) |
355 | break; | 360 | break; |
356 | 361 | ||
357 | udelay(100); | 362 | udelay(100); |
358 | 363 | ||
359 | tmp |= PDC_RESET; | 364 | tmp |= PDC_RESET; |
360 | writel(tmp, mmio); | 365 | writel(tmp, ata_ctlstat_mmio); |
361 | } | 366 | } |
362 | 367 | ||
363 | tmp &= ~PDC_RESET; | 368 | tmp &= ~PDC_RESET; |
364 | writel(tmp, mmio); | 369 | writel(tmp, ata_ctlstat_mmio); |
365 | readl(mmio); /* flush */ | 370 | readl(ata_ctlstat_mmio); /* flush */ |
366 | } | 371 | } |
367 | 372 | ||
368 | static int pdc_pata_cable_detect(struct ata_port *ap) | 373 | static int pdc_pata_cable_detect(struct ata_port *ap) |
369 | { | 374 | { |
370 | u8 tmp; | 375 | u8 tmp; |
371 | void __iomem *mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; | 376 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; |
372 | 377 | ||
373 | tmp = readb(mmio); | 378 | tmp = readb(ata_mmio + PDC_CTLSTAT + 3); |
374 | if (tmp & 0x01) | 379 | if (tmp & 0x01) |
375 | return ATA_CBL_PATA40; | 380 | return ATA_CBL_PATA40; |
376 | return ATA_CBL_PATA80; | 381 | return ATA_CBL_PATA80; |
@@ -557,31 +562,25 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc) | |||
557 | switch (qc->tf.protocol) { | 562 | switch (qc->tf.protocol) { |
558 | case ATA_PROT_DMA: | 563 | case ATA_PROT_DMA: |
559 | pdc_fill_sg(qc); | 564 | pdc_fill_sg(qc); |
560 | /* fall through */ | 565 | /*FALLTHROUGH*/ |
561 | |||
562 | case ATA_PROT_NODATA: | 566 | case ATA_PROT_NODATA: |
563 | i = pdc_pkt_header(&qc->tf, qc->ap->prd_dma, | 567 | i = pdc_pkt_header(&qc->tf, qc->ap->prd_dma, |
564 | qc->dev->devno, pp->pkt); | 568 | qc->dev->devno, pp->pkt); |
565 | |||
566 | if (qc->tf.flags & ATA_TFLAG_LBA48) | 569 | if (qc->tf.flags & ATA_TFLAG_LBA48) |
567 | i = pdc_prep_lba48(&qc->tf, pp->pkt, i); | 570 | i = pdc_prep_lba48(&qc->tf, pp->pkt, i); |
568 | else | 571 | else |
569 | i = pdc_prep_lba28(&qc->tf, pp->pkt, i); | 572 | i = pdc_prep_lba28(&qc->tf, pp->pkt, i); |
570 | |||
571 | pdc_pkt_footer(&qc->tf, pp->pkt, i); | 573 | pdc_pkt_footer(&qc->tf, pp->pkt, i); |
572 | break; | 574 | break; |
573 | |||
574 | case ATAPI_PROT_PIO: | 575 | case ATAPI_PROT_PIO: |
575 | pdc_fill_sg(qc); | 576 | pdc_fill_sg(qc); |
576 | break; | 577 | break; |
577 | |||
578 | case ATAPI_PROT_DMA: | 578 | case ATAPI_PROT_DMA: |
579 | pdc_fill_sg(qc); | 579 | pdc_fill_sg(qc); |
580 | /*FALLTHROUGH*/ | 580 | /*FALLTHROUGH*/ |
581 | case ATAPI_PROT_NODATA: | 581 | case ATAPI_PROT_NODATA: |
582 | pdc_atapi_pkt(qc); | 582 | pdc_atapi_pkt(qc); |
583 | break; | 583 | break; |
584 | |||
585 | default: | 584 | default: |
586 | break; | 585 | break; |
587 | } | 586 | } |
@@ -611,7 +610,7 @@ static unsigned int pdc_sata_ata_port_to_ata_no(const struct ata_port *ap) | |||
611 | unsigned int nr_ports = pdc_sata_nr_ports(ap); | 610 | unsigned int nr_ports = pdc_sata_nr_ports(ap); |
612 | unsigned int i; | 611 | unsigned int i; |
613 | 612 | ||
614 | for(i = 0; i < nr_ports && host->ports[i] != ap; ++i) | 613 | for (i = 0; i < nr_ports && host->ports[i] != ap; ++i) |
615 | ; | 614 | ; |
616 | BUG_ON(i >= nr_ports); | 615 | BUG_ON(i >= nr_ports); |
617 | return pdc_port_no_to_ata_no(i, pdc_is_sataii_tx4(ap->flags)); | 616 | return pdc_port_no_to_ata_no(i, pdc_is_sataii_tx4(ap->flags)); |
@@ -624,14 +623,14 @@ static unsigned int pdc_sata_hotplug_offset(const struct ata_port *ap) | |||
624 | 623 | ||
625 | static void pdc_freeze(struct ata_port *ap) | 624 | static void pdc_freeze(struct ata_port *ap) |
626 | { | 625 | { |
627 | void __iomem *mmio = ap->ioaddr.cmd_addr; | 626 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; |
628 | u32 tmp; | 627 | u32 tmp; |
629 | 628 | ||
630 | tmp = readl(mmio + PDC_CTLSTAT); | 629 | tmp = readl(ata_mmio + PDC_CTLSTAT); |
631 | tmp |= PDC_IRQ_DISABLE; | 630 | tmp |= PDC_IRQ_DISABLE; |
632 | tmp &= ~PDC_DMA_ENABLE; | 631 | tmp &= ~PDC_DMA_ENABLE; |
633 | writel(tmp, mmio + PDC_CTLSTAT); | 632 | writel(tmp, ata_mmio + PDC_CTLSTAT); |
634 | readl(mmio + PDC_CTLSTAT); /* flush */ | 633 | readl(ata_mmio + PDC_CTLSTAT); /* flush */ |
635 | } | 634 | } |
636 | 635 | ||
637 | static void pdc_sata_freeze(struct ata_port *ap) | 636 | static void pdc_sata_freeze(struct ata_port *ap) |
@@ -659,17 +658,17 @@ static void pdc_sata_freeze(struct ata_port *ap) | |||
659 | 658 | ||
660 | static void pdc_thaw(struct ata_port *ap) | 659 | static void pdc_thaw(struct ata_port *ap) |
661 | { | 660 | { |
662 | void __iomem *mmio = ap->ioaddr.cmd_addr; | 661 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; |
663 | u32 tmp; | 662 | u32 tmp; |
664 | 663 | ||
665 | /* clear IRQ */ | 664 | /* clear IRQ */ |
666 | readl(mmio + PDC_INT_SEQMASK); | 665 | readl(ata_mmio + PDC_COMMAND); |
667 | 666 | ||
668 | /* turn IRQ back on */ | 667 | /* turn IRQ back on */ |
669 | tmp = readl(mmio + PDC_CTLSTAT); | 668 | tmp = readl(ata_mmio + PDC_CTLSTAT); |
670 | tmp &= ~PDC_IRQ_DISABLE; | 669 | tmp &= ~PDC_IRQ_DISABLE; |
671 | writel(tmp, mmio + PDC_CTLSTAT); | 670 | writel(tmp, ata_mmio + PDC_CTLSTAT); |
672 | readl(mmio + PDC_CTLSTAT); /* flush */ | 671 | readl(ata_mmio + PDC_CTLSTAT); /* flush */ |
673 | } | 672 | } |
674 | 673 | ||
675 | static void pdc_sata_thaw(struct ata_port *ap) | 674 | static void pdc_sata_thaw(struct ata_port *ap) |
@@ -743,11 +742,11 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc, | |||
743 | ata_port_abort(ap); | 742 | ata_port_abort(ap); |
744 | } | 743 | } |
745 | 744 | ||
746 | static inline unsigned int pdc_host_intr(struct ata_port *ap, | 745 | static unsigned int pdc_host_intr(struct ata_port *ap, |
747 | struct ata_queued_cmd *qc) | 746 | struct ata_queued_cmd *qc) |
748 | { | 747 | { |
749 | unsigned int handled = 0; | 748 | unsigned int handled = 0; |
750 | void __iomem *port_mmio = ap->ioaddr.cmd_addr; | 749 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; |
751 | u32 port_status, err_mask; | 750 | u32 port_status, err_mask; |
752 | 751 | ||
753 | err_mask = PDC_ERR_MASK; | 752 | err_mask = PDC_ERR_MASK; |
@@ -755,7 +754,7 @@ static inline unsigned int pdc_host_intr(struct ata_port *ap, | |||
755 | err_mask &= ~PDC1_ERR_MASK; | 754 | err_mask &= ~PDC1_ERR_MASK; |
756 | else | 755 | else |
757 | err_mask &= ~PDC2_ERR_MASK; | 756 | err_mask &= ~PDC2_ERR_MASK; |
758 | port_status = readl(port_mmio + PDC_GLOBAL_CTL); | 757 | port_status = readl(ata_mmio + PDC_GLOBAL_CTL); |
759 | if (unlikely(port_status & err_mask)) { | 758 | if (unlikely(port_status & err_mask)) { |
760 | pdc_error_intr(ap, qc, port_status, err_mask); | 759 | pdc_error_intr(ap, qc, port_status, err_mask); |
761 | return 1; | 760 | return 1; |
@@ -770,7 +769,6 @@ static inline unsigned int pdc_host_intr(struct ata_port *ap, | |||
770 | ata_qc_complete(qc); | 769 | ata_qc_complete(qc); |
771 | handled = 1; | 770 | handled = 1; |
772 | break; | 771 | break; |
773 | |||
774 | default: | 772 | default: |
775 | ap->stats.idle_irq++; | 773 | ap->stats.idle_irq++; |
776 | break; | 774 | break; |
@@ -781,10 +779,9 @@ static inline unsigned int pdc_host_intr(struct ata_port *ap, | |||
781 | 779 | ||
782 | static void pdc_irq_clear(struct ata_port *ap) | 780 | static void pdc_irq_clear(struct ata_port *ap) |
783 | { | 781 | { |
784 | struct ata_host *host = ap->host; | 782 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; |
785 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; | ||
786 | 783 | ||
787 | readl(mmio + PDC_INT_SEQMASK); | 784 | readl(ata_mmio + PDC_COMMAND); |
788 | } | 785 | } |
789 | 786 | ||
790 | static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | 787 | static irqreturn_t pdc_interrupt(int irq, void *dev_instance) |
@@ -794,7 +791,7 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | |||
794 | u32 mask = 0; | 791 | u32 mask = 0; |
795 | unsigned int i, tmp; | 792 | unsigned int i, tmp; |
796 | unsigned int handled = 0; | 793 | unsigned int handled = 0; |
797 | void __iomem *mmio_base; | 794 | void __iomem *host_mmio; |
798 | unsigned int hotplug_offset, ata_no; | 795 | unsigned int hotplug_offset, ata_no; |
799 | u32 hotplug_status; | 796 | u32 hotplug_status; |
800 | int is_sataii_tx4; | 797 | int is_sataii_tx4; |
@@ -806,7 +803,7 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | |||
806 | return IRQ_NONE; | 803 | return IRQ_NONE; |
807 | } | 804 | } |
808 | 805 | ||
809 | mmio_base = host->iomap[PDC_MMIO_BAR]; | 806 | host_mmio = host->iomap[PDC_MMIO_BAR]; |
810 | 807 | ||
811 | spin_lock(&host->lock); | 808 | spin_lock(&host->lock); |
812 | 809 | ||
@@ -815,26 +812,26 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | |||
815 | hotplug_offset = PDC2_SATA_PLUG_CSR; | 812 | hotplug_offset = PDC2_SATA_PLUG_CSR; |
816 | else | 813 | else |
817 | hotplug_offset = PDC_SATA_PLUG_CSR; | 814 | hotplug_offset = PDC_SATA_PLUG_CSR; |
818 | hotplug_status = readl(mmio_base + hotplug_offset); | 815 | hotplug_status = readl(host_mmio + hotplug_offset); |
819 | if (hotplug_status & 0xff) | 816 | if (hotplug_status & 0xff) |
820 | writel(hotplug_status | 0xff, mmio_base + hotplug_offset); | 817 | writel(hotplug_status | 0xff, host_mmio + hotplug_offset); |
821 | hotplug_status &= 0xff; /* clear uninteresting bits */ | 818 | hotplug_status &= 0xff; /* clear uninteresting bits */ |
822 | 819 | ||
823 | /* reading should also clear interrupts */ | 820 | /* reading should also clear interrupts */ |
824 | mask = readl(mmio_base + PDC_INT_SEQMASK); | 821 | mask = readl(host_mmio + PDC_INT_SEQMASK); |
825 | 822 | ||
826 | if (mask == 0xffffffff && hotplug_status == 0) { | 823 | if (mask == 0xffffffff && hotplug_status == 0) { |
827 | VPRINTK("QUICK EXIT 2\n"); | 824 | VPRINTK("QUICK EXIT 2\n"); |
828 | goto done_irq; | 825 | goto done_irq; |
829 | } | 826 | } |
830 | 827 | ||
831 | mask &= 0xffff; /* only 16 tags possible */ | 828 | mask &= 0xffff; /* only 16 SEQIDs possible */ |
832 | if (mask == 0 && hotplug_status == 0) { | 829 | if (mask == 0 && hotplug_status == 0) { |
833 | VPRINTK("QUICK EXIT 3\n"); | 830 | VPRINTK("QUICK EXIT 3\n"); |
834 | goto done_irq; | 831 | goto done_irq; |
835 | } | 832 | } |
836 | 833 | ||
837 | writel(mask, mmio_base + PDC_INT_SEQMASK); | 834 | writel(mask, host_mmio + PDC_INT_SEQMASK); |
838 | 835 | ||
839 | is_sataii_tx4 = pdc_is_sataii_tx4(host->ports[0]->flags); | 836 | is_sataii_tx4 = pdc_is_sataii_tx4(host->ports[0]->flags); |
840 | 837 | ||
@@ -875,23 +872,24 @@ done_irq: | |||
875 | return IRQ_RETVAL(handled); | 872 | return IRQ_RETVAL(handled); |
876 | } | 873 | } |
877 | 874 | ||
878 | static inline void pdc_packet_start(struct ata_queued_cmd *qc) | 875 | static void pdc_packet_start(struct ata_queued_cmd *qc) |
879 | { | 876 | { |
880 | struct ata_port *ap = qc->ap; | 877 | struct ata_port *ap = qc->ap; |
881 | struct pdc_port_priv *pp = ap->private_data; | 878 | struct pdc_port_priv *pp = ap->private_data; |
882 | void __iomem *mmio = ap->host->iomap[PDC_MMIO_BAR]; | 879 | void __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR]; |
880 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; | ||
883 | unsigned int port_no = ap->port_no; | 881 | unsigned int port_no = ap->port_no; |
884 | u8 seq = (u8) (port_no + 1); | 882 | u8 seq = (u8) (port_no + 1); |
885 | 883 | ||
886 | VPRINTK("ENTER, ap %p\n", ap); | 884 | VPRINTK("ENTER, ap %p\n", ap); |
887 | 885 | ||
888 | writel(0x00000001, mmio + (seq * 4)); | 886 | writel(0x00000001, host_mmio + (seq * 4)); |
889 | readl(mmio + (seq * 4)); /* flush */ | 887 | readl(host_mmio + (seq * 4)); /* flush */ |
890 | 888 | ||
891 | pp->pkt[2] = seq; | 889 | pp->pkt[2] = seq; |
892 | wmb(); /* flush PRD, pkt writes */ | 890 | wmb(); /* flush PRD, pkt writes */ |
893 | writel(pp->pkt_dma, ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); | 891 | writel(pp->pkt_dma, ata_mmio + PDC_PKT_SUBMIT); |
894 | readl(ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ | 892 | readl(ata_mmio + PDC_PKT_SUBMIT); /* flush */ |
895 | } | 893 | } |
896 | 894 | ||
897 | static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc) | 895 | static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc) |
@@ -909,11 +907,9 @@ static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc) | |||
909 | case ATA_PROT_DMA: | 907 | case ATA_PROT_DMA: |
910 | pdc_packet_start(qc); | 908 | pdc_packet_start(qc); |
911 | return 0; | 909 | return 0; |
912 | |||
913 | default: | 910 | default: |
914 | break; | 911 | break; |
915 | } | 912 | } |
916 | |||
917 | return ata_sff_qc_issue(qc); | 913 | return ata_sff_qc_issue(qc); |
918 | } | 914 | } |
919 | 915 | ||
@@ -987,7 +983,7 @@ static void pdc_ata_setup_port(struct ata_port *ap, | |||
987 | 983 | ||
988 | static void pdc_host_init(struct ata_host *host) | 984 | static void pdc_host_init(struct ata_host *host) |
989 | { | 985 | { |
990 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; | 986 | void __iomem *host_mmio = host->iomap[PDC_MMIO_BAR]; |
991 | int is_gen2 = host->ports[0]->flags & PDC_FLAG_GEN_II; | 987 | int is_gen2 = host->ports[0]->flags & PDC_FLAG_GEN_II; |
992 | int hotplug_offset; | 988 | int hotplug_offset; |
993 | u32 tmp; | 989 | u32 tmp; |
@@ -1004,38 +1000,38 @@ static void pdc_host_init(struct ata_host *host) | |||
1004 | */ | 1000 | */ |
1005 | 1001 | ||
1006 | /* enable BMR_BURST, maybe change FIFO_SHD to 8 dwords */ | 1002 | /* enable BMR_BURST, maybe change FIFO_SHD to 8 dwords */ |
1007 | tmp = readl(mmio + PDC_FLASH_CTL); | 1003 | tmp = readl(host_mmio + PDC_FLASH_CTL); |
1008 | tmp |= 0x02000; /* bit 13 (enable bmr burst) */ | 1004 | tmp |= 0x02000; /* bit 13 (enable bmr burst) */ |
1009 | if (!is_gen2) | 1005 | if (!is_gen2) |
1010 | tmp |= 0x10000; /* bit 16 (fifo threshold at 8 dw) */ | 1006 | tmp |= 0x10000; /* bit 16 (fifo threshold at 8 dw) */ |
1011 | writel(tmp, mmio + PDC_FLASH_CTL); | 1007 | writel(tmp, host_mmio + PDC_FLASH_CTL); |
1012 | 1008 | ||
1013 | /* clear plug/unplug flags for all ports */ | 1009 | /* clear plug/unplug flags for all ports */ |
1014 | tmp = readl(mmio + hotplug_offset); | 1010 | tmp = readl(host_mmio + hotplug_offset); |
1015 | writel(tmp | 0xff, mmio + hotplug_offset); | 1011 | writel(tmp | 0xff, host_mmio + hotplug_offset); |
1016 | 1012 | ||
1017 | /* unmask plug/unplug ints */ | 1013 | /* unmask plug/unplug ints */ |
1018 | tmp = readl(mmio + hotplug_offset); | 1014 | tmp = readl(host_mmio + hotplug_offset); |
1019 | writel(tmp & ~0xff0000, mmio + hotplug_offset); | 1015 | writel(tmp & ~0xff0000, host_mmio + hotplug_offset); |
1020 | 1016 | ||
1021 | /* don't initialise TBG or SLEW on 2nd generation chips */ | 1017 | /* don't initialise TBG or SLEW on 2nd generation chips */ |
1022 | if (is_gen2) | 1018 | if (is_gen2) |
1023 | return; | 1019 | return; |
1024 | 1020 | ||
1025 | /* reduce TBG clock to 133 Mhz. */ | 1021 | /* reduce TBG clock to 133 Mhz. */ |
1026 | tmp = readl(mmio + PDC_TBG_MODE); | 1022 | tmp = readl(host_mmio + PDC_TBG_MODE); |
1027 | tmp &= ~0x30000; /* clear bit 17, 16*/ | 1023 | tmp &= ~0x30000; /* clear bit 17, 16*/ |
1028 | tmp |= 0x10000; /* set bit 17:16 = 0:1 */ | 1024 | tmp |= 0x10000; /* set bit 17:16 = 0:1 */ |
1029 | writel(tmp, mmio + PDC_TBG_MODE); | 1025 | writel(tmp, host_mmio + PDC_TBG_MODE); |
1030 | 1026 | ||
1031 | readl(mmio + PDC_TBG_MODE); /* flush */ | 1027 | readl(host_mmio + PDC_TBG_MODE); /* flush */ |
1032 | msleep(10); | 1028 | msleep(10); |
1033 | 1029 | ||
1034 | /* adjust slew rate control register. */ | 1030 | /* adjust slew rate control register. */ |
1035 | tmp = readl(mmio + PDC_SLEW_CTL); | 1031 | tmp = readl(host_mmio + PDC_SLEW_CTL); |
1036 | tmp &= 0xFFFFF03F; /* clear bit 11 ~ 6 */ | 1032 | tmp &= 0xFFFFF03F; /* clear bit 11 ~ 6 */ |
1037 | tmp |= 0x00000900; /* set bit 11-9 = 100b , bit 8-6 = 100 */ | 1033 | tmp |= 0x00000900; /* set bit 11-9 = 100b , bit 8-6 = 100 */ |
1038 | writel(tmp, mmio + PDC_SLEW_CTL); | 1034 | writel(tmp, host_mmio + PDC_SLEW_CTL); |
1039 | } | 1035 | } |
1040 | 1036 | ||
1041 | static int pdc_ata_init_one(struct pci_dev *pdev, | 1037 | static int pdc_ata_init_one(struct pci_dev *pdev, |
@@ -1045,7 +1041,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | |||
1045 | const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; | 1041 | const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; |
1046 | const struct ata_port_info *ppi[PDC_MAX_PORTS]; | 1042 | const struct ata_port_info *ppi[PDC_MAX_PORTS]; |
1047 | struct ata_host *host; | 1043 | struct ata_host *host; |
1048 | void __iomem *base; | 1044 | void __iomem *host_mmio; |
1049 | int n_ports, i, rc; | 1045 | int n_ports, i, rc; |
1050 | int is_sataii_tx4; | 1046 | int is_sataii_tx4; |
1051 | 1047 | ||
@@ -1062,7 +1058,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | |||
1062 | pcim_pin_device(pdev); | 1058 | pcim_pin_device(pdev); |
1063 | if (rc) | 1059 | if (rc) |
1064 | return rc; | 1060 | return rc; |
1065 | base = pcim_iomap_table(pdev)[PDC_MMIO_BAR]; | 1061 | host_mmio = pcim_iomap_table(pdev)[PDC_MMIO_BAR]; |
1066 | 1062 | ||
1067 | /* determine port configuration and setup host */ | 1063 | /* determine port configuration and setup host */ |
1068 | n_ports = 2; | 1064 | n_ports = 2; |
@@ -1072,7 +1068,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | |||
1072 | ppi[i] = pi; | 1068 | ppi[i] = pi; |
1073 | 1069 | ||
1074 | if (pi->flags & PDC_FLAG_SATA_PATA) { | 1070 | if (pi->flags & PDC_FLAG_SATA_PATA) { |
1075 | u8 tmp = readb(base + PDC_FLASH_CTL+1); | 1071 | u8 tmp = readb(host_mmio + PDC_FLASH_CTL + 1); |
1076 | if (!(tmp & 0x80)) | 1072 | if (!(tmp & 0x80)) |
1077 | ppi[n_ports++] = pi + 1; | 1073 | ppi[n_ports++] = pi + 1; |
1078 | } | 1074 | } |
@@ -1088,13 +1084,13 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | |||
1088 | for (i = 0; i < host->n_ports; i++) { | 1084 | for (i = 0; i < host->n_ports; i++) { |
1089 | struct ata_port *ap = host->ports[i]; | 1085 | struct ata_port *ap = host->ports[i]; |
1090 | unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4); | 1086 | unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4); |
1091 | unsigned int port_offset = 0x200 + ata_no * 0x80; | 1087 | unsigned int ata_offset = 0x200 + ata_no * 0x80; |
1092 | unsigned int scr_offset = 0x400 + ata_no * 0x100; | 1088 | unsigned int scr_offset = 0x400 + ata_no * 0x100; |
1093 | 1089 | ||
1094 | pdc_ata_setup_port(ap, base + port_offset, base + scr_offset); | 1090 | pdc_ata_setup_port(ap, host_mmio + ata_offset, host_mmio + scr_offset); |
1095 | 1091 | ||
1096 | ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio"); | 1092 | ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio"); |
1097 | ata_port_pbar_desc(ap, PDC_MMIO_BAR, port_offset, "port"); | 1093 | ata_port_pbar_desc(ap, PDC_MMIO_BAR, ata_offset, "ata"); |
1098 | } | 1094 | } |
1099 | 1095 | ||
1100 | /* initialize adapter */ | 1096 | /* initialize adapter */ |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 27a110110077..8ee6b5b4ede7 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -899,14 +899,25 @@ static bool sil24_qc_fill_rtf(struct ata_queued_cmd *qc) | |||
899 | 899 | ||
900 | static void sil24_pmp_attach(struct ata_port *ap) | 900 | static void sil24_pmp_attach(struct ata_port *ap) |
901 | { | 901 | { |
902 | u32 *gscr = ap->link.device->gscr; | ||
903 | |||
902 | sil24_config_pmp(ap, 1); | 904 | sil24_config_pmp(ap, 1); |
903 | sil24_init_port(ap); | 905 | sil24_init_port(ap); |
906 | |||
907 | if (sata_pmp_gscr_vendor(gscr) == 0x11ab && | ||
908 | sata_pmp_gscr_devid(gscr) == 0x4140) { | ||
909 | ata_port_printk(ap, KERN_INFO, | ||
910 | "disabling NCQ support due to sil24-mv4140 quirk\n"); | ||
911 | ap->flags &= ~ATA_FLAG_NCQ; | ||
912 | } | ||
904 | } | 913 | } |
905 | 914 | ||
906 | static void sil24_pmp_detach(struct ata_port *ap) | 915 | static void sil24_pmp_detach(struct ata_port *ap) |
907 | { | 916 | { |
908 | sil24_init_port(ap); | 917 | sil24_init_port(ap); |
909 | sil24_config_pmp(ap, 0); | 918 | sil24_config_pmp(ap, 0); |
919 | |||
920 | ap->flags |= ATA_FLAG_NCQ; | ||
910 | } | 921 | } |
911 | 922 | ||
912 | static int sil24_pmp_hardreset(struct ata_link *link, unsigned int *class, | 923 | static int sil24_pmp_hardreset(struct ata_link *link, unsigned int *class, |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 3eeac5a78581..72eccae4904b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -1084,11 +1084,13 @@ static void device_create_release(struct device *dev) | |||
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | /** | 1086 | /** |
1087 | * device_create - creates a device and registers it with sysfs | 1087 | * device_create_vargs - creates a device and registers it with sysfs |
1088 | * @class: pointer to the struct class that this device should be registered to | 1088 | * @class: pointer to the struct class that this device should be registered to |
1089 | * @parent: pointer to the parent struct device of this new device, if any | 1089 | * @parent: pointer to the parent struct device of this new device, if any |
1090 | * @devt: the dev_t for the char device to be added | 1090 | * @devt: the dev_t for the char device to be added |
1091 | * @drvdata: the data to be added to the device for callbacks | ||
1091 | * @fmt: string for the device's name | 1092 | * @fmt: string for the device's name |
1093 | * @args: va_list for the device's name | ||
1092 | * | 1094 | * |
1093 | * This function can be used by char device classes. A struct device | 1095 | * This function can be used by char device classes. A struct device |
1094 | * will be created in sysfs, registered to the specified class. | 1096 | * will be created in sysfs, registered to the specified class. |
@@ -1104,10 +1106,10 @@ static void device_create_release(struct device *dev) | |||
1104 | * Note: the struct class passed to this function must have previously | 1106 | * Note: the struct class passed to this function must have previously |
1105 | * been created with a call to class_create(). | 1107 | * been created with a call to class_create(). |
1106 | */ | 1108 | */ |
1107 | struct device *device_create(struct class *class, struct device *parent, | 1109 | struct device *device_create_vargs(struct class *class, struct device *parent, |
1108 | dev_t devt, const char *fmt, ...) | 1110 | dev_t devt, void *drvdata, const char *fmt, |
1111 | va_list args) | ||
1109 | { | 1112 | { |
1110 | va_list args; | ||
1111 | struct device *dev = NULL; | 1113 | struct device *dev = NULL; |
1112 | int retval = -ENODEV; | 1114 | int retval = -ENODEV; |
1113 | 1115 | ||
@@ -1124,10 +1126,9 @@ struct device *device_create(struct class *class, struct device *parent, | |||
1124 | dev->class = class; | 1126 | dev->class = class; |
1125 | dev->parent = parent; | 1127 | dev->parent = parent; |
1126 | dev->release = device_create_release; | 1128 | dev->release = device_create_release; |
1129 | dev_set_drvdata(dev, drvdata); | ||
1127 | 1130 | ||
1128 | va_start(args, fmt); | ||
1129 | vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); | 1131 | vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); |
1130 | va_end(args); | ||
1131 | retval = device_register(dev); | 1132 | retval = device_register(dev); |
1132 | if (retval) | 1133 | if (retval) |
1133 | goto error; | 1134 | goto error; |
@@ -1138,6 +1139,78 @@ error: | |||
1138 | kfree(dev); | 1139 | kfree(dev); |
1139 | return ERR_PTR(retval); | 1140 | return ERR_PTR(retval); |
1140 | } | 1141 | } |
1142 | EXPORT_SYMBOL_GPL(device_create_vargs); | ||
1143 | |||
1144 | /** | ||
1145 | * device_create_drvdata - creates a device and registers it with sysfs | ||
1146 | * @class: pointer to the struct class that this device should be registered to | ||
1147 | * @parent: pointer to the parent struct device of this new device, if any | ||
1148 | * @devt: the dev_t for the char device to be added | ||
1149 | * @drvdata: the data to be added to the device for callbacks | ||
1150 | * @fmt: string for the device's name | ||
1151 | * | ||
1152 | * This function can be used by char device classes. A struct device | ||
1153 | * will be created in sysfs, registered to the specified class. | ||
1154 | * | ||
1155 | * A "dev" file will be created, showing the dev_t for the device, if | ||
1156 | * the dev_t is not 0,0. | ||
1157 | * If a pointer to a parent struct device is passed in, the newly created | ||
1158 | * struct device will be a child of that device in sysfs. | ||
1159 | * The pointer to the struct device will be returned from the call. | ||
1160 | * Any further sysfs files that might be required can be created using this | ||
1161 | * pointer. | ||
1162 | * | ||
1163 | * Note: the struct class passed to this function must have previously | ||
1164 | * been created with a call to class_create(). | ||
1165 | */ | ||
1166 | struct device *device_create_drvdata(struct class *class, | ||
1167 | struct device *parent, | ||
1168 | dev_t devt, | ||
1169 | void *drvdata, | ||
1170 | const char *fmt, ...) | ||
1171 | { | ||
1172 | va_list vargs; | ||
1173 | struct device *dev; | ||
1174 | |||
1175 | va_start(vargs, fmt); | ||
1176 | dev = device_create_vargs(class, parent, devt, drvdata, fmt, vargs); | ||
1177 | va_end(vargs); | ||
1178 | return dev; | ||
1179 | } | ||
1180 | EXPORT_SYMBOL_GPL(device_create_drvdata); | ||
1181 | |||
1182 | /** | ||
1183 | * device_create - creates a device and registers it with sysfs | ||
1184 | * @class: pointer to the struct class that this device should be registered to | ||
1185 | * @parent: pointer to the parent struct device of this new device, if any | ||
1186 | * @devt: the dev_t for the char device to be added | ||
1187 | * @fmt: string for the device's name | ||
1188 | * | ||
1189 | * This function can be used by char device classes. A struct device | ||
1190 | * will be created in sysfs, registered to the specified class. | ||
1191 | * | ||
1192 | * A "dev" file will be created, showing the dev_t for the device, if | ||
1193 | * the dev_t is not 0,0. | ||
1194 | * If a pointer to a parent struct device is passed in, the newly created | ||
1195 | * struct device will be a child of that device in sysfs. | ||
1196 | * The pointer to the struct device will be returned from the call. | ||
1197 | * Any further sysfs files that might be required can be created using this | ||
1198 | * pointer. | ||
1199 | * | ||
1200 | * Note: the struct class passed to this function must have previously | ||
1201 | * been created with a call to class_create(). | ||
1202 | */ | ||
1203 | struct device *device_create(struct class *class, struct device *parent, | ||
1204 | dev_t devt, const char *fmt, ...) | ||
1205 | { | ||
1206 | va_list vargs; | ||
1207 | struct device *dev; | ||
1208 | |||
1209 | va_start(vargs, fmt); | ||
1210 | dev = device_create_vargs(class, parent, devt, NULL, fmt, vargs); | ||
1211 | va_end(vargs); | ||
1212 | return dev; | ||
1213 | } | ||
1141 | EXPORT_SYMBOL_GPL(device_create); | 1214 | EXPORT_SYMBOL_GPL(device_create); |
1142 | 1215 | ||
1143 | static int __match_devt(struct device *dev, void *data) | 1216 | static int __match_devt(struct device *dev, void *data) |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 7b76fd3b93a4..45cc3d9eacb8 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -418,7 +418,7 @@ void __suspend_report_result(const char *function, void *fn, int ret) | |||
418 | { | 418 | { |
419 | if (ret) { | 419 | if (ret) { |
420 | printk(KERN_ERR "%s(): ", function); | 420 | printk(KERN_ERR "%s(): ", function); |
421 | print_fn_descriptor_symbol("%s() returns ", (unsigned long)fn); | 421 | print_fn_descriptor_symbol("%s returns ", fn); |
422 | printk("%d\n", ret); | 422 | printk("%d\n", ret); |
423 | } | 423 | } |
424 | } | 424 | } |
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index c9751b2b57e6..7516baff3bb9 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -1714,10 +1714,10 @@ static int __init amiga_floppy_init(void) | |||
1714 | int i, ret; | 1714 | int i, ret; |
1715 | 1715 | ||
1716 | if (!MACH_IS_AMIGA) | 1716 | if (!MACH_IS_AMIGA) |
1717 | return -ENXIO; | 1717 | return -ENODEV; |
1718 | 1718 | ||
1719 | if (!AMIGAHW_PRESENT(AMI_FLOPPY)) | 1719 | if (!AMIGAHW_PRESENT(AMI_FLOPPY)) |
1720 | return -ENXIO; | 1720 | return -ENODEV; |
1721 | 1721 | ||
1722 | if (register_blkdev(FLOPPY_MAJOR,"fd")) | 1722 | if (register_blkdev(FLOPPY_MAJOR,"fd")) |
1723 | return -EBUSY; | 1723 | return -EBUSY; |
@@ -1755,7 +1755,7 @@ static int __init amiga_floppy_init(void) | |||
1755 | if (!floppy_queue) | 1755 | if (!floppy_queue) |
1756 | goto out_queue; | 1756 | goto out_queue; |
1757 | 1757 | ||
1758 | ret = -ENXIO; | 1758 | ret = -ENODEV; |
1759 | if (fd_probe_drives() < 1) /* No usable drives */ | 1759 | if (fd_probe_drives() < 1) /* No usable drives */ |
1760 | goto out_probe; | 1760 | goto out_probe; |
1761 | 1761 | ||
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index 2d5853cbd4b0..be20a67f1fa8 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c | |||
@@ -332,7 +332,7 @@ z2_init(void) | |||
332 | int ret; | 332 | int ret; |
333 | 333 | ||
334 | if (!MACH_IS_AMIGA) | 334 | if (!MACH_IS_AMIGA) |
335 | return -ENXIO; | 335 | return -ENODEV; |
336 | 336 | ||
337 | ret = -EBUSY; | 337 | ret = -EBUSY; |
338 | if (register_blkdev(Z2RAM_MAJOR, DEVICE_NAME)) | 338 | if (register_blkdev(Z2RAM_MAJOR, DEVICE_NAME)) |
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h index 6874f31ca8ca..3a05c6d5ebe1 100644 --- a/drivers/char/drm/drm.h +++ b/drivers/char/drm/drm.h | |||
@@ -471,7 +471,6 @@ struct drm_irq_busid { | |||
471 | enum drm_vblank_seq_type { | 471 | enum drm_vblank_seq_type { |
472 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ | 472 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ |
473 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ | 473 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ |
474 | _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ | ||
475 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ | 474 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ |
476 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ | 475 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ |
477 | _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ | 476 | _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ |
@@ -504,21 +503,6 @@ union drm_wait_vblank { | |||
504 | struct drm_wait_vblank_reply reply; | 503 | struct drm_wait_vblank_reply reply; |
505 | }; | 504 | }; |
506 | 505 | ||
507 | enum drm_modeset_ctl_cmd { | ||
508 | _DRM_PRE_MODESET = 1, | ||
509 | _DRM_POST_MODESET = 2, | ||
510 | }; | ||
511 | |||
512 | /** | ||
513 | * DRM_IOCTL_MODESET_CTL ioctl argument type | ||
514 | * | ||
515 | * \sa drmModesetCtl(). | ||
516 | */ | ||
517 | struct drm_modeset_ctl { | ||
518 | unsigned long arg; | ||
519 | enum drm_modeset_ctl_cmd cmd; | ||
520 | }; | ||
521 | |||
522 | /** | 506 | /** |
523 | * DRM_IOCTL_AGP_ENABLE ioctl argument type. | 507 | * DRM_IOCTL_AGP_ENABLE ioctl argument type. |
524 | * | 508 | * |
@@ -603,7 +587,6 @@ struct drm_set_version { | |||
603 | #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) | 587 | #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) |
604 | #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) | 588 | #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) |
605 | #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) | 589 | #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) |
606 | #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) | ||
607 | 590 | ||
608 | #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) | 591 | #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) |
609 | #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) | 592 | #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) |
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 213b3ca3468e..0764b662b339 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -100,8 +100,10 @@ struct drm_device; | |||
100 | #define DRIVER_HAVE_DMA 0x20 | 100 | #define DRIVER_HAVE_DMA 0x20 |
101 | #define DRIVER_HAVE_IRQ 0x40 | 101 | #define DRIVER_HAVE_IRQ 0x40 |
102 | #define DRIVER_IRQ_SHARED 0x80 | 102 | #define DRIVER_IRQ_SHARED 0x80 |
103 | #define DRIVER_IRQ_VBL 0x100 | ||
103 | #define DRIVER_DMA_QUEUE 0x200 | 104 | #define DRIVER_DMA_QUEUE 0x200 |
104 | #define DRIVER_FB_DMA 0x400 | 105 | #define DRIVER_FB_DMA 0x400 |
106 | #define DRIVER_IRQ_VBL2 0x800 | ||
105 | 107 | ||
106 | /***********************************************************************/ | 108 | /***********************************************************************/ |
107 | /** \name Begin the DRM... */ | 109 | /** \name Begin the DRM... */ |
@@ -577,52 +579,10 @@ struct drm_driver { | |||
577 | int (*context_dtor) (struct drm_device *dev, int context); | 579 | int (*context_dtor) (struct drm_device *dev, int context); |
578 | int (*kernel_context_switch) (struct drm_device *dev, int old, | 580 | int (*kernel_context_switch) (struct drm_device *dev, int old, |
579 | int new); | 581 | int new); |
580 | void (*kernel_context_switch_unlock) (struct drm_device * dev); | 582 | void (*kernel_context_switch_unlock) (struct drm_device *dev); |
581 | /** | 583 | int (*vblank_wait) (struct drm_device *dev, unsigned int *sequence); |
582 | * get_vblank_counter - get raw hardware vblank counter | 584 | int (*vblank_wait2) (struct drm_device *dev, unsigned int *sequence); |
583 | * @dev: DRM device | 585 | int (*dri_library_name) (struct drm_device *dev, char *buf); |
584 | * @crtc: counter to fetch | ||
585 | * | ||
586 | * Driver callback for fetching a raw hardware vblank counter | ||
587 | * for @crtc. If a device doesn't have a hardware counter, the | ||
588 | * driver can simply return the value of drm_vblank_count and | ||
589 | * make the enable_vblank() and disable_vblank() hooks into no-ops, | ||
590 | * leaving interrupts enabled at all times. | ||
591 | * | ||
592 | * Wraparound handling and loss of events due to modesetting is dealt | ||
593 | * with in the DRM core code. | ||
594 | * | ||
595 | * RETURNS | ||
596 | * Raw vblank counter value. | ||
597 | */ | ||
598 | u32 (*get_vblank_counter) (struct drm_device *dev, int crtc); | ||
599 | |||
600 | /** | ||
601 | * enable_vblank - enable vblank interrupt events | ||
602 | * @dev: DRM device | ||
603 | * @crtc: which irq to enable | ||
604 | * | ||
605 | * Enable vblank interrupts for @crtc. If the device doesn't have | ||
606 | * a hardware vblank counter, this routine should be a no-op, since | ||
607 | * interrupts will have to stay on to keep the count accurate. | ||
608 | * | ||
609 | * RETURNS | ||
610 | * Zero on success, appropriate errno if the given @crtc's vblank | ||
611 | * interrupt cannot be enabled. | ||
612 | */ | ||
613 | int (*enable_vblank) (struct drm_device *dev, int crtc); | ||
614 | |||
615 | /** | ||
616 | * disable_vblank - disable vblank interrupt events | ||
617 | * @dev: DRM device | ||
618 | * @crtc: which irq to enable | ||
619 | * | ||
620 | * Disable vblank interrupts for @crtc. If the device doesn't have | ||
621 | * a hardware vblank counter, this routine should be a no-op, since | ||
622 | * interrupts will have to stay on to keep the count accurate. | ||
623 | */ | ||
624 | void (*disable_vblank) (struct drm_device *dev, int crtc); | ||
625 | int (*dri_library_name) (struct drm_device *dev, char * buf); | ||
626 | 586 | ||
627 | /** | 587 | /** |
628 | * Called by \c drm_device_is_agp. Typically used to determine if a | 588 | * Called by \c drm_device_is_agp. Typically used to determine if a |
@@ -641,7 +601,7 @@ struct drm_driver { | |||
641 | 601 | ||
642 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); | 602 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
643 | void (*irq_preinstall) (struct drm_device *dev); | 603 | void (*irq_preinstall) (struct drm_device *dev); |
644 | int (*irq_postinstall) (struct drm_device *dev); | 604 | void (*irq_postinstall) (struct drm_device *dev); |
645 | void (*irq_uninstall) (struct drm_device *dev); | 605 | void (*irq_uninstall) (struct drm_device *dev); |
646 | void (*reclaim_buffers) (struct drm_device *dev, | 606 | void (*reclaim_buffers) (struct drm_device *dev, |
647 | struct drm_file * file_priv); | 607 | struct drm_file * file_priv); |
@@ -770,21 +730,13 @@ struct drm_device { | |||
770 | /** \name VBLANK IRQ support */ | 730 | /** \name VBLANK IRQ support */ |
771 | /*@{ */ | 731 | /*@{ */ |
772 | 732 | ||
773 | wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ | 733 | wait_queue_head_t vbl_queue; /**< VBLANK wait queue */ |
774 | atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ | 734 | atomic_t vbl_received; |
735 | atomic_t vbl_received2; /**< number of secondary VBLANK interrupts */ | ||
775 | spinlock_t vbl_lock; | 736 | spinlock_t vbl_lock; |
776 | struct list_head *vbl_sigs; /**< signal list to send on VBLANK */ | 737 | struct list_head vbl_sigs; /**< signal list to send on VBLANK */ |
777 | atomic_t vbl_signal_pending; /* number of signals pending on all crtcs*/ | 738 | struct list_head vbl_sigs2; /**< signals to send on secondary VBLANK */ |
778 | atomic_t *vblank_refcount; /* number of users of vblank interrupts per crtc */ | 739 | unsigned int vbl_pending; |
779 | u32 *last_vblank; /* protected by dev->vbl_lock, used */ | ||
780 | /* for wraparound handling */ | ||
781 | u32 *vblank_offset; /* used to track how many vblanks */ | ||
782 | int *vblank_enabled; /* so we don't call enable more than | ||
783 | once per disable */ | ||
784 | u32 *vblank_premodeset; /* were lost during modeset */ | ||
785 | struct timer_list vblank_disable_timer; | ||
786 | |||
787 | unsigned long max_vblank_count; /**< size of vblank counter register */ | ||
788 | spinlock_t tasklet_lock; /**< For drm_locked_tasklet */ | 740 | spinlock_t tasklet_lock; /**< For drm_locked_tasklet */ |
789 | void (*locked_tasklet_func)(struct drm_device *dev); | 741 | void (*locked_tasklet_func)(struct drm_device *dev); |
790 | 742 | ||
@@ -804,7 +756,6 @@ struct drm_device { | |||
804 | #ifdef __alpha__ | 756 | #ifdef __alpha__ |
805 | struct pci_controller *hose; | 757 | struct pci_controller *hose; |
806 | #endif | 758 | #endif |
807 | int num_crtcs; /**< Number of CRTCs on this device */ | ||
808 | struct drm_sg_mem *sg; /**< Scatter gather memory */ | 759 | struct drm_sg_mem *sg; /**< Scatter gather memory */ |
809 | void *dev_private; /**< device private data */ | 760 | void *dev_private; /**< device private data */ |
810 | struct drm_sigdata sigdata; /**< For block_all_signals */ | 761 | struct drm_sigdata sigdata; /**< For block_all_signals */ |
@@ -1039,19 +990,11 @@ extern void drm_driver_irq_preinstall(struct drm_device *dev); | |||
1039 | extern void drm_driver_irq_postinstall(struct drm_device *dev); | 990 | extern void drm_driver_irq_postinstall(struct drm_device *dev); |
1040 | extern void drm_driver_irq_uninstall(struct drm_device *dev); | 991 | extern void drm_driver_irq_uninstall(struct drm_device *dev); |
1041 | 992 | ||
1042 | extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); | 993 | extern int drm_wait_vblank(struct drm_device *dev, void *data, |
1043 | extern int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *filp); | ||
1044 | extern int drm_vblank_wait(struct drm_device * dev, unsigned int *vbl_seq); | ||
1045 | extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*)); | ||
1046 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); | ||
1047 | extern void drm_update_vblank_count(struct drm_device *dev, int crtc); | ||
1048 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); | ||
1049 | extern int drm_vblank_get(struct drm_device *dev, int crtc); | ||
1050 | extern void drm_vblank_put(struct drm_device *dev, int crtc); | ||
1051 | |||
1052 | /* Modesetting support */ | ||
1053 | extern int drm_modeset_ctl(struct drm_device *dev, void *data, | ||
1054 | struct drm_file *file_priv); | 994 | struct drm_file *file_priv); |
995 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); | ||
996 | extern void drm_vbl_send_signals(struct drm_device *dev); | ||
997 | extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*)); | ||
1055 | 998 | ||
1056 | /* AGP/GART support (drm_agpsupport.h) */ | 999 | /* AGP/GART support (drm_agpsupport.h) */ |
1057 | extern struct drm_agp_head *drm_agp_init(struct drm_device *dev); | 1000 | extern struct drm_agp_head *drm_agp_init(struct drm_device *dev); |
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c index 68f0da801ed8..d2e6da85f58a 100644 --- a/drivers/char/drm/drm_fops.c +++ b/drivers/char/drm/drm_fops.c | |||
@@ -323,7 +323,6 @@ int drm_release(struct inode *inode, struct file *filp) | |||
323 | struct drm_file *file_priv = filp->private_data; | 323 | struct drm_file *file_priv = filp->private_data; |
324 | struct drm_device *dev = file_priv->minor->dev; | 324 | struct drm_device *dev = file_priv->minor->dev; |
325 | int retcode = 0; | 325 | int retcode = 0; |
326 | unsigned long irqflags; | ||
327 | 326 | ||
328 | lock_kernel(); | 327 | lock_kernel(); |
329 | 328 | ||
@@ -355,11 +354,9 @@ int drm_release(struct inode *inode, struct file *filp) | |||
355 | */ | 354 | */ |
356 | 355 | ||
357 | do{ | 356 | do{ |
358 | spin_lock_irqsave(&dev->lock.spinlock, | 357 | spin_lock_bh(&dev->lock.spinlock); |
359 | irqflags); | ||
360 | locked = dev->lock.idle_has_lock; | 358 | locked = dev->lock.idle_has_lock; |
361 | spin_unlock_irqrestore(&dev->lock.spinlock, | 359 | spin_unlock_bh(&dev->lock.spinlock); |
362 | irqflags); | ||
363 | if (locked) | 360 | if (locked) |
364 | break; | 361 | break; |
365 | schedule(); | 362 | schedule(); |
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c index 286f9d61e7d5..089c015c01d1 100644 --- a/drivers/char/drm/drm_irq.c +++ b/drivers/char/drm/drm_irq.c | |||
@@ -71,117 +71,6 @@ int drm_irq_by_busid(struct drm_device *dev, void *data, | |||
71 | return 0; | 71 | return 0; |
72 | } | 72 | } |
73 | 73 | ||
74 | static void vblank_disable_fn(unsigned long arg) | ||
75 | { | ||
76 | struct drm_device *dev = (struct drm_device *)arg; | ||
77 | unsigned long irqflags; | ||
78 | int i; | ||
79 | |||
80 | for (i = 0; i < dev->num_crtcs; i++) { | ||
81 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | ||
82 | if (atomic_read(&dev->vblank_refcount[i]) == 0 && | ||
83 | dev->vblank_enabled[i]) { | ||
84 | dev->driver->disable_vblank(dev, i); | ||
85 | dev->vblank_enabled[i] = 0; | ||
86 | } | ||
87 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | static void drm_vblank_cleanup(struct drm_device *dev) | ||
92 | { | ||
93 | /* Bail if the driver didn't call drm_vblank_init() */ | ||
94 | if (dev->num_crtcs == 0) | ||
95 | return; | ||
96 | |||
97 | del_timer(&dev->vblank_disable_timer); | ||
98 | |||
99 | vblank_disable_fn((unsigned long)dev); | ||
100 | |||
101 | drm_free(dev->vbl_queue, sizeof(*dev->vbl_queue) * dev->num_crtcs, | ||
102 | DRM_MEM_DRIVER); | ||
103 | drm_free(dev->vbl_sigs, sizeof(*dev->vbl_sigs) * dev->num_crtcs, | ||
104 | DRM_MEM_DRIVER); | ||
105 | drm_free(dev->_vblank_count, sizeof(*dev->_vblank_count) * | ||
106 | dev->num_crtcs, DRM_MEM_DRIVER); | ||
107 | drm_free(dev->vblank_refcount, sizeof(*dev->vblank_refcount) * | ||
108 | dev->num_crtcs, DRM_MEM_DRIVER); | ||
109 | drm_free(dev->vblank_enabled, sizeof(*dev->vblank_enabled) * | ||
110 | dev->num_crtcs, DRM_MEM_DRIVER); | ||
111 | drm_free(dev->last_vblank, sizeof(*dev->last_vblank) * dev->num_crtcs, | ||
112 | DRM_MEM_DRIVER); | ||
113 | drm_free(dev->vblank_premodeset, sizeof(*dev->vblank_premodeset) * | ||
114 | dev->num_crtcs, DRM_MEM_DRIVER); | ||
115 | drm_free(dev->vblank_offset, sizeof(*dev->vblank_offset) * dev->num_crtcs, | ||
116 | DRM_MEM_DRIVER); | ||
117 | |||
118 | dev->num_crtcs = 0; | ||
119 | } | ||
120 | |||
121 | int drm_vblank_init(struct drm_device *dev, int num_crtcs) | ||
122 | { | ||
123 | int i, ret = -ENOMEM; | ||
124 | |||
125 | setup_timer(&dev->vblank_disable_timer, vblank_disable_fn, | ||
126 | (unsigned long)dev); | ||
127 | spin_lock_init(&dev->vbl_lock); | ||
128 | atomic_set(&dev->vbl_signal_pending, 0); | ||
129 | dev->num_crtcs = num_crtcs; | ||
130 | |||
131 | dev->vbl_queue = drm_alloc(sizeof(wait_queue_head_t) * num_crtcs, | ||
132 | DRM_MEM_DRIVER); | ||
133 | if (!dev->vbl_queue) | ||
134 | goto err; | ||
135 | |||
136 | dev->vbl_sigs = drm_alloc(sizeof(struct list_head) * num_crtcs, | ||
137 | DRM_MEM_DRIVER); | ||
138 | if (!dev->vbl_sigs) | ||
139 | goto err; | ||
140 | |||
141 | dev->_vblank_count = drm_alloc(sizeof(atomic_t) * num_crtcs, | ||
142 | DRM_MEM_DRIVER); | ||
143 | if (!dev->_vblank_count) | ||
144 | goto err; | ||
145 | |||
146 | dev->vblank_refcount = drm_alloc(sizeof(atomic_t) * num_crtcs, | ||
147 | DRM_MEM_DRIVER); | ||
148 | if (!dev->vblank_refcount) | ||
149 | goto err; | ||
150 | |||
151 | dev->vblank_enabled = drm_calloc(num_crtcs, sizeof(int), | ||
152 | DRM_MEM_DRIVER); | ||
153 | if (!dev->vblank_enabled) | ||
154 | goto err; | ||
155 | |||
156 | dev->last_vblank = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER); | ||
157 | if (!dev->last_vblank) | ||
158 | goto err; | ||
159 | |||
160 | dev->vblank_premodeset = drm_calloc(num_crtcs, sizeof(u32), | ||
161 | DRM_MEM_DRIVER); | ||
162 | if (!dev->vblank_premodeset) | ||
163 | goto err; | ||
164 | |||
165 | dev->vblank_offset = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER); | ||
166 | if (!dev->vblank_offset) | ||
167 | goto err; | ||
168 | |||
169 | /* Zero per-crtc vblank stuff */ | ||
170 | for (i = 0; i < num_crtcs; i++) { | ||
171 | init_waitqueue_head(&dev->vbl_queue[i]); | ||
172 | INIT_LIST_HEAD(&dev->vbl_sigs[i]); | ||
173 | atomic_set(&dev->_vblank_count[i], 0); | ||
174 | atomic_set(&dev->vblank_refcount[i], 0); | ||
175 | } | ||
176 | |||
177 | return 0; | ||
178 | |||
179 | err: | ||
180 | drm_vblank_cleanup(dev); | ||
181 | return ret; | ||
182 | } | ||
183 | EXPORT_SYMBOL(drm_vblank_init); | ||
184 | |||
185 | /** | 74 | /** |
186 | * Install IRQ handler. | 75 | * Install IRQ handler. |
187 | * | 76 | * |
@@ -220,6 +109,17 @@ static int drm_irq_install(struct drm_device * dev) | |||
220 | 109 | ||
221 | DRM_DEBUG("irq=%d\n", dev->irq); | 110 | DRM_DEBUG("irq=%d\n", dev->irq); |
222 | 111 | ||
112 | if (drm_core_check_feature(dev, DRIVER_IRQ_VBL)) { | ||
113 | init_waitqueue_head(&dev->vbl_queue); | ||
114 | |||
115 | spin_lock_init(&dev->vbl_lock); | ||
116 | |||
117 | INIT_LIST_HEAD(&dev->vbl_sigs); | ||
118 | INIT_LIST_HEAD(&dev->vbl_sigs2); | ||
119 | |||
120 | dev->vbl_pending = 0; | ||
121 | } | ||
122 | |||
223 | /* Before installing handler */ | 123 | /* Before installing handler */ |
224 | dev->driver->irq_preinstall(dev); | 124 | dev->driver->irq_preinstall(dev); |
225 | 125 | ||
@@ -237,14 +137,9 @@ static int drm_irq_install(struct drm_device * dev) | |||
237 | } | 137 | } |
238 | 138 | ||
239 | /* After installing handler */ | 139 | /* After installing handler */ |
240 | ret = dev->driver->irq_postinstall(dev); | 140 | dev->driver->irq_postinstall(dev); |
241 | if (ret < 0) { | ||
242 | mutex_lock(&dev->struct_mutex); | ||
243 | dev->irq_enabled = 0; | ||
244 | mutex_unlock(&dev->struct_mutex); | ||
245 | } | ||
246 | 141 | ||
247 | return ret; | 142 | return 0; |
248 | } | 143 | } |
249 | 144 | ||
250 | /** | 145 | /** |
@@ -275,8 +170,6 @@ int drm_irq_uninstall(struct drm_device * dev) | |||
275 | 170 | ||
276 | free_irq(dev->irq, dev); | 171 | free_irq(dev->irq, dev); |
277 | 172 | ||
278 | drm_vblank_cleanup(dev); | ||
279 | |||
280 | dev->locked_tasklet_func = NULL; | 173 | dev->locked_tasklet_func = NULL; |
281 | 174 | ||
282 | return 0; | 175 | return 0; |
@@ -321,148 +214,6 @@ int drm_control(struct drm_device *dev, void *data, | |||
321 | } | 214 | } |
322 | 215 | ||
323 | /** | 216 | /** |
324 | * drm_vblank_count - retrieve "cooked" vblank counter value | ||
325 | * @dev: DRM device | ||
326 | * @crtc: which counter to retrieve | ||
327 | * | ||
328 | * Fetches the "cooked" vblank count value that represents the number of | ||
329 | * vblank events since the system was booted, including lost events due to | ||
330 | * modesetting activity. | ||
331 | */ | ||
332 | u32 drm_vblank_count(struct drm_device *dev, int crtc) | ||
333 | { | ||
334 | return atomic_read(&dev->_vblank_count[crtc]) + | ||
335 | dev->vblank_offset[crtc]; | ||
336 | } | ||
337 | EXPORT_SYMBOL(drm_vblank_count); | ||
338 | |||
339 | /** | ||
340 | * drm_update_vblank_count - update the master vblank counter | ||
341 | * @dev: DRM device | ||
342 | * @crtc: counter to update | ||
343 | * | ||
344 | * Call back into the driver to update the appropriate vblank counter | ||
345 | * (specified by @crtc). Deal with wraparound, if it occurred, and | ||
346 | * update the last read value so we can deal with wraparound on the next | ||
347 | * call if necessary. | ||
348 | */ | ||
349 | void drm_update_vblank_count(struct drm_device *dev, int crtc) | ||
350 | { | ||
351 | unsigned long irqflags; | ||
352 | u32 cur_vblank, diff; | ||
353 | |||
354 | /* | ||
355 | * Interrupts were disabled prior to this call, so deal with counter | ||
356 | * wrap if needed. | ||
357 | * NOTE! It's possible we lost a full dev->max_vblank_count events | ||
358 | * here if the register is small or we had vblank interrupts off for | ||
359 | * a long time. | ||
360 | */ | ||
361 | cur_vblank = dev->driver->get_vblank_counter(dev, crtc); | ||
362 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | ||
363 | if (cur_vblank < dev->last_vblank[crtc]) { | ||
364 | diff = dev->max_vblank_count - | ||
365 | dev->last_vblank[crtc]; | ||
366 | diff += cur_vblank; | ||
367 | } else { | ||
368 | diff = cur_vblank - dev->last_vblank[crtc]; | ||
369 | } | ||
370 | dev->last_vblank[crtc] = cur_vblank; | ||
371 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
372 | |||
373 | atomic_add(diff, &dev->_vblank_count[crtc]); | ||
374 | } | ||
375 | EXPORT_SYMBOL(drm_update_vblank_count); | ||
376 | |||
377 | /** | ||
378 | * drm_vblank_get - get a reference count on vblank events | ||
379 | * @dev: DRM device | ||
380 | * @crtc: which CRTC to own | ||
381 | * | ||
382 | * Acquire a reference count on vblank events to avoid having them disabled | ||
383 | * while in use. Note callers will probably want to update the master counter | ||
384 | * using drm_update_vblank_count() above before calling this routine so that | ||
385 | * wakeups occur on the right vblank event. | ||
386 | * | ||
387 | * RETURNS | ||
388 | * Zero on success, nonzero on failure. | ||
389 | */ | ||
390 | int drm_vblank_get(struct drm_device *dev, int crtc) | ||
391 | { | ||
392 | unsigned long irqflags; | ||
393 | int ret = 0; | ||
394 | |||
395 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | ||
396 | /* Going from 0->1 means we have to enable interrupts again */ | ||
397 | if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1 && | ||
398 | !dev->vblank_enabled[crtc]) { | ||
399 | ret = dev->driver->enable_vblank(dev, crtc); | ||
400 | if (ret) | ||
401 | atomic_dec(&dev->vblank_refcount[crtc]); | ||
402 | else | ||
403 | dev->vblank_enabled[crtc] = 1; | ||
404 | } | ||
405 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
406 | |||
407 | return ret; | ||
408 | } | ||
409 | EXPORT_SYMBOL(drm_vblank_get); | ||
410 | |||
411 | /** | ||
412 | * drm_vblank_put - give up ownership of vblank events | ||
413 | * @dev: DRM device | ||
414 | * @crtc: which counter to give up | ||
415 | * | ||
416 | * Release ownership of a given vblank counter, turning off interrupts | ||
417 | * if possible. | ||
418 | */ | ||
419 | void drm_vblank_put(struct drm_device *dev, int crtc) | ||
420 | { | ||
421 | /* Last user schedules interrupt disable */ | ||
422 | if (atomic_dec_and_test(&dev->vblank_refcount[crtc])) | ||
423 | mod_timer(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ); | ||
424 | } | ||
425 | EXPORT_SYMBOL(drm_vblank_put); | ||
426 | |||
427 | /** | ||
428 | * drm_modeset_ctl - handle vblank event counter changes across mode switch | ||
429 | * @DRM_IOCTL_ARGS: standard ioctl arguments | ||
430 | * | ||
431 | * Applications should call the %_DRM_PRE_MODESET and %_DRM_POST_MODESET | ||
432 | * ioctls around modesetting so that any lost vblank events are accounted for. | ||
433 | */ | ||
434 | int drm_modeset_ctl(struct drm_device *dev, void *data, | ||
435 | struct drm_file *file_priv) | ||
436 | { | ||
437 | struct drm_modeset_ctl *modeset = data; | ||
438 | int crtc, ret = 0; | ||
439 | u32 new; | ||
440 | |||
441 | crtc = modeset->arg; | ||
442 | if (crtc >= dev->num_crtcs) { | ||
443 | ret = -EINVAL; | ||
444 | goto out; | ||
445 | } | ||
446 | |||
447 | switch (modeset->cmd) { | ||
448 | case _DRM_PRE_MODESET: | ||
449 | dev->vblank_premodeset[crtc] = | ||
450 | dev->driver->get_vblank_counter(dev, crtc); | ||
451 | break; | ||
452 | case _DRM_POST_MODESET: | ||
453 | new = dev->driver->get_vblank_counter(dev, crtc); | ||
454 | dev->vblank_offset[crtc] = dev->vblank_premodeset[crtc] - new; | ||
455 | break; | ||
456 | default: | ||
457 | ret = -EINVAL; | ||
458 | break; | ||
459 | } | ||
460 | |||
461 | out: | ||
462 | return ret; | ||
463 | } | ||
464 | |||
465 | /** | ||
466 | * Wait for VBLANK. | 217 | * Wait for VBLANK. |
467 | * | 218 | * |
468 | * \param inode device inode. | 219 | * \param inode device inode. |
@@ -481,13 +232,12 @@ out: | |||
481 | * | 232 | * |
482 | * If a signal is not requested, then calls vblank_wait(). | 233 | * If a signal is not requested, then calls vblank_wait(). |
483 | */ | 234 | */ |
484 | int drm_wait_vblank(struct drm_device *dev, void *data, | 235 | int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv) |
485 | struct drm_file *file_priv) | ||
486 | { | 236 | { |
487 | union drm_wait_vblank *vblwait = data; | 237 | union drm_wait_vblank *vblwait = data; |
488 | struct timeval now; | 238 | struct timeval now; |
489 | int ret = 0; | 239 | int ret = 0; |
490 | unsigned int flags, seq, crtc; | 240 | unsigned int flags, seq; |
491 | 241 | ||
492 | if ((!dev->irq) || (!dev->irq_enabled)) | 242 | if ((!dev->irq) || (!dev->irq_enabled)) |
493 | return -EINVAL; | 243 | return -EINVAL; |
@@ -501,13 +251,13 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
501 | } | 251 | } |
502 | 252 | ||
503 | flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; | 253 | flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; |
504 | crtc = flags & _DRM_VBLANK_SECONDARY ? 1 : 0; | ||
505 | 254 | ||
506 | if (crtc >= dev->num_crtcs) | 255 | if (!drm_core_check_feature(dev, (flags & _DRM_VBLANK_SECONDARY) ? |
256 | DRIVER_IRQ_VBL2 : DRIVER_IRQ_VBL)) | ||
507 | return -EINVAL; | 257 | return -EINVAL; |
508 | 258 | ||
509 | drm_update_vblank_count(dev, crtc); | 259 | seq = atomic_read((flags & _DRM_VBLANK_SECONDARY) ? &dev->vbl_received2 |
510 | seq = drm_vblank_count(dev, crtc); | 260 | : &dev->vbl_received); |
511 | 261 | ||
512 | switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) { | 262 | switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) { |
513 | case _DRM_VBLANK_RELATIVE: | 263 | case _DRM_VBLANK_RELATIVE: |
@@ -526,7 +276,8 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
526 | 276 | ||
527 | if (flags & _DRM_VBLANK_SIGNAL) { | 277 | if (flags & _DRM_VBLANK_SIGNAL) { |
528 | unsigned long irqflags; | 278 | unsigned long irqflags; |
529 | struct list_head *vbl_sigs = &dev->vbl_sigs[crtc]; | 279 | struct list_head *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY) |
280 | ? &dev->vbl_sigs2 : &dev->vbl_sigs; | ||
530 | struct drm_vbl_sig *vbl_sig; | 281 | struct drm_vbl_sig *vbl_sig; |
531 | 282 | ||
532 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | 283 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
@@ -547,26 +298,22 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
547 | } | 298 | } |
548 | } | 299 | } |
549 | 300 | ||
550 | if (atomic_read(&dev->vbl_signal_pending) >= 100) { | 301 | if (dev->vbl_pending >= 100) { |
551 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | 302 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); |
552 | return -EBUSY; | 303 | return -EBUSY; |
553 | } | 304 | } |
554 | 305 | ||
306 | dev->vbl_pending++; | ||
307 | |||
555 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | 308 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); |
556 | 309 | ||
557 | vbl_sig = drm_calloc(1, sizeof(struct drm_vbl_sig), | 310 | if (! |
558 | DRM_MEM_DRIVER); | 311 | (vbl_sig = |
559 | if (!vbl_sig) | 312 | drm_alloc(sizeof(struct drm_vbl_sig), DRM_MEM_DRIVER))) { |
560 | return -ENOMEM; | 313 | return -ENOMEM; |
561 | |||
562 | ret = drm_vblank_get(dev, crtc); | ||
563 | if (ret) { | ||
564 | drm_free(vbl_sig, sizeof(struct drm_vbl_sig), | ||
565 | DRM_MEM_DRIVER); | ||
566 | return ret; | ||
567 | } | 314 | } |
568 | 315 | ||
569 | atomic_inc(&dev->vbl_signal_pending); | 316 | memset((void *)vbl_sig, 0, sizeof(*vbl_sig)); |
570 | 317 | ||
571 | vbl_sig->sequence = vblwait->request.sequence; | 318 | vbl_sig->sequence = vblwait->request.sequence; |
572 | vbl_sig->info.si_signo = vblwait->request.signal; | 319 | vbl_sig->info.si_signo = vblwait->request.signal; |
@@ -580,20 +327,17 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
580 | 327 | ||
581 | vblwait->reply.sequence = seq; | 328 | vblwait->reply.sequence = seq; |
582 | } else { | 329 | } else { |
583 | unsigned long cur_vblank; | 330 | if (flags & _DRM_VBLANK_SECONDARY) { |
584 | 331 | if (dev->driver->vblank_wait2) | |
585 | ret = drm_vblank_get(dev, crtc); | 332 | ret = dev->driver->vblank_wait2(dev, &vblwait->request.sequence); |
586 | if (ret) | 333 | } else if (dev->driver->vblank_wait) |
587 | return ret; | 334 | ret = |
588 | DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ, | 335 | dev->driver->vblank_wait(dev, |
589 | (((cur_vblank = drm_vblank_count(dev, crtc)) | 336 | &vblwait->request.sequence); |
590 | - vblwait->request.sequence) <= (1 << 23))); | ||
591 | drm_vblank_put(dev, crtc); | ||
592 | do_gettimeofday(&now); | ||
593 | 337 | ||
338 | do_gettimeofday(&now); | ||
594 | vblwait->reply.tval_sec = now.tv_sec; | 339 | vblwait->reply.tval_sec = now.tv_sec; |
595 | vblwait->reply.tval_usec = now.tv_usec; | 340 | vblwait->reply.tval_usec = now.tv_usec; |
596 | vblwait->reply.sequence = cur_vblank; | ||
597 | } | 341 | } |
598 | 342 | ||
599 | done: | 343 | done: |
@@ -604,57 +348,44 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
604 | * Send the VBLANK signals. | 348 | * Send the VBLANK signals. |
605 | * | 349 | * |
606 | * \param dev DRM device. | 350 | * \param dev DRM device. |
607 | * \param crtc CRTC where the vblank event occurred | ||
608 | * | 351 | * |
609 | * Sends a signal for each task in drm_device::vbl_sigs and empties the list. | 352 | * Sends a signal for each task in drm_device::vbl_sigs and empties the list. |
610 | * | 353 | * |
611 | * If a signal is not requested, then calls vblank_wait(). | 354 | * If a signal is not requested, then calls vblank_wait(). |
612 | */ | 355 | */ |
613 | static void drm_vbl_send_signals(struct drm_device * dev, int crtc) | 356 | void drm_vbl_send_signals(struct drm_device * dev) |
614 | { | 357 | { |
615 | struct drm_vbl_sig *vbl_sig, *tmp; | ||
616 | struct list_head *vbl_sigs; | ||
617 | unsigned int vbl_seq; | ||
618 | unsigned long flags; | 358 | unsigned long flags; |
359 | int i; | ||
619 | 360 | ||
620 | spin_lock_irqsave(&dev->vbl_lock, flags); | 361 | spin_lock_irqsave(&dev->vbl_lock, flags); |
621 | 362 | ||
622 | vbl_sigs = &dev->vbl_sigs[crtc]; | 363 | for (i = 0; i < 2; i++) { |
623 | vbl_seq = drm_vblank_count(dev, crtc); | 364 | struct drm_vbl_sig *vbl_sig, *tmp; |
365 | struct list_head *vbl_sigs = i ? &dev->vbl_sigs2 : &dev->vbl_sigs; | ||
366 | unsigned int vbl_seq = atomic_read(i ? &dev->vbl_received2 : | ||
367 | &dev->vbl_received); | ||
624 | 368 | ||
625 | list_for_each_entry_safe(vbl_sig, tmp, vbl_sigs, head) { | 369 | list_for_each_entry_safe(vbl_sig, tmp, vbl_sigs, head) { |
626 | if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) { | 370 | if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) { |
627 | vbl_sig->info.si_code = vbl_seq; | 371 | vbl_sig->info.si_code = vbl_seq; |
628 | send_sig_info(vbl_sig->info.si_signo, | 372 | send_sig_info(vbl_sig->info.si_signo, |
629 | &vbl_sig->info, vbl_sig->task); | 373 | &vbl_sig->info, vbl_sig->task); |
630 | 374 | ||
631 | list_del(&vbl_sig->head); | 375 | list_del(&vbl_sig->head); |
632 | 376 | ||
633 | drm_free(vbl_sig, sizeof(*vbl_sig), | 377 | drm_free(vbl_sig, sizeof(*vbl_sig), |
634 | DRM_MEM_DRIVER); | 378 | DRM_MEM_DRIVER); |
635 | atomic_dec(&dev->vbl_signal_pending); | 379 | |
636 | drm_vblank_put(dev, crtc); | 380 | dev->vbl_pending--; |
637 | } | 381 | } |
382 | } | ||
638 | } | 383 | } |
639 | 384 | ||
640 | spin_unlock_irqrestore(&dev->vbl_lock, flags); | 385 | spin_unlock_irqrestore(&dev->vbl_lock, flags); |
641 | } | 386 | } |
642 | 387 | ||
643 | /** | 388 | EXPORT_SYMBOL(drm_vbl_send_signals); |
644 | * drm_handle_vblank - handle a vblank event | ||
645 | * @dev: DRM device | ||
646 | * @crtc: where this event occurred | ||
647 | * | ||
648 | * Drivers should call this routine in their vblank interrupt handlers to | ||
649 | * update the vblank counter and send any signals that may be pending. | ||
650 | */ | ||
651 | void drm_handle_vblank(struct drm_device *dev, int crtc) | ||
652 | { | ||
653 | drm_update_vblank_count(dev, crtc); | ||
654 | DRM_WAKEUP(&dev->vbl_queue[crtc]); | ||
655 | drm_vbl_send_signals(dev, crtc); | ||
656 | } | ||
657 | EXPORT_SYMBOL(drm_handle_vblank); | ||
658 | 389 | ||
659 | /** | 390 | /** |
660 | * Tasklet wrapper function. | 391 | * Tasklet wrapper function. |
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c index 12dcdd1832f0..0998723cde79 100644 --- a/drivers/char/drm/drm_lock.c +++ b/drivers/char/drm/drm_lock.c | |||
@@ -53,7 +53,6 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
53 | DECLARE_WAITQUEUE(entry, current); | 53 | DECLARE_WAITQUEUE(entry, current); |
54 | struct drm_lock *lock = data; | 54 | struct drm_lock *lock = data; |
55 | int ret = 0; | 55 | int ret = 0; |
56 | unsigned long irqflags; | ||
57 | 56 | ||
58 | ++file_priv->lock_count; | 57 | ++file_priv->lock_count; |
59 | 58 | ||
@@ -72,9 +71,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
72 | return -EINVAL; | 71 | return -EINVAL; |
73 | 72 | ||
74 | add_wait_queue(&dev->lock.lock_queue, &entry); | 73 | add_wait_queue(&dev->lock.lock_queue, &entry); |
75 | spin_lock_irqsave(&dev->lock.spinlock, irqflags); | 74 | spin_lock_bh(&dev->lock.spinlock); |
76 | dev->lock.user_waiters++; | 75 | dev->lock.user_waiters++; |
77 | spin_unlock_irqrestore(&dev->lock.spinlock, irqflags); | 76 | spin_unlock_bh(&dev->lock.spinlock); |
78 | for (;;) { | 77 | for (;;) { |
79 | __set_current_state(TASK_INTERRUPTIBLE); | 78 | __set_current_state(TASK_INTERRUPTIBLE); |
80 | if (!dev->lock.hw_lock) { | 79 | if (!dev->lock.hw_lock) { |
@@ -96,9 +95,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
96 | break; | 95 | break; |
97 | } | 96 | } |
98 | } | 97 | } |
99 | spin_lock_irqsave(&dev->lock.spinlock, irqflags); | 98 | spin_lock_bh(&dev->lock.spinlock); |
100 | dev->lock.user_waiters--; | 99 | dev->lock.user_waiters--; |
101 | spin_unlock_irqrestore(&dev->lock.spinlock, irqflags); | 100 | spin_unlock_bh(&dev->lock.spinlock); |
102 | __set_current_state(TASK_RUNNING); | 101 | __set_current_state(TASK_RUNNING); |
103 | remove_wait_queue(&dev->lock.lock_queue, &entry); | 102 | remove_wait_queue(&dev->lock.lock_queue, &entry); |
104 | 103 | ||
@@ -199,9 +198,8 @@ int drm_lock_take(struct drm_lock_data *lock_data, | |||
199 | { | 198 | { |
200 | unsigned int old, new, prev; | 199 | unsigned int old, new, prev; |
201 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 200 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
202 | unsigned long irqflags; | ||
203 | 201 | ||
204 | spin_lock_irqsave(&lock_data->spinlock, irqflags); | 202 | spin_lock_bh(&lock_data->spinlock); |
205 | do { | 203 | do { |
206 | old = *lock; | 204 | old = *lock; |
207 | if (old & _DRM_LOCK_HELD) | 205 | if (old & _DRM_LOCK_HELD) |
@@ -213,7 +211,7 @@ int drm_lock_take(struct drm_lock_data *lock_data, | |||
213 | } | 211 | } |
214 | prev = cmpxchg(lock, old, new); | 212 | prev = cmpxchg(lock, old, new); |
215 | } while (prev != old); | 213 | } while (prev != old); |
216 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 214 | spin_unlock_bh(&lock_data->spinlock); |
217 | 215 | ||
218 | if (_DRM_LOCKING_CONTEXT(old) == context) { | 216 | if (_DRM_LOCKING_CONTEXT(old) == context) { |
219 | if (old & _DRM_LOCK_HELD) { | 217 | if (old & _DRM_LOCK_HELD) { |
@@ -274,16 +272,15 @@ int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context) | |||
274 | { | 272 | { |
275 | unsigned int old, new, prev; | 273 | unsigned int old, new, prev; |
276 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 274 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
277 | unsigned long irqflags; | ||
278 | 275 | ||
279 | spin_lock_irqsave(&lock_data->spinlock, irqflags); | 276 | spin_lock_bh(&lock_data->spinlock); |
280 | if (lock_data->kernel_waiters != 0) { | 277 | if (lock_data->kernel_waiters != 0) { |
281 | drm_lock_transfer(lock_data, 0); | 278 | drm_lock_transfer(lock_data, 0); |
282 | lock_data->idle_has_lock = 1; | 279 | lock_data->idle_has_lock = 1; |
283 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 280 | spin_unlock_bh(&lock_data->spinlock); |
284 | return 1; | 281 | return 1; |
285 | } | 282 | } |
286 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 283 | spin_unlock_bh(&lock_data->spinlock); |
287 | 284 | ||
288 | do { | 285 | do { |
289 | old = *lock; | 286 | old = *lock; |
@@ -347,20 +344,19 @@ static int drm_notifier(void *priv) | |||
347 | void drm_idlelock_take(struct drm_lock_data *lock_data) | 344 | void drm_idlelock_take(struct drm_lock_data *lock_data) |
348 | { | 345 | { |
349 | int ret = 0; | 346 | int ret = 0; |
350 | unsigned long irqflags; | ||
351 | 347 | ||
352 | spin_lock_irqsave(&lock_data->spinlock, irqflags); | 348 | spin_lock_bh(&lock_data->spinlock); |
353 | lock_data->kernel_waiters++; | 349 | lock_data->kernel_waiters++; |
354 | if (!lock_data->idle_has_lock) { | 350 | if (!lock_data->idle_has_lock) { |
355 | 351 | ||
356 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 352 | spin_unlock_bh(&lock_data->spinlock); |
357 | ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT); | 353 | ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT); |
358 | spin_lock_irqsave(&lock_data->spinlock, irqflags); | 354 | spin_lock_bh(&lock_data->spinlock); |
359 | 355 | ||
360 | if (ret == 1) | 356 | if (ret == 1) |
361 | lock_data->idle_has_lock = 1; | 357 | lock_data->idle_has_lock = 1; |
362 | } | 358 | } |
363 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 359 | spin_unlock_bh(&lock_data->spinlock); |
364 | } | 360 | } |
365 | EXPORT_SYMBOL(drm_idlelock_take); | 361 | EXPORT_SYMBOL(drm_idlelock_take); |
366 | 362 | ||
@@ -368,9 +364,8 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) | |||
368 | { | 364 | { |
369 | unsigned int old, prev; | 365 | unsigned int old, prev; |
370 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 366 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
371 | unsigned long irqflags; | ||
372 | 367 | ||
373 | spin_lock_irqsave(&lock_data->spinlock, irqflags); | 368 | spin_lock_bh(&lock_data->spinlock); |
374 | if (--lock_data->kernel_waiters == 0) { | 369 | if (--lock_data->kernel_waiters == 0) { |
375 | if (lock_data->idle_has_lock) { | 370 | if (lock_data->idle_has_lock) { |
376 | do { | 371 | do { |
@@ -381,7 +376,7 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) | |||
381 | lock_data->idle_has_lock = 0; | 376 | lock_data->idle_has_lock = 0; |
382 | } | 377 | } |
383 | } | 378 | } |
384 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 379 | spin_unlock_bh(&lock_data->spinlock); |
385 | } | 380 | } |
386 | EXPORT_SYMBOL(drm_idlelock_release); | 381 | EXPORT_SYMBOL(drm_idlelock_release); |
387 | 382 | ||
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index f47e46e3529f..88974342933c 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -415,13 +415,10 @@ static void i915_emit_breadcrumb(struct drm_device *dev) | |||
415 | drm_i915_private_t *dev_priv = dev->dev_private; | 415 | drm_i915_private_t *dev_priv = dev->dev_private; |
416 | RING_LOCALS; | 416 | RING_LOCALS; |
417 | 417 | ||
418 | if (++dev_priv->counter > BREADCRUMB_MASK) { | 418 | dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter; |
419 | dev_priv->counter = 1; | ||
420 | DRM_DEBUG("Breadcrumb counter wrapped around\n"); | ||
421 | } | ||
422 | 419 | ||
423 | if (dev_priv->sarea_priv) | 420 | if (dev_priv->counter > 0x7FFFFFFFUL) |
424 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter; | 421 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter = 1; |
425 | 422 | ||
426 | BEGIN_LP_RING(4); | 423 | BEGIN_LP_RING(4); |
427 | OUT_RING(CMD_STORE_DWORD_IDX); | 424 | OUT_RING(CMD_STORE_DWORD_IDX); |
@@ -431,26 +428,6 @@ static void i915_emit_breadcrumb(struct drm_device *dev) | |||
431 | ADVANCE_LP_RING(); | 428 | ADVANCE_LP_RING(); |
432 | } | 429 | } |
433 | 430 | ||
434 | int i915_emit_mi_flush(struct drm_device *dev, uint32_t flush) | ||
435 | { | ||
436 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
437 | uint32_t flush_cmd = CMD_MI_FLUSH; | ||
438 | RING_LOCALS; | ||
439 | |||
440 | flush_cmd |= flush; | ||
441 | |||
442 | i915_kernel_lost_context(dev); | ||
443 | |||
444 | BEGIN_LP_RING(4); | ||
445 | OUT_RING(flush_cmd); | ||
446 | OUT_RING(0); | ||
447 | OUT_RING(0); | ||
448 | OUT_RING(0); | ||
449 | ADVANCE_LP_RING(); | ||
450 | |||
451 | return 0; | ||
452 | } | ||
453 | |||
454 | static int i915_dispatch_cmdbuffer(struct drm_device * dev, | 431 | static int i915_dispatch_cmdbuffer(struct drm_device * dev, |
455 | drm_i915_cmdbuffer_t * cmd) | 432 | drm_i915_cmdbuffer_t * cmd) |
456 | { | 433 | { |
@@ -534,74 +511,52 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev, | |||
534 | return 0; | 511 | return 0; |
535 | } | 512 | } |
536 | 513 | ||
537 | static void i915_do_dispatch_flip(struct drm_device * dev, int plane, int sync) | 514 | static int i915_dispatch_flip(struct drm_device * dev) |
538 | { | 515 | { |
539 | drm_i915_private_t *dev_priv = dev->dev_private; | 516 | drm_i915_private_t *dev_priv = dev->dev_private; |
540 | u32 num_pages, current_page, next_page, dspbase; | ||
541 | int shift = 2 * plane, x, y; | ||
542 | RING_LOCALS; | 517 | RING_LOCALS; |
543 | 518 | ||
544 | /* Calculate display base offset */ | 519 | DRM_DEBUG("%s: page=%d pfCurrentPage=%d\n", |
545 | num_pages = dev_priv->sarea_priv->third_handle ? 3 : 2; | 520 | __FUNCTION__, |
546 | current_page = (dev_priv->sarea_priv->pf_current_page >> shift) & 0x3; | 521 | dev_priv->current_page, |
547 | next_page = (current_page + 1) % num_pages; | 522 | dev_priv->sarea_priv->pf_current_page); |
548 | 523 | ||
549 | switch (next_page) { | 524 | i915_kernel_lost_context(dev); |
550 | default: | 525 | |
551 | case 0: | 526 | BEGIN_LP_RING(2); |
552 | dspbase = dev_priv->sarea_priv->front_offset; | 527 | OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); |
553 | break; | 528 | OUT_RING(0); |
554 | case 1: | 529 | ADVANCE_LP_RING(); |
555 | dspbase = dev_priv->sarea_priv->back_offset; | ||
556 | break; | ||
557 | case 2: | ||
558 | dspbase = dev_priv->sarea_priv->third_offset; | ||
559 | break; | ||
560 | } | ||
561 | 530 | ||
562 | if (plane == 0) { | 531 | BEGIN_LP_RING(6); |
563 | x = dev_priv->sarea_priv->planeA_x; | 532 | OUT_RING(CMD_OP_DISPLAYBUFFER_INFO | ASYNC_FLIP); |
564 | y = dev_priv->sarea_priv->planeA_y; | 533 | OUT_RING(0); |
534 | if (dev_priv->current_page == 0) { | ||
535 | OUT_RING(dev_priv->back_offset); | ||
536 | dev_priv->current_page = 1; | ||
565 | } else { | 537 | } else { |
566 | x = dev_priv->sarea_priv->planeB_x; | 538 | OUT_RING(dev_priv->front_offset); |
567 | y = dev_priv->sarea_priv->planeB_y; | 539 | dev_priv->current_page = 0; |
568 | } | 540 | } |
541 | OUT_RING(0); | ||
542 | ADVANCE_LP_RING(); | ||
569 | 543 | ||
570 | dspbase += (y * dev_priv->sarea_priv->pitch + x) * dev_priv->cpp; | 544 | BEGIN_LP_RING(2); |
545 | OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_PLANE_A_FLIP); | ||
546 | OUT_RING(0); | ||
547 | ADVANCE_LP_RING(); | ||
571 | 548 | ||
572 | DRM_DEBUG("plane=%d current_page=%d dspbase=0x%x\n", plane, current_page, | 549 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter++; |
573 | dspbase); | ||
574 | 550 | ||
575 | BEGIN_LP_RING(4); | 551 | BEGIN_LP_RING(4); |
576 | OUT_RING(sync ? 0 : | 552 | OUT_RING(CMD_STORE_DWORD_IDX); |
577 | (MI_WAIT_FOR_EVENT | (plane ? MI_WAIT_FOR_PLANE_B_FLIP : | 553 | OUT_RING(20); |
578 | MI_WAIT_FOR_PLANE_A_FLIP))); | 554 | OUT_RING(dev_priv->counter); |
579 | OUT_RING(CMD_OP_DISPLAYBUFFER_INFO | (sync ? 0 : ASYNC_FLIP) | | 555 | OUT_RING(0); |
580 | (plane ? DISPLAY_PLANE_B : DISPLAY_PLANE_A)); | ||
581 | OUT_RING(dev_priv->sarea_priv->pitch * dev_priv->cpp); | ||
582 | OUT_RING(dspbase); | ||
583 | ADVANCE_LP_RING(); | 556 | ADVANCE_LP_RING(); |
584 | 557 | ||
585 | dev_priv->sarea_priv->pf_current_page &= ~(0x3 << shift); | 558 | dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; |
586 | dev_priv->sarea_priv->pf_current_page |= next_page << shift; | 559 | return 0; |
587 | } | ||
588 | |||
589 | void i915_dispatch_flip(struct drm_device * dev, int planes, int sync) | ||
590 | { | ||
591 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
592 | int i; | ||
593 | |||
594 | DRM_DEBUG("planes=0x%x pfCurrentPage=%d\n", | ||
595 | planes, dev_priv->sarea_priv->pf_current_page); | ||
596 | |||
597 | i915_emit_mi_flush(dev, MI_READ_FLUSH | MI_EXE_FLUSH); | ||
598 | |||
599 | for (i = 0; i < 2; i++) | ||
600 | if (planes & (1 << i)) | ||
601 | i915_do_dispatch_flip(dev, i, sync); | ||
602 | |||
603 | i915_emit_breadcrumb(dev); | ||
604 | |||
605 | } | 560 | } |
606 | 561 | ||
607 | static int i915_quiescent(struct drm_device * dev) | 562 | static int i915_quiescent(struct drm_device * dev) |
@@ -624,6 +579,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, | |||
624 | struct drm_file *file_priv) | 579 | struct drm_file *file_priv) |
625 | { | 580 | { |
626 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 581 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
582 | u32 *hw_status = dev_priv->hw_status_page; | ||
627 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) | 583 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) |
628 | dev_priv->sarea_priv; | 584 | dev_priv->sarea_priv; |
629 | drm_i915_batchbuffer_t *batch = data; | 585 | drm_i915_batchbuffer_t *batch = data; |
@@ -646,7 +602,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, | |||
646 | 602 | ||
647 | ret = i915_dispatch_batchbuffer(dev, batch); | 603 | ret = i915_dispatch_batchbuffer(dev, batch); |
648 | 604 | ||
649 | sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); | 605 | sarea_priv->last_dispatch = (int)hw_status[5]; |
650 | return ret; | 606 | return ret; |
651 | } | 607 | } |
652 | 608 | ||
@@ -654,6 +610,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, | |||
654 | struct drm_file *file_priv) | 610 | struct drm_file *file_priv) |
655 | { | 611 | { |
656 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 612 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
613 | u32 *hw_status = dev_priv->hw_status_page; | ||
657 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) | 614 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) |
658 | dev_priv->sarea_priv; | 615 | dev_priv->sarea_priv; |
659 | drm_i915_cmdbuffer_t *cmdbuf = data; | 616 | drm_i915_cmdbuffer_t *cmdbuf = data; |
@@ -678,51 +635,18 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, | |||
678 | return ret; | 635 | return ret; |
679 | } | 636 | } |
680 | 637 | ||
681 | sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); | 638 | sarea_priv->last_dispatch = (int)hw_status[5]; |
682 | return 0; | ||
683 | } | ||
684 | |||
685 | static int i915_do_cleanup_pageflip(struct drm_device * dev) | ||
686 | { | ||
687 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
688 | int i, planes, num_pages = dev_priv->sarea_priv->third_handle ? 3 : 2; | ||
689 | |||
690 | DRM_DEBUG("\n"); | ||
691 | |||
692 | for (i = 0, planes = 0; i < 2; i++) | ||
693 | if (dev_priv->sarea_priv->pf_current_page & (0x3 << (2 * i))) { | ||
694 | dev_priv->sarea_priv->pf_current_page = | ||
695 | (dev_priv->sarea_priv->pf_current_page & | ||
696 | ~(0x3 << (2 * i))) | ((num_pages - 1) << (2 * i)); | ||
697 | |||
698 | planes |= 1 << i; | ||
699 | } | ||
700 | |||
701 | if (planes) | ||
702 | i915_dispatch_flip(dev, planes, 0); | ||
703 | |||
704 | return 0; | 639 | return 0; |
705 | } | 640 | } |
706 | 641 | ||
707 | static int i915_flip_bufs(struct drm_device *dev, void *data, | 642 | static int i915_flip_bufs(struct drm_device *dev, void *data, |
708 | struct drm_file *file_priv) | 643 | struct drm_file *file_priv) |
709 | { | 644 | { |
710 | drm_i915_flip_t *param = data; | 645 | DRM_DEBUG("%s\n", __FUNCTION__); |
711 | |||
712 | DRM_DEBUG("\n"); | ||
713 | 646 | ||
714 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 647 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
715 | 648 | ||
716 | /* This is really planes */ | 649 | return i915_dispatch_flip(dev); |
717 | if (param->pipes & ~0x3) { | ||
718 | DRM_ERROR("Invalid planes 0x%x, only <= 0x3 is valid\n", | ||
719 | param->pipes); | ||
720 | return -EINVAL; | ||
721 | } | ||
722 | |||
723 | i915_dispatch_flip(dev, param->pipes, 0); | ||
724 | |||
725 | return 0; | ||
726 | } | 650 | } |
727 | 651 | ||
728 | static int i915_getparam(struct drm_device *dev, void *data, | 652 | static int i915_getparam(struct drm_device *dev, void *data, |
@@ -883,8 +807,6 @@ void i915_driver_lastclose(struct drm_device * dev) | |||
883 | if (!dev_priv) | 807 | if (!dev_priv) |
884 | return; | 808 | return; |
885 | 809 | ||
886 | if (drm_getsarea(dev) && dev_priv->sarea_priv) | ||
887 | i915_do_cleanup_pageflip(dev); | ||
888 | if (dev_priv->agp_heap) | 810 | if (dev_priv->agp_heap) |
889 | i915_mem_takedown(&(dev_priv->agp_heap)); | 811 | i915_mem_takedown(&(dev_priv->agp_heap)); |
890 | 812 | ||
diff --git a/drivers/char/drm/i915_drm.h b/drivers/char/drm/i915_drm.h index 0431c00e2289..05c66cf03a9e 100644 --- a/drivers/char/drm/i915_drm.h +++ b/drivers/char/drm/i915_drm.h | |||
@@ -105,29 +105,14 @@ typedef struct _drm_i915_sarea { | |||
105 | unsigned int rotated_tiled; | 105 | unsigned int rotated_tiled; |
106 | unsigned int rotated2_tiled; | 106 | unsigned int rotated2_tiled; |
107 | 107 | ||
108 | int planeA_x; | 108 | int pipeA_x; |
109 | int planeA_y; | 109 | int pipeA_y; |
110 | int planeA_w; | 110 | int pipeA_w; |
111 | int planeA_h; | 111 | int pipeA_h; |
112 | int planeB_x; | 112 | int pipeB_x; |
113 | int planeB_y; | 113 | int pipeB_y; |
114 | int planeB_w; | 114 | int pipeB_w; |
115 | int planeB_h; | 115 | int pipeB_h; |
116 | |||
117 | /* Triple buffering */ | ||
118 | drm_handle_t third_handle; | ||
119 | int third_offset; | ||
120 | int third_size; | ||
121 | unsigned int third_tiled; | ||
122 | |||
123 | /* buffer object handles for the static buffers. May change | ||
124 | * over the lifetime of the client, though it doesn't in our current | ||
125 | * implementation. | ||
126 | */ | ||
127 | unsigned int front_bo_handle; | ||
128 | unsigned int back_bo_handle; | ||
129 | unsigned int third_bo_handle; | ||
130 | unsigned int depth_bo_handle; | ||
131 | } drm_i915_sarea_t; | 116 | } drm_i915_sarea_t; |
132 | 117 | ||
133 | /* Flags for perf_boxes | 118 | /* Flags for perf_boxes |
@@ -161,7 +146,7 @@ typedef struct _drm_i915_sarea { | |||
161 | 146 | ||
162 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) | 147 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) |
163 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) | 148 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) |
164 | #define DRM_IOCTL_I915_FLIP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FLIP, drm_i915_flip_t) | 149 | #define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) |
165 | #define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) | 150 | #define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) |
166 | #define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) | 151 | #define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) |
167 | #define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) | 152 | #define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) |
@@ -176,18 +161,6 @@ typedef struct _drm_i915_sarea { | |||
176 | #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) | 161 | #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) |
177 | #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) | 162 | #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) |
178 | 163 | ||
179 | /* Asynchronous page flipping: | ||
180 | */ | ||
181 | typedef struct drm_i915_flip { | ||
182 | /* | ||
183 | * This is really talking about planes, and we could rename it | ||
184 | * except for the fact that some of the duplicated i915_drm.h files | ||
185 | * out there check for HAVE_I915_FLIP and so might pick up this | ||
186 | * version. | ||
187 | */ | ||
188 | int pipes; | ||
189 | } drm_i915_flip_t; | ||
190 | |||
191 | /* Allow drivers to submit batchbuffers directly to hardware, relying | 164 | /* Allow drivers to submit batchbuffers directly to hardware, relying |
192 | * on the security mechanisms provided by hardware. | 165 | * on the security mechanisms provided by hardware. |
193 | */ | 166 | */ |
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c index bb8f1b2fb383..e8f3d682e3b1 100644 --- a/drivers/char/drm/i915_drv.c +++ b/drivers/char/drm/i915_drv.c | |||
@@ -147,7 +147,7 @@ static void i915_save_vga(struct drm_device *dev) | |||
147 | i915_write_indexed(cr_index, cr_data, 0x11, | 147 | i915_write_indexed(cr_index, cr_data, 0x11, |
148 | i915_read_indexed(cr_index, cr_data, 0x11) & | 148 | i915_read_indexed(cr_index, cr_data, 0x11) & |
149 | (~0x80)); | 149 | (~0x80)); |
150 | for (i = 0; i < 0x24; i++) | 150 | for (i = 0; i <= 0x24; i++) |
151 | dev_priv->saveCR[i] = | 151 | dev_priv->saveCR[i] = |
152 | i915_read_indexed(cr_index, cr_data, i); | 152 | i915_read_indexed(cr_index, cr_data, i); |
153 | /* Make sure we don't turn off CR group 0 writes */ | 153 | /* Make sure we don't turn off CR group 0 writes */ |
@@ -156,7 +156,7 @@ static void i915_save_vga(struct drm_device *dev) | |||
156 | /* Attribute controller registers */ | 156 | /* Attribute controller registers */ |
157 | inb(st01); | 157 | inb(st01); |
158 | dev_priv->saveAR_INDEX = inb(VGA_AR_INDEX); | 158 | dev_priv->saveAR_INDEX = inb(VGA_AR_INDEX); |
159 | for (i = 0; i < 20; i++) | 159 | for (i = 0; i <= 0x14; i++) |
160 | dev_priv->saveAR[i] = i915_read_ar(st01, i, 0); | 160 | dev_priv->saveAR[i] = i915_read_ar(st01, i, 0); |
161 | inb(st01); | 161 | inb(st01); |
162 | outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX); | 162 | outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX); |
@@ -206,7 +206,7 @@ static void i915_restore_vga(struct drm_device *dev) | |||
206 | /* CRT controller regs */ | 206 | /* CRT controller regs */ |
207 | /* Enable CR group 0 writes */ | 207 | /* Enable CR group 0 writes */ |
208 | i915_write_indexed(cr_index, cr_data, 0x11, dev_priv->saveCR[0x11]); | 208 | i915_write_indexed(cr_index, cr_data, 0x11, dev_priv->saveCR[0x11]); |
209 | for (i = 0; i < 0x24; i++) | 209 | for (i = 0; i <= 0x24; i++) |
210 | i915_write_indexed(cr_index, cr_data, i, dev_priv->saveCR[i]); | 210 | i915_write_indexed(cr_index, cr_data, i, dev_priv->saveCR[i]); |
211 | 211 | ||
212 | /* Graphics controller regs */ | 212 | /* Graphics controller regs */ |
@@ -223,7 +223,7 @@ static void i915_restore_vga(struct drm_device *dev) | |||
223 | 223 | ||
224 | /* Attribute controller registers */ | 224 | /* Attribute controller registers */ |
225 | inb(st01); | 225 | inb(st01); |
226 | for (i = 0; i < 20; i++) | 226 | for (i = 0; i <= 0x14; i++) |
227 | i915_write_ar(st01, i, dev_priv->saveAR[i], 0); | 227 | i915_write_ar(st01, i, dev_priv->saveAR[i], 0); |
228 | inb(st01); /* switch back to index mode */ | 228 | inb(st01); /* switch back to index mode */ |
229 | outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX); | 229 | outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX); |
@@ -256,6 +256,9 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
256 | pci_save_state(dev->pdev); | 256 | pci_save_state(dev->pdev); |
257 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | 257 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); |
258 | 258 | ||
259 | /* Display arbitration control */ | ||
260 | dev_priv->saveDSPARB = I915_READ(DSPARB); | ||
261 | |||
259 | /* Pipe & plane A info */ | 262 | /* Pipe & plane A info */ |
260 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); | 263 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); |
261 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); | 264 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); |
@@ -349,6 +352,7 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
349 | dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); | 352 | dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); |
350 | 353 | ||
351 | /* Clock gating state */ | 354 | /* Clock gating state */ |
355 | dev_priv->saveD_STATE = I915_READ(D_STATE); | ||
352 | dev_priv->saveDSPCLK_GATE_D = I915_READ(DSPCLK_GATE_D); | 356 | dev_priv->saveDSPCLK_GATE_D = I915_READ(DSPCLK_GATE_D); |
353 | 357 | ||
354 | /* Cache mode state */ | 358 | /* Cache mode state */ |
@@ -388,6 +392,8 @@ static int i915_resume(struct drm_device *dev) | |||
388 | 392 | ||
389 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); | 393 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); |
390 | 394 | ||
395 | I915_WRITE(DSPARB, dev_priv->saveDSPARB); | ||
396 | |||
391 | /* Pipe & plane A info */ | 397 | /* Pipe & plane A info */ |
392 | /* Prime the clock */ | 398 | /* Prime the clock */ |
393 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | 399 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { |
@@ -507,6 +513,7 @@ static int i915_resume(struct drm_device *dev) | |||
507 | udelay(150); | 513 | udelay(150); |
508 | 514 | ||
509 | /* Clock gating state */ | 515 | /* Clock gating state */ |
516 | I915_WRITE (D_STATE, dev_priv->saveD_STATE); | ||
510 | I915_WRITE (DSPCLK_GATE_D, dev_priv->saveDSPCLK_GATE_D); | 517 | I915_WRITE (DSPCLK_GATE_D, dev_priv->saveDSPCLK_GATE_D); |
511 | 518 | ||
512 | /* Cache mode state */ | 519 | /* Cache mode state */ |
@@ -533,7 +540,8 @@ static struct drm_driver driver = { | |||
533 | */ | 540 | */ |
534 | .driver_features = | 541 | .driver_features = |
535 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ | 542 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ |
536 | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, | 543 | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL | |
544 | DRIVER_IRQ_VBL2, | ||
537 | .load = i915_driver_load, | 545 | .load = i915_driver_load, |
538 | .unload = i915_driver_unload, | 546 | .unload = i915_driver_unload, |
539 | .lastclose = i915_driver_lastclose, | 547 | .lastclose = i915_driver_lastclose, |
@@ -541,9 +549,8 @@ static struct drm_driver driver = { | |||
541 | .suspend = i915_suspend, | 549 | .suspend = i915_suspend, |
542 | .resume = i915_resume, | 550 | .resume = i915_resume, |
543 | .device_is_agp = i915_driver_device_is_agp, | 551 | .device_is_agp = i915_driver_device_is_agp, |
544 | .get_vblank_counter = i915_get_vblank_counter, | 552 | .vblank_wait = i915_driver_vblank_wait, |
545 | .enable_vblank = i915_enable_vblank, | 553 | .vblank_wait2 = i915_driver_vblank_wait2, |
546 | .disable_vblank = i915_disable_vblank, | ||
547 | .irq_preinstall = i915_driver_irq_preinstall, | 554 | .irq_preinstall = i915_driver_irq_preinstall, |
548 | .irq_postinstall = i915_driver_irq_postinstall, | 555 | .irq_postinstall = i915_driver_irq_postinstall, |
549 | .irq_uninstall = i915_driver_irq_uninstall, | 556 | .irq_uninstall = i915_driver_irq_uninstall, |
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h index db7001f22561..1b20f7c0639c 100644 --- a/drivers/char/drm/i915_drv.h +++ b/drivers/char/drm/i915_drv.h | |||
@@ -76,9 +76,8 @@ struct mem_block { | |||
76 | typedef struct _drm_i915_vbl_swap { | 76 | typedef struct _drm_i915_vbl_swap { |
77 | struct list_head head; | 77 | struct list_head head; |
78 | drm_drawable_t drw_id; | 78 | drm_drawable_t drw_id; |
79 | unsigned int plane; | 79 | unsigned int pipe; |
80 | unsigned int sequence; | 80 | unsigned int sequence; |
81 | int flip; | ||
82 | } drm_i915_vbl_swap_t; | 81 | } drm_i915_vbl_swap_t; |
83 | 82 | ||
84 | typedef struct drm_i915_private { | 83 | typedef struct drm_i915_private { |
@@ -91,7 +90,7 @@ typedef struct drm_i915_private { | |||
91 | drm_dma_handle_t *status_page_dmah; | 90 | drm_dma_handle_t *status_page_dmah; |
92 | void *hw_status_page; | 91 | void *hw_status_page; |
93 | dma_addr_t dma_status_page; | 92 | dma_addr_t dma_status_page; |
94 | uint32_t counter; | 93 | unsigned long counter; |
95 | unsigned int status_gfx_addr; | 94 | unsigned int status_gfx_addr; |
96 | drm_local_map_t hws_map; | 95 | drm_local_map_t hws_map; |
97 | 96 | ||
@@ -104,18 +103,13 @@ typedef struct drm_i915_private { | |||
104 | 103 | ||
105 | wait_queue_head_t irq_queue; | 104 | wait_queue_head_t irq_queue; |
106 | atomic_t irq_received; | 105 | atomic_t irq_received; |
107 | atomic_t irq_emited; | 106 | atomic_t irq_emitted; |
108 | 107 | ||
109 | int tex_lru_log_granularity; | 108 | int tex_lru_log_granularity; |
110 | int allow_batchbuffer; | 109 | int allow_batchbuffer; |
111 | struct mem_block *agp_heap; | 110 | struct mem_block *agp_heap; |
112 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; | 111 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; |
113 | int vblank_pipe; | 112 | int vblank_pipe; |
114 | spinlock_t user_irq_lock; | ||
115 | int user_irq_refcount; | ||
116 | int fence_irq_on; | ||
117 | uint32_t irq_enable_reg; | ||
118 | int irq_enabled; | ||
119 | 113 | ||
120 | spinlock_t swaps_lock; | 114 | spinlock_t swaps_lock; |
121 | drm_i915_vbl_swap_t vbl_swaps; | 115 | drm_i915_vbl_swap_t vbl_swaps; |
@@ -125,6 +119,7 @@ typedef struct drm_i915_private { | |||
125 | u8 saveLBB; | 119 | u8 saveLBB; |
126 | u32 saveDSPACNTR; | 120 | u32 saveDSPACNTR; |
127 | u32 saveDSPBCNTR; | 121 | u32 saveDSPBCNTR; |
122 | u32 saveDSPARB; | ||
128 | u32 savePIPEACONF; | 123 | u32 savePIPEACONF; |
129 | u32 savePIPEBCONF; | 124 | u32 savePIPEBCONF; |
130 | u32 savePIPEASRC; | 125 | u32 savePIPEASRC; |
@@ -194,6 +189,7 @@ typedef struct drm_i915_private { | |||
194 | u32 saveIIR; | 189 | u32 saveIIR; |
195 | u32 saveIMR; | 190 | u32 saveIMR; |
196 | u32 saveCACHE_MODE_0; | 191 | u32 saveCACHE_MODE_0; |
192 | u32 saveD_STATE; | ||
197 | u32 saveDSPCLK_GATE_D; | 193 | u32 saveDSPCLK_GATE_D; |
198 | u32 saveMI_ARB_STATE; | 194 | u32 saveMI_ARB_STATE; |
199 | u32 saveSWF0[16]; | 195 | u32 saveSWF0[16]; |
@@ -203,10 +199,10 @@ typedef struct drm_i915_private { | |||
203 | u8 saveSR[8]; | 199 | u8 saveSR[8]; |
204 | u8 saveGR[25]; | 200 | u8 saveGR[25]; |
205 | u8 saveAR_INDEX; | 201 | u8 saveAR_INDEX; |
206 | u8 saveAR[20]; | 202 | u8 saveAR[21]; |
207 | u8 saveDACMASK; | 203 | u8 saveDACMASK; |
208 | u8 saveDACDATA[256*3]; /* 256 3-byte colors */ | 204 | u8 saveDACDATA[256*3]; /* 256 3-byte colors */ |
209 | u8 saveCR[36]; | 205 | u8 saveCR[37]; |
210 | } drm_i915_private_t; | 206 | } drm_i915_private_t; |
211 | 207 | ||
212 | extern struct drm_ioctl_desc i915_ioctls[]; | 208 | extern struct drm_ioctl_desc i915_ioctls[]; |
@@ -222,7 +218,7 @@ extern void i915_driver_preclose(struct drm_device *dev, | |||
222 | extern int i915_driver_device_is_agp(struct drm_device * dev); | 218 | extern int i915_driver_device_is_agp(struct drm_device * dev); |
223 | extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, | 219 | extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, |
224 | unsigned long arg); | 220 | unsigned long arg); |
225 | extern void i915_dispatch_flip(struct drm_device * dev, int pipes, int sync); | 221 | |
226 | /* i915_irq.c */ | 222 | /* i915_irq.c */ |
227 | extern int i915_irq_emit(struct drm_device *dev, void *data, | 223 | extern int i915_irq_emit(struct drm_device *dev, void *data, |
228 | struct drm_file *file_priv); | 224 | struct drm_file *file_priv); |
@@ -233,7 +229,7 @@ extern int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequenc | |||
233 | extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence); | 229 | extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence); |
234 | extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); | 230 | extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); |
235 | extern void i915_driver_irq_preinstall(struct drm_device * dev); | 231 | extern void i915_driver_irq_preinstall(struct drm_device * dev); |
236 | extern int i915_driver_irq_postinstall(struct drm_device * dev); | 232 | extern void i915_driver_irq_postinstall(struct drm_device * dev); |
237 | extern void i915_driver_irq_uninstall(struct drm_device * dev); | 233 | extern void i915_driver_irq_uninstall(struct drm_device * dev); |
238 | extern int i915_vblank_pipe_set(struct drm_device *dev, void *data, | 234 | extern int i915_vblank_pipe_set(struct drm_device *dev, void *data, |
239 | struct drm_file *file_priv); | 235 | struct drm_file *file_priv); |
@@ -241,9 +237,6 @@ extern int i915_vblank_pipe_get(struct drm_device *dev, void *data, | |||
241 | struct drm_file *file_priv); | 237 | struct drm_file *file_priv); |
242 | extern int i915_vblank_swap(struct drm_device *dev, void *data, | 238 | extern int i915_vblank_swap(struct drm_device *dev, void *data, |
243 | struct drm_file *file_priv); | 239 | struct drm_file *file_priv); |
244 | extern int i915_enable_vblank(struct drm_device *dev, int crtc); | ||
245 | extern void i915_disable_vblank(struct drm_device *dev, int crtc); | ||
246 | extern u32 i915_get_vblank_counter(struct drm_device *dev, int crtc); | ||
247 | 240 | ||
248 | /* i915_mem.c */ | 241 | /* i915_mem.c */ |
249 | extern int i915_mem_alloc(struct drm_device *dev, void *data, | 242 | extern int i915_mem_alloc(struct drm_device *dev, void *data, |
@@ -388,91 +381,21 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
388 | 381 | ||
389 | /* Interrupt bits: | 382 | /* Interrupt bits: |
390 | */ | 383 | */ |
391 | #define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1<<18) | 384 | #define USER_INT_FLAG (1<<1) |
392 | #define I915_DISPLAY_PORT_INTERRUPT (1<<17) | 385 | #define VSYNC_PIPEB_FLAG (1<<5) |
393 | #define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1<<15) | 386 | #define VSYNC_PIPEA_FLAG (1<<7) |
394 | #define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1<<14) | 387 | #define HWB_OOM_FLAG (1<<13) /* binner out of memory */ |
395 | #define I915_HWB_OOM_INTERRUPT (1<<13) /* binner out of memory */ | ||
396 | #define I915_SYNC_STATUS_INTERRUPT (1<<12) | ||
397 | #define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1<<11) | ||
398 | #define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1<<10) | ||
399 | #define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1<<9) | ||
400 | #define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1<<8) | ||
401 | #define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1<<7) | ||
402 | #define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1<<6) | ||
403 | #define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1<<5) | ||
404 | #define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1<<4) | ||
405 | #define I915_DEBUG_INTERRUPT (1<<2) | ||
406 | #define I915_USER_INTERRUPT (1<<1) | ||
407 | |||
408 | 388 | ||
409 | #define I915REG_HWSTAM 0x02098 | 389 | #define I915REG_HWSTAM 0x02098 |
410 | #define I915REG_INT_IDENTITY_R 0x020a4 | 390 | #define I915REG_INT_IDENTITY_R 0x020a4 |
411 | #define I915REG_INT_MASK_R 0x020a8 | 391 | #define I915REG_INT_MASK_R 0x020a8 |
412 | #define I915REG_INT_ENABLE_R 0x020a0 | 392 | #define I915REG_INT_ENABLE_R 0x020a0 |
413 | #define I915REG_INSTPM 0x020c0 | ||
414 | |||
415 | #define PIPEADSL 0x70000 | ||
416 | #define PIPEBDSL 0x71000 | ||
417 | 393 | ||
418 | #define I915REG_PIPEASTAT 0x70024 | 394 | #define I915REG_PIPEASTAT 0x70024 |
419 | #define I915REG_PIPEBSTAT 0x71024 | 395 | #define I915REG_PIPEBSTAT 0x71024 |
420 | /* | ||
421 | * The two pipe frame counter registers are not synchronized, so | ||
422 | * reading a stable value is somewhat tricky. The following code | ||
423 | * should work: | ||
424 | * | ||
425 | * do { | ||
426 | * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> | ||
427 | * PIPE_FRAME_HIGH_SHIFT; | ||
428 | * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >> | ||
429 | * PIPE_FRAME_LOW_SHIFT); | ||
430 | * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> | ||
431 | * PIPE_FRAME_HIGH_SHIFT); | ||
432 | * } while (high1 != high2); | ||
433 | * frame = (high1 << 8) | low1; | ||
434 | */ | ||
435 | #define PIPEAFRAMEHIGH 0x70040 | ||
436 | #define PIPEBFRAMEHIGH 0x71040 | ||
437 | #define PIPE_FRAME_HIGH_MASK 0x0000ffff | ||
438 | #define PIPE_FRAME_HIGH_SHIFT 0 | ||
439 | #define PIPEAFRAMEPIXEL 0x70044 | ||
440 | #define PIPEBFRAMEPIXEL 0x71044 | ||
441 | 396 | ||
442 | #define PIPE_FRAME_LOW_MASK 0xff000000 | 397 | #define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17) |
443 | #define PIPE_FRAME_LOW_SHIFT 24 | 398 | #define I915_VBLANK_CLEAR (1UL<<1) |
444 | /* | ||
445 | * Pixel within the current frame is counted in the PIPEAFRAMEPIXEL register | ||
446 | * and is 24 bits wide. | ||
447 | */ | ||
448 | #define PIPE_PIXEL_MASK 0x00ffffff | ||
449 | #define PIPE_PIXEL_SHIFT 0 | ||
450 | |||
451 | #define I915_FIFO_UNDERRUN_STATUS (1UL<<31) | ||
452 | #define I915_CRC_ERROR_ENABLE (1UL<<29) | ||
453 | #define I915_CRC_DONE_ENABLE (1UL<<28) | ||
454 | #define I915_GMBUS_EVENT_ENABLE (1UL<<27) | ||
455 | #define I915_VSYNC_INTERRUPT_ENABLE (1UL<<25) | ||
456 | #define I915_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24) | ||
457 | #define I915_DPST_EVENT_ENABLE (1UL<<23) | ||
458 | #define I915_LEGACY_BLC_EVENT_ENABLE (1UL<<22) | ||
459 | #define I915_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21) | ||
460 | #define I915_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20) | ||
461 | #define I915_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */ | ||
462 | #define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17) | ||
463 | #define I915_OVERLAY_UPDATED_ENABLE (1UL<<16) | ||
464 | #define I915_CRC_ERROR_INTERRUPT_STATUS (1UL<<13) | ||
465 | #define I915_CRC_DONE_INTERRUPT_STATUS (1UL<<12) | ||
466 | #define I915_GMBUS_INTERRUPT_STATUS (1UL<<11) | ||
467 | #define I915_VSYNC_INTERRUPT_STATUS (1UL<<9) | ||
468 | #define I915_DISPLAY_LINE_COMPARE_STATUS (1UL<<8) | ||
469 | #define I915_DPST_EVENT_STATUS (1UL<<7) | ||
470 | #define I915_LEGACY_BLC_EVENT_STATUS (1UL<<6) | ||
471 | #define I915_ODD_FIELD_INTERRUPT_STATUS (1UL<<5) | ||
472 | #define I915_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4) | ||
473 | #define I915_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */ | ||
474 | #define I915_VBLANK_INTERRUPT_STATUS (1UL<<1) | ||
475 | #define I915_OVERLAY_UPDATED_STATUS (1UL<<0) | ||
476 | 399 | ||
477 | #define SRX_INDEX 0x3c4 | 400 | #define SRX_INDEX 0x3c4 |
478 | #define SRX_DATA 0x3c5 | 401 | #define SRX_DATA 0x3c5 |
@@ -749,6 +672,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
749 | /** P1 value is 2 greater than this field */ | 672 | /** P1 value is 2 greater than this field */ |
750 | # define VGA0_PD_P1_MASK (0x1f << 0) | 673 | # define VGA0_PD_P1_MASK (0x1f << 0) |
751 | 674 | ||
675 | /* PCI D state control register */ | ||
676 | #define D_STATE 0x6104 | ||
752 | #define DSPCLK_GATE_D 0x6200 | 677 | #define DSPCLK_GATE_D 0x6200 |
753 | 678 | ||
754 | /* I830 CRTC registers */ | 679 | /* I830 CRTC registers */ |
@@ -1059,6 +984,12 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
1059 | #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21) | 984 | #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21) |
1060 | #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21) | 985 | #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21) |
1061 | 986 | ||
987 | #define DSPARB 0x70030 | ||
988 | #define DSPARB_CSTART_MASK (0x7f << 7) | ||
989 | #define DSPARB_CSTART_SHIFT 7 | ||
990 | #define DSPARB_BSTART_MASK (0x7f) | ||
991 | #define DSPARB_BSTART_SHIFT 0 | ||
992 | |||
1062 | #define PIPEBCONF 0x71008 | 993 | #define PIPEBCONF 0x71008 |
1063 | #define PIPEBCONF_ENABLE (1<<31) | 994 | #define PIPEBCONF_ENABLE (1<<31) |
1064 | #define PIPEBCONF_DISABLE 0 | 995 | #define PIPEBCONF_DISABLE 0 |
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c index 023ce66ef3ab..f7f16e7a8bf3 100644 --- a/drivers/char/drm/i915_irq.c +++ b/drivers/char/drm/i915_irq.c | |||
@@ -38,109 +38,6 @@ | |||
38 | #define MAX_NOPID ((u32)~0) | 38 | #define MAX_NOPID ((u32)~0) |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * i915_get_pipe - return the the pipe associated with a given plane | ||
42 | * @dev: DRM device | ||
43 | * @plane: plane to look for | ||
44 | * | ||
45 | * The Intel Mesa & 2D drivers call the vblank routines with a plane number | ||
46 | * rather than a pipe number, since they may not always be equal. This routine | ||
47 | * maps the given @plane back to a pipe number. | ||
48 | */ | ||
49 | static int | ||
50 | i915_get_pipe(struct drm_device *dev, int plane) | ||
51 | { | ||
52 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
53 | u32 dspcntr; | ||
54 | |||
55 | dspcntr = plane ? I915_READ(DSPBCNTR) : I915_READ(DSPACNTR); | ||
56 | |||
57 | return dspcntr & DISPPLANE_SEL_PIPE_MASK ? 1 : 0; | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * i915_get_plane - return the the plane associated with a given pipe | ||
62 | * @dev: DRM device | ||
63 | * @pipe: pipe to look for | ||
64 | * | ||
65 | * The Intel Mesa & 2D drivers call the vblank routines with a plane number | ||
66 | * rather than a plane number, since they may not always be equal. This routine | ||
67 | * maps the given @pipe back to a plane number. | ||
68 | */ | ||
69 | static int | ||
70 | i915_get_plane(struct drm_device *dev, int pipe) | ||
71 | { | ||
72 | if (i915_get_pipe(dev, 0) == pipe) | ||
73 | return 0; | ||
74 | return 1; | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * i915_pipe_enabled - check if a pipe is enabled | ||
79 | * @dev: DRM device | ||
80 | * @pipe: pipe to check | ||
81 | * | ||
82 | * Reading certain registers when the pipe is disabled can hang the chip. | ||
83 | * Use this routine to make sure the PLL is running and the pipe is active | ||
84 | * before reading such registers if unsure. | ||
85 | */ | ||
86 | static int | ||
87 | i915_pipe_enabled(struct drm_device *dev, int pipe) | ||
88 | { | ||
89 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
90 | unsigned long pipeconf = pipe ? PIPEBCONF : PIPEACONF; | ||
91 | |||
92 | if (I915_READ(pipeconf) & PIPEACONF_ENABLE) | ||
93 | return 1; | ||
94 | |||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | /** | ||
99 | * Emit a synchronous flip. | ||
100 | * | ||
101 | * This function must be called with the drawable spinlock held. | ||
102 | */ | ||
103 | static void | ||
104 | i915_dispatch_vsync_flip(struct drm_device *dev, struct drm_drawable_info *drw, | ||
105 | int plane) | ||
106 | { | ||
107 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
108 | drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv; | ||
109 | u16 x1, y1, x2, y2; | ||
110 | int pf_planes = 1 << plane; | ||
111 | |||
112 | /* If the window is visible on the other plane, we have to flip on that | ||
113 | * plane as well. | ||
114 | */ | ||
115 | if (plane == 1) { | ||
116 | x1 = sarea_priv->planeA_x; | ||
117 | y1 = sarea_priv->planeA_y; | ||
118 | x2 = x1 + sarea_priv->planeA_w; | ||
119 | y2 = y1 + sarea_priv->planeA_h; | ||
120 | } else { | ||
121 | x1 = sarea_priv->planeB_x; | ||
122 | y1 = sarea_priv->planeB_y; | ||
123 | x2 = x1 + sarea_priv->planeB_w; | ||
124 | y2 = y1 + sarea_priv->planeB_h; | ||
125 | } | ||
126 | |||
127 | if (x2 > 0 && y2 > 0) { | ||
128 | int i, num_rects = drw->num_rects; | ||
129 | struct drm_clip_rect *rect = drw->rects; | ||
130 | |||
131 | for (i = 0; i < num_rects; i++) | ||
132 | if (!(rect[i].x1 >= x2 || rect[i].y1 >= y2 || | ||
133 | rect[i].x2 <= x1 || rect[i].y2 <= y1)) { | ||
134 | pf_planes = 0x3; | ||
135 | |||
136 | break; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | i915_dispatch_flip(dev, pf_planes, 1); | ||
141 | } | ||
142 | |||
143 | /** | ||
144 | * Emit blits for scheduled buffer swaps. | 41 | * Emit blits for scheduled buffer swaps. |
145 | * | 42 | * |
146 | * This function will be called with the HW lock held. | 43 | * This function will be called with the HW lock held. |
@@ -148,19 +45,20 @@ i915_dispatch_vsync_flip(struct drm_device *dev, struct drm_drawable_info *drw, | |||
148 | static void i915_vblank_tasklet(struct drm_device *dev) | 45 | static void i915_vblank_tasklet(struct drm_device *dev) |
149 | { | 46 | { |
150 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 47 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
48 | unsigned long irqflags; | ||
151 | struct list_head *list, *tmp, hits, *hit; | 49 | struct list_head *list, *tmp, hits, *hit; |
152 | int nhits, nrects, slice[2], upper[2], lower[2], i, num_pages; | 50 | int nhits, nrects, slice[2], upper[2], lower[2], i; |
153 | unsigned counter[2]; | 51 | unsigned counter[2] = { atomic_read(&dev->vbl_received), |
52 | atomic_read(&dev->vbl_received2) }; | ||
154 | struct drm_drawable_info *drw; | 53 | struct drm_drawable_info *drw; |
155 | drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv; | 54 | drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv; |
156 | u32 cpp = dev_priv->cpp, offsets[3]; | 55 | u32 cpp = dev_priv->cpp; |
157 | u32 cmd = (cpp == 4) ? (XY_SRC_COPY_BLT_CMD | | 56 | u32 cmd = (cpp == 4) ? (XY_SRC_COPY_BLT_CMD | |
158 | XY_SRC_COPY_BLT_WRITE_ALPHA | | 57 | XY_SRC_COPY_BLT_WRITE_ALPHA | |
159 | XY_SRC_COPY_BLT_WRITE_RGB) | 58 | XY_SRC_COPY_BLT_WRITE_RGB) |
160 | : XY_SRC_COPY_BLT_CMD; | 59 | : XY_SRC_COPY_BLT_CMD; |
161 | u32 src_pitch = sarea_priv->pitch * cpp; | 60 | u32 src_pitch = sarea_priv->pitch * cpp; |
162 | u32 dst_pitch = sarea_priv->pitch * cpp; | 61 | u32 dst_pitch = sarea_priv->pitch * cpp; |
163 | /* COPY rop (0xcc), map cpp to magic color depth constants */ | ||
164 | u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24); | 62 | u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24); |
165 | RING_LOCALS; | 63 | RING_LOCALS; |
166 | 64 | ||
@@ -173,34 +71,24 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
173 | src_pitch >>= 2; | 71 | src_pitch >>= 2; |
174 | } | 72 | } |
175 | 73 | ||
176 | counter[0] = drm_vblank_count(dev, 0); | ||
177 | counter[1] = drm_vblank_count(dev, 1); | ||
178 | |||
179 | DRM_DEBUG("\n"); | 74 | DRM_DEBUG("\n"); |
180 | 75 | ||
181 | INIT_LIST_HEAD(&hits); | 76 | INIT_LIST_HEAD(&hits); |
182 | 77 | ||
183 | nhits = nrects = 0; | 78 | nhits = nrects = 0; |
184 | 79 | ||
185 | /* No irqsave/restore necessary. This tasklet may be run in an | 80 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); |
186 | * interrupt context or normal context, but we don't have to worry | ||
187 | * about getting interrupted by something acquiring the lock, because | ||
188 | * we are the interrupt context thing that acquires the lock. | ||
189 | */ | ||
190 | spin_lock(&dev_priv->swaps_lock); | ||
191 | 81 | ||
192 | /* Find buffer swaps scheduled for this vertical blank */ | 82 | /* Find buffer swaps scheduled for this vertical blank */ |
193 | list_for_each_safe(list, tmp, &dev_priv->vbl_swaps.head) { | 83 | list_for_each_safe(list, tmp, &dev_priv->vbl_swaps.head) { |
194 | drm_i915_vbl_swap_t *vbl_swap = | 84 | drm_i915_vbl_swap_t *vbl_swap = |
195 | list_entry(list, drm_i915_vbl_swap_t, head); | 85 | list_entry(list, drm_i915_vbl_swap_t, head); |
196 | int pipe = i915_get_pipe(dev, vbl_swap->plane); | ||
197 | 86 | ||
198 | if ((counter[pipe] - vbl_swap->sequence) > (1<<23)) | 87 | if ((counter[vbl_swap->pipe] - vbl_swap->sequence) > (1<<23)) |
199 | continue; | 88 | continue; |
200 | 89 | ||
201 | list_del(list); | 90 | list_del(list); |
202 | dev_priv->swaps_pending--; | 91 | dev_priv->swaps_pending--; |
203 | drm_vblank_put(dev, pipe); | ||
204 | 92 | ||
205 | spin_unlock(&dev_priv->swaps_lock); | 93 | spin_unlock(&dev_priv->swaps_lock); |
206 | spin_lock(&dev->drw_lock); | 94 | spin_lock(&dev->drw_lock); |
@@ -238,23 +126,43 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
238 | spin_lock(&dev_priv->swaps_lock); | 126 | spin_lock(&dev_priv->swaps_lock); |
239 | } | 127 | } |
240 | 128 | ||
241 | spin_unlock(&dev_priv->swaps_lock); | 129 | if (nhits == 0) { |
242 | 130 | spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); | |
243 | if (nhits == 0) | ||
244 | return; | 131 | return; |
132 | } | ||
133 | |||
134 | spin_unlock(&dev_priv->swaps_lock); | ||
245 | 135 | ||
246 | i915_kernel_lost_context(dev); | 136 | i915_kernel_lost_context(dev); |
247 | 137 | ||
248 | upper[0] = upper[1] = 0; | 138 | if (IS_I965G(dev)) { |
249 | slice[0] = max(sarea_priv->planeA_h / nhits, 1); | 139 | BEGIN_LP_RING(4); |
250 | slice[1] = max(sarea_priv->planeB_h / nhits, 1); | 140 | |
251 | lower[0] = sarea_priv->planeA_y + slice[0]; | 141 | OUT_RING(GFX_OP_DRAWRECT_INFO_I965); |
252 | lower[1] = sarea_priv->planeB_y + slice[0]; | 142 | OUT_RING(0); |
143 | OUT_RING(((sarea_priv->width - 1) & 0xffff) | ((sarea_priv->height - 1) << 16)); | ||
144 | OUT_RING(0); | ||
145 | ADVANCE_LP_RING(); | ||
146 | } else { | ||
147 | BEGIN_LP_RING(6); | ||
253 | 148 | ||
254 | offsets[0] = sarea_priv->front_offset; | 149 | OUT_RING(GFX_OP_DRAWRECT_INFO); |
255 | offsets[1] = sarea_priv->back_offset; | 150 | OUT_RING(0); |
256 | offsets[2] = sarea_priv->third_offset; | 151 | OUT_RING(0); |
257 | num_pages = sarea_priv->third_handle ? 3 : 2; | 152 | OUT_RING(sarea_priv->width | sarea_priv->height << 16); |
153 | OUT_RING(sarea_priv->width | sarea_priv->height << 16); | ||
154 | OUT_RING(0); | ||
155 | |||
156 | ADVANCE_LP_RING(); | ||
157 | } | ||
158 | |||
159 | sarea_priv->ctxOwner = DRM_KERNEL_CONTEXT; | ||
160 | |||
161 | upper[0] = upper[1] = 0; | ||
162 | slice[0] = max(sarea_priv->pipeA_h / nhits, 1); | ||
163 | slice[1] = max(sarea_priv->pipeB_h / nhits, 1); | ||
164 | lower[0] = sarea_priv->pipeA_y + slice[0]; | ||
165 | lower[1] = sarea_priv->pipeB_y + slice[0]; | ||
258 | 166 | ||
259 | spin_lock(&dev->drw_lock); | 167 | spin_lock(&dev->drw_lock); |
260 | 168 | ||
@@ -266,8 +174,6 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
266 | for (i = 0; i++ < nhits; | 174 | for (i = 0; i++ < nhits; |
267 | upper[0] = lower[0], lower[0] += slice[0], | 175 | upper[0] = lower[0], lower[0] += slice[0], |
268 | upper[1] = lower[1], lower[1] += slice[1]) { | 176 | upper[1] = lower[1], lower[1] += slice[1]) { |
269 | int init_drawrect = 1; | ||
270 | |||
271 | if (i == nhits) | 177 | if (i == nhits) |
272 | lower[0] = lower[1] = sarea_priv->height; | 178 | lower[0] = lower[1] = sarea_priv->height; |
273 | 179 | ||
@@ -275,7 +181,7 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
275 | drm_i915_vbl_swap_t *swap_hit = | 181 | drm_i915_vbl_swap_t *swap_hit = |
276 | list_entry(hit, drm_i915_vbl_swap_t, head); | 182 | list_entry(hit, drm_i915_vbl_swap_t, head); |
277 | struct drm_clip_rect *rect; | 183 | struct drm_clip_rect *rect; |
278 | int num_rects, plane, front, back; | 184 | int num_rects, pipe; |
279 | unsigned short top, bottom; | 185 | unsigned short top, bottom; |
280 | 186 | ||
281 | drw = drm_get_drawable_info(dev, swap_hit->drw_id); | 187 | drw = drm_get_drawable_info(dev, swap_hit->drw_id); |
@@ -283,50 +189,10 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
283 | if (!drw) | 189 | if (!drw) |
284 | continue; | 190 | continue; |
285 | 191 | ||
286 | plane = swap_hit->plane; | ||
287 | |||
288 | if (swap_hit->flip) { | ||
289 | i915_dispatch_vsync_flip(dev, drw, plane); | ||
290 | continue; | ||
291 | } | ||
292 | |||
293 | if (init_drawrect) { | ||
294 | int width = sarea_priv->width; | ||
295 | int height = sarea_priv->height; | ||
296 | if (IS_I965G(dev)) { | ||
297 | BEGIN_LP_RING(4); | ||
298 | |||
299 | OUT_RING(GFX_OP_DRAWRECT_INFO_I965); | ||
300 | OUT_RING(0); | ||
301 | OUT_RING(((width - 1) & 0xffff) | ((height - 1) << 16)); | ||
302 | OUT_RING(0); | ||
303 | |||
304 | ADVANCE_LP_RING(); | ||
305 | } else { | ||
306 | BEGIN_LP_RING(6); | ||
307 | |||
308 | OUT_RING(GFX_OP_DRAWRECT_INFO); | ||
309 | OUT_RING(0); | ||
310 | OUT_RING(0); | ||
311 | OUT_RING(((width - 1) & 0xffff) | ((height - 1) << 16)); | ||
312 | OUT_RING(0); | ||
313 | OUT_RING(0); | ||
314 | |||
315 | ADVANCE_LP_RING(); | ||
316 | } | ||
317 | |||
318 | sarea_priv->ctxOwner = DRM_KERNEL_CONTEXT; | ||
319 | |||
320 | init_drawrect = 0; | ||
321 | } | ||
322 | |||
323 | rect = drw->rects; | 192 | rect = drw->rects; |
324 | top = upper[plane]; | 193 | pipe = swap_hit->pipe; |
325 | bottom = lower[plane]; | 194 | top = upper[pipe]; |
326 | 195 | bottom = lower[pipe]; | |
327 | front = (dev_priv->sarea_priv->pf_current_page >> | ||
328 | (2 * plane)) & 0x3; | ||
329 | back = (front + 1) % num_pages; | ||
330 | 196 | ||
331 | for (num_rects = drw->num_rects; num_rects--; rect++) { | 197 | for (num_rects = drw->num_rects; num_rects--; rect++) { |
332 | int y1 = max(rect->y1, top); | 198 | int y1 = max(rect->y1, top); |
@@ -341,17 +207,17 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
341 | OUT_RING(ropcpp | dst_pitch); | 207 | OUT_RING(ropcpp | dst_pitch); |
342 | OUT_RING((y1 << 16) | rect->x1); | 208 | OUT_RING((y1 << 16) | rect->x1); |
343 | OUT_RING((y2 << 16) | rect->x2); | 209 | OUT_RING((y2 << 16) | rect->x2); |
344 | OUT_RING(offsets[front]); | 210 | OUT_RING(sarea_priv->front_offset); |
345 | OUT_RING((y1 << 16) | rect->x1); | 211 | OUT_RING((y1 << 16) | rect->x1); |
346 | OUT_RING(src_pitch); | 212 | OUT_RING(src_pitch); |
347 | OUT_RING(offsets[back]); | 213 | OUT_RING(sarea_priv->back_offset); |
348 | 214 | ||
349 | ADVANCE_LP_RING(); | 215 | ADVANCE_LP_RING(); |
350 | } | 216 | } |
351 | } | 217 | } |
352 | } | 218 | } |
353 | 219 | ||
354 | spin_unlock(&dev->drw_lock); | 220 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); |
355 | 221 | ||
356 | list_for_each_safe(hit, tmp, &hits) { | 222 | list_for_each_safe(hit, tmp, &hits) { |
357 | drm_i915_vbl_swap_t *swap_hit = | 223 | drm_i915_vbl_swap_t *swap_hit = |
@@ -363,112 +229,67 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
363 | } | 229 | } |
364 | } | 230 | } |
365 | 231 | ||
366 | u32 i915_get_vblank_counter(struct drm_device *dev, int plane) | ||
367 | { | ||
368 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
369 | unsigned long high_frame; | ||
370 | unsigned long low_frame; | ||
371 | u32 high1, high2, low, count; | ||
372 | int pipe; | ||
373 | |||
374 | pipe = i915_get_pipe(dev, plane); | ||
375 | high_frame = pipe ? PIPEBFRAMEHIGH : PIPEAFRAMEHIGH; | ||
376 | low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL; | ||
377 | |||
378 | if (!i915_pipe_enabled(dev, pipe)) { | ||
379 | printk(KERN_ERR "trying to get vblank count for disabled " | ||
380 | "pipe %d\n", pipe); | ||
381 | return 0; | ||
382 | } | ||
383 | |||
384 | /* | ||
385 | * High & low register fields aren't synchronized, so make sure | ||
386 | * we get a low value that's stable across two reads of the high | ||
387 | * register. | ||
388 | */ | ||
389 | do { | ||
390 | high1 = ((I915_READ(high_frame) & PIPE_FRAME_HIGH_MASK) >> | ||
391 | PIPE_FRAME_HIGH_SHIFT); | ||
392 | low = ((I915_READ(low_frame) & PIPE_FRAME_LOW_MASK) >> | ||
393 | PIPE_FRAME_LOW_SHIFT); | ||
394 | high2 = ((I915_READ(high_frame) & PIPE_FRAME_HIGH_MASK) >> | ||
395 | PIPE_FRAME_HIGH_SHIFT); | ||
396 | } while (high1 != high2); | ||
397 | |||
398 | count = (high1 << 8) | low; | ||
399 | |||
400 | /* count may be reset by other driver(e.g. 2D driver), | ||
401 | we have no way to know if it is wrapped or resetted | ||
402 | when count is zero. do a rough guess. | ||
403 | */ | ||
404 | if (count == 0 && dev->last_vblank[pipe] < dev->max_vblank_count/2) | ||
405 | dev->last_vblank[pipe] = 0; | ||
406 | |||
407 | return count; | ||
408 | } | ||
409 | |||
410 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | 232 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) |
411 | { | 233 | { |
412 | struct drm_device *dev = (struct drm_device *) arg; | 234 | struct drm_device *dev = (struct drm_device *) arg; |
413 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 235 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
414 | u32 iir; | 236 | u16 temp; |
415 | u32 pipea_stats, pipeb_stats; | 237 | u32 pipea_stats, pipeb_stats; |
416 | int vblank = 0; | ||
417 | |||
418 | iir = I915_READ(I915REG_INT_IDENTITY_R); | ||
419 | if (iir == 0) { | ||
420 | DRM_DEBUG ("iir 0x%08x im 0x%08x ie 0x%08x pipea 0x%08x pipeb 0x%08x\n", | ||
421 | iir, | ||
422 | I915_READ(I915REG_INT_MASK_R), | ||
423 | I915_READ(I915REG_INT_ENABLE_R), | ||
424 | I915_READ(I915REG_PIPEASTAT), | ||
425 | I915_READ(I915REG_PIPEBSTAT)); | ||
426 | return IRQ_NONE; | ||
427 | } | ||
428 | 238 | ||
429 | /* | 239 | pipea_stats = I915_READ(I915REG_PIPEASTAT); |
430 | * Clear the PIPE(A|B)STAT regs before the IIR otherwise | 240 | pipeb_stats = I915_READ(I915REG_PIPEBSTAT); |
431 | * we may get extra interrupts. | ||
432 | */ | ||
433 | if (iir & I915_DISPLAY_PIPE_A_EVENT_INTERRUPT) { | ||
434 | pipea_stats = I915_READ(I915REG_PIPEASTAT); | ||
435 | if (pipea_stats & (I915_START_VBLANK_INTERRUPT_STATUS| | ||
436 | I915_VBLANK_INTERRUPT_STATUS)) | ||
437 | { | ||
438 | vblank++; | ||
439 | drm_handle_vblank(dev, i915_get_plane(dev, 0)); | ||
440 | } | ||
441 | I915_WRITE(I915REG_PIPEASTAT, pipea_stats); | ||
442 | } | ||
443 | if (iir & I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) { | ||
444 | pipeb_stats = I915_READ(I915REG_PIPEBSTAT); | ||
445 | if (pipeb_stats & (I915_START_VBLANK_INTERRUPT_STATUS| | ||
446 | I915_VBLANK_INTERRUPT_STATUS)) | ||
447 | { | ||
448 | vblank++; | ||
449 | drm_handle_vblank(dev, i915_get_plane(dev, 1)); | ||
450 | } | ||
451 | I915_WRITE(I915REG_PIPEBSTAT, pipeb_stats); | ||
452 | } | ||
453 | 241 | ||
454 | if (dev_priv->sarea_priv) | 242 | temp = I915_READ16(I915REG_INT_IDENTITY_R); |
455 | dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); | ||
456 | 243 | ||
457 | I915_WRITE(I915REG_INT_IDENTITY_R, iir); | 244 | temp &= (USER_INT_FLAG | VSYNC_PIPEA_FLAG | VSYNC_PIPEB_FLAG); |
458 | (void) I915_READ(I915REG_INT_IDENTITY_R); /* Flush posted write */ | ||
459 | 245 | ||
460 | if (iir & I915_USER_INTERRUPT) { | 246 | DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp); |
247 | |||
248 | if (temp == 0) | ||
249 | return IRQ_NONE; | ||
250 | |||
251 | I915_WRITE16(I915REG_INT_IDENTITY_R, temp); | ||
252 | (void) I915_READ16(I915REG_INT_IDENTITY_R); | ||
253 | DRM_READMEMORYBARRIER(); | ||
254 | |||
255 | dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); | ||
256 | |||
257 | if (temp & USER_INT_FLAG) | ||
461 | DRM_WAKEUP(&dev_priv->irq_queue); | 258 | DRM_WAKEUP(&dev_priv->irq_queue); |
462 | } | 259 | |
463 | if (vblank) { | 260 | if (temp & (VSYNC_PIPEA_FLAG | VSYNC_PIPEB_FLAG)) { |
261 | int vblank_pipe = dev_priv->vblank_pipe; | ||
262 | |||
263 | if ((vblank_pipe & | ||
264 | (DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B)) | ||
265 | == (DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B)) { | ||
266 | if (temp & VSYNC_PIPEA_FLAG) | ||
267 | atomic_inc(&dev->vbl_received); | ||
268 | if (temp & VSYNC_PIPEB_FLAG) | ||
269 | atomic_inc(&dev->vbl_received2); | ||
270 | } else if (((temp & VSYNC_PIPEA_FLAG) && | ||
271 | (vblank_pipe & DRM_I915_VBLANK_PIPE_A)) || | ||
272 | ((temp & VSYNC_PIPEB_FLAG) && | ||
273 | (vblank_pipe & DRM_I915_VBLANK_PIPE_B))) | ||
274 | atomic_inc(&dev->vbl_received); | ||
275 | |||
276 | DRM_WAKEUP(&dev->vbl_queue); | ||
277 | drm_vbl_send_signals(dev); | ||
278 | |||
464 | if (dev_priv->swaps_pending > 0) | 279 | if (dev_priv->swaps_pending > 0) |
465 | drm_locked_tasklet(dev, i915_vblank_tasklet); | 280 | drm_locked_tasklet(dev, i915_vblank_tasklet); |
281 | I915_WRITE(I915REG_PIPEASTAT, | ||
282 | pipea_stats|I915_VBLANK_INTERRUPT_ENABLE| | ||
283 | I915_VBLANK_CLEAR); | ||
284 | I915_WRITE(I915REG_PIPEBSTAT, | ||
285 | pipeb_stats|I915_VBLANK_INTERRUPT_ENABLE| | ||
286 | I915_VBLANK_CLEAR); | ||
466 | } | 287 | } |
467 | 288 | ||
468 | return IRQ_HANDLED; | 289 | return IRQ_HANDLED; |
469 | } | 290 | } |
470 | 291 | ||
471 | static int i915_emit_irq(struct drm_device *dev) | 292 | static int i915_emit_irq(struct drm_device * dev) |
472 | { | 293 | { |
473 | drm_i915_private_t *dev_priv = dev->dev_private; | 294 | drm_i915_private_t *dev_priv = dev->dev_private; |
474 | RING_LOCALS; | 295 | RING_LOCALS; |
@@ -515,12 +336,42 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr) | |||
515 | READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); | 336 | READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); |
516 | } | 337 | } |
517 | 338 | ||
518 | if (dev_priv->sarea_priv) | 339 | dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); |
519 | dev_priv->sarea_priv->last_dispatch = | ||
520 | READ_BREADCRUMB(dev_priv); | ||
521 | return ret; | 340 | return ret; |
522 | } | 341 | } |
523 | 342 | ||
343 | static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequence, | ||
344 | atomic_t *counter) | ||
345 | { | ||
346 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
347 | unsigned int cur_vblank; | ||
348 | int ret = 0; | ||
349 | |||
350 | if (!dev_priv) { | ||
351 | DRM_ERROR("called with no initialization\n"); | ||
352 | return -EINVAL; | ||
353 | } | ||
354 | |||
355 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, | ||
356 | (((cur_vblank = atomic_read(counter)) | ||
357 | - *sequence) <= (1<<23))); | ||
358 | |||
359 | *sequence = cur_vblank; | ||
360 | |||
361 | return ret; | ||
362 | } | ||
363 | |||
364 | |||
365 | int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence) | ||
366 | { | ||
367 | return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received); | ||
368 | } | ||
369 | |||
370 | int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence) | ||
371 | { | ||
372 | return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received2); | ||
373 | } | ||
374 | |||
524 | /* Needs the lock as it touches the ring. | 375 | /* Needs the lock as it touches the ring. |
525 | */ | 376 | */ |
526 | int i915_irq_emit(struct drm_device *dev, void *data, | 377 | int i915_irq_emit(struct drm_device *dev, void *data, |
@@ -563,96 +414,18 @@ int i915_irq_wait(struct drm_device *dev, void *data, | |||
563 | return i915_wait_irq(dev, irqwait->irq_seq); | 414 | return i915_wait_irq(dev, irqwait->irq_seq); |
564 | } | 415 | } |
565 | 416 | ||
566 | int i915_enable_vblank(struct drm_device *dev, int plane) | ||
567 | { | ||
568 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
569 | int pipe = i915_get_pipe(dev, plane); | ||
570 | u32 pipestat_reg = 0; | ||
571 | u32 pipestat; | ||
572 | |||
573 | switch (pipe) { | ||
574 | case 0: | ||
575 | pipestat_reg = I915REG_PIPEASTAT; | ||
576 | dev_priv->irq_enable_reg |= I915_DISPLAY_PIPE_A_EVENT_INTERRUPT; | ||
577 | break; | ||
578 | case 1: | ||
579 | pipestat_reg = I915REG_PIPEBSTAT; | ||
580 | dev_priv->irq_enable_reg |= I915_DISPLAY_PIPE_B_EVENT_INTERRUPT; | ||
581 | break; | ||
582 | default: | ||
583 | DRM_ERROR("tried to enable vblank on non-existent pipe %d\n", | ||
584 | pipe); | ||
585 | break; | ||
586 | } | ||
587 | |||
588 | if (pipestat_reg) | ||
589 | { | ||
590 | pipestat = I915_READ (pipestat_reg); | ||
591 | /* | ||
592 | * Older chips didn't have the start vblank interrupt, | ||
593 | * but | ||
594 | */ | ||
595 | if (IS_I965G (dev)) | ||
596 | pipestat |= I915_START_VBLANK_INTERRUPT_ENABLE; | ||
597 | else | ||
598 | pipestat |= I915_VBLANK_INTERRUPT_ENABLE; | ||
599 | /* | ||
600 | * Clear any pending status | ||
601 | */ | ||
602 | pipestat |= (I915_START_VBLANK_INTERRUPT_STATUS | | ||
603 | I915_VBLANK_INTERRUPT_STATUS); | ||
604 | I915_WRITE(pipestat_reg, pipestat); | ||
605 | } | ||
606 | I915_WRITE(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg); | ||
607 | |||
608 | return 0; | ||
609 | } | ||
610 | |||
611 | void i915_disable_vblank(struct drm_device *dev, int plane) | ||
612 | { | ||
613 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
614 | int pipe = i915_get_pipe(dev, plane); | ||
615 | u32 pipestat_reg = 0; | ||
616 | u32 pipestat; | ||
617 | |||
618 | switch (pipe) { | ||
619 | case 0: | ||
620 | pipestat_reg = I915REG_PIPEASTAT; | ||
621 | dev_priv->irq_enable_reg &= ~I915_DISPLAY_PIPE_A_EVENT_INTERRUPT; | ||
622 | break; | ||
623 | case 1: | ||
624 | pipestat_reg = I915REG_PIPEBSTAT; | ||
625 | dev_priv->irq_enable_reg &= ~I915_DISPLAY_PIPE_B_EVENT_INTERRUPT; | ||
626 | break; | ||
627 | default: | ||
628 | DRM_ERROR("tried to disable vblank on non-existent pipe %d\n", | ||
629 | pipe); | ||
630 | break; | ||
631 | } | ||
632 | |||
633 | I915_WRITE(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg); | ||
634 | if (pipestat_reg) | ||
635 | { | ||
636 | pipestat = I915_READ (pipestat_reg); | ||
637 | pipestat &= ~(I915_START_VBLANK_INTERRUPT_ENABLE | | ||
638 | I915_VBLANK_INTERRUPT_ENABLE); | ||
639 | /* | ||
640 | * Clear any pending status | ||
641 | */ | ||
642 | pipestat |= (I915_START_VBLANK_INTERRUPT_STATUS | | ||
643 | I915_VBLANK_INTERRUPT_STATUS); | ||
644 | I915_WRITE(pipestat_reg, pipestat); | ||
645 | } | ||
646 | } | ||
647 | |||
648 | static void i915_enable_interrupt (struct drm_device *dev) | 417 | static void i915_enable_interrupt (struct drm_device *dev) |
649 | { | 418 | { |
650 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 419 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
420 | u16 flag; | ||
651 | 421 | ||
652 | dev_priv->irq_enable_reg |= I915_USER_INTERRUPT; | 422 | flag = 0; |
423 | if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_A) | ||
424 | flag |= VSYNC_PIPEA_FLAG; | ||
425 | if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_B) | ||
426 | flag |= VSYNC_PIPEB_FLAG; | ||
653 | 427 | ||
654 | I915_WRITE(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg); | 428 | I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | flag); |
655 | dev_priv->irq_enabled = 1; | ||
656 | } | 429 | } |
657 | 430 | ||
658 | /* Set the vblank monitor pipe | 431 | /* Set the vblank monitor pipe |
@@ -675,6 +448,8 @@ int i915_vblank_pipe_set(struct drm_device *dev, void *data, | |||
675 | 448 | ||
676 | dev_priv->vblank_pipe = pipe->pipe; | 449 | dev_priv->vblank_pipe = pipe->pipe; |
677 | 450 | ||
451 | i915_enable_interrupt (dev); | ||
452 | |||
678 | return 0; | 453 | return 0; |
679 | } | 454 | } |
680 | 455 | ||
@@ -692,9 +467,9 @@ int i915_vblank_pipe_get(struct drm_device *dev, void *data, | |||
692 | 467 | ||
693 | flag = I915_READ(I915REG_INT_ENABLE_R); | 468 | flag = I915_READ(I915REG_INT_ENABLE_R); |
694 | pipe->pipe = 0; | 469 | pipe->pipe = 0; |
695 | if (flag & I915_DISPLAY_PIPE_A_EVENT_INTERRUPT) | 470 | if (flag & VSYNC_PIPEA_FLAG) |
696 | pipe->pipe |= DRM_I915_VBLANK_PIPE_A; | 471 | pipe->pipe |= DRM_I915_VBLANK_PIPE_A; |
697 | if (flag & I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) | 472 | if (flag & VSYNC_PIPEB_FLAG) |
698 | pipe->pipe |= DRM_I915_VBLANK_PIPE_B; | 473 | pipe->pipe |= DRM_I915_VBLANK_PIPE_B; |
699 | 474 | ||
700 | return 0; | 475 | return 0; |
@@ -709,30 +484,27 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
709 | drm_i915_private_t *dev_priv = dev->dev_private; | 484 | drm_i915_private_t *dev_priv = dev->dev_private; |
710 | drm_i915_vblank_swap_t *swap = data; | 485 | drm_i915_vblank_swap_t *swap = data; |
711 | drm_i915_vbl_swap_t *vbl_swap; | 486 | drm_i915_vbl_swap_t *vbl_swap; |
712 | unsigned int pipe, seqtype, curseq, plane; | 487 | unsigned int pipe, seqtype, curseq; |
713 | unsigned long irqflags; | 488 | unsigned long irqflags; |
714 | struct list_head *list; | 489 | struct list_head *list; |
715 | int ret; | ||
716 | 490 | ||
717 | if (!dev_priv) { | 491 | if (!dev_priv) { |
718 | DRM_ERROR("%s called with no initialization\n", __func__); | 492 | DRM_ERROR("%s called with no initialization\n", __func__); |
719 | return -EINVAL; | 493 | return -EINVAL; |
720 | } | 494 | } |
721 | 495 | ||
722 | if (!dev_priv->sarea_priv || dev_priv->sarea_priv->rotation) { | 496 | if (dev_priv->sarea_priv->rotation) { |
723 | DRM_DEBUG("Rotation not supported\n"); | 497 | DRM_DEBUG("Rotation not supported\n"); |
724 | return -EINVAL; | 498 | return -EINVAL; |
725 | } | 499 | } |
726 | 500 | ||
727 | if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE | | 501 | if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE | |
728 | _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS | | 502 | _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)) { |
729 | _DRM_VBLANK_FLIP)) { | ||
730 | DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype); | 503 | DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype); |
731 | return -EINVAL; | 504 | return -EINVAL; |
732 | } | 505 | } |
733 | 506 | ||
734 | plane = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; | 507 | pipe = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; |
735 | pipe = i915_get_pipe(dev, plane); | ||
736 | 508 | ||
737 | seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE); | 509 | seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE); |
738 | 510 | ||
@@ -743,11 +515,6 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
743 | 515 | ||
744 | spin_lock_irqsave(&dev->drw_lock, irqflags); | 516 | spin_lock_irqsave(&dev->drw_lock, irqflags); |
745 | 517 | ||
746 | /* It makes no sense to schedule a swap for a drawable that doesn't have | ||
747 | * valid information at this point. E.g. this could mean that the X | ||
748 | * server is too old to push drawable information to the DRM, in which | ||
749 | * case all such swaps would become ineffective. | ||
750 | */ | ||
751 | if (!drm_get_drawable_info(dev, swap->drawable)) { | 518 | if (!drm_get_drawable_info(dev, swap->drawable)) { |
752 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); | 519 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); |
753 | DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable); | 520 | DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable); |
@@ -756,8 +523,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
756 | 523 | ||
757 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); | 524 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); |
758 | 525 | ||
759 | drm_update_vblank_count(dev, pipe); | 526 | curseq = atomic_read(pipe ? &dev->vbl_received2 : &dev->vbl_received); |
760 | curseq = drm_vblank_count(dev, pipe); | ||
761 | 527 | ||
762 | if (seqtype == _DRM_VBLANK_RELATIVE) | 528 | if (seqtype == _DRM_VBLANK_RELATIVE) |
763 | swap->sequence += curseq; | 529 | swap->sequence += curseq; |
@@ -771,43 +537,14 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
771 | } | 537 | } |
772 | } | 538 | } |
773 | 539 | ||
774 | if (swap->seqtype & _DRM_VBLANK_FLIP) { | ||
775 | swap->sequence--; | ||
776 | |||
777 | if ((curseq - swap->sequence) <= (1<<23)) { | ||
778 | struct drm_drawable_info *drw; | ||
779 | |||
780 | LOCK_TEST_WITH_RETURN(dev, file_priv); | ||
781 | |||
782 | spin_lock_irqsave(&dev->drw_lock, irqflags); | ||
783 | |||
784 | drw = drm_get_drawable_info(dev, swap->drawable); | ||
785 | |||
786 | if (!drw) { | ||
787 | spin_unlock_irqrestore(&dev->drw_lock, | ||
788 | irqflags); | ||
789 | DRM_DEBUG("Invalid drawable ID %d\n", | ||
790 | swap->drawable); | ||
791 | return -EINVAL; | ||
792 | } | ||
793 | |||
794 | i915_dispatch_vsync_flip(dev, drw, plane); | ||
795 | |||
796 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); | ||
797 | |||
798 | return 0; | ||
799 | } | ||
800 | } | ||
801 | |||
802 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); | 540 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); |
803 | 541 | ||
804 | list_for_each(list, &dev_priv->vbl_swaps.head) { | 542 | list_for_each(list, &dev_priv->vbl_swaps.head) { |
805 | vbl_swap = list_entry(list, drm_i915_vbl_swap_t, head); | 543 | vbl_swap = list_entry(list, drm_i915_vbl_swap_t, head); |
806 | 544 | ||
807 | if (vbl_swap->drw_id == swap->drawable && | 545 | if (vbl_swap->drw_id == swap->drawable && |
808 | vbl_swap->plane == plane && | 546 | vbl_swap->pipe == pipe && |
809 | vbl_swap->sequence == swap->sequence) { | 547 | vbl_swap->sequence == swap->sequence) { |
810 | vbl_swap->flip = (swap->seqtype & _DRM_VBLANK_FLIP); | ||
811 | spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); | 548 | spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); |
812 | DRM_DEBUG("Already scheduled\n"); | 549 | DRM_DEBUG("Already scheduled\n"); |
813 | return 0; | 550 | return 0; |
@@ -830,19 +567,9 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
830 | 567 | ||
831 | DRM_DEBUG("\n"); | 568 | DRM_DEBUG("\n"); |
832 | 569 | ||
833 | ret = drm_vblank_get(dev, pipe); | ||
834 | if (ret) { | ||
835 | drm_free(vbl_swap, sizeof(*vbl_swap), DRM_MEM_DRIVER); | ||
836 | return ret; | ||
837 | } | ||
838 | |||
839 | vbl_swap->drw_id = swap->drawable; | 570 | vbl_swap->drw_id = swap->drawable; |
840 | vbl_swap->plane = plane; | 571 | vbl_swap->pipe = pipe; |
841 | vbl_swap->sequence = swap->sequence; | 572 | vbl_swap->sequence = swap->sequence; |
842 | vbl_swap->flip = (swap->seqtype & _DRM_VBLANK_FLIP); | ||
843 | |||
844 | if (vbl_swap->flip) | ||
845 | swap->sequence++; | ||
846 | 573 | ||
847 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); | 574 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); |
848 | 575 | ||
@@ -860,57 +587,37 @@ void i915_driver_irq_preinstall(struct drm_device * dev) | |||
860 | { | 587 | { |
861 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 588 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
862 | 589 | ||
863 | I915_WRITE16(I915REG_HWSTAM, 0xeffe); | 590 | I915_WRITE16(I915REG_HWSTAM, 0xfffe); |
864 | I915_WRITE16(I915REG_INT_MASK_R, 0x0); | 591 | I915_WRITE16(I915REG_INT_MASK_R, 0x0); |
865 | I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); | 592 | I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); |
866 | } | 593 | } |
867 | 594 | ||
868 | int i915_driver_irq_postinstall(struct drm_device * dev) | 595 | void i915_driver_irq_postinstall(struct drm_device * dev) |
869 | { | 596 | { |
870 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 597 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
871 | int ret, num_pipes = 2; | ||
872 | 598 | ||
873 | spin_lock_init(&dev_priv->swaps_lock); | 599 | spin_lock_init(&dev_priv->swaps_lock); |
874 | INIT_LIST_HEAD(&dev_priv->vbl_swaps.head); | 600 | INIT_LIST_HEAD(&dev_priv->vbl_swaps.head); |
875 | dev_priv->swaps_pending = 0; | 601 | dev_priv->swaps_pending = 0; |
876 | 602 | ||
877 | dev_priv->user_irq_refcount = 0; | 603 | if (!dev_priv->vblank_pipe) |
878 | dev_priv->irq_enable_reg = 0; | 604 | dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A; |
879 | |||
880 | ret = drm_vblank_init(dev, num_pipes); | ||
881 | if (ret) | ||
882 | return ret; | ||
883 | |||
884 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ | ||
885 | |||
886 | i915_enable_interrupt(dev); | 605 | i915_enable_interrupt(dev); |
887 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); | 606 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); |
888 | |||
889 | /* | ||
890 | * Initialize the hardware status page IRQ location. | ||
891 | */ | ||
892 | |||
893 | I915_WRITE(I915REG_INSTPM, (1 << 5) | (1 << 21)); | ||
894 | return 0; | ||
895 | } | 607 | } |
896 | 608 | ||
897 | void i915_driver_irq_uninstall(struct drm_device * dev) | 609 | void i915_driver_irq_uninstall(struct drm_device * dev) |
898 | { | 610 | { |
899 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 611 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
900 | u32 temp; | 612 | u16 temp; |
901 | 613 | ||
902 | if (!dev_priv) | 614 | if (!dev_priv) |
903 | return; | 615 | return; |
904 | 616 | ||
905 | dev_priv->irq_enabled = 0; | 617 | I915_WRITE16(I915REG_HWSTAM, 0xffff); |
906 | I915_WRITE(I915REG_HWSTAM, 0xffffffff); | 618 | I915_WRITE16(I915REG_INT_MASK_R, 0xffff); |
907 | I915_WRITE(I915REG_INT_MASK_R, 0xffffffff); | 619 | I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); |
908 | I915_WRITE(I915REG_INT_ENABLE_R, 0x0); | 620 | |
909 | 621 | temp = I915_READ16(I915REG_INT_IDENTITY_R); | |
910 | temp = I915_READ(I915REG_PIPEASTAT); | 622 | I915_WRITE16(I915REG_INT_IDENTITY_R, temp); |
911 | I915_WRITE(I915REG_PIPEASTAT, temp); | ||
912 | temp = I915_READ(I915REG_PIPEBSTAT); | ||
913 | I915_WRITE(I915REG_PIPEBSTAT, temp); | ||
914 | temp = I915_READ(I915REG_INT_IDENTITY_R); | ||
915 | I915_WRITE(I915REG_INT_IDENTITY_R, temp); | ||
916 | } | 623 | } |
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c index 6b3790939e76..5572939fc7d1 100644 --- a/drivers/char/drm/mga_drv.c +++ b/drivers/char/drm/mga_drv.c | |||
@@ -45,16 +45,15 @@ static struct pci_device_id pciidlist[] = { | |||
45 | static struct drm_driver driver = { | 45 | static struct drm_driver driver = { |
46 | .driver_features = | 46 | .driver_features = |
47 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | | 47 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | |
48 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, | 48 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | |
49 | DRIVER_IRQ_VBL, | ||
49 | .dev_priv_size = sizeof(drm_mga_buf_priv_t), | 50 | .dev_priv_size = sizeof(drm_mga_buf_priv_t), |
50 | .load = mga_driver_load, | 51 | .load = mga_driver_load, |
51 | .unload = mga_driver_unload, | 52 | .unload = mga_driver_unload, |
52 | .lastclose = mga_driver_lastclose, | 53 | .lastclose = mga_driver_lastclose, |
53 | .dma_quiescent = mga_driver_dma_quiescent, | 54 | .dma_quiescent = mga_driver_dma_quiescent, |
54 | .device_is_agp = mga_driver_device_is_agp, | 55 | .device_is_agp = mga_driver_device_is_agp, |
55 | .get_vblank_counter = mga_get_vblank_counter, | 56 | .vblank_wait = mga_driver_vblank_wait, |
56 | .enable_vblank = mga_enable_vblank, | ||
57 | .disable_vblank = mga_disable_vblank, | ||
58 | .irq_preinstall = mga_driver_irq_preinstall, | 57 | .irq_preinstall = mga_driver_irq_preinstall, |
59 | .irq_postinstall = mga_driver_irq_postinstall, | 58 | .irq_postinstall = mga_driver_irq_postinstall, |
60 | .irq_uninstall = mga_driver_irq_uninstall, | 59 | .irq_uninstall = mga_driver_irq_uninstall, |
diff --git a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h index 8f7291f36363..f6ebd24bd587 100644 --- a/drivers/char/drm/mga_drv.h +++ b/drivers/char/drm/mga_drv.h | |||
@@ -120,7 +120,6 @@ typedef struct drm_mga_private { | |||
120 | u32 clear_cmd; | 120 | u32 clear_cmd; |
121 | u32 maccess; | 121 | u32 maccess; |
122 | 122 | ||
123 | atomic_t vbl_received; /**< Number of vblanks received. */ | ||
124 | wait_queue_head_t fence_queue; | 123 | wait_queue_head_t fence_queue; |
125 | atomic_t last_fence_retired; | 124 | atomic_t last_fence_retired; |
126 | u32 next_fence_to_post; | 125 | u32 next_fence_to_post; |
@@ -182,14 +181,11 @@ extern int mga_warp_install_microcode(drm_mga_private_t * dev_priv); | |||
182 | extern int mga_warp_init(drm_mga_private_t * dev_priv); | 181 | extern int mga_warp_init(drm_mga_private_t * dev_priv); |
183 | 182 | ||
184 | /* mga_irq.c */ | 183 | /* mga_irq.c */ |
185 | extern int mga_enable_vblank(struct drm_device *dev, int crtc); | ||
186 | extern void mga_disable_vblank(struct drm_device *dev, int crtc); | ||
187 | extern u32 mga_get_vblank_counter(struct drm_device *dev, int crtc); | ||
188 | extern int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence); | 184 | extern int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence); |
189 | extern int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence); | 185 | extern int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence); |
190 | extern irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS); | 186 | extern irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS); |
191 | extern void mga_driver_irq_preinstall(struct drm_device * dev); | 187 | extern void mga_driver_irq_preinstall(struct drm_device * dev); |
192 | extern int mga_driver_irq_postinstall(struct drm_device * dev); | 188 | extern void mga_driver_irq_postinstall(struct drm_device * dev); |
193 | extern void mga_driver_irq_uninstall(struct drm_device * dev); | 189 | extern void mga_driver_irq_uninstall(struct drm_device * dev); |
194 | extern long mga_compat_ioctl(struct file *filp, unsigned int cmd, | 190 | extern long mga_compat_ioctl(struct file *filp, unsigned int cmd, |
195 | unsigned long arg); | 191 | unsigned long arg); |
diff --git a/drivers/char/drm/mga_irq.c b/drivers/char/drm/mga_irq.c index 06852fb4b278..9302cb8f0f83 100644 --- a/drivers/char/drm/mga_irq.c +++ b/drivers/char/drm/mga_irq.c | |||
@@ -35,20 +35,6 @@ | |||
35 | #include "mga_drm.h" | 35 | #include "mga_drm.h" |
36 | #include "mga_drv.h" | 36 | #include "mga_drv.h" |
37 | 37 | ||
38 | u32 mga_get_vblank_counter(struct drm_device *dev, int crtc) | ||
39 | { | ||
40 | const drm_mga_private_t *const dev_priv = | ||
41 | (drm_mga_private_t *) dev->dev_private; | ||
42 | |||
43 | if (crtc != 0) { | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | |||
48 | return atomic_read(&dev_priv->vbl_received); | ||
49 | } | ||
50 | |||
51 | |||
52 | irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) | 38 | irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) |
53 | { | 39 | { |
54 | struct drm_device *dev = (struct drm_device *) arg; | 40 | struct drm_device *dev = (struct drm_device *) arg; |
@@ -61,8 +47,9 @@ irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) | |||
61 | /* VBLANK interrupt */ | 47 | /* VBLANK interrupt */ |
62 | if (status & MGA_VLINEPEN) { | 48 | if (status & MGA_VLINEPEN) { |
63 | MGA_WRITE(MGA_ICLEAR, MGA_VLINEICLR); | 49 | MGA_WRITE(MGA_ICLEAR, MGA_VLINEICLR); |
64 | atomic_inc(&dev_priv->vbl_received); | 50 | atomic_inc(&dev->vbl_received); |
65 | drm_handle_vblank(dev, 0); | 51 | DRM_WAKEUP(&dev->vbl_queue); |
52 | drm_vbl_send_signals(dev); | ||
66 | handled = 1; | 53 | handled = 1; |
67 | } | 54 | } |
68 | 55 | ||
@@ -91,34 +78,22 @@ irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) | |||
91 | return IRQ_NONE; | 78 | return IRQ_NONE; |
92 | } | 79 | } |
93 | 80 | ||
94 | int mga_enable_vblank(struct drm_device *dev, int crtc) | 81 | int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence) |
95 | { | 82 | { |
96 | drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; | 83 | unsigned int cur_vblank; |
97 | 84 | int ret = 0; | |
98 | if (crtc != 0) { | ||
99 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", | ||
100 | crtc); | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); | ||
105 | return 0; | ||
106 | } | ||
107 | 85 | ||
86 | /* Assume that the user has missed the current sequence number | ||
87 | * by about a day rather than she wants to wait for years | ||
88 | * using vertical blanks... | ||
89 | */ | ||
90 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, | ||
91 | (((cur_vblank = atomic_read(&dev->vbl_received)) | ||
92 | - *sequence) <= (1 << 23))); | ||
108 | 93 | ||
109 | void mga_disable_vblank(struct drm_device *dev, int crtc) | 94 | *sequence = cur_vblank; |
110 | { | ||
111 | if (crtc != 0) { | ||
112 | DRM_ERROR("tried to disable vblank on non-existent crtc %d\n", | ||
113 | crtc); | ||
114 | } | ||
115 | 95 | ||
116 | /* Do *NOT* disable the vertical refresh interrupt. MGA doesn't have | 96 | return ret; |
117 | * a nice hardware counter that tracks the number of refreshes when | ||
118 | * the interrupt is disabled, and the kernel doesn't know the refresh | ||
119 | * rate to calculate an estimate. | ||
120 | */ | ||
121 | /* MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); */ | ||
122 | } | 97 | } |
123 | 98 | ||
124 | int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence) | 99 | int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence) |
@@ -150,22 +125,14 @@ void mga_driver_irq_preinstall(struct drm_device * dev) | |||
150 | MGA_WRITE(MGA_ICLEAR, ~0); | 125 | MGA_WRITE(MGA_ICLEAR, ~0); |
151 | } | 126 | } |
152 | 127 | ||
153 | int mga_driver_irq_postinstall(struct drm_device * dev) | 128 | void mga_driver_irq_postinstall(struct drm_device * dev) |
154 | { | 129 | { |
155 | drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; | 130 | drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; |
156 | int ret; | ||
157 | |||
158 | ret = drm_vblank_init(dev, 1); | ||
159 | if (ret) | ||
160 | return ret; | ||
161 | 131 | ||
162 | DRM_INIT_WAITQUEUE(&dev_priv->fence_queue); | 132 | DRM_INIT_WAITQUEUE(&dev_priv->fence_queue); |
163 | 133 | ||
164 | /* Turn on soft trap interrupt. Vertical blank interrupts are enabled | 134 | /* Turn on vertical blank interrupt and soft trap interrupt. */ |
165 | * in mga_enable_vblank. | 135 | MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); |
166 | */ | ||
167 | MGA_WRITE(MGA_IEN, MGA_SOFTRAPEN); | ||
168 | return 0; | ||
169 | } | 136 | } |
170 | 137 | ||
171 | void mga_driver_irq_uninstall(struct drm_device * dev) | 138 | void mga_driver_irq_uninstall(struct drm_device * dev) |
diff --git a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c index 2888aa01ebc7..6108e7587e12 100644 --- a/drivers/char/drm/r128_drv.c +++ b/drivers/char/drm/r128_drv.c | |||
@@ -43,13 +43,12 @@ static struct pci_device_id pciidlist[] = { | |||
43 | static struct drm_driver driver = { | 43 | static struct drm_driver driver = { |
44 | .driver_features = | 44 | .driver_features = |
45 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | | 45 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | |
46 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, | 46 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | |
47 | DRIVER_IRQ_VBL, | ||
47 | .dev_priv_size = sizeof(drm_r128_buf_priv_t), | 48 | .dev_priv_size = sizeof(drm_r128_buf_priv_t), |
48 | .preclose = r128_driver_preclose, | 49 | .preclose = r128_driver_preclose, |
49 | .lastclose = r128_driver_lastclose, | 50 | .lastclose = r128_driver_lastclose, |
50 | .get_vblank_counter = r128_get_vblank_counter, | 51 | .vblank_wait = r128_driver_vblank_wait, |
51 | .enable_vblank = r128_enable_vblank, | ||
52 | .disable_vblank = r128_disable_vblank, | ||
53 | .irq_preinstall = r128_driver_irq_preinstall, | 52 | .irq_preinstall = r128_driver_irq_preinstall, |
54 | .irq_postinstall = r128_driver_irq_postinstall, | 53 | .irq_postinstall = r128_driver_irq_postinstall, |
55 | .irq_uninstall = r128_driver_irq_uninstall, | 54 | .irq_uninstall = r128_driver_irq_uninstall, |
diff --git a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h index 80af9e09e75d..011105e51ac6 100644 --- a/drivers/char/drm/r128_drv.h +++ b/drivers/char/drm/r128_drv.h | |||
@@ -97,8 +97,6 @@ typedef struct drm_r128_private { | |||
97 | u32 crtc_offset; | 97 | u32 crtc_offset; |
98 | u32 crtc_offset_cntl; | 98 | u32 crtc_offset_cntl; |
99 | 99 | ||
100 | atomic_t vbl_received; | ||
101 | |||
102 | u32 color_fmt; | 100 | u32 color_fmt; |
103 | unsigned int front_offset; | 101 | unsigned int front_offset; |
104 | unsigned int front_pitch; | 102 | unsigned int front_pitch; |
@@ -151,12 +149,11 @@ extern int r128_wait_ring(drm_r128_private_t * dev_priv, int n); | |||
151 | extern int r128_do_cce_idle(drm_r128_private_t * dev_priv); | 149 | extern int r128_do_cce_idle(drm_r128_private_t * dev_priv); |
152 | extern int r128_do_cleanup_cce(struct drm_device * dev); | 150 | extern int r128_do_cleanup_cce(struct drm_device * dev); |
153 | 151 | ||
154 | extern int r128_enable_vblank(struct drm_device *dev, int crtc); | 152 | extern int r128_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence); |
155 | extern void r128_disable_vblank(struct drm_device *dev, int crtc); | 153 | |
156 | extern u32 r128_get_vblank_counter(struct drm_device *dev, int crtc); | ||
157 | extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS); | 154 | extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS); |
158 | extern void r128_driver_irq_preinstall(struct drm_device * dev); | 155 | extern void r128_driver_irq_preinstall(struct drm_device * dev); |
159 | extern int r128_driver_irq_postinstall(struct drm_device * dev); | 156 | extern void r128_driver_irq_postinstall(struct drm_device * dev); |
160 | extern void r128_driver_irq_uninstall(struct drm_device * dev); | 157 | extern void r128_driver_irq_uninstall(struct drm_device * dev); |
161 | extern void r128_driver_lastclose(struct drm_device * dev); | 158 | extern void r128_driver_lastclose(struct drm_device * dev); |
162 | extern void r128_driver_preclose(struct drm_device * dev, | 159 | extern void r128_driver_preclose(struct drm_device * dev, |
diff --git a/drivers/char/drm/r128_irq.c b/drivers/char/drm/r128_irq.c index 5b95bd898f95..c76fdca7662d 100644 --- a/drivers/char/drm/r128_irq.c +++ b/drivers/char/drm/r128_irq.c | |||
@@ -35,16 +35,6 @@ | |||
35 | #include "r128_drm.h" | 35 | #include "r128_drm.h" |
36 | #include "r128_drv.h" | 36 | #include "r128_drv.h" |
37 | 37 | ||
38 | u32 r128_get_vblank_counter(struct drm_device *dev, int crtc) | ||
39 | { | ||
40 | const drm_r128_private_t *dev_priv = dev->dev_private; | ||
41 | |||
42 | if (crtc != 0) | ||
43 | return 0; | ||
44 | |||
45 | return atomic_read(&dev_priv->vbl_received); | ||
46 | } | ||
47 | |||
48 | irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS) | 38 | irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS) |
49 | { | 39 | { |
50 | struct drm_device *dev = (struct drm_device *) arg; | 40 | struct drm_device *dev = (struct drm_device *) arg; |
@@ -56,38 +46,30 @@ irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS) | |||
56 | /* VBLANK interrupt */ | 46 | /* VBLANK interrupt */ |
57 | if (status & R128_CRTC_VBLANK_INT) { | 47 | if (status & R128_CRTC_VBLANK_INT) { |
58 | R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); | 48 | R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); |
59 | atomic_inc(&dev_priv->vbl_received); | 49 | atomic_inc(&dev->vbl_received); |
60 | drm_handle_vblank(dev, 0); | 50 | DRM_WAKEUP(&dev->vbl_queue); |
51 | drm_vbl_send_signals(dev); | ||
61 | return IRQ_HANDLED; | 52 | return IRQ_HANDLED; |
62 | } | 53 | } |
63 | return IRQ_NONE; | 54 | return IRQ_NONE; |
64 | } | 55 | } |
65 | 56 | ||
66 | int r128_enable_vblank(struct drm_device *dev, int crtc) | 57 | int r128_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence) |
67 | { | 58 | { |
68 | drm_r128_private_t *dev_priv = dev->dev_private; | 59 | unsigned int cur_vblank; |
69 | 60 | int ret = 0; | |
70 | if (crtc != 0) { | ||
71 | DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc); | ||
72 | return -EINVAL; | ||
73 | } | ||
74 | 61 | ||
75 | R128_WRITE(R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN); | 62 | /* Assume that the user has missed the current sequence number |
76 | return 0; | 63 | * by about a day rather than she wants to wait for years |
77 | } | 64 | * using vertical blanks... |
65 | */ | ||
66 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, | ||
67 | (((cur_vblank = atomic_read(&dev->vbl_received)) | ||
68 | - *sequence) <= (1 << 23))); | ||
78 | 69 | ||
79 | void r128_disable_vblank(struct drm_device *dev, int crtc) | 70 | *sequence = cur_vblank; |
80 | { | ||
81 | if (crtc != 0) | ||
82 | DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc); | ||
83 | 71 | ||
84 | /* | 72 | return ret; |
85 | * FIXME: implement proper interrupt disable by using the vblank | ||
86 | * counter register (if available) | ||
87 | * | ||
88 | * R128_WRITE(R128_GEN_INT_CNTL, | ||
89 | * R128_READ(R128_GEN_INT_CNTL) & ~R128_CRTC_VBLANK_INT_EN); | ||
90 | */ | ||
91 | } | 73 | } |
92 | 74 | ||
93 | void r128_driver_irq_preinstall(struct drm_device * dev) | 75 | void r128_driver_irq_preinstall(struct drm_device * dev) |
@@ -100,9 +82,12 @@ void r128_driver_irq_preinstall(struct drm_device * dev) | |||
100 | R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); | 82 | R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); |
101 | } | 83 | } |
102 | 84 | ||
103 | int r128_driver_irq_postinstall(struct drm_device * dev) | 85 | void r128_driver_irq_postinstall(struct drm_device * dev) |
104 | { | 86 | { |
105 | return drm_vblank_init(dev, 1); | 87 | drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private; |
88 | |||
89 | /* Turn on VBL interrupt */ | ||
90 | R128_WRITE(R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN); | ||
106 | } | 91 | } |
107 | 92 | ||
108 | void r128_driver_irq_uninstall(struct drm_device * dev) | 93 | void r128_driver_irq_uninstall(struct drm_device * dev) |
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c index a2610319624d..349ac3d3b848 100644 --- a/drivers/char/drm/radeon_drv.c +++ b/drivers/char/drm/radeon_drv.c | |||
@@ -59,7 +59,8 @@ static struct pci_device_id pciidlist[] = { | |||
59 | static struct drm_driver driver = { | 59 | static struct drm_driver driver = { |
60 | .driver_features = | 60 | .driver_features = |
61 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | | 61 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | |
62 | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED, | 62 | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | |
63 | DRIVER_IRQ_VBL | DRIVER_IRQ_VBL2, | ||
63 | .dev_priv_size = sizeof(drm_radeon_buf_priv_t), | 64 | .dev_priv_size = sizeof(drm_radeon_buf_priv_t), |
64 | .load = radeon_driver_load, | 65 | .load = radeon_driver_load, |
65 | .firstopen = radeon_driver_firstopen, | 66 | .firstopen = radeon_driver_firstopen, |
@@ -68,9 +69,8 @@ static struct drm_driver driver = { | |||
68 | .postclose = radeon_driver_postclose, | 69 | .postclose = radeon_driver_postclose, |
69 | .lastclose = radeon_driver_lastclose, | 70 | .lastclose = radeon_driver_lastclose, |
70 | .unload = radeon_driver_unload, | 71 | .unload = radeon_driver_unload, |
71 | .get_vblank_counter = radeon_get_vblank_counter, | 72 | .vblank_wait = radeon_driver_vblank_wait, |
72 | .enable_vblank = radeon_enable_vblank, | 73 | .vblank_wait2 = radeon_driver_vblank_wait2, |
73 | .disable_vblank = radeon_disable_vblank, | ||
74 | .dri_library_name = dri_library_name, | 74 | .dri_library_name = dri_library_name, |
75 | .irq_preinstall = radeon_driver_irq_preinstall, | 75 | .irq_preinstall = radeon_driver_irq_preinstall, |
76 | .irq_postinstall = radeon_driver_irq_postinstall, | 76 | .irq_postinstall = radeon_driver_irq_postinstall, |
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index b791420bd3d9..173ae620223a 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h | |||
@@ -304,9 +304,6 @@ typedef struct drm_radeon_private { | |||
304 | 304 | ||
305 | u32 scratch_ages[5]; | 305 | u32 scratch_ages[5]; |
306 | 306 | ||
307 | unsigned int crtc_last_cnt; | ||
308 | unsigned int crtc2_last_cnt; | ||
309 | |||
310 | /* starting from here on, data is preserved accross an open */ | 307 | /* starting from here on, data is preserved accross an open */ |
311 | uint32_t flags; /* see radeon_chip_flags */ | 308 | uint32_t flags; /* see radeon_chip_flags */ |
312 | unsigned long fb_aper_offset; | 309 | unsigned long fb_aper_offset; |
@@ -377,13 +374,13 @@ extern int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file * | |||
377 | extern int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv); | 374 | extern int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv); |
378 | 375 | ||
379 | extern void radeon_do_release(struct drm_device * dev); | 376 | extern void radeon_do_release(struct drm_device * dev); |
380 | extern u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc); | 377 | extern int radeon_driver_vblank_wait(struct drm_device * dev, |
381 | extern int radeon_enable_vblank(struct drm_device *dev, int crtc); | 378 | unsigned int *sequence); |
382 | extern void radeon_disable_vblank(struct drm_device *dev, int crtc); | 379 | extern int radeon_driver_vblank_wait2(struct drm_device * dev, |
383 | extern void radeon_do_release(struct drm_device * dev); | 380 | unsigned int *sequence); |
384 | extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS); | 381 | extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS); |
385 | extern void radeon_driver_irq_preinstall(struct drm_device * dev); | 382 | extern void radeon_driver_irq_preinstall(struct drm_device * dev); |
386 | extern int radeon_driver_irq_postinstall(struct drm_device * dev); | 383 | extern void radeon_driver_irq_postinstall(struct drm_device * dev); |
387 | extern void radeon_driver_irq_uninstall(struct drm_device * dev); | 384 | extern void radeon_driver_irq_uninstall(struct drm_device * dev); |
388 | extern int radeon_vblank_crtc_get(struct drm_device *dev); | 385 | extern int radeon_vblank_crtc_get(struct drm_device *dev); |
389 | extern int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value); | 386 | extern int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value); |
@@ -561,12 +558,6 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, | |||
561 | ? DRM_READ32( dev_priv->ring_rptr, RADEON_SCRATCHOFF(x) ) \ | 558 | ? DRM_READ32( dev_priv->ring_rptr, RADEON_SCRATCHOFF(x) ) \ |
562 | : RADEON_READ( RADEON_SCRATCH_REG0 + 4*(x) ) ) | 559 | : RADEON_READ( RADEON_SCRATCH_REG0 + 4*(x) ) ) |
563 | 560 | ||
564 | #define RADEON_CRTC_CRNT_FRAME 0x0214 | ||
565 | #define RADEON_CRTC2_CRNT_FRAME 0x0314 | ||
566 | |||
567 | #define RADEON_CRTC_STATUS 0x005c | ||
568 | #define RADEON_CRTC2_STATUS 0x03fc | ||
569 | |||
570 | #define RADEON_GEN_INT_CNTL 0x0040 | 561 | #define RADEON_GEN_INT_CNTL 0x0040 |
571 | # define RADEON_CRTC_VBLANK_MASK (1 << 0) | 562 | # define RADEON_CRTC_VBLANK_MASK (1 << 0) |
572 | # define RADEON_CRTC2_VBLANK_MASK (1 << 9) | 563 | # define RADEON_CRTC2_VBLANK_MASK (1 << 9) |
diff --git a/drivers/char/drm/radeon_irq.c b/drivers/char/drm/radeon_irq.c index 507d6b747a13..009af3814b6f 100644 --- a/drivers/char/drm/radeon_irq.c +++ b/drivers/char/drm/radeon_irq.c | |||
@@ -35,61 +35,12 @@ | |||
35 | #include "radeon_drm.h" | 35 | #include "radeon_drm.h" |
36 | #include "radeon_drv.h" | 36 | #include "radeon_drv.h" |
37 | 37 | ||
38 | static void radeon_irq_set_state(struct drm_device *dev, u32 mask, int state) | 38 | static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t * dev_priv, |
39 | u32 mask) | ||
39 | { | 40 | { |
40 | drm_radeon_private_t *dev_priv = dev->dev_private; | 41 | u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS) & mask; |
41 | |||
42 | if (state) | ||
43 | dev_priv->irq_enable_reg |= mask; | ||
44 | else | ||
45 | dev_priv->irq_enable_reg &= ~mask; | ||
46 | |||
47 | RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg); | ||
48 | } | ||
49 | |||
50 | int radeon_enable_vblank(struct drm_device *dev, int crtc) | ||
51 | { | ||
52 | switch (crtc) { | ||
53 | case 0: | ||
54 | radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 1); | ||
55 | break; | ||
56 | case 1: | ||
57 | radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 1); | ||
58 | break; | ||
59 | default: | ||
60 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", | ||
61 | crtc); | ||
62 | return EINVAL; | ||
63 | } | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | void radeon_disable_vblank(struct drm_device *dev, int crtc) | ||
69 | { | ||
70 | switch (crtc) { | ||
71 | case 0: | ||
72 | radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 0); | ||
73 | break; | ||
74 | case 1: | ||
75 | radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 0); | ||
76 | break; | ||
77 | default: | ||
78 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", | ||
79 | crtc); | ||
80 | break; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t * dev_priv) | ||
85 | { | ||
86 | u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS) & | ||
87 | (RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT | | ||
88 | RADEON_CRTC2_VBLANK_STAT); | ||
89 | |||
90 | if (irqs) | 42 | if (irqs) |
91 | RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs); | 43 | RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs); |
92 | |||
93 | return irqs; | 44 | return irqs; |
94 | } | 45 | } |
95 | 46 | ||
@@ -121,21 +72,39 @@ irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS) | |||
121 | /* Only consider the bits we're interested in - others could be used | 72 | /* Only consider the bits we're interested in - others could be used |
122 | * outside the DRM | 73 | * outside the DRM |
123 | */ | 74 | */ |
124 | stat = radeon_acknowledge_irqs(dev_priv); | 75 | stat = radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK | |
76 | RADEON_CRTC_VBLANK_STAT | | ||
77 | RADEON_CRTC2_VBLANK_STAT)); | ||
125 | if (!stat) | 78 | if (!stat) |
126 | return IRQ_NONE; | 79 | return IRQ_NONE; |
127 | 80 | ||
128 | stat &= dev_priv->irq_enable_reg; | 81 | stat &= dev_priv->irq_enable_reg; |
129 | 82 | ||
130 | /* SW interrupt */ | 83 | /* SW interrupt */ |
131 | if (stat & RADEON_SW_INT_TEST) | 84 | if (stat & RADEON_SW_INT_TEST) { |
132 | DRM_WAKEUP(&dev_priv->swi_queue); | 85 | DRM_WAKEUP(&dev_priv->swi_queue); |
86 | } | ||
133 | 87 | ||
134 | /* VBLANK interrupt */ | 88 | /* VBLANK interrupt */ |
135 | if (stat & RADEON_CRTC_VBLANK_STAT) | 89 | if (stat & (RADEON_CRTC_VBLANK_STAT|RADEON_CRTC2_VBLANK_STAT)) { |
136 | drm_handle_vblank(dev, 0); | 90 | int vblank_crtc = dev_priv->vblank_crtc; |
137 | if (stat & RADEON_CRTC2_VBLANK_STAT) | 91 | |
138 | drm_handle_vblank(dev, 1); | 92 | if ((vblank_crtc & |
93 | (DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) == | ||
94 | (DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) { | ||
95 | if (stat & RADEON_CRTC_VBLANK_STAT) | ||
96 | atomic_inc(&dev->vbl_received); | ||
97 | if (stat & RADEON_CRTC2_VBLANK_STAT) | ||
98 | atomic_inc(&dev->vbl_received2); | ||
99 | } else if (((stat & RADEON_CRTC_VBLANK_STAT) && | ||
100 | (vblank_crtc & DRM_RADEON_VBLANK_CRTC1)) || | ||
101 | ((stat & RADEON_CRTC2_VBLANK_STAT) && | ||
102 | (vblank_crtc & DRM_RADEON_VBLANK_CRTC2))) | ||
103 | atomic_inc(&dev->vbl_received); | ||
104 | |||
105 | DRM_WAKEUP(&dev->vbl_queue); | ||
106 | drm_vbl_send_signals(dev); | ||
107 | } | ||
139 | 108 | ||
140 | return IRQ_HANDLED; | 109 | return IRQ_HANDLED; |
141 | } | 110 | } |
@@ -175,27 +144,54 @@ static int radeon_wait_irq(struct drm_device * dev, int swi_nr) | |||
175 | return ret; | 144 | return ret; |
176 | } | 145 | } |
177 | 146 | ||
178 | u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc) | 147 | static int radeon_driver_vblank_do_wait(struct drm_device * dev, |
148 | unsigned int *sequence, int crtc) | ||
179 | { | 149 | { |
180 | drm_radeon_private_t *dev_priv = dev->dev_private; | 150 | drm_radeon_private_t *dev_priv = |
181 | u32 crtc_cnt_reg, crtc_status_reg; | 151 | (drm_radeon_private_t *) dev->dev_private; |
182 | 152 | unsigned int cur_vblank; | |
153 | int ret = 0; | ||
154 | int ack = 0; | ||
155 | atomic_t *counter; | ||
183 | if (!dev_priv) { | 156 | if (!dev_priv) { |
184 | DRM_ERROR("called with no initialization\n"); | 157 | DRM_ERROR("called with no initialization\n"); |
185 | return -EINVAL; | 158 | return -EINVAL; |
186 | } | 159 | } |
187 | 160 | ||
188 | if (crtc == 0) { | 161 | if (crtc == DRM_RADEON_VBLANK_CRTC1) { |
189 | crtc_cnt_reg = RADEON_CRTC_CRNT_FRAME; | 162 | counter = &dev->vbl_received; |
190 | crtc_status_reg = RADEON_CRTC_STATUS; | 163 | ack |= RADEON_CRTC_VBLANK_STAT; |
191 | } else if (crtc == 1) { | 164 | } else if (crtc == DRM_RADEON_VBLANK_CRTC2) { |
192 | crtc_cnt_reg = RADEON_CRTC2_CRNT_FRAME; | 165 | counter = &dev->vbl_received2; |
193 | crtc_status_reg = RADEON_CRTC2_STATUS; | 166 | ack |= RADEON_CRTC2_VBLANK_STAT; |
194 | } else { | 167 | } else |
195 | return -EINVAL; | 168 | return -EINVAL; |
196 | } | ||
197 | 169 | ||
198 | return RADEON_READ(crtc_cnt_reg) + (RADEON_READ(crtc_status_reg) & 1); | 170 | radeon_acknowledge_irqs(dev_priv, ack); |
171 | |||
172 | dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; | ||
173 | |||
174 | /* Assume that the user has missed the current sequence number | ||
175 | * by about a day rather than she wants to wait for years | ||
176 | * using vertical blanks... | ||
177 | */ | ||
178 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, | ||
179 | (((cur_vblank = atomic_read(counter)) | ||
180 | - *sequence) <= (1 << 23))); | ||
181 | |||
182 | *sequence = cur_vblank; | ||
183 | |||
184 | return ret; | ||
185 | } | ||
186 | |||
187 | int radeon_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence) | ||
188 | { | ||
189 | return radeon_driver_vblank_do_wait(dev, sequence, DRM_RADEON_VBLANK_CRTC1); | ||
190 | } | ||
191 | |||
192 | int radeon_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence) | ||
193 | { | ||
194 | return radeon_driver_vblank_do_wait(dev, sequence, DRM_RADEON_VBLANK_CRTC2); | ||
199 | } | 195 | } |
200 | 196 | ||
201 | /* Needs the lock as it touches the ring. | 197 | /* Needs the lock as it touches the ring. |
@@ -238,6 +234,21 @@ int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_pr | |||
238 | return radeon_wait_irq(dev, irqwait->irq_seq); | 234 | return radeon_wait_irq(dev, irqwait->irq_seq); |
239 | } | 235 | } |
240 | 236 | ||
237 | static void radeon_enable_interrupt(struct drm_device *dev) | ||
238 | { | ||
239 | drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private; | ||
240 | |||
241 | dev_priv->irq_enable_reg = RADEON_SW_INT_ENABLE; | ||
242 | if (dev_priv->vblank_crtc & DRM_RADEON_VBLANK_CRTC1) | ||
243 | dev_priv->irq_enable_reg |= RADEON_CRTC_VBLANK_MASK; | ||
244 | |||
245 | if (dev_priv->vblank_crtc & DRM_RADEON_VBLANK_CRTC2) | ||
246 | dev_priv->irq_enable_reg |= RADEON_CRTC2_VBLANK_MASK; | ||
247 | |||
248 | RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg); | ||
249 | dev_priv->irq_enabled = 1; | ||
250 | } | ||
251 | |||
241 | /* drm_dma.h hooks | 252 | /* drm_dma.h hooks |
242 | */ | 253 | */ |
243 | void radeon_driver_irq_preinstall(struct drm_device * dev) | 254 | void radeon_driver_irq_preinstall(struct drm_device * dev) |
@@ -249,27 +260,20 @@ void radeon_driver_irq_preinstall(struct drm_device * dev) | |||
249 | RADEON_WRITE(RADEON_GEN_INT_CNTL, 0); | 260 | RADEON_WRITE(RADEON_GEN_INT_CNTL, 0); |
250 | 261 | ||
251 | /* Clear bits if they're already high */ | 262 | /* Clear bits if they're already high */ |
252 | radeon_acknowledge_irqs(dev_priv); | 263 | radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK | |
264 | RADEON_CRTC_VBLANK_STAT | | ||
265 | RADEON_CRTC2_VBLANK_STAT)); | ||
253 | } | 266 | } |
254 | 267 | ||
255 | int radeon_driver_irq_postinstall(struct drm_device * dev) | 268 | void radeon_driver_irq_postinstall(struct drm_device * dev) |
256 | { | 269 | { |
257 | drm_radeon_private_t *dev_priv = | 270 | drm_radeon_private_t *dev_priv = |
258 | (drm_radeon_private_t *) dev->dev_private; | 271 | (drm_radeon_private_t *) dev->dev_private; |
259 | int ret; | ||
260 | 272 | ||
261 | atomic_set(&dev_priv->swi_emitted, 0); | 273 | atomic_set(&dev_priv->swi_emitted, 0); |
262 | DRM_INIT_WAITQUEUE(&dev_priv->swi_queue); | 274 | DRM_INIT_WAITQUEUE(&dev_priv->swi_queue); |
263 | 275 | ||
264 | ret = drm_vblank_init(dev, 2); | 276 | radeon_enable_interrupt(dev); |
265 | if (ret) | ||
266 | return ret; | ||
267 | |||
268 | dev->max_vblank_count = 0x001fffff; | ||
269 | |||
270 | radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1); | ||
271 | |||
272 | return 0; | ||
273 | } | 277 | } |
274 | 278 | ||
275 | void radeon_driver_irq_uninstall(struct drm_device * dev) | 279 | void radeon_driver_irq_uninstall(struct drm_device * dev) |
@@ -311,5 +315,6 @@ int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value) | |||
311 | return -EINVAL; | 315 | return -EINVAL; |
312 | } | 316 | } |
313 | dev_priv->vblank_crtc = (unsigned int)value; | 317 | dev_priv->vblank_crtc = (unsigned int)value; |
318 | radeon_enable_interrupt(dev); | ||
314 | return 0; | 319 | return 0; |
315 | } | 320 | } |
diff --git a/drivers/char/drm/via_drv.c b/drivers/char/drm/via_drv.c index 37870a4a3dc7..80c01cdfa37d 100644 --- a/drivers/char/drm/via_drv.c +++ b/drivers/char/drm/via_drv.c | |||
@@ -40,13 +40,11 @@ static struct pci_device_id pciidlist[] = { | |||
40 | static struct drm_driver driver = { | 40 | static struct drm_driver driver = { |
41 | .driver_features = | 41 | .driver_features = |
42 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | | 42 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | |
43 | DRIVER_IRQ_SHARED, | 43 | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL, |
44 | .load = via_driver_load, | 44 | .load = via_driver_load, |
45 | .unload = via_driver_unload, | 45 | .unload = via_driver_unload, |
46 | .context_dtor = via_final_context, | 46 | .context_dtor = via_final_context, |
47 | .get_vblank_counter = via_get_vblank_counter, | 47 | .vblank_wait = via_driver_vblank_wait, |
48 | .enable_vblank = via_enable_vblank, | ||
49 | .disable_vblank = via_disable_vblank, | ||
50 | .irq_preinstall = via_driver_irq_preinstall, | 48 | .irq_preinstall = via_driver_irq_preinstall, |
51 | .irq_postinstall = via_driver_irq_postinstall, | 49 | .irq_postinstall = via_driver_irq_postinstall, |
52 | .irq_uninstall = via_driver_irq_uninstall, | 50 | .irq_uninstall = via_driver_irq_uninstall, |
diff --git a/drivers/char/drm/via_drv.h b/drivers/char/drm/via_drv.h index fe67030e39ac..2daae81874cd 100644 --- a/drivers/char/drm/via_drv.h +++ b/drivers/char/drm/via_drv.h | |||
@@ -75,7 +75,6 @@ typedef struct drm_via_private { | |||
75 | struct timeval last_vblank; | 75 | struct timeval last_vblank; |
76 | int last_vblank_valid; | 76 | int last_vblank_valid; |
77 | unsigned usec_per_vblank; | 77 | unsigned usec_per_vblank; |
78 | atomic_t vbl_received; | ||
79 | drm_via_state_t hc_state; | 78 | drm_via_state_t hc_state; |
80 | char pci_buf[VIA_PCI_BUF_SIZE]; | 79 | char pci_buf[VIA_PCI_BUF_SIZE]; |
81 | const uint32_t *fire_offsets[VIA_FIRE_BUF_SIZE]; | 80 | const uint32_t *fire_offsets[VIA_FIRE_BUF_SIZE]; |
@@ -131,13 +130,11 @@ extern int via_init_context(struct drm_device * dev, int context); | |||
131 | extern int via_final_context(struct drm_device * dev, int context); | 130 | extern int via_final_context(struct drm_device * dev, int context); |
132 | 131 | ||
133 | extern int via_do_cleanup_map(struct drm_device * dev); | 132 | extern int via_do_cleanup_map(struct drm_device * dev); |
134 | extern u32 via_get_vblank_counter(struct drm_device *dev, int crtc); | 133 | extern int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence); |
135 | extern int via_enable_vblank(struct drm_device *dev, int crtc); | ||
136 | extern void via_disable_vblank(struct drm_device *dev, int crtc); | ||
137 | 134 | ||
138 | extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS); | 135 | extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS); |
139 | extern void via_driver_irq_preinstall(struct drm_device * dev); | 136 | extern void via_driver_irq_preinstall(struct drm_device * dev); |
140 | extern int via_driver_irq_postinstall(struct drm_device * dev); | 137 | extern void via_driver_irq_postinstall(struct drm_device * dev); |
141 | extern void via_driver_irq_uninstall(struct drm_device * dev); | 138 | extern void via_driver_irq_uninstall(struct drm_device * dev); |
142 | 139 | ||
143 | extern int via_dma_cleanup(struct drm_device * dev); | 140 | extern int via_dma_cleanup(struct drm_device * dev); |
diff --git a/drivers/char/drm/via_irq.c b/drivers/char/drm/via_irq.c index f1ab6fc7c07e..c6bb978a1106 100644 --- a/drivers/char/drm/via_irq.c +++ b/drivers/char/drm/via_irq.c | |||
@@ -92,17 +92,8 @@ static int via_irqmap_unichrome[] = {-1, -1, -1, 0, -1, 1}; | |||
92 | static unsigned time_diff(struct timeval *now, struct timeval *then) | 92 | static unsigned time_diff(struct timeval *now, struct timeval *then) |
93 | { | 93 | { |
94 | return (now->tv_usec >= then->tv_usec) ? | 94 | return (now->tv_usec >= then->tv_usec) ? |
95 | now->tv_usec - then->tv_usec : | 95 | now->tv_usec - then->tv_usec : |
96 | 1000000 - (then->tv_usec - now->tv_usec); | 96 | 1000000 - (then->tv_usec - now->tv_usec); |
97 | } | ||
98 | |||
99 | u32 via_get_vblank_counter(struct drm_device *dev, int crtc) | ||
100 | { | ||
101 | drm_via_private_t *dev_priv = dev->dev_private; | ||
102 | if (crtc != 0) | ||
103 | return 0; | ||
104 | |||
105 | return atomic_read(&dev_priv->vbl_received); | ||
106 | } | 97 | } |
107 | 98 | ||
108 | irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) | 99 | irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) |
@@ -117,8 +108,8 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) | |||
117 | 108 | ||
118 | status = VIA_READ(VIA_REG_INTERRUPT); | 109 | status = VIA_READ(VIA_REG_INTERRUPT); |
119 | if (status & VIA_IRQ_VBLANK_PENDING) { | 110 | if (status & VIA_IRQ_VBLANK_PENDING) { |
120 | atomic_inc(&dev_priv->vbl_received); | 111 | atomic_inc(&dev->vbl_received); |
121 | if (!(atomic_read(&dev_priv->vbl_received) & 0x0F)) { | 112 | if (!(atomic_read(&dev->vbl_received) & 0x0F)) { |
122 | do_gettimeofday(&cur_vblank); | 113 | do_gettimeofday(&cur_vblank); |
123 | if (dev_priv->last_vblank_valid) { | 114 | if (dev_priv->last_vblank_valid) { |
124 | dev_priv->usec_per_vblank = | 115 | dev_priv->usec_per_vblank = |
@@ -128,11 +119,12 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) | |||
128 | dev_priv->last_vblank = cur_vblank; | 119 | dev_priv->last_vblank = cur_vblank; |
129 | dev_priv->last_vblank_valid = 1; | 120 | dev_priv->last_vblank_valid = 1; |
130 | } | 121 | } |
131 | if (!(atomic_read(&dev_priv->vbl_received) & 0xFF)) { | 122 | if (!(atomic_read(&dev->vbl_received) & 0xFF)) { |
132 | DRM_DEBUG("US per vblank is: %u\n", | 123 | DRM_DEBUG("US per vblank is: %u\n", |
133 | dev_priv->usec_per_vblank); | 124 | dev_priv->usec_per_vblank); |
134 | } | 125 | } |
135 | drm_handle_vblank(dev, 0); | 126 | DRM_WAKEUP(&dev->vbl_queue); |
127 | drm_vbl_send_signals(dev); | ||
136 | handled = 1; | 128 | handled = 1; |
137 | } | 129 | } |
138 | 130 | ||
@@ -171,34 +163,31 @@ static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t * dev_priv) | |||
171 | } | 163 | } |
172 | } | 164 | } |
173 | 165 | ||
174 | int via_enable_vblank(struct drm_device *dev, int crtc) | 166 | int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence) |
175 | { | 167 | { |
176 | drm_via_private_t *dev_priv = dev->dev_private; | 168 | drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; |
177 | u32 status; | 169 | unsigned int cur_vblank; |
170 | int ret = 0; | ||
178 | 171 | ||
179 | if (crtc != 0) { | 172 | DRM_DEBUG("\n"); |
180 | DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc); | 173 | if (!dev_priv) { |
174 | DRM_ERROR("called with no initialization\n"); | ||
181 | return -EINVAL; | 175 | return -EINVAL; |
182 | } | 176 | } |
183 | 177 | ||
184 | status = VIA_READ(VIA_REG_INTERRUPT); | 178 | viadrv_acknowledge_irqs(dev_priv); |
185 | VIA_WRITE(VIA_REG_INTERRUPT, status & VIA_IRQ_VBLANK_ENABLE); | ||
186 | 179 | ||
187 | VIA_WRITE8(0x83d4, 0x11); | 180 | /* Assume that the user has missed the current sequence number |
188 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); | 181 | * by about a day rather than she wants to wait for years |
182 | * using vertical blanks... | ||
183 | */ | ||
189 | 184 | ||
190 | return 0; | 185 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, |
191 | } | 186 | (((cur_vblank = atomic_read(&dev->vbl_received)) - |
187 | *sequence) <= (1 << 23))); | ||
192 | 188 | ||
193 | void via_disable_vblank(struct drm_device *dev, int crtc) | 189 | *sequence = cur_vblank; |
194 | { | 190 | return ret; |
195 | drm_via_private_t *dev_priv = dev->dev_private; | ||
196 | |||
197 | VIA_WRITE8(0x83d4, 0x11); | ||
198 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30); | ||
199 | |||
200 | if (crtc != 0) | ||
201 | DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc); | ||
202 | } | 191 | } |
203 | 192 | ||
204 | static int | 193 | static int |
@@ -303,25 +292,23 @@ void via_driver_irq_preinstall(struct drm_device * dev) | |||
303 | } | 292 | } |
304 | } | 293 | } |
305 | 294 | ||
306 | int via_driver_irq_postinstall(struct drm_device * dev) | 295 | void via_driver_irq_postinstall(struct drm_device * dev) |
307 | { | 296 | { |
308 | drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; | 297 | drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; |
309 | u32 status; | 298 | u32 status; |
310 | 299 | ||
311 | DRM_DEBUG("via_driver_irq_postinstall\n"); | 300 | DRM_DEBUG("\n"); |
312 | if (!dev_priv) | 301 | if (dev_priv) { |
313 | return -EINVAL; | 302 | status = VIA_READ(VIA_REG_INTERRUPT); |
303 | VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL | ||
304 | | dev_priv->irq_enable_mask); | ||
314 | 305 | ||
315 | drm_vblank_init(dev, 1); | 306 | /* Some magic, oh for some data sheets ! */ |
316 | status = VIA_READ(VIA_REG_INTERRUPT); | ||
317 | VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL | ||
318 | | dev_priv->irq_enable_mask); | ||
319 | 307 | ||
320 | /* Some magic, oh for some data sheets ! */ | 308 | VIA_WRITE8(0x83d4, 0x11); |
321 | VIA_WRITE8(0x83d4, 0x11); | 309 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); |
322 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); | ||
323 | 310 | ||
324 | return 0; | 311 | } |
325 | } | 312 | } |
326 | 313 | ||
327 | void via_driver_irq_uninstall(struct drm_device * dev) | 314 | void via_driver_irq_uninstall(struct drm_device * dev) |
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 19105ec203f7..8096389b0dc2 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -282,16 +282,20 @@ static int opost(unsigned char c, struct tty_struct *tty) | |||
282 | if (O_ONLRET(tty)) | 282 | if (O_ONLRET(tty)) |
283 | tty->column = 0; | 283 | tty->column = 0; |
284 | if (O_ONLCR(tty)) { | 284 | if (O_ONLCR(tty)) { |
285 | if (space < 2) | 285 | if (space < 2) { |
286 | unlock_kernel(); | ||
286 | return -1; | 287 | return -1; |
288 | } | ||
287 | tty_put_char(tty, '\r'); | 289 | tty_put_char(tty, '\r'); |
288 | tty->column = 0; | 290 | tty->column = 0; |
289 | } | 291 | } |
290 | tty->canon_column = tty->column; | 292 | tty->canon_column = tty->column; |
291 | break; | 293 | break; |
292 | case '\r': | 294 | case '\r': |
293 | if (O_ONOCR(tty) && tty->column == 0) | 295 | if (O_ONOCR(tty) && tty->column == 0) { |
296 | unlock_kernel(); | ||
294 | return 0; | 297 | return 0; |
298 | } | ||
295 | if (O_OCRNL(tty)) { | 299 | if (O_OCRNL(tty)) { |
296 | c = '\n'; | 300 | c = '\n'; |
297 | if (O_ONLRET(tty)) | 301 | if (O_ONLRET(tty)) |
@@ -303,10 +307,13 @@ static int opost(unsigned char c, struct tty_struct *tty) | |||
303 | case '\t': | 307 | case '\t': |
304 | spaces = 8 - (tty->column & 7); | 308 | spaces = 8 - (tty->column & 7); |
305 | if (O_TABDLY(tty) == XTABS) { | 309 | if (O_TABDLY(tty) == XTABS) { |
306 | if (space < spaces) | 310 | if (space < spaces) { |
311 | unlock_kernel(); | ||
307 | return -1; | 312 | return -1; |
313 | } | ||
308 | tty->column += spaces; | 314 | tty->column += spaces; |
309 | tty->ops->write(tty, " ", spaces); | 315 | tty->ops->write(tty, " ", spaces); |
316 | unlock_kernel(); | ||
310 | return 0; | 317 | return 0; |
311 | } | 318 | } |
312 | tty->column += spaces; | 319 | tty->column += spaces; |
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c index 53b3d44f8c06..55a95892ccf9 100644 --- a/drivers/char/snsc_event.c +++ b/drivers/char/snsc_event.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
20 | #include <linux/byteorder/generic.h> | 20 | #include <asm/byteorder.h> |
21 | #include <asm/sn/sn_sal.h> | 21 | #include <asm/sn/sn_sal.h> |
22 | #include <asm/unaligned.h> | 22 | #include <asm/unaligned.h> |
23 | #include "snsc.h" | 23 | #include "snsc.h" |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 9e9bad8bdcf4..dbce1263bdff 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -402,6 +402,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = { | |||
402 | &sysrq_showstate_blocked_op, /* w */ | 402 | &sysrq_showstate_blocked_op, /* w */ |
403 | /* x: May be registered on ppc/powerpc for xmon */ | 403 | /* x: May be registered on ppc/powerpc for xmon */ |
404 | NULL, /* x */ | 404 | NULL, /* x */ |
405 | /* y: May be registered on sparc64 for global register dump */ | ||
405 | NULL, /* y */ | 406 | NULL, /* y */ |
406 | NULL /* z */ | 407 | NULL /* z */ |
407 | }; | 408 | }; |
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index e122a0e87bb0..f17ac043b551 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c | |||
@@ -89,9 +89,7 @@ static void scc_break_ctl(struct tty_struct *tty, int break_state); | |||
89 | 89 | ||
90 | static struct tty_driver *scc_driver; | 90 | static struct tty_driver *scc_driver; |
91 | 91 | ||
92 | struct scc_port scc_ports[2]; | 92 | static struct scc_port scc_ports[2]; |
93 | |||
94 | int scc_initialized = 0; | ||
95 | 93 | ||
96 | /*--------------------------------------------------------------------------- | 94 | /*--------------------------------------------------------------------------- |
97 | * Interface from generic_serial.c back here | 95 | * Interface from generic_serial.c back here |
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index 762b729672e0..0ec0f431e6a1 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c | |||
@@ -821,10 +821,10 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) | |||
821 | 821 | ||
822 | dev_dbg(device->common.dev, "%s\n", __func__); | 822 | dev_dbg(device->common.dev, "%s\n", __func__); |
823 | 823 | ||
824 | src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); | 824 | src = kmalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL); |
825 | if (!src) | 825 | if (!src) |
826 | return -ENOMEM; | 826 | return -ENOMEM; |
827 | dest = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); | 827 | dest = kzalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL); |
828 | if (!dest) { | 828 | if (!dest) { |
829 | kfree(src); | 829 | kfree(src); |
830 | return -ENOMEM; | 830 | return -ENOMEM; |
@@ -834,8 +834,6 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) | |||
834 | for (i = 0; i < IOP_ADMA_TEST_SIZE; i++) | 834 | for (i = 0; i < IOP_ADMA_TEST_SIZE; i++) |
835 | ((u8 *) src)[i] = (u8)i; | 835 | ((u8 *) src)[i] = (u8)i; |
836 | 836 | ||
837 | memset(dest, 0, IOP_ADMA_TEST_SIZE); | ||
838 | |||
839 | /* Start copy, using first DMA channel */ | 837 | /* Start copy, using first DMA channel */ |
840 | dma_chan = container_of(device->common.channels.next, | 838 | dma_chan = container_of(device->common.channels.next, |
841 | struct dma_chan, | 839 | struct dma_chan, |
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c index 4a541921a14a..dda14015e873 100644 --- a/drivers/firewire/fw-cdev.c +++ b/drivers/firewire/fw-cdev.c | |||
@@ -113,6 +113,11 @@ static int fw_device_op_open(struct inode *inode, struct file *file) | |||
113 | if (device == NULL) | 113 | if (device == NULL) |
114 | return -ENODEV; | 114 | return -ENODEV; |
115 | 115 | ||
116 | if (fw_device_is_shutdown(device)) { | ||
117 | fw_device_put(device); | ||
118 | return -ENODEV; | ||
119 | } | ||
120 | |||
116 | client = kzalloc(sizeof(*client), GFP_KERNEL); | 121 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
117 | if (client == NULL) { | 122 | if (client == NULL) { |
118 | fw_device_put(device); | 123 | fw_device_put(device); |
@@ -901,6 +906,9 @@ fw_device_op_ioctl(struct file *file, | |||
901 | { | 906 | { |
902 | struct client *client = file->private_data; | 907 | struct client *client = file->private_data; |
903 | 908 | ||
909 | if (fw_device_is_shutdown(client->device)) | ||
910 | return -ENODEV; | ||
911 | |||
904 | return dispatch_ioctl(client, cmd, (void __user *) arg); | 912 | return dispatch_ioctl(client, cmd, (void __user *) arg); |
905 | } | 913 | } |
906 | 914 | ||
@@ -911,6 +919,9 @@ fw_device_op_compat_ioctl(struct file *file, | |||
911 | { | 919 | { |
912 | struct client *client = file->private_data; | 920 | struct client *client = file->private_data; |
913 | 921 | ||
922 | if (fw_device_is_shutdown(client->device)) | ||
923 | return -ENODEV; | ||
924 | |||
914 | return dispatch_ioctl(client, cmd, compat_ptr(arg)); | 925 | return dispatch_ioctl(client, cmd, compat_ptr(arg)); |
915 | } | 926 | } |
916 | #endif | 927 | #endif |
@@ -922,6 +933,9 @@ static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma) | |||
922 | unsigned long size; | 933 | unsigned long size; |
923 | int page_count, retval; | 934 | int page_count, retval; |
924 | 935 | ||
936 | if (fw_device_is_shutdown(client->device)) | ||
937 | return -ENODEV; | ||
938 | |||
925 | /* FIXME: We could support multiple buffers, but we don't. */ | 939 | /* FIXME: We could support multiple buffers, but we don't. */ |
926 | if (client->buffer.pages != NULL) | 940 | if (client->buffer.pages != NULL) |
927 | return -EBUSY; | 941 | return -EBUSY; |
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index f88714b06000..47ac1a7d66e1 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: hid-debug.h,v 1.8 2001/09/25 09:37:57 vojtech Exp $ | ||
3 | * | ||
4 | * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de> | 2 | * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de> |
5 | * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> | 3 | * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> |
6 | * (c) 2007 Jiri Kosina | 4 | * (c) 2007 Jiri Kosina |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index c3eb3f13e2ca..5c52a20ad344 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: hid-input.c,v 1.2 2002/04/23 00:59:25 rdamazio Exp $ | ||
3 | * | ||
4 | * Copyright (c) 2000-2001 Vojtech Pavlik | 2 | * Copyright (c) 2000-2001 Vojtech Pavlik |
5 | * Copyright (c) 2006-2007 Jiri Kosina | 3 | * Copyright (c) 2006-2007 Jiri Kosina |
6 | * | 4 | * |
@@ -218,8 +216,9 @@ int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | |||
218 | } | 216 | } |
219 | } | 217 | } |
220 | 218 | ||
221 | if (test_bit(usage->code, hid->pb_pressed_numlock) || | 219 | if (hid->quirks & HID_QUIRK_APPLE_NUMLOCK_EMULATION && ( |
222 | test_bit(LED_NUML, input->led)) { | 220 | test_bit(usage->code, hid->pb_pressed_numlock) || |
221 | test_bit(LED_NUML, input->led))) { | ||
223 | trans = find_translation(powerbook_numlock_keys, usage->code); | 222 | trans = find_translation(powerbook_numlock_keys, usage->code); |
224 | 223 | ||
225 | if (trans) { | 224 | if (trans) { |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index d3f8d9194f30..1df832a8fcbc 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -325,6 +325,10 @@ | |||
325 | #define USB_DEVICE_ID_MGE_UPS 0xffff | 325 | #define USB_DEVICE_ID_MGE_UPS 0xffff |
326 | #define USB_DEVICE_ID_MGE_UPS1 0x0001 | 326 | #define USB_DEVICE_ID_MGE_UPS1 0x0001 |
327 | 327 | ||
328 | #define USB_VENDOR_ID_MICROCHIP 0x04d8 | ||
329 | #define USB_DEVICE_ID_PICKIT1 0x0032 | ||
330 | #define USB_DEVICE_ID_PICKIT2 0x0033 | ||
331 | |||
328 | #define USB_VENDOR_ID_MICROSOFT 0x045e | 332 | #define USB_VENDOR_ID_MICROSOFT 0x045e |
329 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b | 333 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b |
330 | #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d | 334 | #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d |
@@ -371,6 +375,9 @@ | |||
371 | #define USB_VENDOR_ID_SONY 0x054c | 375 | #define USB_VENDOR_ID_SONY 0x054c |
372 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 | 376 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 |
373 | 377 | ||
378 | #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 | ||
379 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD 0x0038 | ||
380 | |||
374 | #define USB_VENDOR_ID_SUN 0x0430 | 381 | #define USB_VENDOR_ID_SUN 0x0430 |
375 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab | 382 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab |
376 | 383 | ||
@@ -567,6 +574,7 @@ static const struct hid_blacklist { | |||
567 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, | 574 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, |
568 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, | 575 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, |
569 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, | 576 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, |
577 | { USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD, HID_QUIRK_IGNORE }, | ||
570 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE }, | 578 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE }, |
571 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, | 579 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, |
572 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, | 580 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, |
@@ -580,6 +588,9 @@ static const struct hid_blacklist { | |||
580 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR, HID_QUIRK_IGNORE }, | 588 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR, HID_QUIRK_IGNORE }, |
581 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302, HID_QUIRK_IGNORE }, | 589 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302, HID_QUIRK_IGNORE }, |
582 | 590 | ||
591 | { USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1, HID_QUIRK_IGNORE }, | ||
592 | { USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2, HID_QUIRK_IGNORE }, | ||
593 | |||
583 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, | 594 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, |
584 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, | 595 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, |
585 | 596 | ||
@@ -611,28 +622,28 @@ static const struct hid_blacklist { | |||
611 | 622 | ||
612 | { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 623 | { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
613 | 624 | ||
614 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 625 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
615 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 626 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
616 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 627 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
617 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | 628 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, |
618 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 629 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
619 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 630 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
620 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | 631 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, |
621 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 632 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
622 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 633 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
623 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | 634 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, |
624 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 635 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
625 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, | 636 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, |
626 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 637 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
627 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, | 638 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, |
628 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 639 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
629 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 640 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
630 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 641 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
631 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_HAS_FN }, | 642 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, |
632 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 643 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
633 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_HAS_FN }, | 644 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, |
634 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 645 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
635 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 646 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
636 | 647 | ||
637 | { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, | 648 | { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, |
638 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, | 649 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, |
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c index 5d9dbb47e4a8..3cd46d2e53c1 100644 --- a/drivers/hid/usbhid/usbkbd.c +++ b/drivers/hid/usbhid/usbkbd.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: usbkbd.c,v 1.27 2001/12/27 10:37:41 vojtech Exp $ | ||
3 | * | ||
4 | * Copyright (c) 1999-2001 Vojtech Pavlik | 2 | * Copyright (c) 1999-2001 Vojtech Pavlik |
5 | * | 3 | * |
6 | * USB HIDBP Keyboard support | 4 | * USB HIDBP Keyboard support |
diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c index df0d96d989de..703e9d0e8714 100644 --- a/drivers/hid/usbhid/usbmouse.c +++ b/drivers/hid/usbhid/usbmouse.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: usbmouse.c,v 1.15 2001/12/27 10:37:41 vojtech Exp $ | ||
3 | * | ||
4 | * Copyright (c) 1999-2001 Vojtech Pavlik | 2 | * Copyright (c) 1999-2001 Vojtech Pavlik |
5 | * | 3 | * |
6 | * USB HIDBP Mouse support | 4 | * USB HIDBP Mouse support |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 2fa43183d375..43508d61eb7c 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -290,7 +290,7 @@ static u32 amd756_func(struct i2c_adapter *adapter) | |||
290 | { | 290 | { |
291 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 291 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
292 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | 292 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | |
293 | I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_PROC_CALL; | 293 | I2C_FUNC_SMBUS_BLOCK_DATA; |
294 | } | 294 | } |
295 | 295 | ||
296 | static const struct i2c_algorithm smbus_algorithm = { | 296 | static const struct i2c_algorithm smbus_algorithm = { |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 3dac920e53ea..43c9f8df9509 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/init.h> | 50 | #include <linux/init.h> |
51 | #include <linux/i2c.h> | 51 | #include <linux/i2c.h> |
52 | #include <linux/delay.h> | 52 | #include <linux/delay.h> |
53 | #include <linux/dmi.h> | ||
53 | #include <asm/io.h> | 54 | #include <asm/io.h> |
54 | 55 | ||
55 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
@@ -109,6 +110,18 @@ struct nforce2_smbus { | |||
109 | /* Misc definitions */ | 110 | /* Misc definitions */ |
110 | #define MAX_TIMEOUT 100 | 111 | #define MAX_TIMEOUT 100 |
111 | 112 | ||
113 | /* We disable the second SMBus channel on these boards */ | ||
114 | static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = { | ||
115 | { | ||
116 | .ident = "DFI Lanparty NF4 Expert", | ||
117 | .matches = { | ||
118 | DMI_MATCH(DMI_BOARD_VENDOR, "DFI Corp,LTD"), | ||
119 | DMI_MATCH(DMI_BOARD_NAME, "LP UT NF4 Expert"), | ||
120 | }, | ||
121 | }, | ||
122 | { } | ||
123 | }; | ||
124 | |||
112 | static struct pci_driver nforce2_driver; | 125 | static struct pci_driver nforce2_driver; |
113 | 126 | ||
114 | static void nforce2_abort(struct i2c_adapter *adap) | 127 | static void nforce2_abort(struct i2c_adapter *adap) |
@@ -367,10 +380,17 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_ | |||
367 | smbuses[0].base = 0; /* to have a check value */ | 380 | smbuses[0].base = 0; /* to have a check value */ |
368 | } | 381 | } |
369 | /* SMBus adapter 2 */ | 382 | /* SMBus adapter 2 */ |
370 | res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], "SMB2"); | 383 | if (dmi_check_system(nforce2_dmi_blacklist2)) { |
371 | if (res2 < 0) { | 384 | dev_err(&dev->dev, "Disabling SMB2 for safety reasons.\n"); |
372 | dev_err(&dev->dev, "Error probing SMB2.\n"); | 385 | res2 = -EPERM; |
373 | smbuses[1].base = 0; /* to have a check value */ | 386 | smbuses[1].base = 0; |
387 | } else { | ||
388 | res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], | ||
389 | "SMB2"); | ||
390 | if (res2 < 0) { | ||
391 | dev_err(&dev->dev, "Error probing SMB2.\n"); | ||
392 | smbuses[1].base = 0; /* to have a check value */ | ||
393 | } | ||
374 | } | 394 | } |
375 | if ((res1 < 0) && (res2 < 0)) { | 395 | if ((res1 < 0) && (res2 < 0)) { |
376 | /* we did not find even one of the SMBuses, so we give up */ | 396 | /* we did not find even one of the SMBuses, so we give up */ |
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index fb7ea5637eca..cf507b3f60f3 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c | |||
@@ -207,9 +207,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) | |||
207 | fake_client->flags = 0; | 207 | fake_client->flags = 0; |
208 | strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE); | 208 | strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE); |
209 | 209 | ||
210 | /* Prevent 24RF08 corruption (in case of user error) */ | ||
211 | i2c_smbus_write_quick(real_client, 0); | ||
212 | |||
213 | if ((err = i2c_attach_client(real_client)) != 0) | 210 | if ((err = i2c_attach_client(real_client)) != 0) |
214 | goto exit_kfree2; | 211 | goto exit_kfree2; |
215 | 212 | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index c99ebeadb558..d0175f4f8fc6 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -74,10 +74,7 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv) | |||
74 | if (driver->id_table) | 74 | if (driver->id_table) |
75 | return i2c_match_id(driver->id_table, client) != NULL; | 75 | return i2c_match_id(driver->id_table, client) != NULL; |
76 | 76 | ||
77 | /* new style drivers use the same kind of driver matching policy | 77 | return 0; |
78 | * as platform devices or SPI: compare device and driver IDs. | ||
79 | */ | ||
80 | return strcmp(client->driver_name, drv->name) == 0; | ||
81 | } | 78 | } |
82 | 79 | ||
83 | #ifdef CONFIG_HOTPLUG | 80 | #ifdef CONFIG_HOTPLUG |
@@ -91,14 +88,9 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
91 | if (dev->driver) | 88 | if (dev->driver) |
92 | return 0; | 89 | return 0; |
93 | 90 | ||
94 | if (client->driver_name[0]) { | 91 | if (add_uevent_var(env, "MODALIAS=%s%s", |
95 | if (add_uevent_var(env, "MODALIAS=%s", client->driver_name)) | 92 | I2C_MODULE_PREFIX, client->name)) |
96 | return -ENOMEM; | 93 | return -ENOMEM; |
97 | } else { | ||
98 | if (add_uevent_var(env, "MODALIAS=%s%s", | ||
99 | I2C_MODULE_PREFIX, client->name)) | ||
100 | return -ENOMEM; | ||
101 | } | ||
102 | dev_dbg(dev, "uevent\n"); | 94 | dev_dbg(dev, "uevent\n"); |
103 | return 0; | 95 | return 0; |
104 | } | 96 | } |
@@ -206,9 +198,7 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att | |||
206 | static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) | 198 | static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) |
207 | { | 199 | { |
208 | struct i2c_client *client = to_i2c_client(dev); | 200 | struct i2c_client *client = to_i2c_client(dev); |
209 | return client->driver_name[0] | 201 | return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name); |
210 | ? sprintf(buf, "%s\n", client->driver_name) | ||
211 | : sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name); | ||
212 | } | 202 | } |
213 | 203 | ||
214 | static struct device_attribute i2c_dev_attrs[] = { | 204 | static struct device_attribute i2c_dev_attrs[] = { |
@@ -282,8 +272,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) | |||
282 | client->addr = info->addr; | 272 | client->addr = info->addr; |
283 | client->irq = info->irq; | 273 | client->irq = info->irq; |
284 | 274 | ||
285 | strlcpy(client->driver_name, info->driver_name, | ||
286 | sizeof(client->driver_name)); | ||
287 | strlcpy(client->name, info->type, sizeof(client->name)); | 275 | strlcpy(client->name, info->type, sizeof(client->name)); |
288 | 276 | ||
289 | /* a new style driver may be bound to this device when we | 277 | /* a new style driver may be bound to this device when we |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 34b0d4f26b58..655ec7ef568a 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -648,13 +648,12 @@ static int ide_register_port(ide_hwif_t *hwif) | |||
648 | 648 | ||
649 | get_device(&hwif->gendev); | 649 | get_device(&hwif->gendev); |
650 | 650 | ||
651 | hwif->portdev = device_create(ide_port_class, &hwif->gendev, | 651 | hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev, |
652 | MKDEV(0, 0), hwif->name); | 652 | MKDEV(0, 0), hwif, hwif->name); |
653 | if (IS_ERR(hwif->portdev)) { | 653 | if (IS_ERR(hwif->portdev)) { |
654 | ret = PTR_ERR(hwif->portdev); | 654 | ret = PTR_ERR(hwif->portdev); |
655 | device_unregister(&hwif->gendev); | 655 | device_unregister(&hwif->gendev); |
656 | } | 656 | } |
657 | dev_set_drvdata(hwif->portdev, hwif); | ||
658 | out: | 657 | out: |
659 | return ret; | 658 | return ret; |
660 | } | 659 | } |
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index 1f527bbf8d96..caa2632dd08e 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c | |||
@@ -95,6 +95,9 @@ static int __init macide_init(void) | |||
95 | int irq; | 95 | int irq; |
96 | hw_regs_t hw; | 96 | hw_regs_t hw; |
97 | 97 | ||
98 | if (!MACH_IS_MAC) | ||
99 | return -ENODEV; | ||
100 | |||
98 | switch (macintosh_config->ide_type) { | 101 | switch (macintosh_config->ide_type) { |
99 | case MAC_IDE_QUADRA: | 102 | case MAC_IDE_QUADRA: |
100 | base = IDE_BASE; | 103 | base = IDE_BASE; |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 16b9d0ad154e..a5ceff287a28 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -1539,15 +1539,13 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb, | |||
1539 | 1539 | ||
1540 | static void sbp2_create_command_orb(struct sbp2_lu *lu, | 1540 | static void sbp2_create_command_orb(struct sbp2_lu *lu, |
1541 | struct sbp2_command_info *cmd, | 1541 | struct sbp2_command_info *cmd, |
1542 | unchar *scsi_cmd, | 1542 | struct scsi_cmnd *SCpnt) |
1543 | unsigned int scsi_use_sg, | ||
1544 | unsigned int scsi_request_bufflen, | ||
1545 | struct scatterlist *sg, | ||
1546 | enum dma_data_direction dma_dir) | ||
1547 | { | 1543 | { |
1548 | struct sbp2_fwhost_info *hi = lu->hi; | 1544 | struct sbp2_fwhost_info *hi = lu->hi; |
1549 | struct sbp2_command_orb *orb = &cmd->command_orb; | 1545 | struct sbp2_command_orb *orb = &cmd->command_orb; |
1550 | u32 orb_direction; | 1546 | u32 orb_direction; |
1547 | unsigned int scsi_request_bufflen = scsi_bufflen(SCpnt); | ||
1548 | enum dma_data_direction dma_dir = SCpnt->sc_data_direction; | ||
1551 | 1549 | ||
1552 | /* | 1550 | /* |
1553 | * Set-up our command ORB. | 1551 | * Set-up our command ORB. |
@@ -1580,13 +1578,14 @@ static void sbp2_create_command_orb(struct sbp2_lu *lu, | |||
1580 | orb->data_descriptor_lo = 0x0; | 1578 | orb->data_descriptor_lo = 0x0; |
1581 | orb->misc |= ORB_SET_DIRECTION(1); | 1579 | orb->misc |= ORB_SET_DIRECTION(1); |
1582 | } else | 1580 | } else |
1583 | sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sg, | 1581 | sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_sg_count(SCpnt), |
1582 | scsi_sglist(SCpnt), | ||
1584 | orb_direction, dma_dir); | 1583 | orb_direction, dma_dir); |
1585 | 1584 | ||
1586 | sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); | 1585 | sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); |
1587 | 1586 | ||
1588 | memset(orb->cdb, 0, 12); | 1587 | memset(orb->cdb, 0, sizeof(orb->cdb)); |
1589 | memcpy(orb->cdb, scsi_cmd, COMMAND_SIZE(*scsi_cmd)); | 1588 | memcpy(orb->cdb, SCpnt->cmnd, SCpnt->cmd_len); |
1590 | } | 1589 | } |
1591 | 1590 | ||
1592 | static void sbp2_link_orb_command(struct sbp2_lu *lu, | 1591 | static void sbp2_link_orb_command(struct sbp2_lu *lu, |
@@ -1669,16 +1668,13 @@ static void sbp2_link_orb_command(struct sbp2_lu *lu, | |||
1669 | static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt, | 1668 | static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt, |
1670 | void (*done)(struct scsi_cmnd *)) | 1669 | void (*done)(struct scsi_cmnd *)) |
1671 | { | 1670 | { |
1672 | unchar *scsi_cmd = (unchar *)SCpnt->cmnd; | ||
1673 | struct sbp2_command_info *cmd; | 1671 | struct sbp2_command_info *cmd; |
1674 | 1672 | ||
1675 | cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); | 1673 | cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); |
1676 | if (!cmd) | 1674 | if (!cmd) |
1677 | return -EIO; | 1675 | return -EIO; |
1678 | 1676 | ||
1679 | sbp2_create_command_orb(lu, cmd, scsi_cmd, scsi_sg_count(SCpnt), | 1677 | sbp2_create_command_orb(lu, cmd, SCpnt); |
1680 | scsi_bufflen(SCpnt), scsi_sglist(SCpnt), | ||
1681 | SCpnt->sc_data_direction); | ||
1682 | sbp2_link_orb_command(lu, cmd); | 1678 | sbp2_link_orb_command(lu, cmd); |
1683 | 1679 | ||
1684 | return 0; | 1680 | return 0; |
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 3aa2db54eae4..840ede9ae965 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -1005,8 +1005,9 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
1005 | if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) | 1005 | if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) |
1006 | goto err_cdev; | 1006 | goto err_cdev; |
1007 | 1007 | ||
1008 | port->dev = device_create(umad_class, device->dma_device, | 1008 | port->dev = device_create_drvdata(umad_class, device->dma_device, |
1009 | port->cdev->dev, "umad%d", port->dev_num); | 1009 | port->cdev->dev, port, |
1010 | "umad%d", port->dev_num); | ||
1010 | if (IS_ERR(port->dev)) | 1011 | if (IS_ERR(port->dev)) |
1011 | goto err_cdev; | 1012 | goto err_cdev; |
1012 | 1013 | ||
@@ -1024,15 +1025,12 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
1024 | if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) | 1025 | if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) |
1025 | goto err_sm_cdev; | 1026 | goto err_sm_cdev; |
1026 | 1027 | ||
1027 | port->sm_dev = device_create(umad_class, device->dma_device, | 1028 | port->sm_dev = device_create_drvdata(umad_class, device->dma_device, |
1028 | port->sm_cdev->dev, | 1029 | port->sm_cdev->dev, port, |
1029 | "issm%d", port->dev_num); | 1030 | "issm%d", port->dev_num); |
1030 | if (IS_ERR(port->sm_dev)) | 1031 | if (IS_ERR(port->sm_dev)) |
1031 | goto err_sm_cdev; | 1032 | goto err_sm_cdev; |
1032 | 1033 | ||
1033 | dev_set_drvdata(port->dev, port); | ||
1034 | dev_set_drvdata(port->sm_dev, port); | ||
1035 | |||
1036 | if (device_create_file(port->sm_dev, &dev_attr_ibdev)) | 1034 | if (device_create_file(port->sm_dev, &dev_attr_ibdev)) |
1037 | goto err_sm_dev; | 1035 | goto err_sm_dev; |
1038 | if (device_create_file(port->sm_dev, &dev_attr_port)) | 1036 | if (device_create_file(port->sm_dev, &dev_attr_port)) |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index cc1afa28c181..f806da184b51 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -755,14 +755,15 @@ static void ib_uverbs_add_one(struct ib_device *device) | |||
755 | if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1)) | 755 | if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1)) |
756 | goto err_cdev; | 756 | goto err_cdev; |
757 | 757 | ||
758 | uverbs_dev->dev = device_create(uverbs_class, device->dma_device, | 758 | uverbs_dev->dev = device_create_drvdata(uverbs_class, |
759 | uverbs_dev->cdev->dev, | 759 | device->dma_device, |
760 | "uverbs%d", uverbs_dev->devnum); | 760 | uverbs_dev->cdev->dev, |
761 | uverbs_dev, | ||
762 | "uverbs%d", | ||
763 | uverbs_dev->devnum); | ||
761 | if (IS_ERR(uverbs_dev->dev)) | 764 | if (IS_ERR(uverbs_dev->dev)) |
762 | goto err_cdev; | 765 | goto err_cdev; |
763 | 766 | ||
764 | dev_set_drvdata(uverbs_dev->dev, uverbs_dev); | ||
765 | |||
766 | if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev)) | 767 | if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev)) |
767 | goto err_class; | 768 | goto err_class; |
768 | if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) | 769 | if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) |
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c index 50d80ecf0b80..aacf71f3cd44 100644 --- a/drivers/input/keyboard/hilkbd.c +++ b/drivers/input/keyboard/hilkbd.c | |||
@@ -217,6 +217,10 @@ hil_keyb_init(void) | |||
217 | return -ENOMEM; | 217 | return -ENOMEM; |
218 | 218 | ||
219 | #if defined(CONFIG_HP300) | 219 | #if defined(CONFIG_HP300) |
220 | if (!MACH_IS_HP300) { | ||
221 | err = -ENODEV; | ||
222 | goto err1; | ||
223 | } | ||
220 | if (!hwreg_present((void *)(HILBASE + HIL_DATA))) { | 224 | if (!hwreg_present((void *)(HILBASE + HIL_DATA))) { |
221 | printk(KERN_ERR "HIL: hardware register was not found\n"); | 225 | printk(KERN_ERR "HIL: hardware register was not found\n"); |
222 | err = -ENODEV; | 226 | err = -ENODEV; |
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index ab76ea442fa5..45e5d05b01de 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c | |||
@@ -691,6 +691,11 @@ static int __init hp_sdc_rtc_init(void) | |||
691 | { | 691 | { |
692 | int ret; | 692 | int ret; |
693 | 693 | ||
694 | #ifdef __mc68000__ | ||
695 | if (!MACH_IS_HP300) | ||
696 | return -ENODEV; | ||
697 | #endif | ||
698 | |||
694 | init_MUTEX(&i8042tregs); | 699 | init_MUTEX(&i8042tregs); |
695 | 700 | ||
696 | if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) | 701 | if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) |
diff --git a/drivers/input/serio/hp_sdc_mlc.c b/drivers/input/serio/hp_sdc_mlc.c index f1fd3b638a37..587398f5c9df 100644 --- a/drivers/input/serio/hp_sdc_mlc.c +++ b/drivers/input/serio/hp_sdc_mlc.c | |||
@@ -306,6 +306,11 @@ static int __init hp_sdc_mlc_init(void) | |||
306 | { | 306 | { |
307 | hil_mlc *mlc = &hp_sdc_mlc; | 307 | hil_mlc *mlc = &hp_sdc_mlc; |
308 | 308 | ||
309 | #ifdef __mc68000__ | ||
310 | if (!MACH_IS_HP300) | ||
311 | return -ENODEV; | ||
312 | #endif | ||
313 | |||
309 | printk(KERN_INFO PREFIX "Registering the System Domain Controller's HIL MLC.\n"); | 314 | printk(KERN_INFO PREFIX "Registering the System Domain Controller's HIL MLC.\n"); |
310 | 315 | ||
311 | hp_sdc_mlc_priv.emtestmode = 0; | 316 | hp_sdc_mlc_priv.emtestmode = 0; |
diff --git a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c index cb89aff2e160..d962a8d78b14 100644 --- a/drivers/input/serio/q40kbd.c +++ b/drivers/input/serio/q40kbd.c | |||
@@ -156,7 +156,7 @@ static int __init q40kbd_init(void) | |||
156 | int error; | 156 | int error; |
157 | 157 | ||
158 | if (!MACH_IS_Q40) | 158 | if (!MACH_IS_Q40) |
159 | return -EIO; | 159 | return -ENODEV; |
160 | 160 | ||
161 | error = platform_driver_register(&q40kbd_driver); | 161 | error = platform_driver_register(&q40kbd_driver); |
162 | if (error) | 162 | if (error) |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index b3c54be74556..559a40861c39 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -103,13 +103,11 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) | |||
103 | { | 103 | { |
104 | int rc; | 104 | int rc; |
105 | 105 | ||
106 | led_cdev->dev = device_create(leds_class, parent, 0, "%s", | 106 | led_cdev->dev = device_create_drvdata(leds_class, parent, 0, led_cdev, |
107 | led_cdev->name); | 107 | "%s", led_cdev->name); |
108 | if (IS_ERR(led_cdev->dev)) | 108 | if (IS_ERR(led_cdev->dev)) |
109 | return PTR_ERR(led_cdev->dev); | 109 | return PTR_ERR(led_cdev->dev); |
110 | 110 | ||
111 | dev_set_drvdata(led_cdev->dev, led_cdev); | ||
112 | |||
113 | /* register the attributes */ | 111 | /* register the attributes */ |
114 | rc = device_create_file(led_cdev->dev, &dev_attr_brightness); | 112 | rc = device_create_file(led_cdev->dev, &dev_attr_brightness); |
115 | if (rc) | 113 | if (rc) |
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index b8b9e44f7f4e..dbaad39020a1 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
@@ -334,7 +334,7 @@ int __init adb_init(void) | |||
334 | return 0; | 334 | return 0; |
335 | } | 335 | } |
336 | 336 | ||
337 | __initcall(adb_init); | 337 | device_initcall(adb_init); |
338 | 338 | ||
339 | static int | 339 | static int |
340 | do_adb_reset_bus(void) | 340 | do_adb_reset_bus(void) |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 2ca3e9cfb2bb..0165aac533bf 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2613,7 +2613,7 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2613 | struct bttv_fh *fh = priv; | 2613 | struct bttv_fh *fh = priv; |
2614 | 2614 | ||
2615 | mutex_lock(&fh->cap.vb_lock); | 2615 | mutex_lock(&fh->cap.vb_lock); |
2616 | retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, | 2616 | retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, |
2617 | V4L2_MEMORY_MMAP); | 2617 | V4L2_MEMORY_MMAP); |
2618 | if (retval < 0) { | 2618 | if (retval < 0) { |
2619 | mutex_unlock(&fh->cap.vb_lock); | 2619 | mutex_unlock(&fh->cap.vb_lock); |
diff --git a/drivers/media/video/cs5345.c b/drivers/media/video/cs5345.c index 2a429f9e32cd..03411503457e 100644 --- a/drivers/media/video/cs5345.c +++ b/drivers/media/video/cs5345.c | |||
@@ -160,10 +160,17 @@ static int cs5345_probe(struct i2c_client *client, | |||
160 | 160 | ||
161 | /* ----------------------------------------------------------------------- */ | 161 | /* ----------------------------------------------------------------------- */ |
162 | 162 | ||
163 | static const struct i2c_device_id cs5345_id[] = { | ||
164 | { "cs5345", 0 }, | ||
165 | { } | ||
166 | }; | ||
167 | MODULE_DEVICE_TABLE(i2c, cs5345_id); | ||
168 | |||
163 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 169 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
164 | .name = "cs5345", | 170 | .name = "cs5345", |
165 | .driverid = I2C_DRIVERID_CS5345, | 171 | .driverid = I2C_DRIVERID_CS5345, |
166 | .command = cs5345_command, | 172 | .command = cs5345_command, |
167 | .probe = cs5345_probe, | 173 | .probe = cs5345_probe, |
174 | .id_table = cs5345_id, | ||
168 | }; | 175 | }; |
169 | 176 | ||
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index 2dfd0afc62db..d965af860ab2 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c | |||
@@ -144,7 +144,8 @@ static int cs53l32a_probe(struct i2c_client *client, | |||
144 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 144 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
145 | return -EIO; | 145 | return -EIO; |
146 | 146 | ||
147 | snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); | 147 | if (!id) |
148 | strlcpy(client->name, "cs53l32a", sizeof(client->name)); | ||
148 | 149 | ||
149 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 150 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
150 | client->addr << 1, client->adapter->name); | 151 | client->addr << 1, client->adapter->name); |
@@ -175,10 +176,17 @@ static int cs53l32a_probe(struct i2c_client *client, | |||
175 | return 0; | 176 | return 0; |
176 | } | 177 | } |
177 | 178 | ||
179 | static const struct i2c_device_id cs53l32a_id[] = { | ||
180 | { "cs53l32a", 0 }, | ||
181 | { } | ||
182 | }; | ||
183 | MODULE_DEVICE_TABLE(i2c, cs53l32a_id); | ||
184 | |||
178 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 185 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
179 | .name = "cs53l32a", | 186 | .name = "cs53l32a", |
180 | .driverid = I2C_DRIVERID_CS53L32A, | 187 | .driverid = I2C_DRIVERID_CS53L32A, |
181 | .command = cs53l32a_command, | 188 | .command = cs53l32a_command, |
182 | .probe = cs53l32a_probe, | 189 | .probe = cs53l32a_probe, |
190 | .id_table = cs53l32a_id, | ||
183 | }; | 191 | }; |
184 | 192 | ||
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index 4f08a4058d1a..1d6c51a75313 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c | |||
@@ -74,7 +74,7 @@ static const u8 hw_bus[] = { | |||
74 | }; | 74 | }; |
75 | 75 | ||
76 | /* This array should match the CX18_HW_ defines */ | 76 | /* This array should match the CX18_HW_ defines */ |
77 | static const char * const hw_drivernames[] = { | 77 | static const char * const hw_devicenames[] = { |
78 | "tuner", | 78 | "tuner", |
79 | "tveeprom", | 79 | "tveeprom", |
80 | "cs5345", | 80 | "cs5345", |
@@ -95,8 +95,7 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
95 | id = hw_driverids[idx]; | 95 | id = hw_driverids[idx]; |
96 | bus = hw_bus[idx]; | 96 | bus = hw_bus[idx]; |
97 | memset(&info, 0, sizeof(info)); | 97 | memset(&info, 0, sizeof(info)); |
98 | strlcpy(info.driver_name, hw_drivernames[idx], | 98 | strlcpy(info.type, hw_devicenames[idx], sizeof(info.type)); |
99 | sizeof(info.driver_name)); | ||
100 | info.addr = hw_addrs[idx]; | 99 | info.addr = hw_addrs[idx]; |
101 | for (i = 0; i < I2C_CLIENTS_MAX; i++) | 100 | for (i = 0; i < I2C_CLIENTS_MAX; i++) |
102 | if (cx->i2c_clients[i] == NULL) | 101 | if (cx->i2c_clients[i] == NULL) |
@@ -279,7 +278,7 @@ static const char *cx18_i2c_id_name(u32 id) | |||
279 | 278 | ||
280 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) | 279 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) |
281 | if (hw_driverids[i] == id) | 280 | if (hw_driverids[i] == id) |
282 | return hw_drivernames[i]; | 281 | return hw_devicenames[i]; |
283 | return "unknown device"; | 282 | return "unknown device"; |
284 | } | 283 | } |
285 | 284 | ||
@@ -290,7 +289,7 @@ static const char *cx18_i2c_hw_name(u32 hw) | |||
290 | 289 | ||
291 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) | 290 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) |
292 | if (1 << i == hw) | 291 | if (1 << i == hw) |
293 | return hw_drivernames[i]; | 292 | return hw_devicenames[i]; |
294 | return "unknown device"; | 293 | return "unknown device"; |
295 | } | 294 | } |
296 | 295 | ||
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 88823810497c..607efdcd22f8 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1284,10 +1284,17 @@ static int cx25840_remove(struct i2c_client *client) | |||
1284 | return 0; | 1284 | return 0; |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | static const struct i2c_device_id cx25840_id[] = { | ||
1288 | { "cx25840", 0 }, | ||
1289 | { } | ||
1290 | }; | ||
1291 | MODULE_DEVICE_TABLE(i2c, cx25840_id); | ||
1292 | |||
1287 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1293 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1288 | .name = "cx25840", | 1294 | .name = "cx25840", |
1289 | .driverid = I2C_DRIVERID_CX25840, | 1295 | .driverid = I2C_DRIVERID_CX25840, |
1290 | .command = cx25840_command, | 1296 | .command = cx25840_command, |
1291 | .probe = cx25840_probe, | 1297 | .probe = cx25840_probe, |
1292 | .remove = cx25840_remove, | 1298 | .remove = cx25840_remove, |
1299 | .id_table = cx25840_id, | ||
1293 | }; | 1300 | }; |
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index 5e749c528a62..15d037ae25c5 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
35 | #include <linux/vmalloc.h> | 35 | #include <linux/vmalloc.h> |
36 | #include <linux/page-flags.h> | 36 | #include <linux/page-flags.h> |
37 | #include <linux/byteorder/generic.h> | 37 | #include <asm/byteorder.h> |
38 | #include <asm/page.h> | 38 | #include <asm/page.h> |
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | 40 | ||
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 771adf47e944..32129f3ea836 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -136,7 +136,7 @@ static const u8 hw_addrs[] = { | |||
136 | }; | 136 | }; |
137 | 137 | ||
138 | /* This array should match the IVTV_HW_ defines */ | 138 | /* This array should match the IVTV_HW_ defines */ |
139 | static const char * const hw_drivernames[] = { | 139 | static const char * const hw_devicenames[] = { |
140 | "cx25840", | 140 | "cx25840", |
141 | "saa7115", | 141 | "saa7115", |
142 | "saa7127", | 142 | "saa7127", |
@@ -145,7 +145,7 @@ static const char * const hw_drivernames[] = { | |||
145 | "wm8775", | 145 | "wm8775", |
146 | "cs53l32a", | 146 | "cs53l32a", |
147 | "tveeprom", | 147 | "tveeprom", |
148 | "saa7115", | 148 | "saa7114", |
149 | "upd64031a", | 149 | "upd64031a", |
150 | "upd64083", | 150 | "upd64083", |
151 | "saa717x", | 151 | "saa717x", |
@@ -167,8 +167,7 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
167 | return -1; | 167 | return -1; |
168 | id = hw_driverids[idx]; | 168 | id = hw_driverids[idx]; |
169 | memset(&info, 0, sizeof(info)); | 169 | memset(&info, 0, sizeof(info)); |
170 | strlcpy(info.driver_name, hw_drivernames[idx], | 170 | strlcpy(info.type, hw_devicenames[idx], sizeof(info.type)); |
171 | sizeof(info.driver_name)); | ||
172 | info.addr = hw_addrs[idx]; | 171 | info.addr = hw_addrs[idx]; |
173 | for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {} | 172 | for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {} |
174 | 173 | ||
@@ -657,7 +656,7 @@ static const char *ivtv_i2c_id_name(u32 id) | |||
657 | 656 | ||
658 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) | 657 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) |
659 | if (hw_driverids[i] == id) | 658 | if (hw_driverids[i] == id) |
660 | return hw_drivernames[i]; | 659 | return hw_devicenames[i]; |
661 | return "unknown device"; | 660 | return "unknown device"; |
662 | } | 661 | } |
663 | 662 | ||
@@ -668,7 +667,7 @@ static const char *ivtv_i2c_hw_name(u32 hw) | |||
668 | 667 | ||
669 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) | 668 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) |
670 | if (1 << i == hw) | 669 | if (1 << i == hw) |
671 | return hw_drivernames[i]; | 670 | return hw_devicenames[i]; |
672 | return "unknown device"; | 671 | return "unknown device"; |
673 | } | 672 | } |
674 | 673 | ||
@@ -770,7 +769,7 @@ int init_ivtv_i2c(struct ivtv *itv) | |||
770 | * same size and GPIO must be the last entry. | 769 | * same size and GPIO must be the last entry. |
771 | */ | 770 | */ |
772 | if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) || | 771 | if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) || |
773 | ARRAY_SIZE(hw_drivernames) != ARRAY_SIZE(hw_addrs) || | 772 | ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs) || |
774 | IVTV_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 1)) || | 773 | IVTV_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 1)) || |
775 | hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) { | 774 | hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) { |
776 | IVTV_ERR("Mismatched I2C hardware arrays\n"); | 775 | IVTV_ERR("Mismatched I2C hardware arrays\n"); |
diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c index 5b9dfa2c51b4..8e0160d275ca 100644 --- a/drivers/media/video/m52790.c +++ b/drivers/media/video/m52790.c | |||
@@ -135,8 +135,6 @@ static int m52790_probe(struct i2c_client *client, | |||
135 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 135 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
136 | return -EIO; | 136 | return -EIO; |
137 | 137 | ||
138 | snprintf(client->name, sizeof(client->name) - 1, "m52790"); | ||
139 | |||
140 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 138 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
141 | client->addr << 1, client->adapter->name); | 139 | client->addr << 1, client->adapter->name); |
142 | 140 | ||
@@ -159,11 +157,18 @@ static int m52790_remove(struct i2c_client *client) | |||
159 | 157 | ||
160 | /* ----------------------------------------------------------------------- */ | 158 | /* ----------------------------------------------------------------------- */ |
161 | 159 | ||
160 | static const struct i2c_device_id m52790_id[] = { | ||
161 | { "m52790", 0 }, | ||
162 | { } | ||
163 | }; | ||
164 | MODULE_DEVICE_TABLE(i2c, m52790_id); | ||
165 | |||
162 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 166 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
163 | .name = "m52790", | 167 | .name = "m52790", |
164 | .driverid = I2C_DRIVERID_M52790, | 168 | .driverid = I2C_DRIVERID_M52790, |
165 | .command = m52790_command, | 169 | .command = m52790_command, |
166 | .probe = m52790_probe, | 170 | .probe = m52790_probe, |
167 | .remove = m52790_remove, | 171 | .remove = m52790_remove, |
172 | .id_table = m52790_id, | ||
168 | }; | 173 | }; |
169 | 174 | ||
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index e6273162e123..310dbaba55ff 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -815,7 +815,8 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
815 | int msp_product, msp_prod_hi, msp_prod_lo; | 815 | int msp_product, msp_prod_hi, msp_prod_lo; |
816 | int msp_rom; | 816 | int msp_rom; |
817 | 817 | ||
818 | snprintf(client->name, sizeof(client->name) - 1, "msp3400"); | 818 | if (!id) |
819 | strlcpy(client->name, "msp3400", sizeof(client->name)); | ||
819 | 820 | ||
820 | if (msp_reset(client) == -1) { | 821 | if (msp_reset(client) == -1) { |
821 | v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); | 822 | v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); |
@@ -864,9 +865,6 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
864 | msp_revision = (state->rev1 & 0x0f) + '@'; | 865 | msp_revision = (state->rev1 & 0x0f) + '@'; |
865 | msp_hard = ((state->rev1 >> 8) & 0xff) + '@'; | 866 | msp_hard = ((state->rev1 >> 8) & 0xff) + '@'; |
866 | msp_rom = state->rev2 & 0x1f; | 867 | msp_rom = state->rev2 & 0x1f; |
867 | snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d", | ||
868 | msp_family, msp_product, | ||
869 | msp_revision, msp_hard, msp_rom); | ||
870 | /* Rev B=2, C=3, D=4, G=7 */ | 868 | /* Rev B=2, C=3, D=4, G=7 */ |
871 | state->ident = msp_family * 10000 + 4000 + msp_product * 10 + | 869 | state->ident = msp_family * 10000 + 4000 + msp_product * 10 + |
872 | msp_revision - '@'; | 870 | msp_revision - '@'; |
@@ -931,7 +929,9 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
931 | } | 929 | } |
932 | 930 | ||
933 | /* hello world :-) */ | 931 | /* hello world :-) */ |
934 | v4l_info(client, "%s found @ 0x%x (%s)\n", client->name, | 932 | v4l_info(client, "MSP%d4%02d%c-%c%d found @ 0x%x (%s)\n", |
933 | msp_family, msp_product, | ||
934 | msp_revision, msp_hard, msp_rom, | ||
935 | client->addr << 1, client->adapter->name); | 935 | client->addr << 1, client->adapter->name); |
936 | v4l_info(client, "%s ", client->name); | 936 | v4l_info(client, "%s ", client->name); |
937 | if (state->has_nicam && state->has_radio) | 937 | if (state->has_nicam && state->has_radio) |
@@ -987,6 +987,12 @@ static int msp_remove(struct i2c_client *client) | |||
987 | 987 | ||
988 | /* ----------------------------------------------------------------------- */ | 988 | /* ----------------------------------------------------------------------- */ |
989 | 989 | ||
990 | static const struct i2c_device_id msp_id[] = { | ||
991 | { "msp3400", 0 }, | ||
992 | { } | ||
993 | }; | ||
994 | MODULE_DEVICE_TABLE(i2c, msp_id); | ||
995 | |||
990 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 996 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
991 | .name = "msp3400", | 997 | .name = "msp3400", |
992 | .driverid = I2C_DRIVERID_MSP3400, | 998 | .driverid = I2C_DRIVERID_MSP3400, |
@@ -995,6 +1001,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
995 | .remove = msp_remove, | 1001 | .remove = msp_remove, |
996 | .suspend = msp_suspend, | 1002 | .suspend = msp_suspend, |
997 | .resume = msp_resume, | 1003 | .resume = msp_resume, |
1004 | .id_table = msp_id, | ||
998 | }; | 1005 | }; |
999 | 1006 | ||
1000 | 1007 | ||
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index e684108637ad..435c083cc542 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1456,14 +1456,13 @@ static int saa7115_probe(struct i2c_client *client, | |||
1456 | struct saa711x_state *state; | 1456 | struct saa711x_state *state; |
1457 | int i; | 1457 | int i; |
1458 | char name[17]; | 1458 | char name[17]; |
1459 | u8 chip_id; | 1459 | char chip_id; |
1460 | int autodetect = !id || id->driver_data == 1; | ||
1460 | 1461 | ||
1461 | /* Check if the adapter supports the needed features */ | 1462 | /* Check if the adapter supports the needed features */ |
1462 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 1463 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
1463 | return -EIO; | 1464 | return -EIO; |
1464 | 1465 | ||
1465 | snprintf(client->name, sizeof(client->name) - 1, "saa7115"); | ||
1466 | |||
1467 | for (i = 0; i < 0x0f; i++) { | 1466 | for (i = 0; i < 0x0f; i++) { |
1468 | saa711x_write(client, 0, i); | 1467 | saa711x_write(client, 0, i); |
1469 | name[i] = (saa711x_read(client, 0) & 0x0f) + '0'; | 1468 | name[i] = (saa711x_read(client, 0) & 0x0f) + '0'; |
@@ -1472,8 +1471,7 @@ static int saa7115_probe(struct i2c_client *client, | |||
1472 | } | 1471 | } |
1473 | name[i] = '\0'; | 1472 | name[i] = '\0'; |
1474 | 1473 | ||
1475 | saa711x_write(client, 0, 5); | 1474 | chip_id = name[5]; |
1476 | chip_id = saa711x_read(client, 0) & 0x0f; | ||
1477 | 1475 | ||
1478 | /* Check whether this chip is part of the saa711x series */ | 1476 | /* Check whether this chip is part of the saa711x series */ |
1479 | if (memcmp(name, "1f711", 5)) { | 1477 | if (memcmp(name, "1f711", 5)) { |
@@ -1482,8 +1480,14 @@ static int saa7115_probe(struct i2c_client *client, | |||
1482 | return -ENODEV; | 1480 | return -ENODEV; |
1483 | } | 1481 | } |
1484 | 1482 | ||
1485 | snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); | 1483 | /* Safety check */ |
1486 | v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, client->addr << 1, client->adapter->name); | 1484 | if (!autodetect && id->name[6] != chip_id) { |
1485 | v4l_warn(client, "found saa711%c while %s was expected\n", | ||
1486 | chip_id, id->name); | ||
1487 | } | ||
1488 | snprintf(client->name, sizeof(client->name), "saa711%c", chip_id); | ||
1489 | v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name, | ||
1490 | client->addr << 1, client->adapter->name); | ||
1487 | 1491 | ||
1488 | state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); | 1492 | state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); |
1489 | i2c_set_clientdata(client, state); | 1493 | i2c_set_clientdata(client, state); |
@@ -1499,19 +1503,19 @@ static int saa7115_probe(struct i2c_client *client, | |||
1499 | state->hue = 0; | 1503 | state->hue = 0; |
1500 | state->sat = 64; | 1504 | state->sat = 64; |
1501 | switch (chip_id) { | 1505 | switch (chip_id) { |
1502 | case 1: | 1506 | case '1': |
1503 | state->ident = V4L2_IDENT_SAA7111; | 1507 | state->ident = V4L2_IDENT_SAA7111; |
1504 | break; | 1508 | break; |
1505 | case 3: | 1509 | case '3': |
1506 | state->ident = V4L2_IDENT_SAA7113; | 1510 | state->ident = V4L2_IDENT_SAA7113; |
1507 | break; | 1511 | break; |
1508 | case 4: | 1512 | case '4': |
1509 | state->ident = V4L2_IDENT_SAA7114; | 1513 | state->ident = V4L2_IDENT_SAA7114; |
1510 | break; | 1514 | break; |
1511 | case 5: | 1515 | case '5': |
1512 | state->ident = V4L2_IDENT_SAA7115; | 1516 | state->ident = V4L2_IDENT_SAA7115; |
1513 | break; | 1517 | break; |
1514 | case 8: | 1518 | case '8': |
1515 | state->ident = V4L2_IDENT_SAA7118; | 1519 | state->ident = V4L2_IDENT_SAA7118; |
1516 | break; | 1520 | break; |
1517 | default: | 1521 | default: |
@@ -1553,6 +1557,17 @@ static int saa7115_remove(struct i2c_client *client) | |||
1553 | return 0; | 1557 | return 0; |
1554 | } | 1558 | } |
1555 | 1559 | ||
1560 | static const struct i2c_device_id saa7115_id[] = { | ||
1561 | { "saa711x", 1 }, /* autodetect */ | ||
1562 | { "saa7111", 0 }, | ||
1563 | { "saa7113", 0 }, | ||
1564 | { "saa7114", 0 }, | ||
1565 | { "saa7115", 0 }, | ||
1566 | { "saa7118", 0 }, | ||
1567 | { } | ||
1568 | }; | ||
1569 | MODULE_DEVICE_TABLE(i2c, saa7115_id); | ||
1570 | |||
1556 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1571 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1557 | .name = "saa7115", | 1572 | .name = "saa7115", |
1558 | .driverid = I2C_DRIVERID_SAA711X, | 1573 | .driverid = I2C_DRIVERID_SAA711X, |
@@ -1560,5 +1575,6 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
1560 | .probe = saa7115_probe, | 1575 | .probe = saa7115_probe, |
1561 | .remove = saa7115_remove, | 1576 | .remove = saa7115_remove, |
1562 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, | 1577 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, |
1578 | .id_table = saa7115_id, | ||
1563 | }; | 1579 | }; |
1564 | 1580 | ||
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index e750cd65c1c3..79d11a658bdf 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c | |||
@@ -672,8 +672,6 @@ static int saa7127_probe(struct i2c_client *client, | |||
672 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 672 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
673 | return -EIO; | 673 | return -EIO; |
674 | 674 | ||
675 | snprintf(client->name, sizeof(client->name) - 1, "saa7127"); | ||
676 | |||
677 | v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", | 675 | v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", |
678 | client->addr << 1); | 676 | client->addr << 1); |
679 | 677 | ||
@@ -741,11 +739,18 @@ static int saa7127_remove(struct i2c_client *client) | |||
741 | 739 | ||
742 | /* ----------------------------------------------------------------------- */ | 740 | /* ----------------------------------------------------------------------- */ |
743 | 741 | ||
742 | static struct i2c_device_id saa7127_id[] = { | ||
743 | { "saa7127", 0 }, | ||
744 | { } | ||
745 | }; | ||
746 | MODULE_DEVICE_TABLE(i2c, saa7127_id); | ||
747 | |||
744 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 748 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
745 | .name = "saa7127", | 749 | .name = "saa7127", |
746 | .driverid = I2C_DRIVERID_SAA7127, | 750 | .driverid = I2C_DRIVERID_SAA7127, |
747 | .command = saa7127_command, | 751 | .command = saa7127_command, |
748 | .probe = saa7127_probe, | 752 | .probe = saa7127_probe, |
749 | .remove = saa7127_remove, | 753 | .remove = saa7127_remove, |
754 | .id_table = saa7127_id, | ||
750 | }; | 755 | }; |
751 | 756 | ||
diff --git a/drivers/media/video/saa717x.c b/drivers/media/video/saa717x.c index 72c4081feff5..2220f9569941 100644 --- a/drivers/media/video/saa717x.c +++ b/drivers/media/video/saa717x.c | |||
@@ -1429,8 +1429,6 @@ static int saa717x_probe(struct i2c_client *client, | |||
1429 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 1429 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
1430 | return -EIO; | 1430 | return -EIO; |
1431 | 1431 | ||
1432 | snprintf(client->name, sizeof(client->name) - 1, "saa717x"); | ||
1433 | |||
1434 | if (saa717x_write(client, 0x5a4, 0xfe) && | 1432 | if (saa717x_write(client, 0x5a4, 0xfe) && |
1435 | saa717x_write(client, 0x5a5, 0x0f) && | 1433 | saa717x_write(client, 0x5a5, 0x0f) && |
1436 | saa717x_write(client, 0x5a6, 0x00) && | 1434 | saa717x_write(client, 0x5a6, 0x00) && |
@@ -1507,6 +1505,12 @@ static int saa717x_remove(struct i2c_client *client) | |||
1507 | 1505 | ||
1508 | /* ----------------------------------------------------------------------- */ | 1506 | /* ----------------------------------------------------------------------- */ |
1509 | 1507 | ||
1508 | static const struct i2c_device_id saa717x_id[] = { | ||
1509 | { "saa717x", 0 }, | ||
1510 | { } | ||
1511 | }; | ||
1512 | MODULE_DEVICE_TABLE(i2c, saa717x_id); | ||
1513 | |||
1510 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1514 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1511 | .name = "saa717x", | 1515 | .name = "saa717x", |
1512 | .driverid = I2C_DRIVERID_SAA717X, | 1516 | .driverid = I2C_DRIVERID_SAA717X, |
@@ -1514,4 +1518,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
1514 | .probe = saa717x_probe, | 1518 | .probe = saa717x_probe, |
1515 | .remove = saa717x_remove, | 1519 | .remove = saa717x_remove, |
1516 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, | 1520 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, |
1521 | .id_table = saa717x_id, | ||
1517 | }; | 1522 | }; |
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 5748b1e1a128..7f9c7bcf3c85 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
35 | #include <linux/vmalloc.h> | 35 | #include <linux/vmalloc.h> |
36 | #include <linux/page-flags.h> | 36 | #include <linux/page-flags.h> |
37 | #include <linux/byteorder/generic.h> | 37 | #include <asm/byteorder.h> |
38 | #include <asm/page.h> | 38 | #include <asm/page.h> |
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | 40 | ||
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 5a75788b92ae..198f0afb812e 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -1115,7 +1115,6 @@ static int tuner_probe(struct i2c_client *client, | |||
1115 | if (NULL == t) | 1115 | if (NULL == t) |
1116 | return -ENOMEM; | 1116 | return -ENOMEM; |
1117 | t->i2c = client; | 1117 | t->i2c = client; |
1118 | strlcpy(client->name, "(tuner unset)", sizeof(client->name)); | ||
1119 | i2c_set_clientdata(client, t); | 1118 | i2c_set_clientdata(client, t); |
1120 | t->type = UNSET; | 1119 | t->type = UNSET; |
1121 | t->audmode = V4L2_TUNER_MODE_STEREO; | 1120 | t->audmode = V4L2_TUNER_MODE_STEREO; |
@@ -1273,11 +1272,26 @@ static int tuner_remove(struct i2c_client *client) | |||
1273 | 1272 | ||
1274 | list_del(&t->list); | 1273 | list_del(&t->list); |
1275 | kfree(t); | 1274 | kfree(t); |
1275 | |||
1276 | /* The probing code has overwritten the device name, restore it so | ||
1277 | that reloading the driver will work. Ideally the device name | ||
1278 | should not be overwritten in the first place, but for now that | ||
1279 | will do. */ | ||
1280 | strlcpy(client->name, "tuner", I2C_NAME_SIZE); | ||
1276 | return 0; | 1281 | return 0; |
1277 | } | 1282 | } |
1278 | 1283 | ||
1279 | /* ----------------------------------------------------------------------- */ | 1284 | /* ----------------------------------------------------------------------- */ |
1280 | 1285 | ||
1286 | /* This driver supports many devices and the idea is to let the driver | ||
1287 | detect which device is present. So rather than listing all supported | ||
1288 | devices here, we pretend to support a single, fake device type. */ | ||
1289 | static const struct i2c_device_id tuner_id[] = { | ||
1290 | { "tuner", }, /* autodetect */ | ||
1291 | { } | ||
1292 | }; | ||
1293 | MODULE_DEVICE_TABLE(i2c, tuner_id); | ||
1294 | |||
1281 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1295 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1282 | .name = "tuner", | 1296 | .name = "tuner", |
1283 | .driverid = I2C_DRIVERID_TUNER, | 1297 | .driverid = I2C_DRIVERID_TUNER, |
@@ -1287,6 +1301,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
1287 | .suspend = tuner_suspend, | 1301 | .suspend = tuner_suspend, |
1288 | .resume = tuner_resume, | 1302 | .resume = tuner_resume, |
1289 | .legacy_probe = tuner_legacy_probe, | 1303 | .legacy_probe = tuner_legacy_probe, |
1304 | .id_table = tuner_id, | ||
1290 | }; | 1305 | }; |
1291 | 1306 | ||
1292 | 1307 | ||
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c index 93bfd19dec7d..b4628874933b 100644 --- a/drivers/media/video/upd64031a.c +++ b/drivers/media/video/upd64031a.c | |||
@@ -228,6 +228,11 @@ static int upd64031a_remove(struct i2c_client *client) | |||
228 | 228 | ||
229 | /* ----------------------------------------------------------------------- */ | 229 | /* ----------------------------------------------------------------------- */ |
230 | 230 | ||
231 | static const struct i2c_device_id upd64031a_id[] = { | ||
232 | { "upd64031a", 0 }, | ||
233 | { } | ||
234 | }; | ||
235 | MODULE_DEVICE_TABLE(i2c, upd64031a_id); | ||
231 | 236 | ||
232 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 237 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
233 | .name = "upd64031a", | 238 | .name = "upd64031a", |
@@ -235,4 +240,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
235 | .command = upd64031a_command, | 240 | .command = upd64031a_command, |
236 | .probe = upd64031a_probe, | 241 | .probe = upd64031a_probe, |
237 | .remove = upd64031a_remove, | 242 | .remove = upd64031a_remove, |
243 | .id_table = upd64031a_id, | ||
238 | }; | 244 | }; |
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c index 9ab712a56ce0..9521ce004dcc 100644 --- a/drivers/media/video/upd64083.c +++ b/drivers/media/video/upd64083.c | |||
@@ -205,6 +205,11 @@ static int upd64083_remove(struct i2c_client *client) | |||
205 | 205 | ||
206 | /* ----------------------------------------------------------------------- */ | 206 | /* ----------------------------------------------------------------------- */ |
207 | 207 | ||
208 | static const struct i2c_device_id upd64083_id[] = { | ||
209 | { "upd64083", 0 }, | ||
210 | { } | ||
211 | }; | ||
212 | MODULE_DEVICE_TABLE(i2c, upd64083_id); | ||
208 | 213 | ||
209 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 214 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
210 | .name = "upd64083", | 215 | .name = "upd64083", |
@@ -212,4 +217,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
212 | .command = upd64083_command, | 217 | .command = upd64083_command, |
213 | .probe = upd64083_probe, | 218 | .probe = upd64083_probe, |
214 | .remove = upd64083_remove, | 219 | .remove = upd64083_remove, |
220 | .id_table = upd64083_id, | ||
215 | }; | 221 | }; |
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 982f4463896c..0a88c44ace00 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c | |||
@@ -331,7 +331,7 @@ int videobuf_mmap_free(struct videobuf_queue *q) | |||
331 | } | 331 | } |
332 | 332 | ||
333 | /* Locking: Caller holds q->vb_lock */ | 333 | /* Locking: Caller holds q->vb_lock */ |
334 | static int __videobuf_mmap_setup(struct videobuf_queue *q, | 334 | int __videobuf_mmap_setup(struct videobuf_queue *q, |
335 | unsigned int bcount, unsigned int bsize, | 335 | unsigned int bcount, unsigned int bsize, |
336 | enum v4l2_memory memory) | 336 | enum v4l2_memory memory) |
337 | { | 337 | { |
@@ -1129,6 +1129,7 @@ EXPORT_SYMBOL_GPL(videobuf_read_stream); | |||
1129 | EXPORT_SYMBOL_GPL(videobuf_read_one); | 1129 | EXPORT_SYMBOL_GPL(videobuf_read_one); |
1130 | EXPORT_SYMBOL_GPL(videobuf_poll_stream); | 1130 | EXPORT_SYMBOL_GPL(videobuf_poll_stream); |
1131 | 1131 | ||
1132 | EXPORT_SYMBOL_GPL(__videobuf_mmap_setup); | ||
1132 | EXPORT_SYMBOL_GPL(videobuf_mmap_setup); | 1133 | EXPORT_SYMBOL_GPL(videobuf_mmap_setup); |
1133 | EXPORT_SYMBOL_GPL(videobuf_mmap_free); | 1134 | EXPORT_SYMBOL_GPL(videobuf_mmap_free); |
1134 | EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); | 1135 | EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); |
diff --git a/drivers/media/video/vp27smpx.c b/drivers/media/video/vp27smpx.c index fac0deba24af..a1f76ee032e7 100644 --- a/drivers/media/video/vp27smpx.c +++ b/drivers/media/video/vp27smpx.c | |||
@@ -130,8 +130,6 @@ static int vp27smpx_probe(struct i2c_client *client, | |||
130 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 130 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
131 | return -EIO; | 131 | return -EIO; |
132 | 132 | ||
133 | snprintf(client->name, sizeof(client->name) - 1, "vp27smpx"); | ||
134 | |||
135 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 133 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
136 | client->addr << 1, client->adapter->name); | 134 | client->addr << 1, client->adapter->name); |
137 | 135 | ||
@@ -154,11 +152,18 @@ static int vp27smpx_remove(struct i2c_client *client) | |||
154 | 152 | ||
155 | /* ----------------------------------------------------------------------- */ | 153 | /* ----------------------------------------------------------------------- */ |
156 | 154 | ||
155 | static const struct i2c_device_id vp27smpx_id[] = { | ||
156 | { "vp27smpx", 0 }, | ||
157 | { } | ||
158 | }; | ||
159 | MODULE_DEVICE_TABLE(i2c, vp27smpx_id); | ||
160 | |||
157 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 161 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
158 | .name = "vp27smpx", | 162 | .name = "vp27smpx", |
159 | .driverid = I2C_DRIVERID_VP27SMPX, | 163 | .driverid = I2C_DRIVERID_VP27SMPX, |
160 | .command = vp27smpx_command, | 164 | .command = vp27smpx_command, |
161 | .probe = vp27smpx_probe, | 165 | .probe = vp27smpx_probe, |
162 | .remove = vp27smpx_remove, | 166 | .remove = vp27smpx_remove, |
167 | .id_table = vp27smpx_id, | ||
163 | }; | 168 | }; |
164 | 169 | ||
diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c index 0f8ed8461fba..fc50299caa36 100644 --- a/drivers/media/video/wm8739.c +++ b/drivers/media/video/wm8739.c | |||
@@ -313,11 +313,18 @@ static int wm8739_remove(struct i2c_client *client) | |||
313 | return 0; | 313 | return 0; |
314 | } | 314 | } |
315 | 315 | ||
316 | static const struct i2c_device_id wm8739_id[] = { | ||
317 | { "wm8739", 0 }, | ||
318 | { } | ||
319 | }; | ||
320 | MODULE_DEVICE_TABLE(i2c, wm8739_id); | ||
321 | |||
316 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 322 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
317 | .name = "wm8739", | 323 | .name = "wm8739", |
318 | .driverid = I2C_DRIVERID_WM8739, | 324 | .driverid = I2C_DRIVERID_WM8739, |
319 | .command = wm8739_command, | 325 | .command = wm8739_command, |
320 | .probe = wm8739_probe, | 326 | .probe = wm8739_probe, |
321 | .remove = wm8739_remove, | 327 | .remove = wm8739_remove, |
328 | .id_table = wm8739_id, | ||
322 | }; | 329 | }; |
323 | 330 | ||
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 67a409e60c46..506378a508b9 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c | |||
@@ -216,11 +216,18 @@ static int wm8775_remove(struct i2c_client *client) | |||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | 218 | ||
219 | static const struct i2c_device_id wm8775_id[] = { | ||
220 | { "wm8775", 0 }, | ||
221 | { } | ||
222 | }; | ||
223 | MODULE_DEVICE_TABLE(i2c, wm8775_id); | ||
224 | |||
219 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 225 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
220 | .name = "wm8775", | 226 | .name = "wm8775", |
221 | .driverid = I2C_DRIVERID_WM8775, | 227 | .driverid = I2C_DRIVERID_WM8775, |
222 | .command = wm8775_command, | 228 | .command = wm8775_command, |
223 | .probe = wm8775_probe, | 229 | .probe = wm8775_probe, |
224 | .remove = wm8775_remove, | 230 | .remove = wm8775_remove, |
231 | .id_table = wm8775_id, | ||
225 | }; | 232 | }; |
226 | 233 | ||
diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c index 363dd2b9475c..e5c4e9f5193f 100644 --- a/drivers/media/video/zc0301/zc0301_core.c +++ b/drivers/media/video/zc0301/zc0301_core.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/vmalloc.h> | 39 | #include <linux/vmalloc.h> |
40 | #include <linux/page-flags.h> | 40 | #include <linux/page-flags.h> |
41 | #include <linux/byteorder/generic.h> | 41 | #include <asm/byteorder.h> |
42 | #include <asm/page.h> | 42 | #include <asm/page.h> |
43 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
44 | 44 | ||
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c index 7b60533efe45..37629ffd34c3 100644 --- a/drivers/media/video/zoran_device.c +++ b/drivers/media/video/zoran_device.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/vmalloc.h> | 33 | #include <linux/vmalloc.h> |
34 | #include <linux/byteorder/generic.h> | ||
35 | 34 | ||
36 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
37 | #include <linux/proc_fs.h> | 36 | #include <linux/proc_fs.h> |
@@ -47,6 +46,7 @@ | |||
47 | #include <linux/delay.h> | 46 | #include <linux/delay.h> |
48 | #include <linux/wait.h> | 47 | #include <linux/wait.h> |
49 | 48 | ||
49 | #include <asm/byteorder.h> | ||
50 | #include <asm/io.h> | 50 | #include <asm/io.h> |
51 | 51 | ||
52 | #include "videocodec.h" | 52 | #include "videocodec.h" |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 0134bec1e399..345c77e46837 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -52,7 +52,6 @@ | |||
52 | #include <linux/pci.h> | 52 | #include <linux/pci.h> |
53 | #include <linux/vmalloc.h> | 53 | #include <linux/vmalloc.h> |
54 | #include <linux/wait.h> | 54 | #include <linux/wait.h> |
55 | #include <linux/byteorder/generic.h> | ||
56 | 55 | ||
57 | #include <linux/interrupt.h> | 56 | #include <linux/interrupt.h> |
58 | #include <linux/i2c.h> | 57 | #include <linux/i2c.h> |
@@ -74,6 +73,7 @@ | |||
74 | #include <media/v4l2-common.h> | 73 | #include <media/v4l2-common.h> |
75 | #include "videocodec.h" | 74 | #include "videocodec.h" |
76 | 75 | ||
76 | #include <asm/byteorder.h> | ||
77 | #include <asm/io.h> | 77 | #include <asm/io.h> |
78 | #include <asm/uaccess.h> | 78 | #include <asm/uaccess.h> |
79 | #include <linux/proc_fs.h> | 79 | #include <linux/proc_fs.h> |
diff --git a/drivers/mmc/card/Kconfig b/drivers/mmc/card/Kconfig index aa8a4e461942..dd0f398ee2f5 100644 --- a/drivers/mmc/card/Kconfig +++ b/drivers/mmc/card/Kconfig | |||
@@ -39,3 +39,15 @@ config SDIO_UART | |||
39 | SDIO function driver for SDIO cards that implements the UART | 39 | SDIO function driver for SDIO cards that implements the UART |
40 | class, as well as the GPS class which appears like a UART. | 40 | class, as well as the GPS class which appears like a UART. |
41 | 41 | ||
42 | config MMC_TEST | ||
43 | tristate "MMC host test driver" | ||
44 | default n | ||
45 | help | ||
46 | Development driver that performs a series of reads and writes | ||
47 | to a memory card in order to expose certain well known bugs | ||
48 | in host controllers. The tests are executed by writing to the | ||
49 | "test" file in sysfs under each card. Note that whatever is | ||
50 | on your card will be overwritten by these tests. | ||
51 | |||
52 | This driver is only of interest to those developing or | ||
53 | testing a host driver. Most people should say N here. | ||
diff --git a/drivers/mmc/card/Makefile b/drivers/mmc/card/Makefile index fc5a784cfa1a..0d407514f67d 100644 --- a/drivers/mmc/card/Makefile +++ b/drivers/mmc/card/Makefile | |||
@@ -8,6 +8,7 @@ endif | |||
8 | 8 | ||
9 | obj-$(CONFIG_MMC_BLOCK) += mmc_block.o | 9 | obj-$(CONFIG_MMC_BLOCK) += mmc_block.o |
10 | mmc_block-objs := block.o queue.o | 10 | mmc_block-objs := block.o queue.o |
11 | obj-$(CONFIG_MMC_TEST) += mmc_test.o | ||
11 | 12 | ||
12 | obj-$(CONFIG_SDIO_UART) += sdio_uart.o | 13 | obj-$(CONFIG_SDIO_UART) += sdio_uart.o |
13 | 14 | ||
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c new file mode 100644 index 000000000000..ffadee549a41 --- /dev/null +++ b/drivers/mmc/card/mmc_test.c | |||
@@ -0,0 +1,892 @@ | |||
1 | /* | ||
2 | * linux/drivers/mmc/card/mmc_test.c | ||
3 | * | ||
4 | * Copyright 2007 Pierre Ossman | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or (at | ||
9 | * your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/mmc/core.h> | ||
13 | #include <linux/mmc/card.h> | ||
14 | #include <linux/mmc/host.h> | ||
15 | #include <linux/mmc/mmc.h> | ||
16 | |||
17 | #include <linux/scatterlist.h> | ||
18 | |||
19 | #define RESULT_OK 0 | ||
20 | #define RESULT_FAIL 1 | ||
21 | #define RESULT_UNSUP_HOST 2 | ||
22 | #define RESULT_UNSUP_CARD 3 | ||
23 | |||
24 | #define BUFFER_SIZE (PAGE_SIZE * 4) | ||
25 | |||
26 | struct mmc_test_card { | ||
27 | struct mmc_card *card; | ||
28 | |||
29 | u8 *buffer; | ||
30 | }; | ||
31 | |||
32 | /*******************************************************************/ | ||
33 | /* Helper functions */ | ||
34 | /*******************************************************************/ | ||
35 | |||
36 | static int mmc_test_set_blksize(struct mmc_test_card *test, unsigned size) | ||
37 | { | ||
38 | struct mmc_command cmd; | ||
39 | int ret; | ||
40 | |||
41 | cmd.opcode = MMC_SET_BLOCKLEN; | ||
42 | cmd.arg = size; | ||
43 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; | ||
44 | ret = mmc_wait_for_cmd(test->card->host, &cmd, 0); | ||
45 | if (ret) | ||
46 | return ret; | ||
47 | |||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | static int __mmc_test_transfer(struct mmc_test_card *test, int write, | ||
52 | unsigned broken_xfer, u8 *buffer, unsigned addr, | ||
53 | unsigned blocks, unsigned blksz) | ||
54 | { | ||
55 | int ret, busy; | ||
56 | |||
57 | struct mmc_request mrq; | ||
58 | struct mmc_command cmd; | ||
59 | struct mmc_command stop; | ||
60 | struct mmc_data data; | ||
61 | |||
62 | struct scatterlist sg; | ||
63 | |||
64 | memset(&mrq, 0, sizeof(struct mmc_request)); | ||
65 | |||
66 | mrq.cmd = &cmd; | ||
67 | mrq.data = &data; | ||
68 | |||
69 | memset(&cmd, 0, sizeof(struct mmc_command)); | ||
70 | |||
71 | if (broken_xfer) { | ||
72 | if (blocks > 1) { | ||
73 | cmd.opcode = write ? | ||
74 | MMC_WRITE_BLOCK : MMC_READ_SINGLE_BLOCK; | ||
75 | } else { | ||
76 | cmd.opcode = MMC_SEND_STATUS; | ||
77 | } | ||
78 | } else { | ||
79 | if (blocks > 1) { | ||
80 | cmd.opcode = write ? | ||
81 | MMC_WRITE_MULTIPLE_BLOCK : MMC_READ_MULTIPLE_BLOCK; | ||
82 | } else { | ||
83 | cmd.opcode = write ? | ||
84 | MMC_WRITE_BLOCK : MMC_READ_SINGLE_BLOCK; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | if (broken_xfer && blocks == 1) | ||
89 | cmd.arg = test->card->rca << 16; | ||
90 | else | ||
91 | cmd.arg = addr; | ||
92 | cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC; | ||
93 | |||
94 | memset(&stop, 0, sizeof(struct mmc_command)); | ||
95 | |||
96 | if (!broken_xfer && (blocks > 1)) { | ||
97 | stop.opcode = MMC_STOP_TRANSMISSION; | ||
98 | stop.arg = 0; | ||
99 | stop.flags = MMC_RSP_R1B | MMC_CMD_AC; | ||
100 | |||
101 | mrq.stop = &stop; | ||
102 | } | ||
103 | |||
104 | memset(&data, 0, sizeof(struct mmc_data)); | ||
105 | |||
106 | data.blksz = blksz; | ||
107 | data.blocks = blocks; | ||
108 | data.flags = write ? MMC_DATA_WRITE : MMC_DATA_READ; | ||
109 | data.sg = &sg; | ||
110 | data.sg_len = 1; | ||
111 | |||
112 | sg_init_one(&sg, buffer, blocks * blksz); | ||
113 | |||
114 | mmc_set_data_timeout(&data, test->card); | ||
115 | |||
116 | mmc_wait_for_req(test->card->host, &mrq); | ||
117 | |||
118 | ret = 0; | ||
119 | |||
120 | if (broken_xfer) { | ||
121 | if (!ret && cmd.error) | ||
122 | ret = cmd.error; | ||
123 | if (!ret && data.error == 0) | ||
124 | ret = RESULT_FAIL; | ||
125 | if (!ret && data.error != -ETIMEDOUT) | ||
126 | ret = data.error; | ||
127 | if (!ret && stop.error) | ||
128 | ret = stop.error; | ||
129 | if (blocks > 1) { | ||
130 | if (!ret && data.bytes_xfered > blksz) | ||
131 | ret = RESULT_FAIL; | ||
132 | } else { | ||
133 | if (!ret && data.bytes_xfered > 0) | ||
134 | ret = RESULT_FAIL; | ||
135 | } | ||
136 | } else { | ||
137 | if (!ret && cmd.error) | ||
138 | ret = cmd.error; | ||
139 | if (!ret && data.error) | ||
140 | ret = data.error; | ||
141 | if (!ret && stop.error) | ||
142 | ret = stop.error; | ||
143 | if (!ret && data.bytes_xfered != blocks * blksz) | ||
144 | ret = RESULT_FAIL; | ||
145 | } | ||
146 | |||
147 | if (ret == -EINVAL) | ||
148 | ret = RESULT_UNSUP_HOST; | ||
149 | |||
150 | busy = 0; | ||
151 | do { | ||
152 | int ret2; | ||
153 | |||
154 | memset(&cmd, 0, sizeof(struct mmc_command)); | ||
155 | |||
156 | cmd.opcode = MMC_SEND_STATUS; | ||
157 | cmd.arg = test->card->rca << 16; | ||
158 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; | ||
159 | |||
160 | ret2 = mmc_wait_for_cmd(test->card->host, &cmd, 0); | ||
161 | if (ret2) | ||
162 | break; | ||
163 | |||
164 | if (!busy && !(cmd.resp[0] & R1_READY_FOR_DATA)) { | ||
165 | busy = 1; | ||
166 | printk(KERN_INFO "%s: Warning: Host did not " | ||
167 | "wait for busy state to end.\n", | ||
168 | mmc_hostname(test->card->host)); | ||
169 | } | ||
170 | } while (!(cmd.resp[0] & R1_READY_FOR_DATA)); | ||
171 | |||
172 | return ret; | ||
173 | } | ||
174 | |||
175 | static int mmc_test_transfer(struct mmc_test_card *test, int write, | ||
176 | u8 *buffer, unsigned addr, unsigned blocks, unsigned blksz) | ||
177 | { | ||
178 | return __mmc_test_transfer(test, write, 0, buffer, | ||
179 | addr, blocks, blksz); | ||
180 | } | ||
181 | |||
182 | static int mmc_test_prepare_verify(struct mmc_test_card *test, int write) | ||
183 | { | ||
184 | int ret, i; | ||
185 | |||
186 | ret = mmc_test_set_blksize(test, 512); | ||
187 | if (ret) | ||
188 | return ret; | ||
189 | |||
190 | if (write) | ||
191 | memset(test->buffer, 0xDF, BUFFER_SIZE); | ||
192 | else { | ||
193 | for (i = 0;i < BUFFER_SIZE;i++) | ||
194 | test->buffer[i] = i; | ||
195 | } | ||
196 | |||
197 | for (i = 0;i < BUFFER_SIZE / 512;i++) { | ||
198 | ret = mmc_test_transfer(test, 1, test->buffer + i * 512, | ||
199 | i * 512, 1, 512); | ||
200 | if (ret) | ||
201 | return ret; | ||
202 | } | ||
203 | |||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static int mmc_test_prepare_verify_write(struct mmc_test_card *test) | ||
208 | { | ||
209 | return mmc_test_prepare_verify(test, 1); | ||
210 | } | ||
211 | |||
212 | static int mmc_test_prepare_verify_read(struct mmc_test_card *test) | ||
213 | { | ||
214 | return mmc_test_prepare_verify(test, 0); | ||
215 | } | ||
216 | |||
217 | static int mmc_test_verified_transfer(struct mmc_test_card *test, int write, | ||
218 | u8 *buffer, unsigned addr, unsigned blocks, unsigned blksz) | ||
219 | { | ||
220 | int ret, i, sectors; | ||
221 | |||
222 | /* | ||
223 | * It is assumed that the above preparation has been done. | ||
224 | */ | ||
225 | |||
226 | memset(test->buffer, 0, BUFFER_SIZE); | ||
227 | |||
228 | if (write) { | ||
229 | for (i = 0;i < blocks * blksz;i++) | ||
230 | buffer[i] = i; | ||
231 | } | ||
232 | |||
233 | ret = mmc_test_set_blksize(test, blksz); | ||
234 | if (ret) | ||
235 | return ret; | ||
236 | |||
237 | ret = mmc_test_transfer(test, write, buffer, addr, blocks, blksz); | ||
238 | if (ret) | ||
239 | return ret; | ||
240 | |||
241 | if (write) { | ||
242 | ret = mmc_test_set_blksize(test, 512); | ||
243 | if (ret) | ||
244 | return ret; | ||
245 | |||
246 | sectors = (blocks * blksz + 511) / 512; | ||
247 | if ((sectors * 512) == (blocks * blksz)) | ||
248 | sectors++; | ||
249 | |||
250 | if ((sectors * 512) > BUFFER_SIZE) | ||
251 | return -EINVAL; | ||
252 | |||
253 | memset(test->buffer, 0, sectors * 512); | ||
254 | |||
255 | for (i = 0;i < sectors;i++) { | ||
256 | ret = mmc_test_transfer(test, 0, | ||
257 | test->buffer + i * 512, | ||
258 | addr + i * 512, 1, 512); | ||
259 | if (ret) | ||
260 | return ret; | ||
261 | } | ||
262 | |||
263 | for (i = 0;i < blocks * blksz;i++) { | ||
264 | if (test->buffer[i] != (u8)i) | ||
265 | return RESULT_FAIL; | ||
266 | } | ||
267 | |||
268 | for (;i < sectors * 512;i++) { | ||
269 | if (test->buffer[i] != 0xDF) | ||
270 | return RESULT_FAIL; | ||
271 | } | ||
272 | } else { | ||
273 | for (i = 0;i < blocks * blksz;i++) { | ||
274 | if (buffer[i] != (u8)i) | ||
275 | return RESULT_FAIL; | ||
276 | } | ||
277 | } | ||
278 | |||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | static int mmc_test_cleanup_verify(struct mmc_test_card *test) | ||
283 | { | ||
284 | int ret, i; | ||
285 | |||
286 | ret = mmc_test_set_blksize(test, 512); | ||
287 | if (ret) | ||
288 | return ret; | ||
289 | |||
290 | memset(test->buffer, 0, BUFFER_SIZE); | ||
291 | |||
292 | for (i = 0;i < BUFFER_SIZE / 512;i++) { | ||
293 | ret = mmc_test_transfer(test, 1, test->buffer + i * 512, | ||
294 | i * 512, 1, 512); | ||
295 | if (ret) | ||
296 | return ret; | ||
297 | } | ||
298 | |||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | /*******************************************************************/ | ||
303 | /* Tests */ | ||
304 | /*******************************************************************/ | ||
305 | |||
306 | struct mmc_test_case { | ||
307 | const char *name; | ||
308 | |||
309 | int (*prepare)(struct mmc_test_card *); | ||
310 | int (*run)(struct mmc_test_card *); | ||
311 | int (*cleanup)(struct mmc_test_card *); | ||
312 | }; | ||
313 | |||
314 | static int mmc_test_basic_write(struct mmc_test_card *test) | ||
315 | { | ||
316 | int ret; | ||
317 | |||
318 | ret = mmc_test_set_blksize(test, 512); | ||
319 | if (ret) | ||
320 | return ret; | ||
321 | |||
322 | ret = mmc_test_transfer(test, 1, test->buffer, 0, 1, 512); | ||
323 | if (ret) | ||
324 | return ret; | ||
325 | |||
326 | return 0; | ||
327 | } | ||
328 | |||
329 | static int mmc_test_basic_read(struct mmc_test_card *test) | ||
330 | { | ||
331 | int ret; | ||
332 | |||
333 | ret = mmc_test_set_blksize(test, 512); | ||
334 | if (ret) | ||
335 | return ret; | ||
336 | |||
337 | ret = mmc_test_transfer(test, 0, test->buffer, 0, 1, 512); | ||
338 | if (ret) | ||
339 | return ret; | ||
340 | |||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | static int mmc_test_verify_write(struct mmc_test_card *test) | ||
345 | { | ||
346 | int ret; | ||
347 | |||
348 | ret = mmc_test_verified_transfer(test, 1, test->buffer, 0, 1, 512); | ||
349 | if (ret) | ||
350 | return ret; | ||
351 | |||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | static int mmc_test_verify_read(struct mmc_test_card *test) | ||
356 | { | ||
357 | int ret; | ||
358 | |||
359 | ret = mmc_test_verified_transfer(test, 0, test->buffer, 0, 1, 512); | ||
360 | if (ret) | ||
361 | return ret; | ||
362 | |||
363 | return 0; | ||
364 | } | ||
365 | |||
366 | static int mmc_test_multi_write(struct mmc_test_card *test) | ||
367 | { | ||
368 | int ret; | ||
369 | unsigned int size; | ||
370 | |||
371 | if (test->card->host->max_blk_count == 1) | ||
372 | return RESULT_UNSUP_HOST; | ||
373 | |||
374 | size = PAGE_SIZE * 2; | ||
375 | size = min(size, test->card->host->max_req_size); | ||
376 | size = min(size, test->card->host->max_seg_size); | ||
377 | size = min(size, test->card->host->max_blk_count * 512); | ||
378 | |||
379 | if (size < 1024) | ||
380 | return RESULT_UNSUP_HOST; | ||
381 | |||
382 | ret = mmc_test_verified_transfer(test, 1, test->buffer, 0, | ||
383 | size / 512, 512); | ||
384 | if (ret) | ||
385 | return ret; | ||
386 | |||
387 | return 0; | ||
388 | } | ||
389 | |||
390 | static int mmc_test_multi_read(struct mmc_test_card *test) | ||
391 | { | ||
392 | int ret; | ||
393 | unsigned int size; | ||
394 | |||
395 | if (test->card->host->max_blk_count == 1) | ||
396 | return RESULT_UNSUP_HOST; | ||
397 | |||
398 | size = PAGE_SIZE * 2; | ||
399 | size = min(size, test->card->host->max_req_size); | ||
400 | size = min(size, test->card->host->max_seg_size); | ||
401 | size = min(size, test->card->host->max_blk_count * 512); | ||
402 | |||
403 | if (size < 1024) | ||
404 | return RESULT_UNSUP_HOST; | ||
405 | |||
406 | ret = mmc_test_verified_transfer(test, 0, test->buffer, 0, | ||
407 | size / 512, 512); | ||
408 | if (ret) | ||
409 | return ret; | ||
410 | |||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static int mmc_test_pow2_write(struct mmc_test_card *test) | ||
415 | { | ||
416 | int ret, i; | ||
417 | |||
418 | if (!test->card->csd.write_partial) | ||
419 | return RESULT_UNSUP_CARD; | ||
420 | |||
421 | for (i = 1; i < 512;i <<= 1) { | ||
422 | ret = mmc_test_verified_transfer(test, 1, | ||
423 | test->buffer, 0, 1, i); | ||
424 | if (ret) | ||
425 | return ret; | ||
426 | } | ||
427 | |||
428 | return 0; | ||
429 | } | ||
430 | |||
431 | static int mmc_test_pow2_read(struct mmc_test_card *test) | ||
432 | { | ||
433 | int ret, i; | ||
434 | |||
435 | if (!test->card->csd.read_partial) | ||
436 | return RESULT_UNSUP_CARD; | ||
437 | |||
438 | for (i = 1; i < 512;i <<= 1) { | ||
439 | ret = mmc_test_verified_transfer(test, 0, | ||
440 | test->buffer, 0, 1, i); | ||
441 | if (ret) | ||
442 | return ret; | ||
443 | } | ||
444 | |||
445 | return 0; | ||
446 | } | ||
447 | |||
448 | static int mmc_test_weird_write(struct mmc_test_card *test) | ||
449 | { | ||
450 | int ret, i; | ||
451 | |||
452 | if (!test->card->csd.write_partial) | ||
453 | return RESULT_UNSUP_CARD; | ||
454 | |||
455 | for (i = 3; i < 512;i += 7) { | ||
456 | ret = mmc_test_verified_transfer(test, 1, | ||
457 | test->buffer, 0, 1, i); | ||
458 | if (ret) | ||
459 | return ret; | ||
460 | } | ||
461 | |||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | static int mmc_test_weird_read(struct mmc_test_card *test) | ||
466 | { | ||
467 | int ret, i; | ||
468 | |||
469 | if (!test->card->csd.read_partial) | ||
470 | return RESULT_UNSUP_CARD; | ||
471 | |||
472 | for (i = 3; i < 512;i += 7) { | ||
473 | ret = mmc_test_verified_transfer(test, 0, | ||
474 | test->buffer, 0, 1, i); | ||
475 | if (ret) | ||
476 | return ret; | ||
477 | } | ||
478 | |||
479 | return 0; | ||
480 | } | ||
481 | |||
482 | static int mmc_test_align_write(struct mmc_test_card *test) | ||
483 | { | ||
484 | int ret, i; | ||
485 | |||
486 | for (i = 1;i < 4;i++) { | ||
487 | ret = mmc_test_verified_transfer(test, 1, test->buffer + i, | ||
488 | 0, 1, 512); | ||
489 | if (ret) | ||
490 | return ret; | ||
491 | } | ||
492 | |||
493 | return 0; | ||
494 | } | ||
495 | |||
496 | static int mmc_test_align_read(struct mmc_test_card *test) | ||
497 | { | ||
498 | int ret, i; | ||
499 | |||
500 | for (i = 1;i < 4;i++) { | ||
501 | ret = mmc_test_verified_transfer(test, 0, test->buffer + i, | ||
502 | 0, 1, 512); | ||
503 | if (ret) | ||
504 | return ret; | ||
505 | } | ||
506 | |||
507 | return 0; | ||
508 | } | ||
509 | |||
510 | static int mmc_test_align_multi_write(struct mmc_test_card *test) | ||
511 | { | ||
512 | int ret, i; | ||
513 | unsigned int size; | ||
514 | |||
515 | if (test->card->host->max_blk_count == 1) | ||
516 | return RESULT_UNSUP_HOST; | ||
517 | |||
518 | size = PAGE_SIZE * 2; | ||
519 | size = min(size, test->card->host->max_req_size); | ||
520 | size = min(size, test->card->host->max_seg_size); | ||
521 | size = min(size, test->card->host->max_blk_count * 512); | ||
522 | |||
523 | if (size < 1024) | ||
524 | return RESULT_UNSUP_HOST; | ||
525 | |||
526 | for (i = 1;i < 4;i++) { | ||
527 | ret = mmc_test_verified_transfer(test, 1, test->buffer + i, | ||
528 | 0, size / 512, 512); | ||
529 | if (ret) | ||
530 | return ret; | ||
531 | } | ||
532 | |||
533 | return 0; | ||
534 | } | ||
535 | |||
536 | static int mmc_test_align_multi_read(struct mmc_test_card *test) | ||
537 | { | ||
538 | int ret, i; | ||
539 | unsigned int size; | ||
540 | |||
541 | if (test->card->host->max_blk_count == 1) | ||
542 | return RESULT_UNSUP_HOST; | ||
543 | |||
544 | size = PAGE_SIZE * 2; | ||
545 | size = min(size, test->card->host->max_req_size); | ||
546 | size = min(size, test->card->host->max_seg_size); | ||
547 | size = min(size, test->card->host->max_blk_count * 512); | ||
548 | |||
549 | if (size < 1024) | ||
550 | return RESULT_UNSUP_HOST; | ||
551 | |||
552 | for (i = 1;i < 4;i++) { | ||
553 | ret = mmc_test_verified_transfer(test, 0, test->buffer + i, | ||
554 | 0, size / 512, 512); | ||
555 | if (ret) | ||
556 | return ret; | ||
557 | } | ||
558 | |||
559 | return 0; | ||
560 | } | ||
561 | |||
562 | static int mmc_test_xfersize_write(struct mmc_test_card *test) | ||
563 | { | ||
564 | int ret; | ||
565 | |||
566 | ret = mmc_test_set_blksize(test, 512); | ||
567 | if (ret) | ||
568 | return ret; | ||
569 | |||
570 | ret = __mmc_test_transfer(test, 1, 1, test->buffer, 0, 1, 512); | ||
571 | if (ret) | ||
572 | return ret; | ||
573 | |||
574 | return 0; | ||
575 | } | ||
576 | |||
577 | static int mmc_test_xfersize_read(struct mmc_test_card *test) | ||
578 | { | ||
579 | int ret; | ||
580 | |||
581 | ret = mmc_test_set_blksize(test, 512); | ||
582 | if (ret) | ||
583 | return ret; | ||
584 | |||
585 | ret = __mmc_test_transfer(test, 0, 1, test->buffer, 0, 1, 512); | ||
586 | if (ret) | ||
587 | return ret; | ||
588 | |||
589 | return 0; | ||
590 | } | ||
591 | |||
592 | static int mmc_test_multi_xfersize_write(struct mmc_test_card *test) | ||
593 | { | ||
594 | int ret; | ||
595 | |||
596 | if (test->card->host->max_blk_count == 1) | ||
597 | return RESULT_UNSUP_HOST; | ||
598 | |||
599 | ret = mmc_test_set_blksize(test, 512); | ||
600 | if (ret) | ||
601 | return ret; | ||
602 | |||
603 | ret = __mmc_test_transfer(test, 1, 1, test->buffer, 0, 2, 512); | ||
604 | if (ret) | ||
605 | return ret; | ||
606 | |||
607 | return 0; | ||
608 | } | ||
609 | |||
610 | static int mmc_test_multi_xfersize_read(struct mmc_test_card *test) | ||
611 | { | ||
612 | int ret; | ||
613 | |||
614 | if (test->card->host->max_blk_count == 1) | ||
615 | return RESULT_UNSUP_HOST; | ||
616 | |||
617 | ret = mmc_test_set_blksize(test, 512); | ||
618 | if (ret) | ||
619 | return ret; | ||
620 | |||
621 | ret = __mmc_test_transfer(test, 0, 1, test->buffer, 0, 2, 512); | ||
622 | if (ret) | ||
623 | return ret; | ||
624 | |||
625 | return 0; | ||
626 | } | ||
627 | |||
628 | static const struct mmc_test_case mmc_test_cases[] = { | ||
629 | { | ||
630 | .name = "Basic write (no data verification)", | ||
631 | .run = mmc_test_basic_write, | ||
632 | }, | ||
633 | |||
634 | { | ||
635 | .name = "Basic read (no data verification)", | ||
636 | .run = mmc_test_basic_read, | ||
637 | }, | ||
638 | |||
639 | { | ||
640 | .name = "Basic write (with data verification)", | ||
641 | .prepare = mmc_test_prepare_verify_write, | ||
642 | .run = mmc_test_verify_write, | ||
643 | .cleanup = mmc_test_cleanup_verify, | ||
644 | }, | ||
645 | |||
646 | { | ||
647 | .name = "Basic read (with data verification)", | ||
648 | .prepare = mmc_test_prepare_verify_read, | ||
649 | .run = mmc_test_verify_read, | ||
650 | .cleanup = mmc_test_cleanup_verify, | ||
651 | }, | ||
652 | |||
653 | { | ||
654 | .name = "Multi-block write", | ||
655 | .prepare = mmc_test_prepare_verify_write, | ||
656 | .run = mmc_test_multi_write, | ||
657 | .cleanup = mmc_test_cleanup_verify, | ||
658 | }, | ||
659 | |||
660 | { | ||
661 | .name = "Multi-block read", | ||
662 | .prepare = mmc_test_prepare_verify_read, | ||
663 | .run = mmc_test_multi_read, | ||
664 | .cleanup = mmc_test_cleanup_verify, | ||
665 | }, | ||
666 | |||
667 | { | ||
668 | .name = "Power of two block writes", | ||
669 | .prepare = mmc_test_prepare_verify_write, | ||
670 | .run = mmc_test_pow2_write, | ||
671 | .cleanup = mmc_test_cleanup_verify, | ||
672 | }, | ||
673 | |||
674 | { | ||
675 | .name = "Power of two block reads", | ||
676 | .prepare = mmc_test_prepare_verify_read, | ||
677 | .run = mmc_test_pow2_read, | ||
678 | .cleanup = mmc_test_cleanup_verify, | ||
679 | }, | ||
680 | |||
681 | { | ||
682 | .name = "Weird sized block writes", | ||
683 | .prepare = mmc_test_prepare_verify_write, | ||
684 | .run = mmc_test_weird_write, | ||
685 | .cleanup = mmc_test_cleanup_verify, | ||
686 | }, | ||
687 | |||
688 | { | ||
689 | .name = "Weird sized block reads", | ||
690 | .prepare = mmc_test_prepare_verify_read, | ||
691 | .run = mmc_test_weird_read, | ||
692 | .cleanup = mmc_test_cleanup_verify, | ||
693 | }, | ||
694 | |||
695 | { | ||
696 | .name = "Badly aligned write", | ||
697 | .prepare = mmc_test_prepare_verify_write, | ||
698 | .run = mmc_test_align_write, | ||
699 | .cleanup = mmc_test_cleanup_verify, | ||
700 | }, | ||
701 | |||
702 | { | ||
703 | .name = "Badly aligned read", | ||
704 | .prepare = mmc_test_prepare_verify_read, | ||
705 | .run = mmc_test_align_read, | ||
706 | .cleanup = mmc_test_cleanup_verify, | ||
707 | }, | ||
708 | |||
709 | { | ||
710 | .name = "Badly aligned multi-block write", | ||
711 | .prepare = mmc_test_prepare_verify_write, | ||
712 | .run = mmc_test_align_multi_write, | ||
713 | .cleanup = mmc_test_cleanup_verify, | ||
714 | }, | ||
715 | |||
716 | { | ||
717 | .name = "Badly aligned multi-block read", | ||
718 | .prepare = mmc_test_prepare_verify_read, | ||
719 | .run = mmc_test_align_multi_read, | ||
720 | .cleanup = mmc_test_cleanup_verify, | ||
721 | }, | ||
722 | |||
723 | { | ||
724 | .name = "Correct xfer_size at write (start failure)", | ||
725 | .run = mmc_test_xfersize_write, | ||
726 | }, | ||
727 | |||
728 | { | ||
729 | .name = "Correct xfer_size at read (start failure)", | ||
730 | .run = mmc_test_xfersize_read, | ||
731 | }, | ||
732 | |||
733 | { | ||
734 | .name = "Correct xfer_size at write (midway failure)", | ||
735 | .run = mmc_test_multi_xfersize_write, | ||
736 | }, | ||
737 | |||
738 | { | ||
739 | .name = "Correct xfer_size at read (midway failure)", | ||
740 | .run = mmc_test_multi_xfersize_read, | ||
741 | }, | ||
742 | }; | ||
743 | |||
744 | static struct mutex mmc_test_lock; | ||
745 | |||
746 | static void mmc_test_run(struct mmc_test_card *test) | ||
747 | { | ||
748 | int i, ret; | ||
749 | |||
750 | printk(KERN_INFO "%s: Starting tests of card %s...\n", | ||
751 | mmc_hostname(test->card->host), mmc_card_id(test->card)); | ||
752 | |||
753 | mmc_claim_host(test->card->host); | ||
754 | |||
755 | for (i = 0;i < ARRAY_SIZE(mmc_test_cases);i++) { | ||
756 | printk(KERN_INFO "%s: Test case %d. %s...\n", | ||
757 | mmc_hostname(test->card->host), i + 1, | ||
758 | mmc_test_cases[i].name); | ||
759 | |||
760 | if (mmc_test_cases[i].prepare) { | ||
761 | ret = mmc_test_cases[i].prepare(test); | ||
762 | if (ret) { | ||
763 | printk(KERN_INFO "%s: Result: Prepare " | ||
764 | "stage failed! (%d)\n", | ||
765 | mmc_hostname(test->card->host), | ||
766 | ret); | ||
767 | continue; | ||
768 | } | ||
769 | } | ||
770 | |||
771 | ret = mmc_test_cases[i].run(test); | ||
772 | switch (ret) { | ||
773 | case RESULT_OK: | ||
774 | printk(KERN_INFO "%s: Result: OK\n", | ||
775 | mmc_hostname(test->card->host)); | ||
776 | break; | ||
777 | case RESULT_FAIL: | ||
778 | printk(KERN_INFO "%s: Result: FAILED\n", | ||
779 | mmc_hostname(test->card->host)); | ||
780 | break; | ||
781 | case RESULT_UNSUP_HOST: | ||
782 | printk(KERN_INFO "%s: Result: UNSUPPORTED " | ||
783 | "(by host)\n", | ||
784 | mmc_hostname(test->card->host)); | ||
785 | break; | ||
786 | case RESULT_UNSUP_CARD: | ||
787 | printk(KERN_INFO "%s: Result: UNSUPPORTED " | ||
788 | "(by card)\n", | ||
789 | mmc_hostname(test->card->host)); | ||
790 | break; | ||
791 | default: | ||
792 | printk(KERN_INFO "%s: Result: ERROR (%d)\n", | ||
793 | mmc_hostname(test->card->host), ret); | ||
794 | } | ||
795 | |||
796 | if (mmc_test_cases[i].cleanup) { | ||
797 | ret = mmc_test_cases[i].cleanup(test); | ||
798 | if (ret) { | ||
799 | printk(KERN_INFO "%s: Warning: Cleanup " | ||
800 | "stage failed! (%d)\n", | ||
801 | mmc_hostname(test->card->host), | ||
802 | ret); | ||
803 | } | ||
804 | } | ||
805 | } | ||
806 | |||
807 | mmc_release_host(test->card->host); | ||
808 | |||
809 | printk(KERN_INFO "%s: Tests completed.\n", | ||
810 | mmc_hostname(test->card->host)); | ||
811 | } | ||
812 | |||
813 | static ssize_t mmc_test_show(struct device *dev, | ||
814 | struct device_attribute *attr, char *buf) | ||
815 | { | ||
816 | mutex_lock(&mmc_test_lock); | ||
817 | mutex_unlock(&mmc_test_lock); | ||
818 | |||
819 | return 0; | ||
820 | } | ||
821 | |||
822 | static ssize_t mmc_test_store(struct device *dev, | ||
823 | struct device_attribute *attr, const char *buf, size_t count) | ||
824 | { | ||
825 | struct mmc_card *card; | ||
826 | struct mmc_test_card *test; | ||
827 | |||
828 | card = container_of(dev, struct mmc_card, dev); | ||
829 | |||
830 | test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL); | ||
831 | if (!test) | ||
832 | return -ENOMEM; | ||
833 | |||
834 | test->card = card; | ||
835 | |||
836 | test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL); | ||
837 | if (test->buffer) { | ||
838 | mutex_lock(&mmc_test_lock); | ||
839 | mmc_test_run(test); | ||
840 | mutex_unlock(&mmc_test_lock); | ||
841 | } | ||
842 | |||
843 | kfree(test->buffer); | ||
844 | kfree(test); | ||
845 | |||
846 | return count; | ||
847 | } | ||
848 | |||
849 | static DEVICE_ATTR(test, S_IWUSR | S_IRUGO, mmc_test_show, mmc_test_store); | ||
850 | |||
851 | static int mmc_test_probe(struct mmc_card *card) | ||
852 | { | ||
853 | int ret; | ||
854 | |||
855 | mutex_init(&mmc_test_lock); | ||
856 | |||
857 | ret = device_create_file(&card->dev, &dev_attr_test); | ||
858 | if (ret) | ||
859 | return ret; | ||
860 | |||
861 | return 0; | ||
862 | } | ||
863 | |||
864 | static void mmc_test_remove(struct mmc_card *card) | ||
865 | { | ||
866 | device_remove_file(&card->dev, &dev_attr_test); | ||
867 | } | ||
868 | |||
869 | static struct mmc_driver mmc_driver = { | ||
870 | .drv = { | ||
871 | .name = "mmc_test", | ||
872 | }, | ||
873 | .probe = mmc_test_probe, | ||
874 | .remove = mmc_test_remove, | ||
875 | }; | ||
876 | |||
877 | static int __init mmc_test_init(void) | ||
878 | { | ||
879 | return mmc_register_driver(&mmc_driver); | ||
880 | } | ||
881 | |||
882 | static void __exit mmc_test_exit(void) | ||
883 | { | ||
884 | mmc_unregister_driver(&mmc_driver); | ||
885 | } | ||
886 | |||
887 | module_init(mmc_test_init); | ||
888 | module_exit(mmc_test_exit); | ||
889 | |||
890 | MODULE_LICENSE("GPL"); | ||
891 | MODULE_DESCRIPTION("Multimedia Card (MMC) host test driver"); | ||
892 | MODULE_AUTHOR("Pierre Ossman"); | ||
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index a28fc2f68ce2..8979ad330a4d 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -663,9 +663,12 @@ static void at91_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
663 | gpio_set_value(host->board->vcc_pin, 0); | 663 | gpio_set_value(host->board->vcc_pin, 0); |
664 | break; | 664 | break; |
665 | case MMC_POWER_UP: | 665 | case MMC_POWER_UP: |
666 | case MMC_POWER_ON: | ||
667 | gpio_set_value(host->board->vcc_pin, 1); | 666 | gpio_set_value(host->board->vcc_pin, 1); |
668 | break; | 667 | break; |
668 | case MMC_POWER_ON: | ||
669 | break; | ||
670 | default: | ||
671 | WARN_ON(1); | ||
669 | } | 672 | } |
670 | } | 673 | } |
671 | } | 674 | } |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 14759e9f42ad..549517c35675 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -1003,7 +1003,7 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data) | |||
1003 | 1003 | ||
1004 | static int mmc_omap_get_dma_channel(struct mmc_omap_host *host, struct mmc_data *data) | 1004 | static int mmc_omap_get_dma_channel(struct mmc_omap_host *host, struct mmc_data *data) |
1005 | { | 1005 | { |
1006 | const char *dev_name; | 1006 | const char *dma_dev_name; |
1007 | int sync_dev, dma_ch, is_read, r; | 1007 | int sync_dev, dma_ch, is_read, r; |
1008 | 1008 | ||
1009 | is_read = !(data->flags & MMC_DATA_WRITE); | 1009 | is_read = !(data->flags & MMC_DATA_WRITE); |
@@ -1018,21 +1018,21 @@ static int mmc_omap_get_dma_channel(struct mmc_omap_host *host, struct mmc_data | |||
1018 | if (is_read) { | 1018 | if (is_read) { |
1019 | if (host->id == 1) { | 1019 | if (host->id == 1) { |
1020 | sync_dev = OMAP_DMA_MMC_RX; | 1020 | sync_dev = OMAP_DMA_MMC_RX; |
1021 | dev_name = "MMC1 read"; | 1021 | dma_dev_name = "MMC1 read"; |
1022 | } else { | 1022 | } else { |
1023 | sync_dev = OMAP_DMA_MMC2_RX; | 1023 | sync_dev = OMAP_DMA_MMC2_RX; |
1024 | dev_name = "MMC2 read"; | 1024 | dma_dev_name = "MMC2 read"; |
1025 | } | 1025 | } |
1026 | } else { | 1026 | } else { |
1027 | if (host->id == 1) { | 1027 | if (host->id == 1) { |
1028 | sync_dev = OMAP_DMA_MMC_TX; | 1028 | sync_dev = OMAP_DMA_MMC_TX; |
1029 | dev_name = "MMC1 write"; | 1029 | dma_dev_name = "MMC1 write"; |
1030 | } else { | 1030 | } else { |
1031 | sync_dev = OMAP_DMA_MMC2_TX; | 1031 | sync_dev = OMAP_DMA_MMC2_TX; |
1032 | dev_name = "MMC2 write"; | 1032 | dma_dev_name = "MMC2 write"; |
1033 | } | 1033 | } |
1034 | } | 1034 | } |
1035 | r = omap_request_dma(sync_dev, dev_name, mmc_omap_dma_cb, | 1035 | r = omap_request_dma(sync_dev, dma_dev_name, mmc_omap_dma_cb, |
1036 | host, &dma_ch); | 1036 | host, &dma_ch); |
1037 | if (r != 0) { | 1037 | if (r != 0) { |
1038 | dev_dbg(mmc_dev(host->mmc), "omap_request_dma() failed with %d\n", r); | 1038 | dev_dbg(mmc_dev(host->mmc), "omap_request_dma() failed with %d\n", r); |
diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 2797da7eeee6..da292e647eb1 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c | |||
@@ -1162,6 +1162,7 @@ struct net_device * __init i82596_probe(int unit) | |||
1162 | memcpy(eth_addr, (void *) 0xfffc1f2c, 6); /* YUCK! Get addr from NOVRAM */ | 1162 | memcpy(eth_addr, (void *) 0xfffc1f2c, 6); /* YUCK! Get addr from NOVRAM */ |
1163 | dev->base_addr = MVME_I596_BASE; | 1163 | dev->base_addr = MVME_I596_BASE; |
1164 | dev->irq = (unsigned) MVME16x_IRQ_I596; | 1164 | dev->irq = (unsigned) MVME16x_IRQ_I596; |
1165 | goto found; | ||
1165 | } | 1166 | } |
1166 | #endif | 1167 | #endif |
1167 | #ifdef ENABLE_BVME6000_NET | 1168 | #ifdef ENABLE_BVME6000_NET |
@@ -1176,6 +1177,7 @@ struct net_device * __init i82596_probe(int unit) | |||
1176 | rtc[3] = msr; | 1177 | rtc[3] = msr; |
1177 | dev->base_addr = BVME_I596_BASE; | 1178 | dev->base_addr = BVME_I596_BASE; |
1178 | dev->irq = (unsigned) BVME_IRQ_I596; | 1179 | dev->irq = (unsigned) BVME_IRQ_I596; |
1180 | goto found; | ||
1179 | } | 1181 | } |
1180 | #endif | 1182 | #endif |
1181 | #ifdef ENABLE_APRICOT | 1183 | #ifdef ENABLE_APRICOT |
@@ -1212,8 +1214,13 @@ struct net_device * __init i82596_probe(int unit) | |||
1212 | } | 1214 | } |
1213 | 1215 | ||
1214 | dev->irq = 10; | 1216 | dev->irq = 10; |
1217 | goto found; | ||
1215 | } | 1218 | } |
1216 | #endif | 1219 | #endif |
1220 | err = -ENODEV; | ||
1221 | goto out; | ||
1222 | |||
1223 | found: | ||
1217 | dev->mem_start = (int)__get_free_pages(GFP_ATOMIC, 0); | 1224 | dev->mem_start = (int)__get_free_pages(GFP_ATOMIC, 0); |
1218 | if (!dev->mem_start) { | 1225 | if (!dev->mem_start) { |
1219 | err = -ENOMEM; | 1226 | err = -ENOMEM; |
diff --git a/drivers/net/apne.c b/drivers/net/apne.c index 47a8275d3962..867f6fff543c 100644 --- a/drivers/net/apne.c +++ b/drivers/net/apne.c | |||
@@ -127,6 +127,9 @@ struct net_device * __init apne_probe(int unit) | |||
127 | #endif | 127 | #endif |
128 | int err; | 128 | int err; |
129 | 129 | ||
130 | if (!MACH_IS_AMIGA) | ||
131 | return ERR_PTR(-ENODEV); | ||
132 | |||
130 | if (apne_owned) | 133 | if (apne_owned) |
131 | return ERR_PTR(-ENODEV); | 134 | return ERR_PTR(-ENODEV); |
132 | 135 | ||
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c index 2a66e5b7cebc..4ce8afd481c3 100644 --- a/drivers/net/mac89x0.c +++ b/drivers/net/mac89x0.c | |||
@@ -183,6 +183,9 @@ struct net_device * __init mac89x0_probe(int unit) | |||
183 | int err = -ENODEV; | 183 | int err = -ENODEV; |
184 | DECLARE_MAC_BUF(mac); | 184 | DECLARE_MAC_BUF(mac); |
185 | 185 | ||
186 | if (!MACH_IS_MAC) | ||
187 | return ERR_PTR(-ENODEV); | ||
188 | |||
186 | dev = alloc_etherdev(sizeof(struct net_local)); | 189 | dev = alloc_etherdev(sizeof(struct net_local)); |
187 | if (!dev) | 190 | if (!dev) |
188 | return ERR_PTR(-ENOMEM); | 191 | return ERR_PTR(-ENOMEM); |
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c index 18770527df99..51ad3765e075 100644 --- a/drivers/net/macmace.c +++ b/drivers/net/macmace.c | |||
@@ -781,6 +781,9 @@ static int __init mac_mace_init_module(void) | |||
781 | { | 781 | { |
782 | int err; | 782 | int err; |
783 | 783 | ||
784 | if (!MACH_IS_MAC) | ||
785 | return -ENODEV; | ||
786 | |||
784 | if ((err = platform_driver_register(&mac_mace_driver))) { | 787 | if ((err = platform_driver_register(&mac_mace_driver))) { |
785 | printk(KERN_ERR "Driver registration failed\n"); | 788 | printk(KERN_ERR "Driver registration failed\n"); |
786 | return err; | 789 | return err; |
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index f8d46134daca..359452a06c67 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
@@ -250,6 +250,9 @@ struct net_device * __init sun3lance_probe(int unit) | |||
250 | static int found; | 250 | static int found; |
251 | int err = -ENODEV; | 251 | int err = -ENODEV; |
252 | 252 | ||
253 | if (!MACH_IS_SUN3 && !MACH_IS_SUN3X) | ||
254 | return ERR_PTR(-ENODEV); | ||
255 | |||
253 | /* check that this machine has an onboard lance */ | 256 | /* check that this machine has an onboard lance */ |
254 | switch(idprom->id_machtype) { | 257 | switch(idprom->id_machtype) { |
255 | case SM_SUN3|SM_3_50: | 258 | case SM_SUN3|SM_3_50: |
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c index 0ec7936cbe21..c66b9c324f54 100644 --- a/drivers/net/usb/cdc_subset.c +++ b/drivers/net/usb/cdc_subset.c | |||
@@ -218,7 +218,7 @@ static const struct driver_info blob_info = { | |||
218 | /*-------------------------------------------------------------------------*/ | 218 | /*-------------------------------------------------------------------------*/ |
219 | 219 | ||
220 | #ifndef HAVE_HARDWARE | 220 | #ifndef HAVE_HARDWARE |
221 | #error You need to configure some hardware for this driver | 221 | #warning You need to configure some hardware for this driver |
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | /* | 224 | /* |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index ef2da4023d68..438e63ecccf1 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/string.h> | 47 | #include <linux/string.h> |
48 | #include <linux/ctype.h> | 48 | #include <linux/ctype.h> |
49 | #include <linux/timer.h> | 49 | #include <linux/timer.h> |
50 | #include <asm/byteorder.h> | ||
50 | #include <asm/io.h> | 51 | #include <asm/io.h> |
51 | #include <asm/system.h> | 52 | #include <asm/system.h> |
52 | #include <asm/uaccess.h> | 53 | #include <asm/uaccess.h> |
@@ -60,7 +61,6 @@ | |||
60 | #include <linux/delay.h> | 61 | #include <linux/delay.h> |
61 | #include <linux/wireless.h> | 62 | #include <linux/wireless.h> |
62 | #include <net/iw_handler.h> | 63 | #include <net/iw_handler.h> |
63 | #include <linux/byteorder/generic.h> | ||
64 | #include <linux/crc32.h> | 64 | #include <linux/crc32.h> |
65 | #include <linux/proc_fs.h> | 65 | #include <linux/proc_fs.h> |
66 | #include <linux/device.h> | 66 | #include <linux/device.h> |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 9bd7c4a31253..23ffb7c0caf2 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -65,6 +65,9 @@ struct property *of_find_property(const struct device_node *np, | |||
65 | { | 65 | { |
66 | struct property *pp; | 66 | struct property *pp; |
67 | 67 | ||
68 | if (!np) | ||
69 | return NULL; | ||
70 | |||
68 | read_lock(&devtree_lock); | 71 | read_lock(&devtree_lock); |
69 | for (pp = np->properties; pp != 0; pp = pp->next) { | 72 | for (pp = np->properties; pp != 0; pp = pp->next) { |
70 | if (of_prop_cmp(pp->name, name) == 0) { | 73 | if (of_prop_cmp(pp->name, name) == 0) { |
diff --git a/drivers/parisc/asp.c b/drivers/parisc/asp.c index 558420bc9f88..821369135369 100644 --- a/drivers/parisc/asp.c +++ b/drivers/parisc/asp.c | |||
@@ -88,7 +88,7 @@ asp_init_chip(struct parisc_device *dev) | |||
88 | ret = -EBUSY; | 88 | ret = -EBUSY; |
89 | dev->irq = gsc_claim_irq(&gsc_irq, ASP_GSC_IRQ); | 89 | dev->irq = gsc_claim_irq(&gsc_irq, ASP_GSC_IRQ); |
90 | if (dev->irq < 0) { | 90 | if (dev->irq < 0) { |
91 | printk(KERN_ERR "%s(): cannot get GSC irq\n", __FUNCTION__); | 91 | printk(KERN_ERR "%s(): cannot get GSC irq\n", __func__); |
92 | goto out; | 92 | goto out; |
93 | } | 93 | } |
94 | 94 | ||
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index 07d2a8d4498f..b30e38f3a50d 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c | |||
@@ -359,7 +359,7 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size) | |||
359 | BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE); | 359 | BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE); |
360 | 360 | ||
361 | DBG_RES("%s() size: %d pages_needed %d\n", | 361 | DBG_RES("%s() size: %d pages_needed %d\n", |
362 | __FUNCTION__, size, pages_needed); | 362 | __func__, size, pages_needed); |
363 | 363 | ||
364 | /* | 364 | /* |
365 | ** "seek and ye shall find"...praying never hurts either... | 365 | ** "seek and ye shall find"...praying never hurts either... |
@@ -395,16 +395,16 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size) | |||
395 | #endif | 395 | #endif |
396 | } else { | 396 | } else { |
397 | panic("%s: %s() Too many pages to map. pages_needed: %u\n", | 397 | panic("%s: %s() Too many pages to map. pages_needed: %u\n", |
398 | __FILE__, __FUNCTION__, pages_needed); | 398 | __FILE__, __func__, pages_needed); |
399 | } | 399 | } |
400 | 400 | ||
401 | panic("%s: %s() I/O MMU is out of mapping resources.\n", __FILE__, | 401 | panic("%s: %s() I/O MMU is out of mapping resources.\n", __FILE__, |
402 | __FUNCTION__); | 402 | __func__); |
403 | 403 | ||
404 | resource_found: | 404 | resource_found: |
405 | 405 | ||
406 | DBG_RES("%s() res_idx %d res_hint: %d\n", | 406 | DBG_RES("%s() res_idx %d res_hint: %d\n", |
407 | __FUNCTION__, res_idx, ioc->res_hint); | 407 | __func__, res_idx, ioc->res_hint); |
408 | 408 | ||
409 | #ifdef CCIO_SEARCH_TIME | 409 | #ifdef CCIO_SEARCH_TIME |
410 | { | 410 | { |
@@ -450,7 +450,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped) | |||
450 | BUG_ON(pages_mapped > BITS_PER_LONG); | 450 | BUG_ON(pages_mapped > BITS_PER_LONG); |
451 | 451 | ||
452 | DBG_RES("%s(): res_idx: %d pages_mapped %d\n", | 452 | DBG_RES("%s(): res_idx: %d pages_mapped %d\n", |
453 | __FUNCTION__, res_idx, pages_mapped); | 453 | __func__, res_idx, pages_mapped); |
454 | 454 | ||
455 | #ifdef CCIO_MAP_STATS | 455 | #ifdef CCIO_MAP_STATS |
456 | ioc->used_pages -= pages_mapped; | 456 | ioc->used_pages -= pages_mapped; |
@@ -474,7 +474,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped) | |||
474 | #endif | 474 | #endif |
475 | } else { | 475 | } else { |
476 | panic("%s:%s() Too many pages to unmap.\n", __FILE__, | 476 | panic("%s:%s() Too many pages to unmap.\n", __FILE__, |
477 | __FUNCTION__); | 477 | __func__); |
478 | } | 478 | } |
479 | } | 479 | } |
480 | 480 | ||
@@ -775,7 +775,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size, | |||
775 | pdir_start = &(ioc->pdir_base[idx]); | 775 | pdir_start = &(ioc->pdir_base[idx]); |
776 | 776 | ||
777 | DBG_RUN("%s() 0x%p -> 0x%lx size: %0x%x\n", | 777 | DBG_RUN("%s() 0x%p -> 0x%lx size: %0x%x\n", |
778 | __FUNCTION__, addr, (long)iovp | offset, size); | 778 | __func__, addr, (long)iovp | offset, size); |
779 | 779 | ||
780 | /* If not cacheline aligned, force SAFE_DMA on the whole mess */ | 780 | /* If not cacheline aligned, force SAFE_DMA on the whole mess */ |
781 | if((size % L1_CACHE_BYTES) || ((unsigned long)addr % L1_CACHE_BYTES)) | 781 | if((size % L1_CACHE_BYTES) || ((unsigned long)addr % L1_CACHE_BYTES)) |
@@ -820,7 +820,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size, | |||
820 | ioc = GET_IOC(dev); | 820 | ioc = GET_IOC(dev); |
821 | 821 | ||
822 | DBG_RUN("%s() iovp 0x%lx/%x\n", | 822 | DBG_RUN("%s() iovp 0x%lx/%x\n", |
823 | __FUNCTION__, (long)iova, size); | 823 | __func__, (long)iova, size); |
824 | 824 | ||
825 | iova ^= offset; /* clear offset bits */ | 825 | iova ^= offset; /* clear offset bits */ |
826 | size += offset; | 826 | size += offset; |
@@ -922,7 +922,7 @@ ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
922 | BUG_ON(!dev); | 922 | BUG_ON(!dev); |
923 | ioc = GET_IOC(dev); | 923 | ioc = GET_IOC(dev); |
924 | 924 | ||
925 | DBG_RUN_SG("%s() START %d entries\n", __FUNCTION__, nents); | 925 | DBG_RUN_SG("%s() START %d entries\n", __func__, nents); |
926 | 926 | ||
927 | /* Fast path single entry scatterlists. */ | 927 | /* Fast path single entry scatterlists. */ |
928 | if (nents == 1) { | 928 | if (nents == 1) { |
@@ -966,7 +966,7 @@ ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
966 | 966 | ||
967 | BUG_ON(coalesced != filled); | 967 | BUG_ON(coalesced != filled); |
968 | 968 | ||
969 | DBG_RUN_SG("%s() DONE %d mappings\n", __FUNCTION__, filled); | 969 | DBG_RUN_SG("%s() DONE %d mappings\n", __func__, filled); |
970 | 970 | ||
971 | for (i = 0; i < filled; i++) | 971 | for (i = 0; i < filled; i++) |
972 | current_len += sg_dma_len(sglist + i); | 972 | current_len += sg_dma_len(sglist + i); |
@@ -995,7 +995,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
995 | ioc = GET_IOC(dev); | 995 | ioc = GET_IOC(dev); |
996 | 996 | ||
997 | DBG_RUN_SG("%s() START %d entries, %08lx,%x\n", | 997 | DBG_RUN_SG("%s() START %d entries, %08lx,%x\n", |
998 | __FUNCTION__, nents, sg_virt_addr(sglist), sglist->length); | 998 | __func__, nents, sg_virt_addr(sglist), sglist->length); |
999 | 999 | ||
1000 | #ifdef CCIO_MAP_STATS | 1000 | #ifdef CCIO_MAP_STATS |
1001 | ioc->usg_calls++; | 1001 | ioc->usg_calls++; |
@@ -1011,7 +1011,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
1011 | ++sglist; | 1011 | ++sglist; |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | DBG_RUN_SG("%s() DONE (nents %d)\n", __FUNCTION__, nents); | 1014 | DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | static struct hppa_dma_ops ccio_ops = { | 1017 | static struct hppa_dma_ops ccio_ops = { |
@@ -1225,7 +1225,7 @@ static int | |||
1225 | ccio_get_iotlb_size(struct parisc_device *dev) | 1225 | ccio_get_iotlb_size(struct parisc_device *dev) |
1226 | { | 1226 | { |
1227 | if (dev->spa_shift == 0) { | 1227 | if (dev->spa_shift == 0) { |
1228 | panic("%s() : Can't determine I/O TLB size.\n", __FUNCTION__); | 1228 | panic("%s() : Can't determine I/O TLB size.\n", __func__); |
1229 | } | 1229 | } |
1230 | return (1 << dev->spa_shift); | 1230 | return (1 << dev->spa_shift); |
1231 | } | 1231 | } |
@@ -1315,7 +1315,7 @@ ccio_ioc_init(struct ioc *ioc) | |||
1315 | BUG_ON((1 << get_order(ioc->pdir_size)) != (ioc->pdir_size >> PAGE_SHIFT)); | 1315 | BUG_ON((1 << get_order(ioc->pdir_size)) != (ioc->pdir_size >> PAGE_SHIFT)); |
1316 | 1316 | ||
1317 | DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n", | 1317 | DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n", |
1318 | __FUNCTION__, ioc->ioc_regs, | 1318 | __func__, ioc->ioc_regs, |
1319 | (unsigned long) num_physpages >> (20 - PAGE_SHIFT), | 1319 | (unsigned long) num_physpages >> (20 - PAGE_SHIFT), |
1320 | iova_space_size>>20, | 1320 | iova_space_size>>20, |
1321 | iov_order + PAGE_SHIFT); | 1321 | iov_order + PAGE_SHIFT); |
@@ -1323,7 +1323,7 @@ ccio_ioc_init(struct ioc *ioc) | |||
1323 | ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL, | 1323 | ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL, |
1324 | get_order(ioc->pdir_size)); | 1324 | get_order(ioc->pdir_size)); |
1325 | if(NULL == ioc->pdir_base) { | 1325 | if(NULL == ioc->pdir_base) { |
1326 | panic("%s() could not allocate I/O Page Table\n", __FUNCTION__); | 1326 | panic("%s() could not allocate I/O Page Table\n", __func__); |
1327 | } | 1327 | } |
1328 | memset(ioc->pdir_base, 0, ioc->pdir_size); | 1328 | memset(ioc->pdir_base, 0, ioc->pdir_size); |
1329 | 1329 | ||
@@ -1332,12 +1332,12 @@ ccio_ioc_init(struct ioc *ioc) | |||
1332 | 1332 | ||
1333 | /* resource map size dictated by pdir_size */ | 1333 | /* resource map size dictated by pdir_size */ |
1334 | ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3; | 1334 | ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3; |
1335 | DBG_INIT("%s() res_size 0x%x\n", __FUNCTION__, ioc->res_size); | 1335 | DBG_INIT("%s() res_size 0x%x\n", __func__, ioc->res_size); |
1336 | 1336 | ||
1337 | ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL, | 1337 | ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL, |
1338 | get_order(ioc->res_size)); | 1338 | get_order(ioc->res_size)); |
1339 | if(NULL == ioc->res_map) { | 1339 | if(NULL == ioc->res_map) { |
1340 | panic("%s() could not allocate resource map\n", __FUNCTION__); | 1340 | panic("%s() could not allocate resource map\n", __func__); |
1341 | } | 1341 | } |
1342 | memset(ioc->res_map, 0, ioc->res_size); | 1342 | memset(ioc->res_map, 0, ioc->res_size); |
1343 | 1343 | ||
@@ -1409,7 +1409,7 @@ ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr) | |||
1409 | result = insert_resource(&iomem_resource, res); | 1409 | result = insert_resource(&iomem_resource, res); |
1410 | if (result < 0) { | 1410 | if (result < 0) { |
1411 | printk(KERN_ERR "%s() failed to claim CCIO bus address space (%08lx,%08lx)\n", | 1411 | printk(KERN_ERR "%s() failed to claim CCIO bus address space (%08lx,%08lx)\n", |
1412 | __FUNCTION__, res->start, res->end); | 1412 | __func__, res->start, res->end); |
1413 | } | 1413 | } |
1414 | } | 1414 | } |
1415 | 1415 | ||
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index d9c6322a721b..fd56128525d1 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -180,7 +180,7 @@ static int dino_cfg_read(struct pci_bus *bus, unsigned int devfn, int where, | |||
180 | void __iomem *base_addr = d->hba.base_addr; | 180 | void __iomem *base_addr = d->hba.base_addr; |
181 | unsigned long flags; | 181 | unsigned long flags; |
182 | 182 | ||
183 | DBG("%s: %p, %d, %d, %d\n", __FUNCTION__, base_addr, devfn, where, | 183 | DBG("%s: %p, %d, %d, %d\n", __func__, base_addr, devfn, where, |
184 | size); | 184 | size); |
185 | spin_lock_irqsave(&d->dinosaur_pen, flags); | 185 | spin_lock_irqsave(&d->dinosaur_pen, flags); |
186 | 186 | ||
@@ -215,7 +215,7 @@ static int dino_cfg_write(struct pci_bus *bus, unsigned int devfn, int where, | |||
215 | void __iomem *base_addr = d->hba.base_addr; | 215 | void __iomem *base_addr = d->hba.base_addr; |
216 | unsigned long flags; | 216 | unsigned long flags; |
217 | 217 | ||
218 | DBG("%s: %p, %d, %d, %d\n", __FUNCTION__, base_addr, devfn, where, | 218 | DBG("%s: %p, %d, %d, %d\n", __func__, base_addr, devfn, where, |
219 | size); | 219 | size); |
220 | spin_lock_irqsave(&d->dinosaur_pen, flags); | 220 | spin_lock_irqsave(&d->dinosaur_pen, flags); |
221 | 221 | ||
@@ -301,7 +301,7 @@ static void dino_disable_irq(unsigned int irq) | |||
301 | struct dino_device *dino_dev = irq_desc[irq].chip_data; | 301 | struct dino_device *dino_dev = irq_desc[irq].chip_data; |
302 | int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); | 302 | int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); |
303 | 303 | ||
304 | DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, dino_dev, irq); | 304 | DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq); |
305 | 305 | ||
306 | /* Clear the matching bit in the IMR register */ | 306 | /* Clear the matching bit in the IMR register */ |
307 | dino_dev->imr &= ~(DINO_MASK_IRQ(local_irq)); | 307 | dino_dev->imr &= ~(DINO_MASK_IRQ(local_irq)); |
@@ -314,7 +314,7 @@ static void dino_enable_irq(unsigned int irq) | |||
314 | int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); | 314 | int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); |
315 | u32 tmp; | 315 | u32 tmp; |
316 | 316 | ||
317 | DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, dino_dev, irq); | 317 | DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq); |
318 | 318 | ||
319 | /* | 319 | /* |
320 | ** clear pending IRQ bits | 320 | ** clear pending IRQ bits |
@@ -340,7 +340,7 @@ static void dino_enable_irq(unsigned int irq) | |||
340 | tmp = __raw_readl(dino_dev->hba.base_addr+DINO_ILR); | 340 | tmp = __raw_readl(dino_dev->hba.base_addr+DINO_ILR); |
341 | if (tmp & DINO_MASK_IRQ(local_irq)) { | 341 | if (tmp & DINO_MASK_IRQ(local_irq)) { |
342 | DBG(KERN_WARNING "%s(): IRQ asserted! (ILR 0x%x)\n", | 342 | DBG(KERN_WARNING "%s(): IRQ asserted! (ILR 0x%x)\n", |
343 | __FUNCTION__, tmp); | 343 | __func__, tmp); |
344 | gsc_writel(dino_dev->txn_data, dino_dev->txn_addr); | 344 | gsc_writel(dino_dev->txn_data, dino_dev->txn_addr); |
345 | } | 345 | } |
346 | } | 346 | } |
@@ -388,7 +388,7 @@ ilr_again: | |||
388 | int local_irq = __ffs(mask); | 388 | int local_irq = __ffs(mask); |
389 | int irq = dino_dev->global_irq[local_irq]; | 389 | int irq = dino_dev->global_irq[local_irq]; |
390 | DBG(KERN_DEBUG "%s(%d, %p) mask 0x%x\n", | 390 | DBG(KERN_DEBUG "%s(%d, %p) mask 0x%x\n", |
391 | __FUNCTION__, irq, intr_dev, mask); | 391 | __func__, irq, intr_dev, mask); |
392 | __do_IRQ(irq); | 392 | __do_IRQ(irq); |
393 | mask &= ~(1 << local_irq); | 393 | mask &= ~(1 << local_irq); |
394 | } while (mask); | 394 | } while (mask); |
@@ -566,7 +566,7 @@ dino_fixup_bus(struct pci_bus *bus) | |||
566 | int port_base = HBA_PORT_BASE(dino_dev->hba.hba_num); | 566 | int port_base = HBA_PORT_BASE(dino_dev->hba.hba_num); |
567 | 567 | ||
568 | DBG(KERN_WARNING "%s(0x%p) bus %d platform_data 0x%p\n", | 568 | DBG(KERN_WARNING "%s(0x%p) bus %d platform_data 0x%p\n", |
569 | __FUNCTION__, bus, bus->secondary, | 569 | __func__, bus, bus->secondary, |
570 | bus->bridge->platform_data); | 570 | bus->bridge->platform_data); |
571 | 571 | ||
572 | /* Firmware doesn't set up card-mode dino, so we have to */ | 572 | /* Firmware doesn't set up card-mode dino, so we have to */ |
diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c index 1b3e3fd12d95..f7d088b897ee 100644 --- a/drivers/parisc/gsc.c +++ b/drivers/parisc/gsc.c | |||
@@ -112,7 +112,7 @@ static void gsc_asic_disable_irq(unsigned int irq) | |||
112 | int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); | 112 | int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); |
113 | u32 imr; | 113 | u32 imr; |
114 | 114 | ||
115 | DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __FUNCTION__, irq, | 115 | DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __func__, irq, |
116 | irq_dev->name, imr); | 116 | irq_dev->name, imr); |
117 | 117 | ||
118 | /* Disable the IRQ line by clearing the bit in the IMR */ | 118 | /* Disable the IRQ line by clearing the bit in the IMR */ |
@@ -127,7 +127,7 @@ static void gsc_asic_enable_irq(unsigned int irq) | |||
127 | int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); | 127 | int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); |
128 | u32 imr; | 128 | u32 imr; |
129 | 129 | ||
130 | DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __FUNCTION__, irq, | 130 | DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __func__, irq, |
131 | irq_dev->name, imr); | 131 | irq_dev->name, imr); |
132 | 132 | ||
133 | /* Enable the IRQ line by setting the bit in the IMR */ | 133 | /* Enable the IRQ line by setting the bit in the IMR */ |
diff --git a/drivers/parisc/lasi.c b/drivers/parisc/lasi.c index cb3d28176129..bee510098ce8 100644 --- a/drivers/parisc/lasi.c +++ b/drivers/parisc/lasi.c | |||
@@ -193,7 +193,7 @@ lasi_init_chip(struct parisc_device *dev) | |||
193 | dev->irq = gsc_alloc_irq(&gsc_irq); | 193 | dev->irq = gsc_alloc_irq(&gsc_irq); |
194 | if (dev->irq < 0) { | 194 | if (dev->irq < 0) { |
195 | printk(KERN_ERR "%s(): cannot get GSC irq\n", | 195 | printk(KERN_ERR "%s(): cannot get GSC irq\n", |
196 | __FUNCTION__); | 196 | __func__); |
197 | kfree(lasi); | 197 | kfree(lasi); |
198 | return -EBUSY; | 198 | return -EBUSY; |
199 | } | 199 | } |
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 66ce61048361..a28c8946deaa 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
@@ -377,12 +377,12 @@ static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int | |||
377 | /* original - Generate config cycle on broken elroy | 377 | /* original - Generate config cycle on broken elroy |
378 | with risk we will miss PCI bus errors. */ | 378 | with risk we will miss PCI bus errors. */ |
379 | *data = lba_rd_cfg(d, tok, pos, size); | 379 | *data = lba_rd_cfg(d, tok, pos, size); |
380 | DBG_CFG("%s(%x+%2x) -> 0x%x (a)\n", __FUNCTION__, tok, pos, *data); | 380 | DBG_CFG("%s(%x+%2x) -> 0x%x (a)\n", __func__, tok, pos, *data); |
381 | return 0; | 381 | return 0; |
382 | } | 382 | } |
383 | 383 | ||
384 | if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->secondary, devfn, d)) { | 384 | if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->secondary, devfn, d)) { |
385 | DBG_CFG("%s(%x+%2x) -> -1 (b)\n", __FUNCTION__, tok, pos); | 385 | DBG_CFG("%s(%x+%2x) -> -1 (b)\n", __func__, tok, pos); |
386 | /* either don't want to look or know device isn't present. */ | 386 | /* either don't want to look or know device isn't present. */ |
387 | *data = ~0U; | 387 | *data = ~0U; |
388 | return(0); | 388 | return(0); |
@@ -398,7 +398,7 @@ static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int | |||
398 | case 2: *data = READ_REG16(data_reg + (pos & 2)); break; | 398 | case 2: *data = READ_REG16(data_reg + (pos & 2)); break; |
399 | case 4: *data = READ_REG32(data_reg); break; | 399 | case 4: *data = READ_REG32(data_reg); break; |
400 | } | 400 | } |
401 | DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __FUNCTION__, tok, pos, *data); | 401 | DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __func__, tok, pos, *data); |
402 | return 0; | 402 | return 0; |
403 | } | 403 | } |
404 | 404 | ||
@@ -441,16 +441,16 @@ static int elroy_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int | |||
441 | if (!LBA_SKIP_PROBE(d)) { | 441 | if (!LBA_SKIP_PROBE(d)) { |
442 | /* Original Workaround */ | 442 | /* Original Workaround */ |
443 | lba_wr_cfg(d, tok, pos, (u32) data, size); | 443 | lba_wr_cfg(d, tok, pos, (u32) data, size); |
444 | DBG_CFG("%s(%x+%2x) = 0x%x (a)\n", __FUNCTION__, tok, pos,data); | 444 | DBG_CFG("%s(%x+%2x) = 0x%x (a)\n", __func__, tok, pos,data); |
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
447 | 447 | ||
448 | if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->secondary, devfn, d))) { | 448 | if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->secondary, devfn, d))) { |
449 | DBG_CFG("%s(%x+%2x) = 0x%x (b)\n", __FUNCTION__, tok, pos,data); | 449 | DBG_CFG("%s(%x+%2x) = 0x%x (b)\n", __func__, tok, pos,data); |
450 | return 1; /* New Workaround */ | 450 | return 1; /* New Workaround */ |
451 | } | 451 | } |
452 | 452 | ||
453 | DBG_CFG("%s(%x+%2x) = 0x%x (c)\n", __FUNCTION__, tok, pos, data); | 453 | DBG_CFG("%s(%x+%2x) = 0x%x (c)\n", __func__, tok, pos, data); |
454 | 454 | ||
455 | /* Basic Algorithm */ | 455 | /* Basic Algorithm */ |
456 | LBA_CFG_ADDR_SETUP(d, tok | pos); | 456 | LBA_CFG_ADDR_SETUP(d, tok | pos); |
@@ -521,7 +521,7 @@ static int mercury_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, i | |||
521 | if ((pos > 255) || (devfn > 255)) | 521 | if ((pos > 255) || (devfn > 255)) |
522 | return -EINVAL; | 522 | return -EINVAL; |
523 | 523 | ||
524 | DBG_CFG("%s(%x+%2x) <- 0x%x (c)\n", __FUNCTION__, tok, pos, data); | 524 | DBG_CFG("%s(%x+%2x) <- 0x%x (c)\n", __func__, tok, pos, data); |
525 | 525 | ||
526 | LBA_CFG_TR4_ADDR_SETUP(d, tok | pos); | 526 | LBA_CFG_TR4_ADDR_SETUP(d, tok | pos); |
527 | switch(size) { | 527 | switch(size) { |
@@ -890,7 +890,7 @@ LBA_PORT_IN(32, 0) | |||
890 | #define LBA_PORT_OUT(size, mask) \ | 890 | #define LBA_PORT_OUT(size, mask) \ |
891 | static void lba_astro_out##size (struct pci_hba_data *d, u16 addr, u##size val) \ | 891 | static void lba_astro_out##size (struct pci_hba_data *d, u16 addr, u##size val) \ |
892 | { \ | 892 | { \ |
893 | DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, d, addr, val); \ | 893 | DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __func__, d, addr, val); \ |
894 | WRITE_REG##size(val, astro_iop_base + addr); \ | 894 | WRITE_REG##size(val, astro_iop_base + addr); \ |
895 | if (LBA_DEV(d)->hw_rev < 3) \ | 895 | if (LBA_DEV(d)->hw_rev < 3) \ |
896 | lba_t32 = READ_U32(d->base_addr + LBA_FUNC_ID); \ | 896 | lba_t32 = READ_U32(d->base_addr + LBA_FUNC_ID); \ |
@@ -932,7 +932,7 @@ static struct pci_port_ops lba_astro_port_ops = { | |||
932 | static u##size lba_pat_in##size (struct pci_hba_data *l, u16 addr) \ | 932 | static u##size lba_pat_in##size (struct pci_hba_data *l, u16 addr) \ |
933 | { \ | 933 | { \ |
934 | u##size t; \ | 934 | u##size t; \ |
935 | DBG_PORT("%s(0x%p, 0x%x) ->", __FUNCTION__, l, addr); \ | 935 | DBG_PORT("%s(0x%p, 0x%x) ->", __func__, l, addr); \ |
936 | t = READ_REG##size(PIOP_TO_GMMIO(LBA_DEV(l), addr)); \ | 936 | t = READ_REG##size(PIOP_TO_GMMIO(LBA_DEV(l), addr)); \ |
937 | DBG_PORT(" 0x%x\n", t); \ | 937 | DBG_PORT(" 0x%x\n", t); \ |
938 | return (t); \ | 938 | return (t); \ |
@@ -948,7 +948,7 @@ LBA_PORT_IN(32, 0) | |||
948 | static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ | 948 | static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ |
949 | { \ | 949 | { \ |
950 | void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \ | 950 | void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \ |
951 | DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \ | 951 | DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __func__, l, addr, val); \ |
952 | WRITE_REG##size(val, where); \ | 952 | WRITE_REG##size(val, where); \ |
953 | /* flush the I/O down to the elroy at least */ \ | 953 | /* flush the I/O down to the elroy at least */ \ |
954 | lba_t32 = READ_U32(l->base_addr + LBA_FUNC_ID); \ | 954 | lba_t32 = READ_U32(l->base_addr + LBA_FUNC_ID); \ |
@@ -1584,7 +1584,7 @@ void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask) | |||
1584 | WARN_ON((ibase & 0x001fffff) != 0); | 1584 | WARN_ON((ibase & 0x001fffff) != 0); |
1585 | WARN_ON((imask & 0x001fffff) != 0); | 1585 | WARN_ON((imask & 0x001fffff) != 0); |
1586 | 1586 | ||
1587 | DBG("%s() ibase 0x%x imask 0x%x\n", __FUNCTION__, ibase, imask); | 1587 | DBG("%s() ibase 0x%x imask 0x%x\n", __func__, ibase, imask); |
1588 | WRITE_REG32( imask, base_addr + LBA_IMASK); | 1588 | WRITE_REG32( imask, base_addr + LBA_IMASK); |
1589 | WRITE_REG32( ibase, base_addr + LBA_IBASE); | 1589 | WRITE_REG32( ibase, base_addr + LBA_IBASE); |
1590 | iounmap(base_addr); | 1590 | iounmap(base_addr); |
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index 703b85edb004..f9b12664f9fb 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c | |||
@@ -569,7 +569,7 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d | |||
569 | 569 | ||
570 | default: | 570 | default: |
571 | printk(KERN_ERR "%s: Wrong LCD/LED model %d !\n", | 571 | printk(KERN_ERR "%s: Wrong LCD/LED model %d !\n", |
572 | __FUNCTION__, lcd_info.model); | 572 | __func__, lcd_info.model); |
573 | return 1; | 573 | return 1; |
574 | } | 574 | } |
575 | 575 | ||
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index afc849bd3f58..bc73b96346ff 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c | |||
@@ -384,7 +384,7 @@ sba_search_bitmap(struct ioc *ioc, struct device *dev, | |||
384 | } | 384 | } |
385 | mask = RESMAP_MASK(bits_wanted) >> bitshiftcnt; | 385 | mask = RESMAP_MASK(bits_wanted) >> bitshiftcnt; |
386 | 386 | ||
387 | DBG_RES("%s() o %ld %p", __FUNCTION__, o, res_ptr); | 387 | DBG_RES("%s() o %ld %p", __func__, o, res_ptr); |
388 | while(res_ptr < res_end) | 388 | while(res_ptr < res_end) |
389 | { | 389 | { |
390 | DBG_RES(" %p %lx %lx\n", res_ptr, mask, *res_ptr); | 390 | DBG_RES(" %p %lx %lx\n", res_ptr, mask, *res_ptr); |
@@ -454,7 +454,7 @@ sba_alloc_range(struct ioc *ioc, struct device *dev, size_t size) | |||
454 | #endif | 454 | #endif |
455 | 455 | ||
456 | DBG_RES("%s(%x) %d -> %lx hint %x/%x\n", | 456 | DBG_RES("%s(%x) %d -> %lx hint %x/%x\n", |
457 | __FUNCTION__, size, pages_needed, pide, | 457 | __func__, size, pages_needed, pide, |
458 | (uint) ((unsigned long) ioc->res_hint - (unsigned long) ioc->res_map), | 458 | (uint) ((unsigned long) ioc->res_hint - (unsigned long) ioc->res_map), |
459 | ioc->res_bitshift ); | 459 | ioc->res_bitshift ); |
460 | 460 | ||
@@ -497,7 +497,7 @@ sba_free_range(struct ioc *ioc, dma_addr_t iova, size_t size) | |||
497 | unsigned long m = RESMAP_MASK(bits_not_wanted) >> (pide & (BITS_PER_LONG - 1)); | 497 | unsigned long m = RESMAP_MASK(bits_not_wanted) >> (pide & (BITS_PER_LONG - 1)); |
498 | 498 | ||
499 | DBG_RES("%s( ,%x,%x) %x/%lx %x %p %lx\n", | 499 | DBG_RES("%s( ,%x,%x) %x/%lx %x %p %lx\n", |
500 | __FUNCTION__, (uint) iova, size, | 500 | __func__, (uint) iova, size, |
501 | bits_not_wanted, m, pide, res_ptr, *res_ptr); | 501 | bits_not_wanted, m, pide, res_ptr, *res_ptr); |
502 | 502 | ||
503 | #ifdef SBA_COLLECT_STATS | 503 | #ifdef SBA_COLLECT_STATS |
@@ -740,7 +740,7 @@ sba_map_single(struct device *dev, void *addr, size_t size, | |||
740 | iovp = (dma_addr_t) pide << IOVP_SHIFT; | 740 | iovp = (dma_addr_t) pide << IOVP_SHIFT; |
741 | 741 | ||
742 | DBG_RUN("%s() 0x%p -> 0x%lx\n", | 742 | DBG_RUN("%s() 0x%p -> 0x%lx\n", |
743 | __FUNCTION__, addr, (long) iovp | offset); | 743 | __func__, addr, (long) iovp | offset); |
744 | 744 | ||
745 | pdir_start = &(ioc->pdir_base[pide]); | 745 | pdir_start = &(ioc->pdir_base[pide]); |
746 | 746 | ||
@@ -798,7 +798,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size, | |||
798 | unsigned long flags; | 798 | unsigned long flags; |
799 | dma_addr_t offset; | 799 | dma_addr_t offset; |
800 | 800 | ||
801 | DBG_RUN("%s() iovp 0x%lx/%x\n", __FUNCTION__, (long) iova, size); | 801 | DBG_RUN("%s() iovp 0x%lx/%x\n", __func__, (long) iova, size); |
802 | 802 | ||
803 | ioc = GET_IOC(dev); | 803 | ioc = GET_IOC(dev); |
804 | offset = iova & ~IOVP_MASK; | 804 | offset = iova & ~IOVP_MASK; |
@@ -937,7 +937,7 @@ sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
937 | int coalesced, filled = 0; | 937 | int coalesced, filled = 0; |
938 | unsigned long flags; | 938 | unsigned long flags; |
939 | 939 | ||
940 | DBG_RUN_SG("%s() START %d entries\n", __FUNCTION__, nents); | 940 | DBG_RUN_SG("%s() START %d entries\n", __func__, nents); |
941 | 941 | ||
942 | ioc = GET_IOC(dev); | 942 | ioc = GET_IOC(dev); |
943 | 943 | ||
@@ -998,7 +998,7 @@ sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
998 | 998 | ||
999 | spin_unlock_irqrestore(&ioc->res_lock, flags); | 999 | spin_unlock_irqrestore(&ioc->res_lock, flags); |
1000 | 1000 | ||
1001 | DBG_RUN_SG("%s() DONE %d mappings\n", __FUNCTION__, filled); | 1001 | DBG_RUN_SG("%s() DONE %d mappings\n", __func__, filled); |
1002 | 1002 | ||
1003 | return filled; | 1003 | return filled; |
1004 | } | 1004 | } |
@@ -1023,7 +1023,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
1023 | #endif | 1023 | #endif |
1024 | 1024 | ||
1025 | DBG_RUN_SG("%s() START %d entries, %p,%x\n", | 1025 | DBG_RUN_SG("%s() START %d entries, %p,%x\n", |
1026 | __FUNCTION__, nents, sg_virt_addr(sglist), sglist->length); | 1026 | __func__, nents, sg_virt_addr(sglist), sglist->length); |
1027 | 1027 | ||
1028 | ioc = GET_IOC(dev); | 1028 | ioc = GET_IOC(dev); |
1029 | 1029 | ||
@@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
1047 | ++sglist; | 1047 | ++sglist; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | DBG_RUN_SG("%s() DONE (nents %d)\n", __FUNCTION__, nents); | 1050 | DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); |
1051 | 1051 | ||
1052 | #ifdef ASSERT_PDIR_SANITY | 1052 | #ifdef ASSERT_PDIR_SANITY |
1053 | spin_lock_irqsave(&ioc->res_lock, flags); | 1053 | spin_lock_irqsave(&ioc->res_lock, flags); |
@@ -1118,7 +1118,7 @@ sba_alloc_pdir(unsigned int pdir_size) | |||
1118 | pdir_base = __get_free_pages(GFP_KERNEL, pdir_order); | 1118 | pdir_base = __get_free_pages(GFP_KERNEL, pdir_order); |
1119 | if (NULL == (void *) pdir_base) { | 1119 | if (NULL == (void *) pdir_base) { |
1120 | panic("%s() could not allocate I/O Page Table\n", | 1120 | panic("%s() could not allocate I/O Page Table\n", |
1121 | __FUNCTION__); | 1121 | __func__); |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | /* If this is not PA8700 (PCX-W2) | 1124 | /* If this is not PA8700 (PCX-W2) |
@@ -1261,7 +1261,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1261 | ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64); | 1261 | ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64); |
1262 | 1262 | ||
1263 | DBG_INIT("%s() hpa 0x%p IOV %dMB (%d bits)\n", | 1263 | DBG_INIT("%s() hpa 0x%p IOV %dMB (%d bits)\n", |
1264 | __FUNCTION__, ioc->ioc_hpa, iova_space_size >> 20, | 1264 | __func__, ioc->ioc_hpa, iova_space_size >> 20, |
1265 | iov_order + PAGE_SHIFT); | 1265 | iov_order + PAGE_SHIFT); |
1266 | 1266 | ||
1267 | ioc->pdir_base = (void *) __get_free_pages(GFP_KERNEL, | 1267 | ioc->pdir_base = (void *) __get_free_pages(GFP_KERNEL, |
@@ -1272,7 +1272,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1272 | memset(ioc->pdir_base, 0, ioc->pdir_size); | 1272 | memset(ioc->pdir_base, 0, ioc->pdir_size); |
1273 | 1273 | ||
1274 | DBG_INIT("%s() pdir %p size %x\n", | 1274 | DBG_INIT("%s() pdir %p size %x\n", |
1275 | __FUNCTION__, ioc->pdir_base, ioc->pdir_size); | 1275 | __func__, ioc->pdir_base, ioc->pdir_size); |
1276 | 1276 | ||
1277 | #ifdef SBA_HINT_SUPPORT | 1277 | #ifdef SBA_HINT_SUPPORT |
1278 | ioc->hint_shift_pdir = iov_order + PAGE_SHIFT; | 1278 | ioc->hint_shift_pdir = iov_order + PAGE_SHIFT; |
@@ -1354,7 +1354,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1354 | 1354 | ||
1355 | if (agp_found && sba_reserve_agpgart) { | 1355 | if (agp_found && sba_reserve_agpgart) { |
1356 | printk(KERN_INFO "%s: reserving %dMb of IOVA space for agpgart\n", | 1356 | printk(KERN_INFO "%s: reserving %dMb of IOVA space for agpgart\n", |
1357 | __FUNCTION__, (iova_space_size/2) >> 20); | 1357 | __func__, (iova_space_size/2) >> 20); |
1358 | ioc->pdir_size /= 2; | 1358 | ioc->pdir_size /= 2; |
1359 | ioc->pdir_base[PDIR_INDEX(iova_space_size/2)] = SBA_AGPGART_COOKIE; | 1359 | ioc->pdir_base[PDIR_INDEX(iova_space_size/2)] = SBA_AGPGART_COOKIE; |
1360 | } | 1360 | } |
@@ -1406,7 +1406,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1406 | ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64); | 1406 | ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64); |
1407 | 1407 | ||
1408 | DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n", | 1408 | DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n", |
1409 | __FUNCTION__, | 1409 | __func__, |
1410 | ioc->ioc_hpa, | 1410 | ioc->ioc_hpa, |
1411 | (unsigned long) num_physpages >> (20 - PAGE_SHIFT), | 1411 | (unsigned long) num_physpages >> (20 - PAGE_SHIFT), |
1412 | iova_space_size>>20, | 1412 | iova_space_size>>20, |
@@ -1415,7 +1415,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1415 | ioc->pdir_base = sba_alloc_pdir(pdir_size); | 1415 | ioc->pdir_base = sba_alloc_pdir(pdir_size); |
1416 | 1416 | ||
1417 | DBG_INIT("%s() pdir %p size %x\n", | 1417 | DBG_INIT("%s() pdir %p size %x\n", |
1418 | __FUNCTION__, ioc->pdir_base, pdir_size); | 1418 | __func__, ioc->pdir_base, pdir_size); |
1419 | 1419 | ||
1420 | #ifdef SBA_HINT_SUPPORT | 1420 | #ifdef SBA_HINT_SUPPORT |
1421 | /* FIXME : DMA HINTs not used */ | 1421 | /* FIXME : DMA HINTs not used */ |
@@ -1443,7 +1443,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1443 | #endif | 1443 | #endif |
1444 | 1444 | ||
1445 | DBG_INIT("%s() IOV base 0x%lx mask 0x%0lx\n", | 1445 | DBG_INIT("%s() IOV base 0x%lx mask 0x%0lx\n", |
1446 | __FUNCTION__, ioc->ibase, ioc->imask); | 1446 | __func__, ioc->ibase, ioc->imask); |
1447 | 1447 | ||
1448 | /* | 1448 | /* |
1449 | ** FIXME: Hint registers are programmed with default hint | 1449 | ** FIXME: Hint registers are programmed with default hint |
@@ -1470,7 +1470,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1470 | 1470 | ||
1471 | ioc->ibase = 0; /* used by SBA_IOVA and related macros */ | 1471 | ioc->ibase = 0; /* used by SBA_IOVA and related macros */ |
1472 | 1472 | ||
1473 | DBG_INIT("%s() DONE\n", __FUNCTION__); | 1473 | DBG_INIT("%s() DONE\n", __func__); |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | 1476 | ||
@@ -1544,7 +1544,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, | |||
1544 | if (!IS_PLUTO(sba_dev->dev)) { | 1544 | if (!IS_PLUTO(sba_dev->dev)) { |
1545 | ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL); | 1545 | ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL); |
1546 | DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->", | 1546 | DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->", |
1547 | __FUNCTION__, sba_dev->sba_hpa, ioc_ctl); | 1547 | __func__, sba_dev->sba_hpa, ioc_ctl); |
1548 | ioc_ctl &= ~(IOC_CTRL_RM | IOC_CTRL_NC | IOC_CTRL_CE); | 1548 | ioc_ctl &= ~(IOC_CTRL_RM | IOC_CTRL_NC | IOC_CTRL_CE); |
1549 | ioc_ctl |= IOC_CTRL_DD | IOC_CTRL_D4 | IOC_CTRL_TC; | 1549 | ioc_ctl |= IOC_CTRL_DD | IOC_CTRL_D4 | IOC_CTRL_TC; |
1550 | /* j6700 v1.6 firmware sets 0x294f */ | 1550 | /* j6700 v1.6 firmware sets 0x294f */ |
@@ -1675,7 +1675,7 @@ sba_common_init(struct sba_device *sba_dev) | |||
1675 | 1675 | ||
1676 | res_size >>= 3; /* convert bit count to byte count */ | 1676 | res_size >>= 3; /* convert bit count to byte count */ |
1677 | DBG_INIT("%s() res_size 0x%x\n", | 1677 | DBG_INIT("%s() res_size 0x%x\n", |
1678 | __FUNCTION__, res_size); | 1678 | __func__, res_size); |
1679 | 1679 | ||
1680 | sba_dev->ioc[i].res_size = res_size; | 1680 | sba_dev->ioc[i].res_size = res_size; |
1681 | sba_dev->ioc[i].res_map = (char *) __get_free_pages(GFP_KERNEL, get_order(res_size)); | 1681 | sba_dev->ioc[i].res_map = (char *) __get_free_pages(GFP_KERNEL, get_order(res_size)); |
@@ -1688,7 +1688,7 @@ sba_common_init(struct sba_device *sba_dev) | |||
1688 | if (NULL == sba_dev->ioc[i].res_map) | 1688 | if (NULL == sba_dev->ioc[i].res_map) |
1689 | { | 1689 | { |
1690 | panic("%s:%s() could not allocate resource map\n", | 1690 | panic("%s:%s() could not allocate resource map\n", |
1691 | __FILE__, __FUNCTION__ ); | 1691 | __FILE__, __func__ ); |
1692 | } | 1692 | } |
1693 | 1693 | ||
1694 | memset(sba_dev->ioc[i].res_map, 0, res_size); | 1694 | memset(sba_dev->ioc[i].res_map, 0, res_size); |
@@ -1725,7 +1725,7 @@ sba_common_init(struct sba_device *sba_dev) | |||
1725 | #endif | 1725 | #endif |
1726 | 1726 | ||
1727 | DBG_INIT("%s() %d res_map %x %p\n", | 1727 | DBG_INIT("%s() %d res_map %x %p\n", |
1728 | __FUNCTION__, i, res_size, sba_dev->ioc[i].res_map); | 1728 | __func__, i, res_size, sba_dev->ioc[i].res_map); |
1729 | } | 1729 | } |
1730 | 1730 | ||
1731 | spin_lock_init(&sba_dev->sba_lock); | 1731 | spin_lock_init(&sba_dev->sba_lock); |
diff --git a/drivers/parisc/wax.c b/drivers/parisc/wax.c index 813c2c24ab1e..892a83bbe73d 100644 --- a/drivers/parisc/wax.c +++ b/drivers/parisc/wax.c | |||
@@ -93,7 +93,7 @@ wax_init_chip(struct parisc_device *dev) | |||
93 | dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ); | 93 | dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ); |
94 | if (dev->irq < 0) { | 94 | if (dev->irq < 0) { |
95 | printk(KERN_ERR "%s(): cannot get GSC irq\n", | 95 | printk(KERN_ERR "%s(): cannot get GSC irq\n", |
96 | __FUNCTION__); | 96 | __func__); |
97 | kfree(wax); | 97 | kfree(wax); |
98 | return -EBUSY; | 98 | return -EBUSY; |
99 | } | 99 | } |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index f2d9c770f51a..dabb563f51d9 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1503,8 +1503,7 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_f | |||
1503 | (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { | 1503 | (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { |
1504 | #ifdef DEBUG | 1504 | #ifdef DEBUG |
1505 | dev_dbg(&dev->dev, "calling "); | 1505 | dev_dbg(&dev->dev, "calling "); |
1506 | print_fn_descriptor_symbol("%s()\n", | 1506 | print_fn_descriptor_symbol("%s\n", f->hook); |
1507 | (unsigned long) f->hook); | ||
1508 | #endif | 1507 | #endif |
1509 | f->hook(dev); | 1508 | f->hook(dev); |
1510 | } | 1509 | } |
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index ffdb12a59c40..e2b7de4cb05e 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -331,8 +331,7 @@ void pnp_fixup_device(struct pnp_dev *dev) | |||
331 | continue; | 331 | continue; |
332 | #ifdef DEBUG | 332 | #ifdef DEBUG |
333 | dev_dbg(&dev->dev, "%s: calling ", f->id); | 333 | dev_dbg(&dev->dev, "%s: calling ", f->id); |
334 | print_fn_descriptor_symbol("%s\n", | 334 | print_fn_descriptor_symbol("%s\n", f->quirk_function); |
335 | (unsigned long) f->quirk_function); | ||
336 | #endif | 335 | #endif |
337 | f->quirk_function(dev); | 336 | f->quirk_function(dev); |
338 | } | 337 | } |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 138dd76ee347..af1633eb3b70 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -91,15 +91,13 @@ int power_supply_register(struct device *parent, struct power_supply *psy) | |||
91 | { | 91 | { |
92 | int rc = 0; | 92 | int rc = 0; |
93 | 93 | ||
94 | psy->dev = device_create(power_supply_class, parent, 0, | 94 | psy->dev = device_create_drvdata(power_supply_class, parent, 0, |
95 | "%s", psy->name); | 95 | psy, "%s", psy->name); |
96 | if (IS_ERR(psy->dev)) { | 96 | if (IS_ERR(psy->dev)) { |
97 | rc = PTR_ERR(psy->dev); | 97 | rc = PTR_ERR(psy->dev); |
98 | goto dev_create_failed; | 98 | goto dev_create_failed; |
99 | } | 99 | } |
100 | 100 | ||
101 | dev_set_drvdata(psy->dev, psy); | ||
102 | |||
103 | INIT_WORK(&psy->changed_work, power_supply_changed_work); | 101 | INIT_WORK(&psy->changed_work, power_supply_changed_work); |
104 | 102 | ||
105 | rc = power_supply_create_attrs(psy); | 103 | rc = power_supply_create_attrs(psy); |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index ac6d4d3218b3..8ba3f135da22 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -925,6 +925,8 @@ static void dasd_handle_killed_request(struct ccw_device *cdev, | |||
925 | struct dasd_ccw_req *cqr; | 925 | struct dasd_ccw_req *cqr; |
926 | struct dasd_device *device; | 926 | struct dasd_device *device; |
927 | 927 | ||
928 | if (!intparm) | ||
929 | return; | ||
928 | cqr = (struct dasd_ccw_req *) intparm; | 930 | cqr = (struct dasd_ccw_req *) intparm; |
929 | if (cqr->status != DASD_CQR_IN_IO) { | 931 | if (cqr->status != DASD_CQR_IN_IO) { |
930 | MESSAGE(KERN_DEBUG, | 932 | MESSAGE(KERN_DEBUG, |
@@ -976,17 +978,16 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, | |||
976 | if (IS_ERR(irb)) { | 978 | if (IS_ERR(irb)) { |
977 | switch (PTR_ERR(irb)) { | 979 | switch (PTR_ERR(irb)) { |
978 | case -EIO: | 980 | case -EIO: |
979 | dasd_handle_killed_request(cdev, intparm); | ||
980 | break; | 981 | break; |
981 | case -ETIMEDOUT: | 982 | case -ETIMEDOUT: |
982 | printk(KERN_WARNING"%s(%s): request timed out\n", | 983 | printk(KERN_WARNING"%s(%s): request timed out\n", |
983 | __func__, cdev->dev.bus_id); | 984 | __func__, cdev->dev.bus_id); |
984 | //FIXME - dasd uses own timeout interface... | ||
985 | break; | 985 | break; |
986 | default: | 986 | default: |
987 | printk(KERN_WARNING"%s(%s): unknown error %ld\n", | 987 | printk(KERN_WARNING"%s(%s): unknown error %ld\n", |
988 | __func__, cdev->dev.bus_id, PTR_ERR(irb)); | 988 | __func__, cdev->dev.bus_id, PTR_ERR(irb)); |
989 | } | 989 | } |
990 | dasd_handle_killed_request(cdev, intparm); | ||
990 | return; | 991 | return; |
991 | } | 992 | } |
992 | 993 | ||
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index f4fb40257348..d774e79476fe 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -86,10 +86,10 @@ static DEFINE_SPINLOCK(dasd_devmap_lock); | |||
86 | static struct list_head dasd_hashlists[256]; | 86 | static struct list_head dasd_hashlists[256]; |
87 | int dasd_max_devindex; | 87 | int dasd_max_devindex; |
88 | 88 | ||
89 | static struct dasd_devmap *dasd_add_busid(char *, int); | 89 | static struct dasd_devmap *dasd_add_busid(const char *, int); |
90 | 90 | ||
91 | static inline int | 91 | static inline int |
92 | dasd_hash_busid(char *bus_id) | 92 | dasd_hash_busid(const char *bus_id) |
93 | { | 93 | { |
94 | int hash, i; | 94 | int hash, i; |
95 | 95 | ||
@@ -394,7 +394,7 @@ dasd_parse(void) | |||
394 | * devices. | 394 | * devices. |
395 | */ | 395 | */ |
396 | static struct dasd_devmap * | 396 | static struct dasd_devmap * |
397 | dasd_add_busid(char *bus_id, int features) | 397 | dasd_add_busid(const char *bus_id, int features) |
398 | { | 398 | { |
399 | struct dasd_devmap *devmap, *new, *tmp; | 399 | struct dasd_devmap *devmap, *new, *tmp; |
400 | int hash; | 400 | int hash; |
@@ -430,7 +430,7 @@ dasd_add_busid(char *bus_id, int features) | |||
430 | * Find devmap for device with given bus_id. | 430 | * Find devmap for device with given bus_id. |
431 | */ | 431 | */ |
432 | static struct dasd_devmap * | 432 | static struct dasd_devmap * |
433 | dasd_find_busid(char *bus_id) | 433 | dasd_find_busid(const char *bus_id) |
434 | { | 434 | { |
435 | struct dasd_devmap *devmap, *tmp; | 435 | struct dasd_devmap *devmap, *tmp; |
436 | int hash; | 436 | int hash; |
@@ -452,7 +452,7 @@ dasd_find_busid(char *bus_id) | |||
452 | * Check if busid has been added to the list of dasd ranges. | 452 | * Check if busid has been added to the list of dasd ranges. |
453 | */ | 453 | */ |
454 | int | 454 | int |
455 | dasd_busid_known(char *bus_id) | 455 | dasd_busid_known(const char *bus_id) |
456 | { | 456 | { |
457 | return IS_ERR(dasd_find_busid(bus_id)) ? -ENOENT : 0; | 457 | return IS_ERR(dasd_find_busid(bus_id)) ? -ENOENT : 0; |
458 | } | 458 | } |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index 6c624bf44617..fb2f931cf844 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -598,7 +598,7 @@ struct dasd_device *dasd_device_from_cdev_locked(struct ccw_device *); | |||
598 | struct dasd_device *dasd_device_from_devindex(int); | 598 | struct dasd_device *dasd_device_from_devindex(int); |
599 | 599 | ||
600 | int dasd_parse(void); | 600 | int dasd_parse(void); |
601 | int dasd_busid_known(char *); | 601 | int dasd_busid_known(const char *); |
602 | 602 | ||
603 | /* externals in dasd_gendisk.c */ | 603 | /* externals in dasd_gendisk.c */ |
604 | int dasd_gendisk_init(void); | 604 | int dasd_gendisk_init(void); |
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index 7ad8cf157641..76e44eb7c47f 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c | |||
@@ -76,32 +76,9 @@ const char *tape_op_verbose[TO_SIZE] = | |||
76 | [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC", | 76 | [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC", |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static int | 79 | static int devid_to_int(struct ccw_dev_id *dev_id) |
80 | busid_to_int(char *bus_id) | ||
81 | { | 80 | { |
82 | int dec; | 81 | return dev_id->devno + (dev_id->ssid << 16); |
83 | int d; | ||
84 | char * s; | ||
85 | |||
86 | for(s = bus_id, d = 0; *s != '\0' && *s != '.'; s++) | ||
87 | d = (d * 10) + (*s - '0'); | ||
88 | dec = d; | ||
89 | for(s++, d = 0; *s != '\0' && *s != '.'; s++) | ||
90 | d = (d * 10) + (*s - '0'); | ||
91 | dec = (dec << 8) + d; | ||
92 | |||
93 | for(s++; *s != '\0'; s++) { | ||
94 | if (*s >= '0' && *s <= '9') { | ||
95 | d = *s - '0'; | ||
96 | } else if (*s >= 'a' && *s <= 'f') { | ||
97 | d = *s - 'a' + 10; | ||
98 | } else { | ||
99 | d = *s - 'A' + 10; | ||
100 | } | ||
101 | dec = (dec << 4) + d; | ||
102 | } | ||
103 | |||
104 | return dec; | ||
105 | } | 82 | } |
106 | 83 | ||
107 | /* | 84 | /* |
@@ -551,6 +528,7 @@ tape_generic_probe(struct ccw_device *cdev) | |||
551 | { | 528 | { |
552 | struct tape_device *device; | 529 | struct tape_device *device; |
553 | int ret; | 530 | int ret; |
531 | struct ccw_dev_id dev_id; | ||
554 | 532 | ||
555 | device = tape_alloc_device(); | 533 | device = tape_alloc_device(); |
556 | if (IS_ERR(device)) | 534 | if (IS_ERR(device)) |
@@ -565,7 +543,8 @@ tape_generic_probe(struct ccw_device *cdev) | |||
565 | cdev->dev.driver_data = device; | 543 | cdev->dev.driver_data = device; |
566 | cdev->handler = __tape_do_irq; | 544 | cdev->handler = __tape_do_irq; |
567 | device->cdev = cdev; | 545 | device->cdev = cdev; |
568 | device->cdev_id = busid_to_int(cdev->dev.bus_id); | 546 | ccw_device_get_id(cdev, &dev_id); |
547 | device->cdev_id = devid_to_int(&dev_id); | ||
569 | PRINT_INFO("tape device %s found\n", cdev->dev.bus_id); | 548 | PRINT_INFO("tape device %s found\n", cdev->dev.bus_id); |
570 | return ret; | 549 | return ret; |
571 | } | 550 | } |
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index d364e0bfae12..2c2428cc05d8 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -762,10 +762,10 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
762 | device_unregister(dev); | 762 | device_unregister(dev); |
763 | return ret; | 763 | return ret; |
764 | } | 764 | } |
765 | priv->class_device = device_create(vmlogrdr_class, dev, | 765 | priv->class_device = device_create_drvdata(vmlogrdr_class, dev, |
766 | MKDEV(vmlogrdr_major, | 766 | MKDEV(vmlogrdr_major, |
767 | priv->minor_num), | 767 | priv->minor_num), |
768 | "%s", dev->bus_id); | 768 | priv, "%s", dev->bus_id); |
769 | if (IS_ERR(priv->class_device)) { | 769 | if (IS_ERR(priv->class_device)) { |
770 | ret = PTR_ERR(priv->class_device); | 770 | ret = PTR_ERR(priv->class_device); |
771 | priv->class_device=NULL; | 771 | priv->class_device=NULL; |
@@ -773,7 +773,6 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
773 | device_unregister(dev); | 773 | device_unregister(dev); |
774 | return ret; | 774 | return ret; |
775 | } | 775 | } |
776 | dev->driver_data = priv; | ||
777 | priv->device = dev; | 776 | priv->device = dev; |
778 | return 0; | 777 | return 0; |
779 | } | 778 | } |
@@ -858,7 +857,7 @@ static int __init vmlogrdr_init(void) | |||
858 | for (i=0; i < MAXMINOR; ++i ) { | 857 | for (i=0; i < MAXMINOR; ++i ) { |
859 | sys_ser[i].buffer = (char *) get_zeroed_page(GFP_KERNEL); | 858 | sys_ser[i].buffer = (char *) get_zeroed_page(GFP_KERNEL); |
860 | if (!sys_ser[i].buffer) { | 859 | if (!sys_ser[i].buffer) { |
861 | rc = ENOMEM; | 860 | rc = -ENOMEM; |
862 | break; | 861 | break; |
863 | } | 862 | } |
864 | sys_ser[i].current_position = sys_ser[i].buffer; | 863 | sys_ser[i].current_position = sys_ser[i].buffer; |
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c index 9c21b8f43f9b..a4a5f2efea48 100644 --- a/drivers/s390/cio/blacklist.c +++ b/drivers/s390/cio/blacklist.c | |||
@@ -19,7 +19,6 @@ | |||
19 | 19 | ||
20 | #include <asm/cio.h> | 20 | #include <asm/cio.h> |
21 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
22 | #include <asm/cio.h> | ||
23 | 22 | ||
24 | #include "blacklist.h" | 23 | #include "blacklist.h" |
25 | #include "cio.h" | 24 | #include "cio.h" |
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c index ba559053402e..5cf7be008e98 100644 --- a/drivers/s390/cio/device_pgid.c +++ b/drivers/s390/cio/device_pgid.c | |||
@@ -243,16 +243,10 @@ __ccw_device_do_pgid(struct ccw_device *cdev, __u8 func) | |||
243 | /* Setup sense path group id channel program. */ | 243 | /* Setup sense path group id channel program. */ |
244 | cdev->private->pgid[0].inf.fc = func; | 244 | cdev->private->pgid[0].inf.fc = func; |
245 | ccw = cdev->private->iccws; | 245 | ccw = cdev->private->iccws; |
246 | if (!cdev->private->flags.pgid_single) { | 246 | if (cdev->private->flags.pgid_single) |
247 | cdev->private->pgid[0].inf.fc |= SPID_FUNC_MULTI_PATH; | ||
248 | ccw->cmd_code = CCW_CMD_SUSPEND_RECONN; | ||
249 | ccw->cda = 0; | ||
250 | ccw->count = 0; | ||
251 | ccw->flags = CCW_FLAG_SLI | CCW_FLAG_CC; | ||
252 | ccw++; | ||
253 | } else | ||
254 | cdev->private->pgid[0].inf.fc |= SPID_FUNC_SINGLE_PATH; | 247 | cdev->private->pgid[0].inf.fc |= SPID_FUNC_SINGLE_PATH; |
255 | 248 | else | |
249 | cdev->private->pgid[0].inf.fc |= SPID_FUNC_MULTI_PATH; | ||
256 | ccw->cmd_code = CCW_CMD_SET_PGID; | 250 | ccw->cmd_code = CCW_CMD_SET_PGID; |
257 | ccw->cda = (__u32) __pa (&cdev->private->pgid[0]); | 251 | ccw->cda = (__u32) __pa (&cdev->private->pgid[0]); |
258 | ccw->count = sizeof (struct pgid); | 252 | ccw->count = sizeof (struct pgid); |
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index 47a7e6200b26..9f55ce6f3c78 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c | |||
@@ -78,27 +78,32 @@ static unsigned desc_size(const struct kvm_device_desc *desc) | |||
78 | + desc->config_len; | 78 | + desc->config_len; |
79 | } | 79 | } |
80 | 80 | ||
81 | /* | 81 | /* This gets the device's feature bits. */ |
82 | * This tests (and acknowleges) a feature bit. | 82 | static u32 kvm_get_features(struct virtio_device *vdev) |
83 | */ | ||
84 | static bool kvm_feature(struct virtio_device *vdev, unsigned fbit) | ||
85 | { | 83 | { |
84 | unsigned int i; | ||
85 | u32 features = 0; | ||
86 | struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; | 86 | struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; |
87 | u8 *features; | 87 | u8 *in_features = kvm_vq_features(desc); |
88 | 88 | ||
89 | if (fbit / 8 > desc->feature_len) | 89 | for (i = 0; i < min(desc->feature_len * 8, 32); i++) |
90 | return false; | 90 | if (in_features[i / 8] & (1 << (i % 8))) |
91 | features |= (1 << i); | ||
92 | return features; | ||
93 | } | ||
91 | 94 | ||
92 | features = kvm_vq_features(desc); | 95 | static void kvm_set_features(struct virtio_device *vdev, u32 features) |
93 | if (!(features[fbit / 8] & (1 << (fbit % 8)))) | 96 | { |
94 | return false; | 97 | unsigned int i; |
98 | struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; | ||
99 | /* Second half of bitmap is features we accept. */ | ||
100 | u8 *out_features = kvm_vq_features(desc) + desc->feature_len; | ||
95 | 101 | ||
96 | /* | 102 | memset(out_features, 0, desc->feature_len); |
97 | * We set the matching bit in the other half of the bitmap to tell the | 103 | for (i = 0; i < min(desc->feature_len * 8, 32); i++) { |
98 | * Host we want to use this feature. | 104 | if (features & (1 << i)) |
99 | */ | 105 | out_features[i / 8] |= (1 << (i % 8)); |
100 | features[desc->feature_len + fbit / 8] |= (1 << (fbit % 8)); | 106 | } |
101 | return true; | ||
102 | } | 107 | } |
103 | 108 | ||
104 | /* | 109 | /* |
@@ -221,7 +226,8 @@ static void kvm_del_vq(struct virtqueue *vq) | |||
221 | * The config ops structure as defined by virtio config | 226 | * The config ops structure as defined by virtio config |
222 | */ | 227 | */ |
223 | static struct virtio_config_ops kvm_vq_configspace_ops = { | 228 | static struct virtio_config_ops kvm_vq_configspace_ops = { |
224 | .feature = kvm_feature, | 229 | .get_features = kvm_get_features, |
230 | .set_features = kvm_set_features, | ||
225 | .get = kvm_get, | 231 | .get = kvm_get, |
226 | .set = kvm_set, | 232 | .set = kvm_set, |
227 | .get_status = kvm_get_status, | 233 | .get_status = kvm_get_status, |
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 75c84d7b9ce8..c4b938bc30d3 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c | |||
@@ -910,9 +910,9 @@ static int ch_probe(struct device *dev) | |||
910 | ch->minor = minor; | 910 | ch->minor = minor; |
911 | sprintf(ch->name,"ch%d",ch->minor); | 911 | sprintf(ch->name,"ch%d",ch->minor); |
912 | 912 | ||
913 | class_dev = device_create(ch_sysfs_class, dev, | 913 | class_dev = device_create_drvdata(ch_sysfs_class, dev, |
914 | MKDEV(SCSI_CHANGER_MAJOR,ch->minor), | 914 | MKDEV(SCSI_CHANGER_MAJOR, ch->minor), |
915 | "s%s", ch->name); | 915 | ch, "s%s", ch->name); |
916 | if (IS_ERR(class_dev)) { | 916 | if (IS_ERR(class_dev)) { |
917 | printk(KERN_WARNING "ch%d: device_create failed\n", | 917 | printk(KERN_WARNING "ch%d: device_create failed\n", |
918 | ch->minor); | 918 | ch->minor); |
@@ -926,7 +926,6 @@ static int ch_probe(struct device *dev) | |||
926 | if (init) | 926 | if (init) |
927 | ch_init_elem(ch); | 927 | ch_init_elem(ch); |
928 | 928 | ||
929 | dev_set_drvdata(dev, ch); | ||
930 | sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name); | 929 | sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name); |
931 | 930 | ||
932 | return 0; | 931 | return 0; |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 31f7aec44d90..243d8becd30f 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -5695,13 +5695,12 @@ static int osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * S | |||
5695 | struct device *osst_member; | 5695 | struct device *osst_member; |
5696 | int err; | 5696 | int err; |
5697 | 5697 | ||
5698 | osst_member = device_create(osst_sysfs_class, device, dev, "%s", name); | 5698 | osst_member = device_create_drvdata(osst_sysfs_class, device, dev, STp, "%s", name); |
5699 | if (IS_ERR(osst_member)) { | 5699 | if (IS_ERR(osst_member)) { |
5700 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); | 5700 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); |
5701 | return PTR_ERR(osst_member); | 5701 | return PTR_ERR(osst_member); |
5702 | } | 5702 | } |
5703 | 5703 | ||
5704 | dev_set_drvdata(osst_member, STp); | ||
5705 | err = device_create_file(osst_member, &dev_attr_ADR_rev); | 5704 | err = device_create_file(osst_member, &dev_attr_ADR_rev); |
5706 | if (err) | 5705 | if (err) |
5707 | goto err_out; | 5706 | goto err_out; |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index c9d7f721b9e2..ea0edd1b2e76 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1441,17 +1441,18 @@ sg_add(struct device *cl_dev, struct class_interface *cl_intf) | |||
1441 | if (sg_sysfs_valid) { | 1441 | if (sg_sysfs_valid) { |
1442 | struct device *sg_class_member; | 1442 | struct device *sg_class_member; |
1443 | 1443 | ||
1444 | sg_class_member = device_create(sg_sysfs_class, cl_dev->parent, | 1444 | sg_class_member = device_create_drvdata(sg_sysfs_class, |
1445 | MKDEV(SCSI_GENERIC_MAJOR, | 1445 | cl_dev->parent, |
1446 | sdp->index), | 1446 | MKDEV(SCSI_GENERIC_MAJOR, |
1447 | "%s", disk->disk_name); | 1447 | sdp->index), |
1448 | sdp, | ||
1449 | "%s", disk->disk_name); | ||
1448 | if (IS_ERR(sg_class_member)) { | 1450 | if (IS_ERR(sg_class_member)) { |
1449 | printk(KERN_ERR "sg_add: " | 1451 | printk(KERN_ERR "sg_add: " |
1450 | "device_create failed\n"); | 1452 | "device_create failed\n"); |
1451 | error = PTR_ERR(sg_class_member); | 1453 | error = PTR_ERR(sg_class_member); |
1452 | goto cdev_add_err; | 1454 | goto cdev_add_err; |
1453 | } | 1455 | } |
1454 | dev_set_drvdata(sg_class_member, sdp); | ||
1455 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, | 1456 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, |
1456 | &sg_class_member->kobj, "generic"); | 1457 | &sg_class_member->kobj, "generic"); |
1457 | if (error) | 1458 | if (error) |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index e8db66ad0bde..6e5a5bb31311 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -4424,17 +4424,19 @@ static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) | |||
4424 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", | 4424 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", |
4425 | STp->disk->disk_name, st_formats[i]); | 4425 | STp->disk->disk_name, st_formats[i]); |
4426 | st_class_member = | 4426 | st_class_member = |
4427 | device_create(st_sysfs_class, &STp->device->sdev_gendev, | 4427 | device_create_drvdata(st_sysfs_class, |
4428 | MKDEV(SCSI_TAPE_MAJOR, | 4428 | &STp->device->sdev_gendev, |
4429 | TAPE_MINOR(dev_num, mode, rew)), | 4429 | MKDEV(SCSI_TAPE_MAJOR, |
4430 | "%s", name); | 4430 | TAPE_MINOR(dev_num, |
4431 | mode, rew)), | ||
4432 | &STp->modes[mode], | ||
4433 | "%s", name); | ||
4431 | if (IS_ERR(st_class_member)) { | 4434 | if (IS_ERR(st_class_member)) { |
4432 | printk(KERN_WARNING "st%d: device_create failed\n", | 4435 | printk(KERN_WARNING "st%d: device_create failed\n", |
4433 | dev_num); | 4436 | dev_num); |
4434 | error = PTR_ERR(st_class_member); | 4437 | error = PTR_ERR(st_class_member); |
4435 | goto out; | 4438 | goto out; |
4436 | } | 4439 | } |
4437 | dev_set_drvdata(st_class_member, &STp->modes[mode]); | ||
4438 | 4440 | ||
4439 | error = device_create_file(st_class_member, | 4441 | error = device_create_file(st_class_member, |
4440 | &dev_attr_defined); | 4442 | &dev_attr_defined); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index a1ca9b7bf2d5..1400ea6a2491 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -43,6 +43,7 @@ | |||
43 | 43 | ||
44 | #include <asm/io.h> | 44 | #include <asm/io.h> |
45 | #include <asm/irq.h> | 45 | #include <asm/irq.h> |
46 | #include <asm/serial.h> | ||
46 | 47 | ||
47 | #include "8250.h" | 48 | #include "8250.h" |
48 | 49 | ||
@@ -92,8 +93,6 @@ static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS; | |||
92 | */ | 93 | */ |
93 | #define CONFIG_HUB6 1 | 94 | #define CONFIG_HUB6 1 |
94 | 95 | ||
95 | #include <asm/serial.h> | ||
96 | |||
97 | /* | 96 | /* |
98 | * SERIAL_PORT_DFNS tells us about built-in ports that have no | 97 | * SERIAL_PORT_DFNS tells us about built-in ports that have no |
99 | * standard enumeration mechanism. Platforms that can find all | 98 | * standard enumeration mechanism. Platforms that can find all |
@@ -1548,6 +1547,8 @@ static int serial_link_irq_chain(struct uart_8250_port *up) | |||
1548 | i->head = &up->list; | 1547 | i->head = &up->list; |
1549 | spin_unlock_irq(&i->lock); | 1548 | spin_unlock_irq(&i->lock); |
1550 | 1549 | ||
1550 | irq_flags |= SERIAL_EXTRA_IRQ_FLAGS; | ||
1551 | |||
1551 | ret = request_irq(up->port.irq, serial8250_interrupt, | 1552 | ret = request_irq(up->port.irq, serial8250_interrupt, |
1552 | irq_flags, "serial", i); | 1553 | irq_flags, "serial", i); |
1553 | if (ret < 0) | 1554 | if (ret < 0) |
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h index 91bd28f2bb47..a10a40cc0d9e 100644 --- a/drivers/serial/8250.h +++ b/drivers/serial/8250.h | |||
@@ -78,3 +78,8 @@ struct serial8250_config { | |||
78 | #else | 78 | #else |
79 | #define ALPHA_KLUDGE_MCR 0 | 79 | #define ALPHA_KLUDGE_MCR 0 |
80 | #endif | 80 | #endif |
81 | |||
82 | #ifndef SERIAL_EXTRA_IRQ_FLAGS | ||
83 | #define SERIAL_EXTRA_IRQ_FLAGS 0 | ||
84 | #endif | ||
85 | |||
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 62e6eb136a3c..9bc42763623c 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -1361,7 +1361,7 @@ config SERIAL_SC26XX_CONSOLE | |||
1361 | 1361 | ||
1362 | config SERIAL_BFIN_SPORT | 1362 | config SERIAL_BFIN_SPORT |
1363 | tristate "Blackfin SPORT emulate UART (EXPERIMENTAL)" | 1363 | tristate "Blackfin SPORT emulate UART (EXPERIMENTAL)" |
1364 | depends on BFIN && EXPERIMENTAL | 1364 | depends on BLACKFIN && EXPERIMENTAL |
1365 | select SERIAL_CORE | 1365 | select SERIAL_CORE |
1366 | help | 1366 | help |
1367 | Enble support SPORT emulate UART on Blackfin series. | 1367 | Enble support SPORT emulate UART on Blackfin series. |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 8fdafc27fce8..ce6ee92b3a1b 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -184,15 +184,15 @@ static void put_string(struct sci_port *sci_port, const char *buffer, int count) | |||
184 | int h, l; | 184 | int h, l; |
185 | 185 | ||
186 | c = *p++; | 186 | c = *p++; |
187 | h = highhex(c); | 187 | h = hex_asc_hi(c); |
188 | l = lowhex(c); | 188 | l = hex_asc_lo(c); |
189 | put_char(port, h); | 189 | put_char(port, h); |
190 | put_char(port, l); | 190 | put_char(port, l); |
191 | checksum += h + l; | 191 | checksum += h + l; |
192 | } | 192 | } |
193 | put_char(port, '#'); | 193 | put_char(port, '#'); |
194 | put_char(port, highhex(checksum)); | 194 | put_char(port, hex_asc_hi(checksum)); |
195 | put_char(port, lowhex(checksum)); | 195 | put_char(port, hex_asc_lo(checksum)); |
196 | } while (get_char(port) != '+'); | 196 | } while (get_char(port) != '+'); |
197 | } else | 197 | } else |
198 | #endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */ | 198 | #endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */ |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 55cc7b80422a..0a12e90ad416 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -649,15 +649,14 @@ int __uio_register_device(struct module *owner, | |||
649 | if (ret) | 649 | if (ret) |
650 | goto err_get_minor; | 650 | goto err_get_minor; |
651 | 651 | ||
652 | idev->dev = device_create(uio_class->class, parent, | 652 | idev->dev = device_create_drvdata(uio_class->class, parent, |
653 | MKDEV(uio_major, idev->minor), | 653 | MKDEV(uio_major, idev->minor), idev, |
654 | "uio%d", idev->minor); | 654 | "uio%d", idev->minor); |
655 | if (IS_ERR(idev->dev)) { | 655 | if (IS_ERR(idev->dev)) { |
656 | printk(KERN_ERR "UIO: device register failed\n"); | 656 | printk(KERN_ERR "UIO: device register failed\n"); |
657 | ret = PTR_ERR(idev->dev); | 657 | ret = PTR_ERR(idev->dev); |
658 | goto err_device_create; | 658 | goto err_device_create; |
659 | } | 659 | } |
660 | dev_set_drvdata(idev->dev, idev); | ||
661 | 660 | ||
662 | ret = uio_dev_add_attributes(idev); | 661 | ret = uio_dev_add_attributes(idev); |
663 | if (ret) | 662 | if (ret) |
diff --git a/drivers/usb/class/Kconfig b/drivers/usb/class/Kconfig index 3a9102d2591b..66f17ed88cb5 100644 --- a/drivers/usb/class/Kconfig +++ b/drivers/usb/class/Kconfig | |||
@@ -29,3 +29,14 @@ config USB_PRINTER | |||
29 | To compile this driver as a module, choose M here: the | 29 | To compile this driver as a module, choose M here: the |
30 | module will be called usblp. | 30 | module will be called usblp. |
31 | 31 | ||
32 | config USB_WDM | ||
33 | tristate "USB Wireless Device Management support" | ||
34 | depends on USB | ||
35 | ---help--- | ||
36 | This driver supports the WMC Device Management functionality | ||
37 | of cell phones compliant to the CDC WMC specification. You can use | ||
38 | AT commands over this device. | ||
39 | |||
40 | To compile this driver as a module, choose M here: the | ||
41 | module will be called cdc-wdm. | ||
42 | |||
diff --git a/drivers/usb/class/Makefile b/drivers/usb/class/Makefile index cc391e6c2af8..535d59a30600 100644 --- a/drivers/usb/class/Makefile +++ b/drivers/usb/class/Makefile | |||
@@ -5,3 +5,4 @@ | |||
5 | 5 | ||
6 | obj-$(CONFIG_USB_ACM) += cdc-acm.o | 6 | obj-$(CONFIG_USB_ACM) += cdc-acm.o |
7 | obj-$(CONFIG_USB_PRINTER) += usblp.o | 7 | obj-$(CONFIG_USB_PRINTER) += usblp.o |
8 | obj-$(CONFIG_USB_WDM) += cdc-wdm.o | ||
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c new file mode 100644 index 000000000000..107666d4e2ec --- /dev/null +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -0,0 +1,740 @@ | |||
1 | /* | ||
2 | * cdc-wdm.c | ||
3 | * | ||
4 | * This driver supports USB CDC WCM Device Management. | ||
5 | * | ||
6 | * Copyright (c) 2007-2008 Oliver Neukum | ||
7 | * | ||
8 | * Some code taken from cdc-acm.c | ||
9 | * | ||
10 | * Released under the GPLv2. | ||
11 | * | ||
12 | * Many thanks to Carl Nordbeck | ||
13 | */ | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/mutex.h> | ||
20 | #include <linux/uaccess.h> | ||
21 | #include <linux/bitops.h> | ||
22 | #include <linux/poll.h> | ||
23 | #include <linux/usb.h> | ||
24 | #include <linux/usb/cdc.h> | ||
25 | #include <asm/byteorder.h> | ||
26 | #include <asm/unaligned.h> | ||
27 | |||
28 | /* | ||
29 | * Version Information | ||
30 | */ | ||
31 | #define DRIVER_VERSION "v0.02" | ||
32 | #define DRIVER_AUTHOR "Oliver Neukum" | ||
33 | |||
34 | static struct usb_device_id wdm_ids[] = { | ||
35 | { | ||
36 | .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS | | ||
37 | USB_DEVICE_ID_MATCH_INT_SUBCLASS, | ||
38 | .bInterfaceClass = USB_CLASS_COMM, | ||
39 | .bInterfaceSubClass = USB_CDC_SUBCLASS_DMM | ||
40 | }, | ||
41 | { } | ||
42 | }; | ||
43 | |||
44 | #define WDM_MINOR_BASE 176 | ||
45 | |||
46 | |||
47 | #define WDM_IN_USE 1 | ||
48 | #define WDM_DISCONNECTING 2 | ||
49 | #define WDM_RESULT 3 | ||
50 | #define WDM_READ 4 | ||
51 | #define WDM_INT_STALL 5 | ||
52 | #define WDM_POLL_RUNNING 6 | ||
53 | |||
54 | |||
55 | #define WDM_MAX 16 | ||
56 | |||
57 | |||
58 | static DEFINE_MUTEX(wdm_mutex); | ||
59 | |||
60 | /* --- method tables --- */ | ||
61 | |||
62 | struct wdm_device { | ||
63 | u8 *inbuf; /* buffer for response */ | ||
64 | u8 *outbuf; /* buffer for command */ | ||
65 | u8 *sbuf; /* buffer for status */ | ||
66 | u8 *ubuf; /* buffer for copy to user space */ | ||
67 | |||
68 | struct urb *command; | ||
69 | struct urb *response; | ||
70 | struct urb *validity; | ||
71 | struct usb_interface *intf; | ||
72 | struct usb_ctrlrequest *orq; | ||
73 | struct usb_ctrlrequest *irq; | ||
74 | spinlock_t iuspin; | ||
75 | |||
76 | unsigned long flags; | ||
77 | u16 bufsize; | ||
78 | u16 wMaxCommand; | ||
79 | u16 wMaxPacketSize; | ||
80 | u16 bMaxPacketSize0; | ||
81 | __le16 inum; | ||
82 | int reslength; | ||
83 | int length; | ||
84 | int read; | ||
85 | int count; | ||
86 | dma_addr_t shandle; | ||
87 | dma_addr_t ihandle; | ||
88 | struct mutex wlock; | ||
89 | struct mutex rlock; | ||
90 | wait_queue_head_t wait; | ||
91 | struct work_struct rxwork; | ||
92 | int werr; | ||
93 | int rerr; | ||
94 | }; | ||
95 | |||
96 | static struct usb_driver wdm_driver; | ||
97 | |||
98 | /* --- callbacks --- */ | ||
99 | static void wdm_out_callback(struct urb *urb) | ||
100 | { | ||
101 | struct wdm_device *desc; | ||
102 | desc = urb->context; | ||
103 | spin_lock(&desc->iuspin); | ||
104 | desc->werr = urb->status; | ||
105 | spin_unlock(&desc->iuspin); | ||
106 | clear_bit(WDM_IN_USE, &desc->flags); | ||
107 | kfree(desc->outbuf); | ||
108 | wake_up(&desc->wait); | ||
109 | } | ||
110 | |||
111 | static void wdm_in_callback(struct urb *urb) | ||
112 | { | ||
113 | struct wdm_device *desc = urb->context; | ||
114 | int status = urb->status; | ||
115 | |||
116 | spin_lock(&desc->iuspin); | ||
117 | |||
118 | if (status) { | ||
119 | switch (status) { | ||
120 | case -ENOENT: | ||
121 | dev_dbg(&desc->intf->dev, | ||
122 | "nonzero urb status received: -ENOENT"); | ||
123 | break; | ||
124 | case -ECONNRESET: | ||
125 | dev_dbg(&desc->intf->dev, | ||
126 | "nonzero urb status received: -ECONNRESET"); | ||
127 | break; | ||
128 | case -ESHUTDOWN: | ||
129 | dev_dbg(&desc->intf->dev, | ||
130 | "nonzero urb status received: -ESHUTDOWN"); | ||
131 | break; | ||
132 | case -EPIPE: | ||
133 | err("nonzero urb status received: -EPIPE"); | ||
134 | break; | ||
135 | default: | ||
136 | err("Unexpected error %d", status); | ||
137 | break; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | desc->rerr = status; | ||
142 | desc->reslength = urb->actual_length; | ||
143 | memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength); | ||
144 | desc->length += desc->reslength; | ||
145 | wake_up(&desc->wait); | ||
146 | |||
147 | set_bit(WDM_READ, &desc->flags); | ||
148 | spin_unlock(&desc->iuspin); | ||
149 | } | ||
150 | |||
151 | static void wdm_int_callback(struct urb *urb) | ||
152 | { | ||
153 | int rv = 0; | ||
154 | int status = urb->status; | ||
155 | struct wdm_device *desc; | ||
156 | struct usb_ctrlrequest *req; | ||
157 | struct usb_cdc_notification *dr; | ||
158 | |||
159 | desc = urb->context; | ||
160 | req = desc->irq; | ||
161 | dr = (struct usb_cdc_notification *)desc->sbuf; | ||
162 | |||
163 | if (status) { | ||
164 | switch (status) { | ||
165 | case -ESHUTDOWN: | ||
166 | case -ENOENT: | ||
167 | case -ECONNRESET: | ||
168 | return; /* unplug */ | ||
169 | case -EPIPE: | ||
170 | set_bit(WDM_INT_STALL, &desc->flags); | ||
171 | err("Stall on int endpoint"); | ||
172 | goto sw; /* halt is cleared in work */ | ||
173 | default: | ||
174 | err("nonzero urb status received: %d", status); | ||
175 | break; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | if (urb->actual_length < sizeof(struct usb_cdc_notification)) { | ||
180 | err("wdm_int_callback - %d bytes", urb->actual_length); | ||
181 | goto exit; | ||
182 | } | ||
183 | |||
184 | switch (dr->bNotificationType) { | ||
185 | case USB_CDC_NOTIFY_RESPONSE_AVAILABLE: | ||
186 | dev_dbg(&desc->intf->dev, | ||
187 | "NOTIFY_RESPONSE_AVAILABLE received: index %d len %d", | ||
188 | dr->wIndex, dr->wLength); | ||
189 | break; | ||
190 | |||
191 | case USB_CDC_NOTIFY_NETWORK_CONNECTION: | ||
192 | |||
193 | dev_dbg(&desc->intf->dev, | ||
194 | "NOTIFY_NETWORK_CONNECTION %s network", | ||
195 | dr->wValue ? "connected to" : "disconnected from"); | ||
196 | goto exit; | ||
197 | default: | ||
198 | clear_bit(WDM_POLL_RUNNING, &desc->flags); | ||
199 | err("unknown notification %d received: index %d len %d", | ||
200 | dr->bNotificationType, dr->wIndex, dr->wLength); | ||
201 | goto exit; | ||
202 | } | ||
203 | |||
204 | req->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE); | ||
205 | req->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; | ||
206 | req->wValue = 0; | ||
207 | req->wIndex = desc->inum; | ||
208 | req->wLength = cpu_to_le16(desc->bMaxPacketSize0); | ||
209 | |||
210 | usb_fill_control_urb( | ||
211 | desc->response, | ||
212 | interface_to_usbdev(desc->intf), | ||
213 | /* using common endpoint 0 */ | ||
214 | usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), | ||
215 | (unsigned char *)req, | ||
216 | desc->inbuf, | ||
217 | desc->bMaxPacketSize0, | ||
218 | wdm_in_callback, | ||
219 | desc | ||
220 | ); | ||
221 | desc->response->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
222 | spin_lock(&desc->iuspin); | ||
223 | clear_bit(WDM_READ, &desc->flags); | ||
224 | if (!test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
225 | rv = usb_submit_urb(desc->response, GFP_ATOMIC); | ||
226 | dev_dbg(&desc->intf->dev, "%s: usb_submit_urb %d", | ||
227 | __func__, rv); | ||
228 | } | ||
229 | spin_unlock(&desc->iuspin); | ||
230 | if (rv < 0) { | ||
231 | if (rv == -EPERM) | ||
232 | return; | ||
233 | if (rv == -ENOMEM) { | ||
234 | sw: | ||
235 | rv = schedule_work(&desc->rxwork); | ||
236 | if (rv) | ||
237 | err("Cannot schedule work"); | ||
238 | } | ||
239 | } | ||
240 | exit: | ||
241 | rv = usb_submit_urb(urb, GFP_ATOMIC); | ||
242 | if (rv) | ||
243 | err("%s - usb_submit_urb failed with result %d", | ||
244 | __func__, rv); | ||
245 | |||
246 | } | ||
247 | |||
248 | static void kill_urbs(struct wdm_device *desc) | ||
249 | { | ||
250 | usb_kill_urb(desc->command); | ||
251 | usb_kill_urb(desc->validity); | ||
252 | usb_kill_urb(desc->response); | ||
253 | } | ||
254 | |||
255 | static void free_urbs(struct wdm_device *desc) | ||
256 | { | ||
257 | usb_free_urb(desc->validity); | ||
258 | usb_free_urb(desc->response); | ||
259 | usb_free_urb(desc->command); | ||
260 | } | ||
261 | |||
262 | static void cleanup(struct wdm_device *desc) | ||
263 | { | ||
264 | usb_buffer_free(interface_to_usbdev(desc->intf), | ||
265 | desc->wMaxPacketSize, | ||
266 | desc->sbuf, | ||
267 | desc->validity->transfer_dma); | ||
268 | usb_buffer_free(interface_to_usbdev(desc->intf), | ||
269 | desc->wMaxPacketSize, | ||
270 | desc->inbuf, | ||
271 | desc->response->transfer_dma); | ||
272 | kfree(desc->orq); | ||
273 | kfree(desc->irq); | ||
274 | kfree(desc->ubuf); | ||
275 | free_urbs(desc); | ||
276 | kfree(desc); | ||
277 | } | ||
278 | |||
279 | static ssize_t wdm_write | ||
280 | (struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | ||
281 | { | ||
282 | u8 *buf; | ||
283 | int rv = -EMSGSIZE, r, we; | ||
284 | struct wdm_device *desc = file->private_data; | ||
285 | struct usb_ctrlrequest *req; | ||
286 | |||
287 | if (count > desc->wMaxCommand) | ||
288 | count = desc->wMaxCommand; | ||
289 | |||
290 | spin_lock_irq(&desc->iuspin); | ||
291 | we = desc->werr; | ||
292 | desc->werr = 0; | ||
293 | spin_unlock_irq(&desc->iuspin); | ||
294 | if (we < 0) | ||
295 | return -EIO; | ||
296 | |||
297 | r = mutex_lock_interruptible(&desc->wlock); /* concurrent writes */ | ||
298 | rv = -ERESTARTSYS; | ||
299 | if (r) | ||
300 | goto outnl; | ||
301 | |||
302 | r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, | ||
303 | &desc->flags)); | ||
304 | if (r < 0) | ||
305 | goto out; | ||
306 | |||
307 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
308 | rv = -ENODEV; | ||
309 | goto out; | ||
310 | } | ||
311 | |||
312 | desc->outbuf = buf = kmalloc(count, GFP_KERNEL); | ||
313 | if (!buf) { | ||
314 | rv = -ENOMEM; | ||
315 | goto out; | ||
316 | } | ||
317 | |||
318 | r = copy_from_user(buf, buffer, count); | ||
319 | if (r > 0) { | ||
320 | kfree(buf); | ||
321 | rv = -EFAULT; | ||
322 | goto out; | ||
323 | } | ||
324 | |||
325 | req = desc->orq; | ||
326 | usb_fill_control_urb( | ||
327 | desc->command, | ||
328 | interface_to_usbdev(desc->intf), | ||
329 | /* using common endpoint 0 */ | ||
330 | usb_sndctrlpipe(interface_to_usbdev(desc->intf), 0), | ||
331 | (unsigned char *)req, | ||
332 | buf, | ||
333 | count, | ||
334 | wdm_out_callback, | ||
335 | desc | ||
336 | ); | ||
337 | |||
338 | req->bRequestType = (USB_DIR_OUT | USB_TYPE_CLASS | | ||
339 | USB_RECIP_INTERFACE); | ||
340 | req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND; | ||
341 | req->wValue = 0; | ||
342 | req->wIndex = desc->inum; | ||
343 | req->wLength = cpu_to_le16(count); | ||
344 | set_bit(WDM_IN_USE, &desc->flags); | ||
345 | |||
346 | rv = usb_submit_urb(desc->command, GFP_KERNEL); | ||
347 | if (rv < 0) { | ||
348 | kfree(buf); | ||
349 | clear_bit(WDM_IN_USE, &desc->flags); | ||
350 | } else { | ||
351 | dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d", | ||
352 | req->wIndex); | ||
353 | } | ||
354 | out: | ||
355 | mutex_unlock(&desc->wlock); | ||
356 | outnl: | ||
357 | return rv < 0 ? rv : count; | ||
358 | } | ||
359 | |||
360 | static ssize_t wdm_read | ||
361 | (struct file *file, char __user *buffer, size_t count, loff_t *ppos) | ||
362 | { | ||
363 | int rv, cntr; | ||
364 | int i = 0; | ||
365 | struct wdm_device *desc = file->private_data; | ||
366 | |||
367 | |||
368 | rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */ | ||
369 | if (rv < 0) | ||
370 | return -ERESTARTSYS; | ||
371 | |||
372 | if (desc->length == 0) { | ||
373 | desc->read = 0; | ||
374 | retry: | ||
375 | i++; | ||
376 | rv = wait_event_interruptible(desc->wait, | ||
377 | test_bit(WDM_READ, &desc->flags)); | ||
378 | |||
379 | if (rv < 0) { | ||
380 | rv = -ERESTARTSYS; | ||
381 | goto err; | ||
382 | } | ||
383 | |||
384 | spin_lock_irq(&desc->iuspin); | ||
385 | |||
386 | if (desc->rerr) { /* read completed, error happened */ | ||
387 | int t = desc->rerr; | ||
388 | desc->rerr = 0; | ||
389 | spin_unlock_irq(&desc->iuspin); | ||
390 | err("reading had resulted in %d", t); | ||
391 | rv = -EIO; | ||
392 | goto err; | ||
393 | } | ||
394 | /* | ||
395 | * recheck whether we've lost the race | ||
396 | * against the completion handler | ||
397 | */ | ||
398 | if (!test_bit(WDM_READ, &desc->flags)) { /* lost race */ | ||
399 | spin_unlock_irq(&desc->iuspin); | ||
400 | goto retry; | ||
401 | } | ||
402 | if (!desc->reslength) { /* zero length read */ | ||
403 | spin_unlock_irq(&desc->iuspin); | ||
404 | goto retry; | ||
405 | } | ||
406 | clear_bit(WDM_READ, &desc->flags); | ||
407 | spin_unlock_irq(&desc->iuspin); | ||
408 | } | ||
409 | |||
410 | cntr = count > desc->length ? desc->length : count; | ||
411 | rv = copy_to_user(buffer, desc->ubuf, cntr); | ||
412 | if (rv > 0) { | ||
413 | rv = -EFAULT; | ||
414 | goto err; | ||
415 | } | ||
416 | |||
417 | for (i = 0; i < desc->length - cntr; i++) | ||
418 | desc->ubuf[i] = desc->ubuf[i + cntr]; | ||
419 | |||
420 | desc->length -= cntr; | ||
421 | rv = cntr; | ||
422 | |||
423 | err: | ||
424 | mutex_unlock(&desc->rlock); | ||
425 | if (rv < 0) | ||
426 | err("wdm_read: exit error"); | ||
427 | return rv; | ||
428 | } | ||
429 | |||
430 | static int wdm_flush(struct file *file, fl_owner_t id) | ||
431 | { | ||
432 | struct wdm_device *desc = file->private_data; | ||
433 | |||
434 | wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags)); | ||
435 | if (desc->werr < 0) | ||
436 | err("Error in flush path: %d", desc->werr); | ||
437 | |||
438 | return desc->werr; | ||
439 | } | ||
440 | |||
441 | static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait) | ||
442 | { | ||
443 | struct wdm_device *desc = file->private_data; | ||
444 | unsigned long flags; | ||
445 | unsigned int mask = 0; | ||
446 | |||
447 | spin_lock_irqsave(&desc->iuspin, flags); | ||
448 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
449 | mask = POLLERR; | ||
450 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
451 | goto desc_out; | ||
452 | } | ||
453 | if (test_bit(WDM_READ, &desc->flags)) | ||
454 | mask = POLLIN | POLLRDNORM; | ||
455 | if (desc->rerr || desc->werr) | ||
456 | mask |= POLLERR; | ||
457 | if (!test_bit(WDM_IN_USE, &desc->flags)) | ||
458 | mask |= POLLOUT | POLLWRNORM; | ||
459 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
460 | |||
461 | poll_wait(file, &desc->wait, wait); | ||
462 | |||
463 | desc_out: | ||
464 | return mask; | ||
465 | } | ||
466 | |||
467 | static int wdm_open(struct inode *inode, struct file *file) | ||
468 | { | ||
469 | int minor = iminor(inode); | ||
470 | int rv = -ENODEV; | ||
471 | struct usb_interface *intf; | ||
472 | struct wdm_device *desc; | ||
473 | |||
474 | mutex_lock(&wdm_mutex); | ||
475 | intf = usb_find_interface(&wdm_driver, minor); | ||
476 | if (!intf) | ||
477 | goto out; | ||
478 | |||
479 | desc = usb_get_intfdata(intf); | ||
480 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) | ||
481 | goto out; | ||
482 | |||
483 | desc->count++; | ||
484 | file->private_data = desc; | ||
485 | |||
486 | rv = usb_submit_urb(desc->validity, GFP_KERNEL); | ||
487 | |||
488 | if (rv < 0) { | ||
489 | desc->count--; | ||
490 | err("Error submitting int urb - %d", rv); | ||
491 | goto out; | ||
492 | } | ||
493 | rv = 0; | ||
494 | |||
495 | out: | ||
496 | mutex_unlock(&wdm_mutex); | ||
497 | return rv; | ||
498 | } | ||
499 | |||
500 | static int wdm_release(struct inode *inode, struct file *file) | ||
501 | { | ||
502 | struct wdm_device *desc = file->private_data; | ||
503 | |||
504 | mutex_lock(&wdm_mutex); | ||
505 | desc->count--; | ||
506 | if (!desc->count) { | ||
507 | dev_dbg(&desc->intf->dev, "wdm_release: cleanup"); | ||
508 | kill_urbs(desc); | ||
509 | } | ||
510 | mutex_unlock(&wdm_mutex); | ||
511 | return 0; | ||
512 | } | ||
513 | |||
514 | static const struct file_operations wdm_fops = { | ||
515 | .owner = THIS_MODULE, | ||
516 | .read = wdm_read, | ||
517 | .write = wdm_write, | ||
518 | .open = wdm_open, | ||
519 | .flush = wdm_flush, | ||
520 | .release = wdm_release, | ||
521 | .poll = wdm_poll | ||
522 | }; | ||
523 | |||
524 | static struct usb_class_driver wdm_class = { | ||
525 | .name = "cdc-wdm%d", | ||
526 | .fops = &wdm_fops, | ||
527 | .minor_base = WDM_MINOR_BASE, | ||
528 | }; | ||
529 | |||
530 | /* --- error handling --- */ | ||
531 | static void wdm_rxwork(struct work_struct *work) | ||
532 | { | ||
533 | struct wdm_device *desc = container_of(work, struct wdm_device, rxwork); | ||
534 | unsigned long flags; | ||
535 | int rv; | ||
536 | |||
537 | spin_lock_irqsave(&desc->iuspin, flags); | ||
538 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
539 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
540 | } else { | ||
541 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
542 | rv = usb_submit_urb(desc->response, GFP_KERNEL); | ||
543 | if (rv < 0 && rv != -EPERM) { | ||
544 | spin_lock_irqsave(&desc->iuspin, flags); | ||
545 | if (!test_bit(WDM_DISCONNECTING, &desc->flags)) | ||
546 | schedule_work(&desc->rxwork); | ||
547 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
548 | } | ||
549 | } | ||
550 | } | ||
551 | |||
552 | /* --- hotplug --- */ | ||
553 | |||
554 | static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id) | ||
555 | { | ||
556 | int rv = -EINVAL; | ||
557 | struct usb_device *udev = interface_to_usbdev(intf); | ||
558 | struct wdm_device *desc; | ||
559 | struct usb_host_interface *iface; | ||
560 | struct usb_endpoint_descriptor *ep; | ||
561 | struct usb_cdc_dmm_desc *dmhd; | ||
562 | u8 *buffer = intf->altsetting->extra; | ||
563 | int buflen = intf->altsetting->extralen; | ||
564 | u16 maxcom = 0; | ||
565 | |||
566 | if (!buffer) | ||
567 | goto out; | ||
568 | |||
569 | while (buflen > 0) { | ||
570 | if (buffer [1] != USB_DT_CS_INTERFACE) { | ||
571 | err("skipping garbage"); | ||
572 | goto next_desc; | ||
573 | } | ||
574 | |||
575 | switch (buffer [2]) { | ||
576 | case USB_CDC_HEADER_TYPE: | ||
577 | break; | ||
578 | case USB_CDC_DMM_TYPE: | ||
579 | dmhd = (struct usb_cdc_dmm_desc *)buffer; | ||
580 | maxcom = le16_to_cpu(dmhd->wMaxCommand); | ||
581 | dev_dbg(&intf->dev, | ||
582 | "Finding maximum buffer length: %d", maxcom); | ||
583 | break; | ||
584 | default: | ||
585 | err("Ignoring extra header, type %d, length %d", | ||
586 | buffer[2], buffer[0]); | ||
587 | break; | ||
588 | } | ||
589 | next_desc: | ||
590 | buflen -= buffer[0]; | ||
591 | buffer += buffer[0]; | ||
592 | } | ||
593 | |||
594 | rv = -ENOMEM; | ||
595 | desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL); | ||
596 | if (!desc) | ||
597 | goto out; | ||
598 | mutex_init(&desc->wlock); | ||
599 | mutex_init(&desc->rlock); | ||
600 | spin_lock_init(&desc->iuspin); | ||
601 | init_waitqueue_head(&desc->wait); | ||
602 | desc->wMaxCommand = maxcom; | ||
603 | desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); | ||
604 | desc->intf = intf; | ||
605 | INIT_WORK(&desc->rxwork, wdm_rxwork); | ||
606 | |||
607 | iface = &intf->altsetting[0]; | ||
608 | ep = &iface->endpoint[0].desc; | ||
609 | if (!usb_endpoint_is_int_in(ep)) { | ||
610 | rv = -EINVAL; | ||
611 | goto err; | ||
612 | } | ||
613 | |||
614 | desc->wMaxPacketSize = ep->wMaxPacketSize; | ||
615 | desc->bMaxPacketSize0 = cpu_to_le16(udev->descriptor.bMaxPacketSize0); | ||
616 | |||
617 | desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | ||
618 | if (!desc->orq) | ||
619 | goto err; | ||
620 | desc->irq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | ||
621 | if (!desc->irq) | ||
622 | goto err; | ||
623 | |||
624 | desc->validity = usb_alloc_urb(0, GFP_KERNEL); | ||
625 | if (!desc->validity) | ||
626 | goto err; | ||
627 | |||
628 | desc->response = usb_alloc_urb(0, GFP_KERNEL); | ||
629 | if (!desc->response) | ||
630 | goto err; | ||
631 | |||
632 | desc->command = usb_alloc_urb(0, GFP_KERNEL); | ||
633 | if (!desc->command) | ||
634 | goto err; | ||
635 | |||
636 | desc->ubuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); | ||
637 | if (!desc->ubuf) | ||
638 | goto err; | ||
639 | |||
640 | desc->sbuf = usb_buffer_alloc(interface_to_usbdev(intf), | ||
641 | desc->wMaxPacketSize, | ||
642 | GFP_KERNEL, | ||
643 | &desc->validity->transfer_dma); | ||
644 | if (!desc->sbuf) | ||
645 | goto err; | ||
646 | |||
647 | desc->inbuf = usb_buffer_alloc(interface_to_usbdev(intf), | ||
648 | desc->bMaxPacketSize0, | ||
649 | GFP_KERNEL, | ||
650 | &desc->response->transfer_dma); | ||
651 | if (!desc->inbuf) | ||
652 | goto err2; | ||
653 | |||
654 | usb_fill_int_urb( | ||
655 | desc->validity, | ||
656 | interface_to_usbdev(intf), | ||
657 | usb_rcvintpipe(interface_to_usbdev(intf), ep->bEndpointAddress), | ||
658 | desc->sbuf, | ||
659 | desc->wMaxPacketSize, | ||
660 | wdm_int_callback, | ||
661 | desc, | ||
662 | ep->bInterval | ||
663 | ); | ||
664 | desc->validity->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
665 | |||
666 | usb_set_intfdata(intf, desc); | ||
667 | rv = usb_register_dev(intf, &wdm_class); | ||
668 | dev_info(&intf->dev, "cdc-wdm%d: USB WDM device\n", | ||
669 | intf->minor - WDM_MINOR_BASE); | ||
670 | if (rv < 0) | ||
671 | goto err; | ||
672 | out: | ||
673 | return rv; | ||
674 | err2: | ||
675 | usb_buffer_free(interface_to_usbdev(desc->intf), | ||
676 | desc->wMaxPacketSize, | ||
677 | desc->sbuf, | ||
678 | desc->validity->transfer_dma); | ||
679 | err: | ||
680 | free_urbs(desc); | ||
681 | kfree(desc->ubuf); | ||
682 | kfree(desc->orq); | ||
683 | kfree(desc->irq); | ||
684 | kfree(desc); | ||
685 | return rv; | ||
686 | } | ||
687 | |||
688 | static void wdm_disconnect(struct usb_interface *intf) | ||
689 | { | ||
690 | struct wdm_device *desc; | ||
691 | unsigned long flags; | ||
692 | |||
693 | usb_deregister_dev(intf, &wdm_class); | ||
694 | mutex_lock(&wdm_mutex); | ||
695 | desc = usb_get_intfdata(intf); | ||
696 | |||
697 | /* the spinlock makes sure no new urbs are generated in the callbacks */ | ||
698 | spin_lock_irqsave(&desc->iuspin, flags); | ||
699 | set_bit(WDM_DISCONNECTING, &desc->flags); | ||
700 | set_bit(WDM_READ, &desc->flags); | ||
701 | clear_bit(WDM_IN_USE, &desc->flags); | ||
702 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
703 | cancel_work_sync(&desc->rxwork); | ||
704 | kill_urbs(desc); | ||
705 | wake_up_all(&desc->wait); | ||
706 | if (!desc->count) | ||
707 | cleanup(desc); | ||
708 | mutex_unlock(&wdm_mutex); | ||
709 | } | ||
710 | |||
711 | static struct usb_driver wdm_driver = { | ||
712 | .name = "cdc_wdm", | ||
713 | .probe = wdm_probe, | ||
714 | .disconnect = wdm_disconnect, | ||
715 | .id_table = wdm_ids, | ||
716 | }; | ||
717 | |||
718 | /* --- low level module stuff --- */ | ||
719 | |||
720 | static int __init wdm_init(void) | ||
721 | { | ||
722 | int rv; | ||
723 | |||
724 | rv = usb_register(&wdm_driver); | ||
725 | |||
726 | return rv; | ||
727 | } | ||
728 | |||
729 | static void __exit wdm_exit(void) | ||
730 | { | ||
731 | usb_deregister(&wdm_driver); | ||
732 | } | ||
733 | |||
734 | module_init(wdm_init); | ||
735 | module_exit(wdm_exit); | ||
736 | |||
737 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
738 | MODULE_DESCRIPTION("USB Abstract Control Model driver for " | ||
739 | "USB WCM Device Management"); | ||
740 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index bf10e9c4195e..09a53e7f3327 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -818,12 +818,12 @@ static int usb_register_bus(struct usb_bus *bus) | |||
818 | set_bit (busnum, busmap.busmap); | 818 | set_bit (busnum, busmap.busmap); |
819 | bus->busnum = busnum; | 819 | bus->busnum = busnum; |
820 | 820 | ||
821 | bus->dev = device_create(usb_host_class, bus->controller, MKDEV(0, 0), | 821 | bus->dev = device_create_drvdata(usb_host_class, bus->controller, |
822 | "usb_host%d", busnum); | 822 | MKDEV(0, 0), bus, |
823 | "usb_host%d", busnum); | ||
823 | result = PTR_ERR(bus->dev); | 824 | result = PTR_ERR(bus->dev); |
824 | if (IS_ERR(bus->dev)) | 825 | if (IS_ERR(bus->dev)) |
825 | goto error_create_class_dev; | 826 | goto error_create_class_dev; |
826 | dev_set_drvdata(bus->dev, bus); | ||
827 | 827 | ||
828 | /* Add it to the local list of buses */ | 828 | /* Add it to the local list of buses */ |
829 | list_add (&bus->bus_list, &usb_bus_list); | 829 | list_add (&bus->bus_list, &usb_bus_list); |
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index 499b7a23f351..e02bfd4df3a6 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -1526,7 +1526,8 @@ static void udc_disable(struct pxa_udc *udc) | |||
1526 | 1526 | ||
1527 | ep0_idle(udc); | 1527 | ep0_idle(udc); |
1528 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 1528 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
1529 | udc->mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); | 1529 | if (udc->mach->udc_command) |
1530 | udc->mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); | ||
1530 | } | 1531 | } |
1531 | 1532 | ||
1532 | /** | 1533 | /** |
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index d187d0313742..3adfda813a7b 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
@@ -115,6 +115,8 @@ static int ehci_orion_setup(struct usb_hcd *hcd) | |||
115 | if (retval) | 115 | if (retval) |
116 | return retval; | 116 | return retval; |
117 | 117 | ||
118 | hcd->has_tt = 1; | ||
119 | |||
118 | ehci_reset(ehci); | 120 | ehci_reset(ehci); |
119 | ehci_port_power(ehci, 0); | 121 | ehci_port_power(ehci, 0); |
120 | 122 | ||
diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index 24230c638b8e..4cfa25b0f44e 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c | |||
@@ -595,14 +595,14 @@ static int interfacekit_probe(struct usb_interface *intf, const struct usb_devic | |||
595 | } while(value); | 595 | } while(value); |
596 | kit->dev_no = bit; | 596 | kit->dev_no = bit; |
597 | 597 | ||
598 | kit->dev = device_create(phidget_class, &kit->udev->dev, 0, | 598 | kit->dev = device_create_drvdata(phidget_class, &kit->udev->dev, |
599 | "interfacekit%d", kit->dev_no); | 599 | MKDEV(0, 0), kit, |
600 | "interfacekit%d", kit->dev_no); | ||
600 | if (IS_ERR(kit->dev)) { | 601 | if (IS_ERR(kit->dev)) { |
601 | rc = PTR_ERR(kit->dev); | 602 | rc = PTR_ERR(kit->dev); |
602 | kit->dev = NULL; | 603 | kit->dev = NULL; |
603 | goto out; | 604 | goto out; |
604 | } | 605 | } |
605 | dev_set_drvdata(kit->dev, kit); | ||
606 | 606 | ||
607 | if (usb_submit_urb(kit->irq, GFP_KERNEL)) { | 607 | if (usb_submit_urb(kit->irq, GFP_KERNEL)) { |
608 | rc = -EIO; | 608 | rc = -EIO; |
diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c index f0113c17cc5a..9b4696f21b22 100644 --- a/drivers/usb/misc/phidgetmotorcontrol.c +++ b/drivers/usb/misc/phidgetmotorcontrol.c | |||
@@ -365,16 +365,15 @@ static int motorcontrol_probe(struct usb_interface *intf, const struct usb_devic | |||
365 | } while(value); | 365 | } while(value); |
366 | mc->dev_no = bit; | 366 | mc->dev_no = bit; |
367 | 367 | ||
368 | mc->dev = device_create(phidget_class, &mc->udev->dev, 0, | 368 | mc->dev = device_create_drvdata(phidget_class, &mc->udev->dev, |
369 | "motorcontrol%d", mc->dev_no); | 369 | MKDEV(0, 0), mc, |
370 | "motorcontrol%d", mc->dev_no); | ||
370 | if (IS_ERR(mc->dev)) { | 371 | if (IS_ERR(mc->dev)) { |
371 | rc = PTR_ERR(mc->dev); | 372 | rc = PTR_ERR(mc->dev); |
372 | mc->dev = NULL; | 373 | mc->dev = NULL; |
373 | goto out; | 374 | goto out; |
374 | } | 375 | } |
375 | 376 | ||
376 | dev_set_drvdata(mc->dev, mc); | ||
377 | |||
378 | if (usb_submit_urb(mc->irq, GFP_KERNEL)) { | 377 | if (usb_submit_urb(mc->irq, GFP_KERNEL)) { |
379 | rc = -EIO; | 378 | rc = -EIO; |
380 | goto out; | 379 | goto out; |
diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index 7d590c09434a..1ca7ddb41d4d 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c | |||
@@ -275,14 +275,14 @@ servo_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
275 | } while (value); | 275 | } while (value); |
276 | dev->dev_no = bit; | 276 | dev->dev_no = bit; |
277 | 277 | ||
278 | dev->dev = device_create(phidget_class, &dev->udev->dev, 0, | 278 | dev->dev = device_create_drvdata(phidget_class, &dev->udev->dev, |
279 | "servo%d", dev->dev_no); | 279 | MKDEV(0, 0), dev, |
280 | "servo%d", dev->dev_no); | ||
280 | if (IS_ERR(dev->dev)) { | 281 | if (IS_ERR(dev->dev)) { |
281 | rc = PTR_ERR(dev->dev); | 282 | rc = PTR_ERR(dev->dev); |
282 | dev->dev = NULL; | 283 | dev->dev = NULL; |
283 | goto out; | 284 | goto out; |
284 | } | 285 | } |
285 | dev_set_drvdata(dev->dev, dev); | ||
286 | 286 | ||
287 | servo_count = dev->type & SERVO_COUNT_QUAD ? 4 : 1; | 287 | servo_count = dev->type & SERVO_COUNT_QUAD ? 4 : 1; |
288 | 288 | ||
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index ba28fdc9ccd2..1f7c86bd8297 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -28,6 +28,7 @@ static int debug; | |||
28 | 28 | ||
29 | static struct usb_device_id id_table [] = { | 29 | static struct usb_device_id id_table [] = { |
30 | { USB_DEVICE(0x4348, 0x5523) }, | 30 | { USB_DEVICE(0x4348, 0x5523) }, |
31 | { USB_DEVICE(0x1a86, 0x7523) }, | ||
31 | { }, | 32 | { }, |
32 | }; | 33 | }; |
33 | MODULE_DEVICE_TABLE(usb, id_table); | 34 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 5b349ece7247..3cee6feac174 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -374,6 +374,7 @@ static struct usb_device_id id_table_combined [] = { | |||
374 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 374 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
375 | { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), | 375 | { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), |
376 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 376 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
377 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, | ||
377 | { }, /* Optional parameter entry */ | 378 | { }, /* Optional parameter entry */ |
378 | { } /* Terminating entry */ | 379 | { } /* Terminating entry */ |
379 | }; | 380 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 504edf8c3a3f..a72f2c81d664 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -592,6 +592,12 @@ | |||
592 | #define FIC_NEO1973_DEBUG_PID 0x5118 | 592 | #define FIC_NEO1973_DEBUG_PID 0x5118 |
593 | 593 | ||
594 | /* | 594 | /* |
595 | * RATOC REX-USB60F | ||
596 | */ | ||
597 | #define RATOC_VENDOR_ID 0x0584 | ||
598 | #define RATOC_PRODUCT_ID_USB60F 0xb020 | ||
599 | |||
600 | /* | ||
595 | * BmRequestType: 1100 0000b | 601 | * BmRequestType: 1100 0000b |
596 | * bRequest: FTDI_E2_READ | 602 | * bRequest: FTDI_E2_READ |
597 | * wValue: 0 | 603 | * wValue: 0 |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e7e016e60333..6cecd2c12b1d 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -183,6 +183,7 @@ static int option_send_setup(struct usb_serial_port *port); | |||
183 | #define AXESSTEL_PRODUCT_MV110H 0x1000 | 183 | #define AXESSTEL_PRODUCT_MV110H 0x1000 |
184 | 184 | ||
185 | #define ONDA_VENDOR_ID 0x19d2 | 185 | #define ONDA_VENDOR_ID 0x19d2 |
186 | #define ONDA_PRODUCT_MSA501HS 0x0001 | ||
186 | #define ONDA_PRODUCT_ET502HS 0x0002 | 187 | #define ONDA_PRODUCT_ET502HS 0x0002 |
187 | 188 | ||
188 | #define BANDRICH_VENDOR_ID 0x1A8D | 189 | #define BANDRICH_VENDOR_ID 0x1A8D |
@@ -196,6 +197,9 @@ static int option_send_setup(struct usb_serial_port *port); | |||
196 | 197 | ||
197 | #define MAXON_VENDOR_ID 0x16d8 | 198 | #define MAXON_VENDOR_ID 0x16d8 |
198 | 199 | ||
200 | #define TELIT_VENDOR_ID 0x1bc7 | ||
201 | #define TELIT_PRODUCT_UC864E 0x1003 | ||
202 | |||
199 | static struct usb_device_id option_ids[] = { | 203 | static struct usb_device_id option_ids[] = { |
200 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 204 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
201 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 205 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
@@ -297,13 +301,14 @@ static struct usb_device_id option_ids[] = { | |||
297 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, | 301 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, |
298 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, | 302 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, |
299 | { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, | 303 | { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, |
304 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) }, | ||
300 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, | 305 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, |
301 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, | 306 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, |
302 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, | 307 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, |
303 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, | 308 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, |
304 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ | 309 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
305 | { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ | 310 | { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ |
306 | { USB_DEVICE(0x19d2, 0x0001) }, /* Telstra NextG CDMA */ | 311 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, |
307 | { } /* Terminating entry */ | 312 | { } /* Terminating entry */ |
308 | }; | 313 | }; |
309 | MODULE_DEVICE_TABLE(usb, option_ids); | 314 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index c605fb68f807..234c5eea95a2 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -66,7 +66,6 @@ static struct usb_device_id id_table [] = { | |||
66 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) }, | 66 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) }, |
67 | { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, | 67 | { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, |
68 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, | 68 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, |
69 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, | ||
70 | { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, | 69 | { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, |
71 | { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) }, | 70 | { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) }, |
72 | { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, | 71 | { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 10cf872e5ecb..3bdefe020501 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -36,7 +36,6 @@ | |||
36 | 36 | ||
37 | #define RATOC_VENDOR_ID 0x0584 | 37 | #define RATOC_VENDOR_ID 0x0584 |
38 | #define RATOC_PRODUCT_ID 0xb000 | 38 | #define RATOC_PRODUCT_ID 0xb000 |
39 | #define RATOC_PRODUCT_ID_USB60F 0xb020 | ||
40 | 39 | ||
41 | #define TRIPP_VENDOR_ID 0x2478 | 40 | #define TRIPP_VENDOR_ID 0x2478 |
42 | #define TRIPP_PRODUCT_ID 0x2008 | 41 | #define TRIPP_PRODUCT_ID 0x2008 |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 2cdaf1ff8315..002b61b4f0f6 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -627,11 +627,9 @@ config FB_MAC | |||
627 | select FB_CFB_IMAGEBLIT | 627 | select FB_CFB_IMAGEBLIT |
628 | select FB_MACMODES | 628 | select FB_MACMODES |
629 | 629 | ||
630 | # bool ' Apple DAFB display support' CONFIG_FB_DAFB | ||
631 | config FB_HP300 | 630 | config FB_HP300 |
632 | bool | 631 | bool |
633 | depends on (FB = y) && HP300 | 632 | depends on (FB = y) && DIO |
634 | select FB_CFB_FILLRECT | ||
635 | select FB_CFB_IMAGEBLIT | 633 | select FB_CFB_IMAGEBLIT |
636 | default y | 634 | default y |
637 | 635 | ||
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index e6492c1048bf..05a328c11a8b 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -2261,7 +2261,7 @@ int __init amifb_init(void) | |||
2261 | amifb_setup(option); | 2261 | amifb_setup(option); |
2262 | #endif | 2262 | #endif |
2263 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_VIDEO)) | 2263 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_VIDEO)) |
2264 | return -ENXIO; | 2264 | return -ENODEV; |
2265 | 2265 | ||
2266 | /* | 2266 | /* |
2267 | * We request all registers starting from bplpt[0] | 2267 | * We request all registers starting from bplpt[0] |
@@ -2333,7 +2333,7 @@ default_chipset: | |||
2333 | strcat(fb_info.fix.id, "Unknown"); | 2333 | strcat(fb_info.fix.id, "Unknown"); |
2334 | goto default_chipset; | 2334 | goto default_chipset; |
2335 | #else /* CONFIG_FB_AMIGA_OCS */ | 2335 | #else /* CONFIG_FB_AMIGA_OCS */ |
2336 | err = -ENXIO; | 2336 | err = -ENODEV; |
2337 | goto amifb_error; | 2337 | goto amifb_error; |
2338 | #endif /* CONFIG_FB_AMIGA_OCS */ | 2338 | #endif /* CONFIG_FB_AMIGA_OCS */ |
2339 | break; | 2339 | break; |
diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c index 35477177bef4..6ef800bdf482 100644 --- a/drivers/video/display/display-sysfs.c +++ b/drivers/video/display/display-sysfs.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
27 | #include <linux/idr.h> | 27 | #include <linux/idr.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/kdev_t.h> | ||
29 | 30 | ||
30 | static ssize_t display_show_name(struct device *dev, | 31 | static ssize_t display_show_name(struct device *dev, |
31 | struct device_attribute *attr, char *buf) | 32 | struct device_attribute *attr, char *buf) |
@@ -152,10 +153,13 @@ struct display_device *display_device_register(struct display_driver *driver, | |||
152 | mutex_unlock(&allocated_dsp_lock); | 153 | mutex_unlock(&allocated_dsp_lock); |
153 | 154 | ||
154 | if (!ret) { | 155 | if (!ret) { |
155 | new_dev->dev = device_create(display_class, parent, 0, | 156 | new_dev->dev = device_create_drvdata(display_class, |
156 | "display%d", new_dev->idx); | 157 | parent, |
158 | MKDEV(0,0), | ||
159 | new_dev, | ||
160 | "display%d", | ||
161 | new_dev->idx); | ||
157 | if (!IS_ERR(new_dev->dev)) { | 162 | if (!IS_ERR(new_dev->dev)) { |
158 | dev_set_drvdata(new_dev->dev, new_dev); | ||
159 | new_dev->parent = parent; | 163 | new_dev->parent = parent; |
160 | new_dev->driver = driver; | 164 | new_dev->driver = driver; |
161 | mutex_init(&new_dev->lock); | 165 | mutex_init(&new_dev->lock); |
diff --git a/drivers/video/dnfb.c b/drivers/video/dnfb.c index b083ea7e9c69..606da043f4b4 100644 --- a/drivers/video/dnfb.c +++ b/drivers/video/dnfb.c | |||
@@ -284,6 +284,9 @@ int __init dnfb_init(void) | |||
284 | { | 284 | { |
285 | int ret; | 285 | int ret; |
286 | 286 | ||
287 | if (!MACH_IS_APOLLO) | ||
288 | return -ENODEV; | ||
289 | |||
287 | if (fb_get_options("dnfb", NULL)) | 290 | if (fb_get_options("dnfb", NULL)) |
288 | return -ENODEV; | 291 | return -ENODEV; |
289 | 292 | ||
diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c index 2eb4fb159084..b8ebff1e8493 100644 --- a/drivers/video/hpfb.c +++ b/drivers/video/hpfb.c | |||
@@ -382,7 +382,7 @@ int __init hpfb_init(void) | |||
382 | #define INTFBPADDR 0x560000 | 382 | #define INTFBPADDR 0x560000 |
383 | 383 | ||
384 | if (!MACH_IS_HP300) | 384 | if (!MACH_IS_HP300) |
385 | return -ENXIO; | 385 | return -ENODEV; |
386 | 386 | ||
387 | if (fb_get_options("hpfb", NULL)) | 387 | if (fb_get_options("hpfb", NULL)) |
388 | return -ENODEV; | 388 | return -ENODEV; |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 48aea39c35a5..3ee314beacc1 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -355,9 +355,8 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
355 | } | 355 | } |
356 | 356 | ||
357 | #ifdef CONFIG_CPU_FREQ | 357 | #ifdef CONFIG_CPU_FREQ |
358 | pr_debug("pxafb: dma period = %d ps, clock = %d kHz\n", | 358 | pr_debug("pxafb: dma period = %d ps\n", |
359 | pxafb_display_dma_period(var), | 359 | pxafb_display_dma_period(var)); |
360 | get_clk_frequency_khz(0)); | ||
361 | #endif | 360 | #endif |
362 | 361 | ||
363 | return 0; | 362 | return 0; |