Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git

+207 -44
+3 -2
Documentation/usb/error-codes.txt
··· 46 46 47 47 -EMSGSIZE (a) endpoint maxpacket size is zero; it is not usable 48 48 in the current interface altsetting. 49 - (b) ISO packet is biger than endpoint maxpacket 50 - (c) requested data transfer size is invalid (negative) 49 + (b) ISO packet is larger than the endpoint maxpacket. 50 + (c) requested data transfer length is invalid: negative 51 + or too large for the host controller. 51 52 52 53 -ENOSPC This request would overcommit the usb bandwidth reserved 53 54 for periodic transfers (interrupt, isochronous).
+4 -1
drivers/char/drm/drm_context.c
··· 432 432 433 433 if (ctx.handle != DRM_KERNEL_CONTEXT) { 434 434 if (dev->driver->context_ctor) 435 - dev->driver->context_ctor(dev, ctx.handle); 435 + if (!dev->driver->context_ctor(dev, ctx.handle)) { 436 + DRM_DEBUG( "Running out of ctxs or memory.\n"); 437 + return -ENOMEM; 438 + } 436 439 } 437 440 438 441 ctx_entry = drm_alloc(sizeof(*ctx_entry), DRM_MEM_CTXLIST);
+18 -7
drivers/hwmon/w83792d.c
··· 193 193 0xE2 } /* (bit3-0) SmartFanII: Fan3 Level 3 */ 194 194 }; 195 195 196 + #define W83792D_REG_GPIO_EN 0x1A 196 197 #define W83792D_REG_CONFIG 0x40 197 198 #define W83792D_REG_VID_FANDIV 0x47 198 199 #define W83792D_REG_CHIPID 0x49 ··· 258 257 { 259 258 int i; 260 259 val = SENSORS_LIMIT(val, 1, 128) >> 1; 261 - for (i = 0; i < 6; i++) { 260 + for (i = 0; i < 7; i++) { 262 261 if (val == 0) 263 262 break; 264 263 val >>= 1; ··· 1283 1282 w83792d_init_client(new_client); 1284 1283 1285 1284 /* A few vars need to be filled upon startup */ 1286 - for (i = 1; i <= 7; i++) { 1287 - data->fan_min[i - 1] = w83792d_read_value(new_client, 1285 + for (i = 0; i < 7; i++) { 1286 + data->fan_min[i] = w83792d_read_value(new_client, 1288 1287 W83792D_REG_FAN_MIN[i]); 1289 1288 } 1290 1289 ··· 1307 1306 device_create_file_fan(new_client, 1); 1308 1307 device_create_file_fan(new_client, 2); 1309 1308 device_create_file_fan(new_client, 3); 1310 - device_create_file_fan(new_client, 4); 1311 - device_create_file_fan(new_client, 5); 1312 - device_create_file_fan(new_client, 6); 1313 - device_create_file_fan(new_client, 7); 1309 + 1310 + /* Read GPIO enable register to check if pins for fan 4,5 are used as 1311 + GPIO */ 1312 + val1 = w83792d_read_value(new_client, W83792D_REG_GPIO_EN); 1313 + if (!(val1 & 0x40)) 1314 + device_create_file_fan(new_client, 4); 1315 + if (!(val1 & 0x20)) 1316 + device_create_file_fan(new_client, 5); 1317 + 1318 + val1 = w83792d_read_value(new_client, W83792D_REG_PIN); 1319 + if (val1 & 0x40) 1320 + device_create_file_fan(new_client, 6); 1321 + if (val1 & 0x04) 1322 + device_create_file_fan(new_client, 7); 1314 1323 1315 1324 device_create_file_temp1(new_client); /* Temp1 */ 1316 1325 device_create_file_temp_add(new_client, 2); /* Temp2 */
+3
drivers/usb/atm/cxacru.c
··· 787 787 { /* V = Conexant P = ADSL modem (Hasbani project) */ 788 788 USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00 789 789 }, 790 + { /* V = Conexant P = ADSL modem (Well PTI-800 */ 791 + USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00 792 + }, 790 793 { /* V = Conexant P = ADSL modem */ 791 794 USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00 792 795 },
+2 -1
drivers/usb/core/hcd-pci.c
··· 219 219 goto done; 220 220 } 221 221 } 222 + synchronize_irq(dev->irq); 222 223 223 224 /* FIXME until the generic PM interfaces change a lot more, this 224 225 * can't use PCI D1 and D2 states. For example, the confusion ··· 393 392 394 393 dev->dev.power.power_state = PMSG_ON; 395 394 396 - hcd->saw_irq = 0; 395 + clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); 397 396 398 397 if (hcd->driver->resume) { 399 398 retval = hcd->driver->resume(hcd);
+10 -5
drivers/usb/core/hcd.c
··· 1315 1315 * finish unlinking the initial failed usb_set_address() 1316 1316 * or device descriptor fetch. 1317 1317 */ 1318 - if (!hcd->saw_irq && hcd->self.root_hub != urb->dev) { 1318 + if (!test_bit(HCD_FLAG_SAW_IRQ, &hcd->flags) 1319 + && hcd->self.root_hub != urb->dev) { 1319 1320 dev_warn (hcd->self.controller, "Unlink after no-IRQ? " 1320 1321 "Controller is probably using the wrong IRQ." 1321 1322 "\n"); 1322 - hcd->saw_irq = 1; 1323 + set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); 1323 1324 } 1324 1325 1325 1326 urb->status = status; ··· 1650 1649 struct usb_hcd *hcd = __hcd; 1651 1650 int start = hcd->state; 1652 1651 1653 - if (start == HC_STATE_HALT) 1652 + if (unlikely(start == HC_STATE_HALT || 1653 + !test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) 1654 1654 return IRQ_NONE; 1655 1655 if (hcd->driver->irq (hcd, r) == IRQ_NONE) 1656 1656 return IRQ_NONE; 1657 1657 1658 - hcd->saw_irq = 1; 1659 - if (hcd->state == HC_STATE_HALT) 1658 + set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); 1659 + 1660 + if (unlikely(hcd->state == HC_STATE_HALT)) 1660 1661 usb_hc_died (hcd); 1661 1662 return IRQ_HANDLED; 1662 1663 } ··· 1770 1767 struct usb_device *rhdev; 1771 1768 1772 1769 dev_info(hcd->self.controller, "%s\n", hcd->product_desc); 1770 + 1771 + set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 1773 1772 1774 1773 /* till now HC has been in an indeterminate state ... */ 1775 1774 if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0) {
+6 -1
drivers/usb/core/hcd.h
··· 72 72 * hardware info/state 73 73 */ 74 74 const struct hc_driver *driver; /* hw-specific hooks */ 75 - unsigned saw_irq : 1; 75 + 76 + /* Flags that need to be manipulated atomically */ 77 + unsigned long flags; 78 + #define HCD_FLAG_HW_ACCESSIBLE 0x00000001 79 + #define HCD_FLAG_SAW_IRQ 0x00000002 80 + 76 81 unsigned can_wakeup:1; /* hw supports wakeup? */ 77 82 unsigned remote_wakeup:1;/* sw should use wakeup? */ 78 83 unsigned rh_registered:1;/* is root hub registered? */
+38 -8
drivers/usb/host/ehci-pci.c
··· 121 121 return 0; 122 122 } 123 123 124 - /* called by khubd or root hub (re)init threads; leaves HC in halt state */ 125 - static int ehci_pci_reset(struct usb_hcd *hcd) 124 + /* called during probe() after chip reset completes */ 125 + static int ehci_pci_setup(struct usb_hcd *hcd) 126 126 { 127 127 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 128 128 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); ··· 141 141 if (retval) 142 142 return retval; 143 143 144 + /* data structure init */ 145 + retval = ehci_init(hcd); 146 + if (retval) 147 + return retval; 148 + 144 149 /* NOTE: only the parts below this line are PCI-specific */ 145 150 146 151 switch (pdev->vendor) { ··· 159 154 /* AMD8111 EHCI doesn't work, according to AMD errata */ 160 155 if (pdev->device == 0x7463) { 161 156 ehci_info(ehci, "ignoring AMD8111 (errata)\n"); 162 - return -EIO; 157 + retval = -EIO; 158 + goto done; 163 159 } 164 160 break; 165 161 case PCI_VENDOR_ID_NVIDIA: ··· 213 207 /* REVISIT: per-port wake capability (PCI 0x62) currently unused */ 214 208 215 209 retval = ehci_pci_reinit(ehci, pdev); 216 - 217 - /* finish init */ 218 - return ehci_init(hcd); 210 + done: 211 + return retval; 219 212 } 220 213 221 214 /*-------------------------------------------------------------------------*/ ··· 233 228 static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message) 234 229 { 235 230 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 231 + unsigned long flags; 232 + int rc = 0; 236 233 237 234 if (time_before(jiffies, ehci->next_statechange)) 238 235 msleep(10); 239 236 237 + /* Root hub was already suspended. Disable irq emission and 238 + * mark HW unaccessible, bail out if RH has been resumed. Use 239 + * the spinlock to properly synchronize with possible pending 240 + * RH suspend or resume activity. 241 + * 242 + * This is still racy as hcd->state is manipulated outside of 243 + * any locks =P But that will be a different fix. 244 + */ 245 + spin_lock_irqsave (&ehci->lock, flags); 246 + if (hcd->state != HC_STATE_SUSPENDED) { 247 + rc = -EINVAL; 248 + goto bail; 249 + } 250 + writel (0, &ehci->regs->intr_enable); 251 + (void)readl(&ehci->regs->intr_enable); 252 + 253 + clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 254 + bail: 255 + spin_unlock_irqrestore (&ehci->lock, flags); 256 + 240 257 // could save FLADJ in case of Vaux power loss 241 258 // ... we'd only use it to handle clock skew 242 259 243 - return 0; 260 + return rc; 244 261 } 245 262 246 263 static int ehci_pci_resume(struct usb_hcd *hcd) ··· 277 250 278 251 if (time_before(jiffies, ehci->next_statechange)) 279 252 msleep(100); 253 + 254 + /* Mark hardware accessible again as we are out of D3 state by now */ 255 + set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 280 256 281 257 /* If CF is clear, we lost PCI Vaux power and need to restart. */ 282 258 if (readl(&ehci->regs->configured_flag) != FLAG_CF) ··· 349 319 /* 350 320 * basic lifecycle operations 351 321 */ 352 - .reset = ehci_pci_reset, 322 + .reset = ehci_pci_setup, 353 323 .start = ehci_run, 354 324 #ifdef CONFIG_PM 355 325 .suspend = ehci_pci_suspend,
+16 -8
drivers/usb/host/ehci-q.c
··· 912 912 int epnum; 913 913 unsigned long flags; 914 914 struct ehci_qh *qh = NULL; 915 + int rc = 0; 915 916 916 917 qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list); 917 918 epnum = ep->desc.bEndpointAddress; ··· 927 926 #endif 928 927 929 928 spin_lock_irqsave (&ehci->lock, flags); 929 + if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, 930 + &ehci_to_hcd(ehci)->flags))) { 931 + rc = -ESHUTDOWN; 932 + goto done; 933 + } 934 + 930 935 qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv); 936 + if (unlikely(qh == NULL)) { 937 + rc = -ENOMEM; 938 + goto done; 939 + } 931 940 932 941 /* Control/bulk operations through TTs don't need scheduling, 933 942 * the HC and TT handle it when the TT has a buffer ready. 934 943 */ 935 - if (likely (qh != NULL)) { 936 - if (likely (qh->qh_state == QH_STATE_IDLE)) 937 - qh_link_async (ehci, qh_get (qh)); 938 - } 944 + if (likely (qh->qh_state == QH_STATE_IDLE)) 945 + qh_link_async (ehci, qh_get (qh)); 946 + done: 939 947 spin_unlock_irqrestore (&ehci->lock, flags); 940 - if (unlikely (qh == NULL)) { 948 + if (unlikely (qh == NULL)) 941 949 qtd_list_free (ehci, urb, qtd_list); 942 - return -ENOMEM; 943 - } 944 - return 0; 950 + return rc; 945 951 } 946 952 947 953 /*-------------------------------------------------------------------------*/
+16 -2
drivers/usb/host/ehci-sched.c
··· 602 602 603 603 spin_lock_irqsave (&ehci->lock, flags); 604 604 605 + if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, 606 + &ehci_to_hcd(ehci)->flags))) { 607 + status = -ESHUTDOWN; 608 + goto done; 609 + } 610 + 605 611 /* get qh and force any scheduling errors */ 606 612 INIT_LIST_HEAD (&empty); 607 613 qh = qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv); ··· 1462 1456 1463 1457 /* schedule ... need to lock */ 1464 1458 spin_lock_irqsave (&ehci->lock, flags); 1465 - status = iso_stream_schedule (ehci, urb, stream); 1459 + if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, 1460 + &ehci_to_hcd(ehci)->flags))) 1461 + status = -ESHUTDOWN; 1462 + else 1463 + status = iso_stream_schedule (ehci, urb, stream); 1466 1464 if (likely (status == 0)) 1467 1465 itd_link_urb (ehci, urb, ehci->periodic_size << 3, stream); 1468 1466 spin_unlock_irqrestore (&ehci->lock, flags); ··· 1825 1815 1826 1816 /* schedule ... need to lock */ 1827 1817 spin_lock_irqsave (&ehci->lock, flags); 1828 - status = iso_stream_schedule (ehci, urb, stream); 1818 + if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, 1819 + &ehci_to_hcd(ehci)->flags))) 1820 + status = -ESHUTDOWN; 1821 + else 1822 + status = iso_stream_schedule (ehci, urb, stream); 1829 1823 if (status == 0) 1830 1824 sitd_link_urb (ehci, urb, ehci->periodic_size << 3, stream); 1831 1825 spin_unlock_irqrestore (&ehci->lock, flags);
+5 -1
drivers/usb/host/ohci-hcd.c
··· 115 115 116 116 /*-------------------------------------------------------------------------*/ 117 117 118 - // #define OHCI_VERBOSE_DEBUG /* not always helpful */ 118 + #undef OHCI_VERBOSE_DEBUG /* not always helpful */ 119 119 120 120 /* For initializing controller (mask in an HCFS mode too) */ 121 121 #define OHCI_CONTROL_INIT OHCI_CTRL_CBSR ··· 253 253 spin_lock_irqsave (&ohci->lock, flags); 254 254 255 255 /* don't submit to a dead HC */ 256 + if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { 257 + retval = -ENODEV; 258 + goto fail; 259 + } 256 260 if (!HC_IS_RUNNING(hcd->state)) { 257 261 retval = -ENODEV; 258 262 goto fail;
+20 -4
drivers/usb/host/ohci-hub.c
··· 53 53 54 54 spin_lock_irqsave (&ohci->lock, flags); 55 55 56 + if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) { 57 + spin_unlock_irqrestore (&ohci->lock, flags); 58 + return -ESHUTDOWN; 59 + } 60 + 56 61 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); 57 62 switch (ohci->hc_control & OHCI_CTRL_HCFS) { 58 63 case OHCI_USB_RESUME: ··· 145 140 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 146 141 u32 temp, enables; 147 142 int status = -EINPROGRESS; 143 + unsigned long flags; 148 144 149 145 if (time_before (jiffies, ohci->next_statechange)) 150 146 msleep(5); 151 147 152 - spin_lock_irq (&ohci->lock); 148 + spin_lock_irqsave (&ohci->lock, flags); 149 + 150 + if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) { 151 + spin_unlock_irqrestore (&ohci->lock, flags); 152 + return -ESHUTDOWN; 153 + } 154 + 155 + 153 156 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); 154 157 155 158 if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { ··· 192 179 ohci_dbg (ohci, "lost power\n"); 193 180 status = -EBUSY; 194 181 } 195 - spin_unlock_irq (&ohci->lock); 182 + spin_unlock_irqrestore (&ohci->lock, flags); 196 183 if (status == -EBUSY) { 197 184 (void) ohci_init (ohci); 198 185 return ohci_restart (ohci); ··· 310 297 /* handle autosuspended root: finish resuming before 311 298 * letting khubd or root hub timer see state changes. 312 299 */ 313 - if ((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER 314 - || !HC_IS_RUNNING(hcd->state)) { 300 + if (unlikely((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER 301 + || !HC_IS_RUNNING(hcd->state))) { 315 302 can_suspend = 0; 316 303 goto done; 317 304 } ··· 520 507 int ports = hcd_to_bus (hcd)->root_hub->maxchild; 521 508 u32 temp; 522 509 int retval = 0; 510 + 511 + if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) 512 + return -ESHUTDOWN; 523 513 524 514 switch (typeReq) { 525 515 case ClearHubFeature:
+25 -2
drivers/usb/host/ohci-pci.c
··· 105 105 106 106 static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) 107 107 { 108 - /* root hub was already suspended */ 109 - return 0; 108 + struct ohci_hcd *ohci = hcd_to_ohci (hcd); 109 + unsigned long flags; 110 + int rc = 0; 111 + 112 + /* Root hub was already suspended. Disable irq emission and 113 + * mark HW unaccessible, bail out if RH has been resumed. Use 114 + * the spinlock to properly synchronize with possible pending 115 + * RH suspend or resume activity. 116 + * 117 + * This is still racy as hcd->state is manipulated outside of 118 + * any locks =P But that will be a different fix. 119 + */ 120 + spin_lock_irqsave (&ohci->lock, flags); 121 + if (hcd->state != HC_STATE_SUSPENDED) { 122 + rc = -EINVAL; 123 + goto bail; 124 + } 125 + ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); 126 + (void)ohci_readl(ohci, &ohci->regs->intrdisable); 127 + clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 128 + bail: 129 + spin_unlock_irqrestore (&ohci->lock, flags); 130 + 131 + return rc; 110 132 } 111 133 112 134 113 135 static int ohci_pci_resume (struct usb_hcd *hcd) 114 136 { 137 + set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 115 138 usb_hcd_resume_root_hub(hcd); 116 139 return 0; 117 140 }
+6
drivers/usb/host/uhci-hcd.c
··· 717 717 * at the source, so we must turn off PIRQ. 718 718 */ 719 719 pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); 720 + clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 720 721 uhci->hc_inaccessible = 1; 721 722 hcd->poll_rh = 0; 722 723 ··· 733 732 struct uhci_hcd *uhci = hcd_to_uhci(hcd); 734 733 735 734 dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__); 735 + 736 + /* We aren't in D3 state anymore, we do that even if dead as I 737 + * really don't want to keep a stale HCD_FLAG_HW_ACCESSIBLE=0 738 + */ 739 + set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 736 740 737 741 if (uhci->rh_state == UHCI_RH_RESET) /* Dead */ 738 742 return 0;
+1
include/linux/mm.h
··· 956 956 unsigned long vmalloc_to_pfn(void *addr); 957 957 int remap_pfn_range(struct vm_area_struct *, unsigned long addr, 958 958 unsigned long pfn, unsigned long size, pgprot_t); 959 + int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); 959 960 960 961 struct page *follow_page(struct vm_area_struct *, unsigned long address, 961 962 unsigned int foll_flags);
+34 -2
mm/memory.c
··· 1172 1172 spinlock_t *ptl; 1173 1173 1174 1174 retval = -EINVAL; 1175 - if (PageAnon(page) || !PageReserved(page)) 1175 + if (PageAnon(page)) 1176 1176 goto out; 1177 1177 retval = -ENOMEM; 1178 1178 flush_dcache_page(page); ··· 1195 1195 out: 1196 1196 return retval; 1197 1197 } 1198 + 1199 + /* 1200 + * This allows drivers to insert individual pages they've allocated 1201 + * into a user vma. 1202 + * 1203 + * The page has to be a nice clean _individual_ kernel allocation. 1204 + * If you allocate a compound page, you need to have marked it as 1205 + * such (__GFP_COMP), or manually just split the page up yourself 1206 + * (which is mainly an issue of doing "set_page_count(page, 1)" for 1207 + * each sub-page, and then freeing them one by one when you free 1208 + * them rather than freeing it as a compound page). 1209 + * 1210 + * NOTE! Traditionally this was done with "remap_pfn_range()" which 1211 + * took an arbitrary page protection parameter. This doesn't allow 1212 + * that. Your vma protection will have to be set up correctly, which 1213 + * means that if you want a shared writable mapping, you'd better 1214 + * ask for a shared writable mapping! 1215 + * 1216 + * The page does not need to be reserved. 1217 + */ 1218 + int vm_insert_page(struct vm_area_struct *vma, unsigned long addr, struct page *page) 1219 + { 1220 + if (addr < vma->vm_start || addr >= vma->vm_end) 1221 + return -EFAULT; 1222 + if (!page_count(page)) 1223 + return -EINVAL; 1224 + return insert_page(vma->vm_mm, addr, page, vma->vm_page_prot); 1225 + } 1226 + EXPORT_SYMBOL_GPL(vm_insert_page); 1198 1227 1199 1228 /* 1200 1229 * Somebody does a pfn remapping that doesn't actually work as a vma. ··· 1254 1225 if (!pfn_valid(pfn)) 1255 1226 return -EINVAL; 1256 1227 1257 - retval = 0; 1258 1228 page = pfn_to_page(pfn); 1229 + if (!PageReserved(page)) 1230 + return -EINVAL; 1231 + 1232 + retval = 0; 1259 1233 while (start < end) { 1260 1234 retval = insert_page(vma->vm_mm, start, page, prot); 1261 1235 if (retval < 0)