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

Merge tag 'char-misc-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc patches from Greg KH:
"Here is the big char/misc driver pull request for 3.12-rc1

Lots of driver updates all over the char/misc tree, full details in
the shortlog"

* tag 'char-misc-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (62 commits)
drivers: uio: Kconfig: add MMU dependancy for UIO
drivers: uio: Add driver for Humusoft MF624 DAQ PCI card
drivers: uio_pdrv_genirq: use dev_get_platdata()
drivers: uio_pruss: use dev_get_platdata()
drivers: uio_dmem_genirq: use dev_get_platdata()
drivers: parport: Kconfig: exclude h8300 for PARPORT_PC
drivers: misc: ti-st: fix potential race if st_kim_start fails
Drivers: hv: vmbus: Do not attempt to negoatiate a new version prematurely
misc: vmw_balloon: Remove braces to fix build for clang.
Drivers: hv: vmbus: Fix a bug in the handling of channel offers
vme: vme_ca91cx42.c: fix to pass correct device identity to free_irq()
VMCI: Add support for virtual IOMMU
VMCI: Remove non-blocking/pinned queuepair support
uio: uio_pruss: remove unnecessary platform_set_drvdata()
parport: amiga: remove unnecessary platform_set_drvdata()
vme: vme_vmivme7805.c: add missing __iomem annotation
vme: vme_ca91cx42.c: add missing __iomem annotation
vme: vme_tsi148.c: add missing __iomem annotation
drivers/misc/hpilo: Correct panic when an AUX iLO is detected
uio: drop unused vma_count member in uio_device struct
...

+1092 -673
+3 -3
Documentation/devicetree/bindings/extcon/extcon-twl.txt Documentation/devicetree/bindings/extcon/extcon-palmas.txt
··· 1 - EXTCON FOR TWL CHIPS 1 + EXTCON FOR PALMAS/TWL CHIPS 2 2 3 3 PALMAS USB COMPARATOR 4 4 Required Properties: 5 5 - compatible : Should be "ti,palmas-usb" or "ti,twl6035-usb" 6 - - vbus-supply : phandle to the regulator device tree node. 7 6 8 7 Optional Properties: 9 8 - ti,wakeup : To enable the wakeup comparator in probe 9 + - ti,enable-id-detection: Perform ID detection. 10 + - ti,enable-vbus-detection: Perform VBUS detection. 10 11 11 12 palmas-usb { 12 13 compatible = "ti,twl6035-usb", "ti,palmas-usb"; 13 - vbus-supply = <&smps10_reg>; 14 14 ti,wakeup; 15 15 };
+5
Documentation/devicetree/bindings/usb/omap-usb.txt
··· 53 53 It should be set to "1" for HW mode and "2" for SW mode. 54 54 - ranges: the child address space are mapped 1:1 onto the parent address space 55 55 56 + Optional Properties: 57 + - extcon : phandle for the extcon device omap dwc3 uses to detect 58 + connect/disconnect events. 59 + - vbus-supply : phandle to the regulator device tree node if needed. 60 + 56 61 Sub-nodes: 57 62 The dwc3 core should be added as subnode to omap dwc3 glue. 58 63 - dwc3 :
+4
drivers/extcon/Kconfig
··· 14 14 15 15 comment "Extcon Device Drivers" 16 16 17 + config OF_EXTCON 18 + def_tristate y 19 + depends on OF 20 + 17 21 config EXTCON_GPIO 18 22 tristate "GPIO extcon support" 19 23 depends on GPIOLIB
+2
drivers/extcon/Makefile
··· 2 2 # Makefile for external connector class (extcon) devices 3 3 # 4 4 5 + obj-$(CONFIG_OF_EXTCON) += of_extcon.o 6 + 5 7 obj-$(CONFIG_EXTCON) += extcon-class.o 6 8 obj-$(CONFIG_EXTCON_GPIO) += extcon-gpio.o 7 9 obj-$(CONFIG_EXTCON_ADC_JACK) += extcon-adc-jack.o
+2 -1
drivers/extcon/extcon-adc-jack.c
··· 87 87 { 88 88 struct adc_jack_data *data = _data; 89 89 90 - schedule_delayed_work(&data->handler, data->handling_delay); 90 + queue_delayed_work(system_power_efficient_wq, 91 + &data->handler, data->handling_delay); 91 92 return IRQ_HANDLED; 92 93 } 93 94
+15 -10
drivers/extcon/extcon-arizona.c
··· 890 890 891 891 handled: 892 892 if (info->detecting) 893 - schedule_delayed_work(&info->micd_timeout_work, 894 - msecs_to_jiffies(info->micd_timeout)); 893 + queue_delayed_work(system_power_efficient_wq, 894 + &info->micd_timeout_work, 895 + msecs_to_jiffies(info->micd_timeout)); 895 896 896 897 pm_runtime_mark_last_busy(info->dev); 897 898 mutex_unlock(&info->lock); ··· 913 912 mutex_unlock(&info->lock); 914 913 915 914 if (debounce) 916 - schedule_delayed_work(&info->micd_detect_work, 917 - msecs_to_jiffies(debounce)); 915 + queue_delayed_work(system_power_efficient_wq, 916 + &info->micd_detect_work, 917 + msecs_to_jiffies(debounce)); 918 918 else 919 919 arizona_micd_detect(&info->micd_detect_work.work); 920 920 ··· 969 967 if (val == info->last_jackdet) { 970 968 dev_dbg(arizona->dev, "Suppressing duplicate JACKDET\n"); 971 969 if (cancelled_hp) 972 - schedule_delayed_work(&info->hpdet_work, 973 - msecs_to_jiffies(HPDET_DEBOUNCE)); 970 + queue_delayed_work(system_power_efficient_wq, 971 + &info->hpdet_work, 972 + msecs_to_jiffies(HPDET_DEBOUNCE)); 974 973 975 974 if (cancelled_mic) 976 - schedule_delayed_work(&info->micd_timeout_work, 977 - msecs_to_jiffies(info->micd_timeout)); 975 + queue_delayed_work(system_power_efficient_wq, 976 + &info->micd_timeout_work, 977 + msecs_to_jiffies(info->micd_timeout)); 978 978 979 979 goto out; 980 980 } ··· 998 994 999 995 arizona_start_mic(info); 1000 996 } else { 1001 - schedule_delayed_work(&info->hpdet_work, 1002 - msecs_to_jiffies(HPDET_DEBOUNCE)); 997 + queue_delayed_work(system_power_efficient_wq, 998 + &info->hpdet_work, 999 + msecs_to_jiffies(HPDET_DEBOUNCE)); 1003 1000 } 1004 1001 1005 1002 regmap_update_bits(arizona->regmap,
+2 -1
drivers/extcon/extcon-class.c
··· 602 602 edev->dev->class = extcon_class; 603 603 edev->dev->release = extcon_dev_release; 604 604 605 - dev_set_name(edev->dev, "%s", edev->name ? edev->name : dev_name(dev)); 605 + edev->name = edev->name ? edev->name : dev_name(dev); 606 + dev_set_name(edev->dev, "%s", edev->name); 606 607 607 608 if (edev->max_supported) { 608 609 char buf[10];
+1 -1
drivers/extcon/extcon-gpio.c
··· 56 56 { 57 57 struct gpio_extcon_data *extcon_data = dev_id; 58 58 59 - schedule_delayed_work(&extcon_data->work, 59 + queue_delayed_work(system_power_efficient_wq, &extcon_data->work, 60 60 extcon_data->debounce_jiffies); 61 61 return IRQ_HANDLED; 62 62 }
+90 -44
drivers/extcon/extcon-palmas.c
··· 57 57 if (palmas_usb->linkstat != PALMAS_USB_STATE_VBUS) { 58 58 palmas_usb->linkstat = PALMAS_USB_STATE_VBUS; 59 59 extcon_set_cable_state(&palmas_usb->edev, "USB", true); 60 + dev_info(palmas_usb->dev, "USB cable is attached\n"); 60 61 } else { 61 62 dev_dbg(palmas_usb->dev, 62 63 "Spurious connect event detected\n"); ··· 66 65 if (palmas_usb->linkstat == PALMAS_USB_STATE_VBUS) { 67 66 palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT; 68 67 extcon_set_cable_state(&palmas_usb->edev, "USB", false); 68 + dev_info(palmas_usb->dev, "USB cable is detached\n"); 69 69 } else { 70 70 dev_dbg(palmas_usb->dev, 71 71 "Spurious disconnect event detected\n"); ··· 86 84 87 85 if (set & PALMAS_USB_ID_INT_SRC_ID_GND) { 88 86 palmas_write(palmas_usb->palmas, PALMAS_USB_OTG_BASE, 89 - PALMAS_USB_ID_INT_EN_HI_SET, 90 - PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT); 91 - palmas_write(palmas_usb->palmas, PALMAS_USB_OTG_BASE, 92 - PALMAS_USB_ID_INT_EN_HI_CLR, 93 - PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND); 94 - palmas_write(palmas_usb->palmas, PALMAS_USB_OTG_BASE, 95 87 PALMAS_USB_ID_INT_LATCH_CLR, 96 88 PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND); 97 89 palmas_usb->linkstat = PALMAS_USB_STATE_ID; 98 90 extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", true); 91 + dev_info(palmas_usb->dev, "USB-HOST cable is attached\n"); 99 92 } else if (set & PALMAS_USB_ID_INT_SRC_ID_FLOAT) { 100 - palmas_write(palmas_usb->palmas, PALMAS_USB_OTG_BASE, 101 - PALMAS_USB_ID_INT_EN_HI_SET, 102 - PALMAS_USB_ID_INT_EN_HI_SET_ID_GND); 103 - palmas_write(palmas_usb->palmas, PALMAS_USB_OTG_BASE, 104 - PALMAS_USB_ID_INT_EN_HI_CLR, 105 - PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT); 106 93 palmas_write(palmas_usb->palmas, PALMAS_USB_OTG_BASE, 107 94 PALMAS_USB_ID_INT_LATCH_CLR, 108 95 PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT); 109 96 palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT; 110 97 extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", false); 98 + dev_info(palmas_usb->dev, "USB-HOST cable is detached\n"); 99 + } else if ((palmas_usb->linkstat == PALMAS_USB_STATE_ID) && 100 + (!(set & PALMAS_USB_ID_INT_SRC_ID_GND))) { 101 + palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT; 102 + extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", false); 103 + dev_info(palmas_usb->dev, "USB-HOST cable is detached\n"); 111 104 } 112 105 113 106 return IRQ_HANDLED; ··· 119 122 120 123 palmas_write(palmas_usb->palmas, PALMAS_USB_OTG_BASE, 121 124 PALMAS_USB_ID_INT_EN_HI_SET, 122 - PALMAS_USB_ID_INT_EN_HI_SET_ID_GND); 125 + PALMAS_USB_ID_INT_EN_HI_SET_ID_GND | 126 + PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT); 123 127 124 - palmas_vbus_irq_handler(palmas_usb->vbus_irq, palmas_usb); 128 + if (palmas_usb->enable_vbus_detection) 129 + palmas_vbus_irq_handler(palmas_usb->vbus_irq, palmas_usb); 125 130 126 131 /* cold plug for host mode needs this delay */ 127 - msleep(30); 128 - palmas_id_irq_handler(palmas_usb->id_irq, palmas_usb); 132 + if (palmas_usb->enable_id_detection) { 133 + msleep(30); 134 + palmas_id_irq_handler(palmas_usb->id_irq, palmas_usb); 135 + } 129 136 } 130 137 131 138 static int palmas_usb_probe(struct platform_device *pdev) ··· 140 139 struct palmas_usb *palmas_usb; 141 140 int status; 142 141 143 - if (node && !pdata) { 144 - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 145 - 146 - if (!pdata) 147 - return -ENOMEM; 148 - 149 - pdata->wakeup = of_property_read_bool(node, "ti,wakeup"); 150 - } else if (!pdata) { 151 - return -EINVAL; 152 - } 153 - 154 142 palmas_usb = devm_kzalloc(&pdev->dev, sizeof(*palmas_usb), GFP_KERNEL); 155 143 if (!palmas_usb) 156 144 return -ENOMEM; 145 + 146 + if (node && !pdata) { 147 + palmas_usb->wakeup = of_property_read_bool(node, "ti,wakeup"); 148 + palmas_usb->enable_id_detection = of_property_read_bool(node, 149 + "ti,enable-id-detection"); 150 + palmas_usb->enable_vbus_detection = of_property_read_bool(node, 151 + "ti,enable-vbus-detection"); 152 + } else { 153 + palmas_usb->wakeup = true; 154 + palmas_usb->enable_id_detection = true; 155 + palmas_usb->enable_vbus_detection = true; 156 + 157 + if (pdata) 158 + palmas_usb->wakeup = pdata->wakeup; 159 + } 157 160 158 161 palmas->usb = palmas_usb; 159 162 palmas_usb->palmas = palmas; ··· 173 168 palmas_usb->vbus_irq = regmap_irq_get_virq(palmas->irq_data, 174 169 PALMAS_VBUS_IRQ); 175 170 176 - palmas_usb_wakeup(palmas, pdata->wakeup); 171 + palmas_usb_wakeup(palmas, palmas_usb->wakeup); 177 172 178 173 platform_set_drvdata(pdev, palmas_usb); 179 174 180 - palmas_usb->edev.name = "palmas-usb"; 181 175 palmas_usb->edev.supported_cable = palmas_extcon_cable; 182 176 palmas_usb->edev.mutually_exclusive = mutually_exclusive; 183 177 ··· 186 182 return status; 187 183 } 188 184 189 - status = devm_request_threaded_irq(palmas_usb->dev, palmas_usb->id_irq, 190 - NULL, palmas_id_irq_handler, 191 - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, 192 - "palmas_usb_id", palmas_usb); 193 - if (status < 0) { 194 - dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", 185 + if (palmas_usb->enable_id_detection) { 186 + status = devm_request_threaded_irq(palmas_usb->dev, 187 + palmas_usb->id_irq, 188 + NULL, palmas_id_irq_handler, 189 + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | 190 + IRQF_ONESHOT | IRQF_EARLY_RESUME, 191 + "palmas_usb_id", palmas_usb); 192 + if (status < 0) { 193 + dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", 195 194 palmas_usb->id_irq, status); 196 - goto fail_extcon; 195 + goto fail_extcon; 196 + } 197 197 } 198 198 199 - status = devm_request_threaded_irq(palmas_usb->dev, 200 - palmas_usb->vbus_irq, NULL, palmas_vbus_irq_handler, 201 - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, 202 - "palmas_usb_vbus", palmas_usb); 203 - if (status < 0) { 204 - dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", 199 + if (palmas_usb->enable_vbus_detection) { 200 + status = devm_request_threaded_irq(palmas_usb->dev, 201 + palmas_usb->vbus_irq, NULL, 202 + palmas_vbus_irq_handler, 203 + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | 204 + IRQF_ONESHOT | IRQF_EARLY_RESUME, 205 + "palmas_usb_vbus", palmas_usb); 206 + if (status < 0) { 207 + dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", 205 208 palmas_usb->vbus_irq, status); 206 - goto fail_extcon; 209 + goto fail_extcon; 210 + } 207 211 } 208 212 209 213 palmas_enable_irq(palmas_usb); 210 - 214 + device_set_wakeup_capable(&pdev->dev, true); 211 215 return 0; 212 216 213 217 fail_extcon: ··· 233 221 return 0; 234 222 } 235 223 224 + #ifdef CONFIG_PM_SLEEP 225 + static int palmas_usb_suspend(struct device *dev) 226 + { 227 + struct palmas_usb *palmas_usb = dev_get_drvdata(dev); 228 + 229 + if (device_may_wakeup(dev)) { 230 + if (palmas_usb->enable_vbus_detection) 231 + enable_irq_wake(palmas_usb->vbus_irq); 232 + if (palmas_usb->enable_id_detection) 233 + enable_irq_wake(palmas_usb->id_irq); 234 + } 235 + return 0; 236 + } 237 + 238 + static int palmas_usb_resume(struct device *dev) 239 + { 240 + struct palmas_usb *palmas_usb = dev_get_drvdata(dev); 241 + 242 + if (device_may_wakeup(dev)) { 243 + if (palmas_usb->enable_vbus_detection) 244 + disable_irq_wake(palmas_usb->vbus_irq); 245 + if (palmas_usb->enable_id_detection) 246 + disable_irq_wake(palmas_usb->id_irq); 247 + } 248 + return 0; 249 + }; 250 + #endif 251 + 252 + static const struct dev_pm_ops palmas_pm_ops = { 253 + SET_SYSTEM_SLEEP_PM_OPS(palmas_usb_suspend, 254 + palmas_usb_resume) 255 + }; 256 + 236 257 static struct of_device_id of_palmas_match_tbl[] = { 237 258 { .compatible = "ti,palmas-usb", }, 238 259 { .compatible = "ti,twl6035-usb", }, ··· 279 234 .name = "palmas-usb", 280 235 .of_match_table = of_palmas_match_tbl, 281 236 .owner = THIS_MODULE, 237 + .pm = &palmas_pm_ops, 282 238 }, 283 239 }; 284 240
+64
drivers/extcon/of_extcon.c
··· 1 + /* 2 + * OF helpers for External connector (extcon) framework 3 + * 4 + * Copyright (C) 2013 Texas Instruments, Inc. 5 + * Kishon Vijay Abraham I <kishon@ti.com> 6 + * 7 + * Copyright (C) 2013 Samsung Electronics 8 + * Chanwoo Choi <cw00.choi@samsung.com> 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License as published by 12 + * the Free Software Foundation; either version 2 of the License, or 13 + * (at your option) any later version. 14 + */ 15 + 16 + #include <linux/module.h> 17 + #include <linux/slab.h> 18 + #include <linux/err.h> 19 + #include <linux/extcon.h> 20 + #include <linux/of.h> 21 + #include <linux/of_platform.h> 22 + #include <linux/extcon/of_extcon.h> 23 + 24 + /* 25 + * of_extcon_get_extcon_dev - Get the name of extcon device from devicetree 26 + * @dev - instance to the given device 27 + * @index - index into list of extcon_dev 28 + * 29 + * return the instance of extcon device 30 + */ 31 + struct extcon_dev *of_extcon_get_extcon_dev(struct device *dev, int index) 32 + { 33 + struct device_node *node; 34 + struct extcon_dev *edev; 35 + struct platform_device *extcon_parent_dev; 36 + 37 + if (!dev->of_node) { 38 + dev_dbg(dev, "device does not have a device node entry\n"); 39 + return ERR_PTR(-EINVAL); 40 + } 41 + 42 + node = of_parse_phandle(dev->of_node, "extcon", index); 43 + if (!node) { 44 + dev_dbg(dev, "failed to get phandle in %s node\n", 45 + dev->of_node->full_name); 46 + return ERR_PTR(-ENODEV); 47 + } 48 + 49 + extcon_parent_dev = of_find_device_by_node(node); 50 + if (!extcon_parent_dev) { 51 + dev_dbg(dev, "unable to find device by node\n"); 52 + return ERR_PTR(-EPROBE_DEFER); 53 + } 54 + 55 + edev = extcon_get_extcon_dev(dev_name(&extcon_parent_dev->dev)); 56 + if (!edev) { 57 + dev_dbg(dev, "unable to get extcon device : %s\n", 58 + dev_name(&extcon_parent_dev->dev)); 59 + return ERR_PTR(-ENODEV); 60 + } 61 + 62 + return edev; 63 + } 64 + EXPORT_SYMBOL_GPL(of_extcon_get_extcon_dev);
+4 -5
drivers/fmc/fmc-chardev.c
··· 143 143 fc->misc.fops = &fc_fops; 144 144 fc->misc.name = kstrdup(dev_name(&fmc->dev), GFP_KERNEL); 145 145 146 - spin_lock(&fc_lock); 147 146 ret = misc_register(&fc->misc); 148 147 if (ret < 0) 149 - goto err_unlock; 148 + goto out; 149 + spin_lock(&fc_lock); 150 150 list_add(&fc->list, &fc_devices); 151 151 spin_unlock(&fc_lock); 152 152 dev_info(&fc->fmc->dev, "Created misc device \"%s\"\n", 153 153 fc->misc.name); 154 154 return 0; 155 155 156 - err_unlock: 157 - spin_unlock(&fc_lock); 156 + out: 158 157 kfree(fc->misc.name); 159 158 kfree(fc); 160 159 return ret; ··· 173 174 174 175 spin_lock(&fc_lock); 175 176 list_del(&fc->list); 177 + spin_unlock(&fc_lock); 176 178 misc_deregister(&fc->misc); 177 179 kfree(fc->misc.name); 178 180 kfree(fc); 179 - spin_unlock(&fc_lock); 180 181 181 182 return 0; 182 183 }
+2 -2
drivers/fmc/fmc-write-eeprom.c
··· 103 103 * difficult to know in advance when probing the first card if others 104 104 * are there. 105 105 */ 106 - int fwe_probe(struct fmc_device *fmc) 106 + static int fwe_probe(struct fmc_device *fmc) 107 107 { 108 108 int err, index = 0; 109 109 const struct firmware *fw; ··· 144 144 return 0; 145 145 } 146 146 147 - int fwe_remove(struct fmc_device *fmc) 147 + static int fwe_remove(struct fmc_device *fmc) 148 148 { 149 149 return 0; 150 150 }
-1
drivers/hid/hid-hyperv.c
··· 590 590 } 591 591 592 592 MODULE_LICENSE("GPL"); 593 - MODULE_VERSION(HV_DRV_VERSION); 594 593 module_init(mousevsc_init); 595 594 module_exit(mousevsc_exit);
+60 -29
drivers/hv/channel_mgmt.c
··· 48 48 * @negop is of type &struct icmsg_negotiate. 49 49 * Set up and fill in default negotiate response message. 50 50 * 51 - * The max_fw_version specifies the maximum framework version that 52 - * we can support and max _srv_version specifies the maximum service 53 - * version we can support. A special value MAX_SRV_VER can be 54 - * specified to indicate that we can handle the maximum version 55 - * exposed by the host. 51 + * The fw_version specifies the framework version that 52 + * we can support and srv_version specifies the service 53 + * version we can support. 56 54 * 57 55 * Mainly used by Hyper-V drivers. 58 56 */ 59 - void vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, 57 + bool vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, 60 58 struct icmsg_negotiate *negop, u8 *buf, 61 - int max_fw_version, int max_srv_version) 59 + int fw_version, int srv_version) 62 60 { 63 - int icframe_vercnt; 64 - int icmsg_vercnt; 61 + int icframe_major, icframe_minor; 62 + int icmsg_major, icmsg_minor; 63 + int fw_major, fw_minor; 64 + int srv_major, srv_minor; 65 65 int i; 66 + bool found_match = false; 66 67 67 68 icmsghdrp->icmsgsize = 0x10; 69 + fw_major = (fw_version >> 16); 70 + fw_minor = (fw_version & 0xFFFF); 71 + 72 + srv_major = (srv_version >> 16); 73 + srv_minor = (srv_version & 0xFFFF); 68 74 69 75 negop = (struct icmsg_negotiate *)&buf[ 70 76 sizeof(struct vmbuspipe_hdr) + 71 77 sizeof(struct icmsg_hdr)]; 72 78 73 - icframe_vercnt = negop->icframe_vercnt; 74 - icmsg_vercnt = negop->icmsg_vercnt; 79 + icframe_major = negop->icframe_vercnt; 80 + icframe_minor = 0; 81 + 82 + icmsg_major = negop->icmsg_vercnt; 83 + icmsg_minor = 0; 75 84 76 85 /* 77 86 * Select the framework version number we will ··· 88 79 */ 89 80 90 81 for (i = 0; i < negop->icframe_vercnt; i++) { 91 - if (negop->icversion_data[i].major <= max_fw_version) 92 - icframe_vercnt = negop->icversion_data[i].major; 82 + if ((negop->icversion_data[i].major == fw_major) && 83 + (negop->icversion_data[i].minor == fw_minor)) { 84 + icframe_major = negop->icversion_data[i].major; 85 + icframe_minor = negop->icversion_data[i].minor; 86 + found_match = true; 87 + } 93 88 } 89 + 90 + if (!found_match) 91 + goto fw_error; 92 + 93 + found_match = false; 94 94 95 95 for (i = negop->icframe_vercnt; 96 96 (i < negop->icframe_vercnt + negop->icmsg_vercnt); i++) { 97 - if (negop->icversion_data[i].major <= max_srv_version) 98 - icmsg_vercnt = negop->icversion_data[i].major; 97 + if ((negop->icversion_data[i].major == srv_major) && 98 + (negop->icversion_data[i].minor == srv_minor)) { 99 + icmsg_major = negop->icversion_data[i].major; 100 + icmsg_minor = negop->icversion_data[i].minor; 101 + found_match = true; 102 + } 99 103 } 100 104 101 105 /* 102 - * Respond with the maximum framework and service 106 + * Respond with the framework and service 103 107 * version numbers we can support. 104 108 */ 105 - negop->icframe_vercnt = 1; 106 - negop->icmsg_vercnt = 1; 107 - negop->icversion_data[0].major = icframe_vercnt; 108 - negop->icversion_data[0].minor = 0; 109 - negop->icversion_data[1].major = icmsg_vercnt; 110 - negop->icversion_data[1].minor = 0; 109 + 110 + fw_error: 111 + if (!found_match) { 112 + negop->icframe_vercnt = 0; 113 + negop->icmsg_vercnt = 0; 114 + } else { 115 + negop->icframe_vercnt = 1; 116 + negop->icmsg_vercnt = 1; 117 + } 118 + 119 + negop->icversion_data[0].major = icframe_major; 120 + negop->icversion_data[0].minor = icframe_minor; 121 + negop->icversion_data[1].major = icmsg_major; 122 + negop->icversion_data[1].minor = icmsg_minor; 123 + return found_match; 111 124 } 112 125 113 126 EXPORT_SYMBOL_GPL(vmbus_prep_negotiate_resp); ··· 293 262 } 294 263 295 264 /* 265 + * This state is used to indicate a successful open 266 + * so that when we do close the channel normally, we 267 + * can cleanup properly 268 + */ 269 + newchannel->state = CHANNEL_OPEN_STATE; 270 + 271 + /* 296 272 * Start the process of binding this offer to the driver 297 273 * We need to set the DeviceObject field before calling 298 274 * vmbus_child_dev_add() ··· 325 287 kfree(newchannel->device_obj); 326 288 327 289 free_channel(newchannel); 328 - } else { 329 - /* 330 - * This state is used to indicate a successful open 331 - * so that when we do close the channel normally, we 332 - * can cleanup properly 333 - */ 334 - newchannel->state = CHANNEL_OPEN_STATE; 335 290 } 336 291 } 337 292
+4 -1
drivers/hv/connection.c
··· 195 195 196 196 do { 197 197 ret = vmbus_negotiate_version(msginfo, version); 198 - if (ret == 0) 198 + if (ret) 199 + goto cleanup; 200 + 201 + if (vmbus_connection.conn_state == CONNECTED) 199 202 break; 200 203 201 204 version = vmbus_get_next_version(version);
+2 -3
drivers/hv/hv_balloon.c
··· 825 825 memset(&resp, 0, sizeof(struct dm_hot_add_response)); 826 826 resp.hdr.type = DM_MEM_HOT_ADD_RESPONSE; 827 827 resp.hdr.size = sizeof(struct dm_hot_add_response); 828 - resp.hdr.trans_id = atomic_inc_return(&trans_id); 829 828 830 829 #ifdef CONFIG_MEMORY_HOTPLUG 831 830 pg_start = dm->ha_wrk.ha_page_range.finfo.start_page; ··· 886 887 pr_info("Memory hot add failed\n"); 887 888 888 889 dm->state = DM_INITIALIZED; 890 + resp.hdr.trans_id = atomic_inc_return(&trans_id); 889 891 vmbus_sendpacket(dm->dev->channel, &resp, 890 892 sizeof(struct dm_hot_add_response), 891 893 (unsigned long)NULL, ··· 1081 1081 bl_resp = (struct dm_balloon_response *)send_buffer; 1082 1082 memset(send_buffer, 0, PAGE_SIZE); 1083 1083 bl_resp->hdr.type = DM_BALLOON_RESPONSE; 1084 - bl_resp->hdr.trans_id = atomic_inc_return(&trans_id); 1085 1084 bl_resp->hdr.size = sizeof(struct dm_balloon_response); 1086 1085 bl_resp->more_pages = 1; 1087 1086 ··· 1108 1109 */ 1109 1110 1110 1111 do { 1112 + bl_resp->hdr.trans_id = atomic_inc_return(&trans_id); 1111 1113 ret = vmbus_sendpacket(dm_device.dev->channel, 1112 1114 bl_resp, 1113 1115 bl_resp->hdr.size, ··· 1526 1526 module_init(init_balloon_drv); 1527 1527 1528 1528 MODULE_DESCRIPTION("Hyper-V Balloon"); 1529 - MODULE_VERSION(HV_DRV_VERSION); 1530 1529 MODULE_LICENSE("GPL");
+25 -1
drivers/hv/hv_kvp.c
··· 29 29 #include <linux/hyperv.h> 30 30 31 31 32 + /* 33 + * Pre win8 version numbers used in ws2008 and ws 2008 r2 (win7) 34 + */ 35 + #define WIN7_SRV_MAJOR 3 36 + #define WIN7_SRV_MINOR 0 37 + #define WIN7_SRV_MAJOR_MINOR (WIN7_SRV_MAJOR << 16 | WIN7_SRV_MINOR) 38 + 39 + #define WIN8_SRV_MAJOR 4 40 + #define WIN8_SRV_MINOR 0 41 + #define WIN8_SRV_MAJOR_MINOR (WIN8_SRV_MAJOR << 16 | WIN8_SRV_MINOR) 32 42 33 43 /* 34 44 * Global state maintained for transaction that is being processed. ··· 86 76 /* 87 77 * Register the kernel component with the user-level daemon. 88 78 * As part of this registration, pass the LIC version number. 79 + * This number has no meaning, it satisfies the registration protocol. 89 80 */ 81 + #define HV_DRV_VERSION "3.1" 90 82 91 83 static void 92 84 kvp_register(int reg_value) ··· 605 593 sizeof(struct vmbuspipe_hdr)]; 606 594 607 595 if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { 596 + /* 597 + * We start with win8 version and if the host cannot 598 + * support that we use the previous version. 599 + */ 600 + if (vmbus_prep_negotiate_resp(icmsghdrp, negop, 601 + recv_buffer, UTIL_FW_MAJOR_MINOR, 602 + WIN8_SRV_MAJOR_MINOR)) 603 + goto done; 604 + 608 605 vmbus_prep_negotiate_resp(icmsghdrp, negop, 609 - recv_buffer, MAX_SRV_VER, MAX_SRV_VER); 606 + recv_buffer, UTIL_FW_MAJOR_MINOR, 607 + WIN7_SRV_MAJOR_MINOR); 608 + 610 609 } else { 611 610 kvp_msg = (struct hv_kvp_msg *)&recv_buffer[ 612 611 sizeof(struct vmbuspipe_hdr) + ··· 649 626 return; 650 627 651 628 } 629 + done: 652 630 653 631 icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION 654 632 | ICMSGHDRFLAG_RESPONSE;
+6 -12
drivers/hv/hv_snapshot.c
··· 24 24 #include <linux/workqueue.h> 25 25 #include <linux/hyperv.h> 26 26 27 + #define VSS_MAJOR 5 28 + #define VSS_MINOR 0 29 + #define VSS_MAJOR_MINOR (VSS_MAJOR << 16 | VSS_MINOR) 30 + 27 31 28 32 29 33 /* ··· 190 186 191 187 if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { 192 188 vmbus_prep_negotiate_resp(icmsghdrp, negop, 193 - recv_buffer, MAX_SRV_VER, MAX_SRV_VER); 194 - /* 195 - * We currently negotiate the highest number the 196 - * host has presented. If this version is not 197 - * atleast 5.0, reject. 198 - */ 199 - negop = (struct icmsg_negotiate *)&recv_buffer[ 200 - sizeof(struct vmbuspipe_hdr) + 201 - sizeof(struct icmsg_hdr)]; 202 - 203 - if (negop->icversion_data[1].major < 5) 204 - negop->icframe_vercnt = 0; 189 + recv_buffer, UTIL_FW_MAJOR_MINOR, 190 + VSS_MAJOR_MINOR); 205 191 } else { 206 192 vss_msg = (struct hv_vss_msg *)&recv_buffer[ 207 193 sizeof(struct vmbuspipe_hdr) +
+18 -4
drivers/hv/hv_util.c
··· 28 28 #include <linux/reboot.h> 29 29 #include <linux/hyperv.h> 30 30 31 + #define SHUTDOWN_MAJOR 3 32 + #define SHUTDOWN_MINOR 0 33 + #define SHUTDOWN_MAJOR_MINOR (SHUTDOWN_MAJOR << 16 | SHUTDOWN_MINOR) 34 + 35 + #define TIMESYNCH_MAJOR 3 36 + #define TIMESYNCH_MINOR 0 37 + #define TIMESYNCH_MAJOR_MINOR (TIMESYNCH_MAJOR << 16 | TIMESYNCH_MINOR) 38 + 39 + #define HEARTBEAT_MAJOR 3 40 + #define HEARTBEAT_MINOR 0 41 + #define HEARTBEAT_MAJOR_MINOR (HEARTBEAT_MAJOR << 16 | HEARTBEAT_MINOR) 42 + 31 43 static void shutdown_onchannelcallback(void *context); 32 44 static struct hv_util_service util_shutdown = { 33 45 .util_cb = shutdown_onchannelcallback, ··· 99 87 100 88 if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { 101 89 vmbus_prep_negotiate_resp(icmsghdrp, negop, 102 - shut_txf_buf, MAX_SRV_VER, MAX_SRV_VER); 90 + shut_txf_buf, UTIL_FW_MAJOR_MINOR, 91 + SHUTDOWN_MAJOR_MINOR); 103 92 } else { 104 93 shutdown_msg = 105 94 (struct shutdown_msg_data *)&shut_txf_buf[ ··· 226 213 227 214 if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { 228 215 vmbus_prep_negotiate_resp(icmsghdrp, NULL, time_txf_buf, 229 - MAX_SRV_VER, MAX_SRV_VER); 216 + UTIL_FW_MAJOR_MINOR, 217 + TIMESYNCH_MAJOR_MINOR); 230 218 } else { 231 219 timedatap = (struct ictimesync_data *)&time_txf_buf[ 232 220 sizeof(struct vmbuspipe_hdr) + ··· 267 253 268 254 if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { 269 255 vmbus_prep_negotiate_resp(icmsghdrp, NULL, 270 - hbeat_txf_buf, MAX_SRV_VER, MAX_SRV_VER); 256 + hbeat_txf_buf, UTIL_FW_MAJOR_MINOR, 257 + HEARTBEAT_MAJOR_MINOR); 271 258 } else { 272 259 heartbeat_msg = 273 260 (struct heartbeat_msg_data *)&hbeat_txf_buf[ ··· 395 380 module_exit(exit_hyperv_utils); 396 381 397 382 MODULE_DESCRIPTION("Hyper-V Utilities"); 398 - MODULE_VERSION(HV_DRV_VERSION); 399 383 MODULE_LICENSE("GPL");
-1
drivers/hv/vmbus_drv.c
··· 816 816 817 817 818 818 MODULE_LICENSE("GPL"); 819 - MODULE_VERSION(HV_DRV_VERSION); 820 819 821 820 subsys_initcall(hv_acpi_init); 822 821 module_exit(vmbus_exit);
-8
drivers/misc/atmel-ssc.c
··· 19 19 #include <linux/module.h> 20 20 21 21 #include <linux/of.h> 22 - #include <linux/pinctrl/consumer.h> 23 22 24 23 /* Serialize access to ssc_list and user count */ 25 24 static DEFINE_SPINLOCK(user_lock); ··· 136 137 struct resource *regs; 137 138 struct ssc_device *ssc; 138 139 const struct atmel_ssc_platform_data *plat_dat; 139 - struct pinctrl *pinctrl; 140 - 141 - pinctrl = devm_pinctrl_get_select_default(&pdev->dev); 142 - if (IS_ERR(pinctrl)) { 143 - dev_err(&pdev->dev, "Failed to request pinctrl\n"); 144 - return PTR_ERR(pinctrl); 145 - } 146 140 147 141 ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL); 148 142 if (!ssc) {
+2 -2
drivers/misc/hpilo.c
··· 759 759 760 760 /* Ignore subsystem_device = 0x1979 (set by BIOS) */ 761 761 if (pdev->subsystem_device == 0x1979) 762 - goto out; 762 + return 0; 763 763 764 764 if (max_ccb > MAX_CCB) 765 765 max_ccb = MAX_CCB; ··· 899 899 class_destroy(ilo_class); 900 900 } 901 901 902 - MODULE_VERSION("1.4"); 902 + MODULE_VERSION("1.4.1"); 903 903 MODULE_ALIAS(ILO_NAME); 904 904 MODULE_DESCRIPTION(ILO_NAME); 905 905 MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>");
+60 -3
drivers/misc/lkdtm.c
··· 43 43 #include <linux/slab.h> 44 44 #include <scsi/scsi_cmnd.h> 45 45 #include <linux/debugfs.h> 46 + #include <linux/vmalloc.h> 46 47 47 48 #ifdef CONFIG_IDE 48 49 #include <linux/ide.h> ··· 51 50 52 51 #define DEFAULT_COUNT 10 53 52 #define REC_NUM_DEFAULT 10 53 + #define EXEC_SIZE 64 54 54 55 55 enum cname { 56 56 CN_INVALID, ··· 70 68 CT_NONE, 71 69 CT_PANIC, 72 70 CT_BUG, 71 + CT_WARNING, 73 72 CT_EXCEPTION, 74 73 CT_LOOP, 75 74 CT_OVERFLOW, ··· 80 77 CT_WRITE_AFTER_FREE, 81 78 CT_SOFTLOCKUP, 82 79 CT_HARDLOCKUP, 80 + CT_SPINLOCKUP, 83 81 CT_HUNG_TASK, 82 + CT_EXEC_DATA, 83 + CT_EXEC_STACK, 84 + CT_EXEC_KMALLOC, 85 + CT_EXEC_VMALLOC, 84 86 }; 85 87 86 88 static char* cp_name[] = { ··· 103 95 static char* cp_type[] = { 104 96 "PANIC", 105 97 "BUG", 98 + "WARNING", 106 99 "EXCEPTION", 107 100 "LOOP", 108 101 "OVERFLOW", ··· 113 104 "WRITE_AFTER_FREE", 114 105 "SOFTLOCKUP", 115 106 "HARDLOCKUP", 107 + "SPINLOCKUP", 116 108 "HUNG_TASK", 109 + "EXEC_DATA", 110 + "EXEC_STACK", 111 + "EXEC_KMALLOC", 112 + "EXEC_VMALLOC", 117 113 }; 118 114 119 115 static struct jprobe lkdtm; ··· 135 121 static enum ctype cptype = CT_NONE; 136 122 static int count = DEFAULT_COUNT; 137 123 static DEFINE_SPINLOCK(count_lock); 124 + static DEFINE_SPINLOCK(lock_me_up); 125 + 126 + static u8 data_area[EXEC_SIZE]; 138 127 139 128 module_param(recur_count, int, 0644); 140 129 MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test, "\ ··· 292 275 return recursive_loop(a); 293 276 } 294 277 278 + static void do_nothing(void) 279 + { 280 + return; 281 + } 282 + 283 + static void execute_location(void *dst) 284 + { 285 + void (*func)(void) = dst; 286 + 287 + memcpy(dst, do_nothing, EXEC_SIZE); 288 + func(); 289 + } 290 + 295 291 static void lkdtm_do_action(enum ctype which) 296 292 { 297 293 switch (which) { ··· 313 283 break; 314 284 case CT_BUG: 315 285 BUG(); 286 + break; 287 + case CT_WARNING: 288 + WARN_ON(1); 316 289 break; 317 290 case CT_EXCEPTION: 318 291 *((int *) 0) = 0; ··· 328 295 (void) recursive_loop(0); 329 296 break; 330 297 case CT_CORRUPT_STACK: { 331 - volatile u32 data[8]; 332 - volatile u32 *p = data; 298 + /* Make sure the compiler creates and uses an 8 char array. */ 299 + volatile char data[8]; 333 300 334 - p[12] = 0x12345678; 301 + memset((void *)data, 0, 64); 335 302 break; 336 303 } 337 304 case CT_UNALIGNED_LOAD_STORE_WRITE: { ··· 373 340 for (;;) 374 341 cpu_relax(); 375 342 break; 343 + case CT_SPINLOCKUP: 344 + /* Must be called twice to trigger. */ 345 + spin_lock(&lock_me_up); 346 + break; 376 347 case CT_HUNG_TASK: 377 348 set_current_state(TASK_UNINTERRUPTIBLE); 378 349 schedule(); 379 350 break; 351 + case CT_EXEC_DATA: 352 + execute_location(data_area); 353 + break; 354 + case CT_EXEC_STACK: { 355 + u8 stack_area[EXEC_SIZE]; 356 + execute_location(stack_area); 357 + break; 358 + } 359 + case CT_EXEC_KMALLOC: { 360 + u32 *kmalloc_area = kmalloc(EXEC_SIZE, GFP_KERNEL); 361 + execute_location(kmalloc_area); 362 + kfree(kmalloc_area); 363 + break; 364 + } 365 + case CT_EXEC_VMALLOC: { 366 + u32 *vmalloc_area = vmalloc(EXEC_SIZE); 367 + execute_location(vmalloc_area); 368 + vfree(vmalloc_area); 369 + break; 370 + } 380 371 case CT_NONE: 381 372 default: 382 373 break;
+11 -3
drivers/misc/mei/amthif.c
··· 418 418 struct file *file, poll_table *wait) 419 419 { 420 420 unsigned int mask = 0; 421 - mutex_unlock(&dev->device_lock); 421 + 422 422 poll_wait(file, &dev->iamthif_cl.wait, wait); 423 + 423 424 mutex_lock(&dev->device_lock); 424 - if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE && 425 - dev->iamthif_file_object == file) { 425 + if (!mei_cl_is_connected(&dev->iamthif_cl)) { 426 + 427 + mask = POLLERR; 428 + 429 + } else if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE && 430 + dev->iamthif_file_object == file) { 431 + 426 432 mask |= (POLLIN | POLLRDNORM); 427 433 dev_dbg(&dev->pdev->dev, "run next amthif cb\n"); 428 434 mei_amthif_run_next_cmd(dev); 429 435 } 436 + mutex_unlock(&dev->device_lock); 437 + 430 438 return mask; 431 439 } 432 440
+2 -2
drivers/misc/mei/bus.c
··· 47 47 id = driver->id_table; 48 48 49 49 while (id->name[0]) { 50 - if (!strcmp(dev_name(dev), id->name)) 50 + if (!strncmp(dev_name(dev), id->name, sizeof(id->name))) 51 51 return 1; 52 52 53 53 id++; ··· 71 71 72 72 dev_dbg(dev, "Device probe\n"); 73 73 74 - strncpy(id.name, dev_name(dev), MEI_CL_NAME_SIZE); 74 + strncpy(id.name, dev_name(dev), sizeof(id.name)); 75 75 76 76 return driver->probe(device, &id); 77 77 }
+8 -7
drivers/misc/mei/client.c
··· 635 635 636 636 dev = cl->dev; 637 637 638 - if (cl->state != MEI_FILE_CONNECTED) 639 - return -ENODEV; 640 - 641 - if (dev->dev_state != MEI_DEV_ENABLED) 638 + if (!mei_cl_is_connected(cl)) 642 639 return -ENODEV; 643 640 644 641 if (cl->read_cb) { ··· 889 892 890 893 891 894 /** 892 - * mei_cl_all_read_wakeup - wake up all readings so they can be interrupted 895 + * mei_cl_all_wakeup - wake up all readers and writers they can be interrupted 893 896 * 894 897 * @dev - mei device 895 898 */ 896 - void mei_cl_all_read_wakeup(struct mei_device *dev) 899 + void mei_cl_all_wakeup(struct mei_device *dev) 897 900 { 898 901 struct mei_cl *cl, *next; 899 902 list_for_each_entry_safe(cl, next, &dev->file_list, link) { 900 903 if (waitqueue_active(&cl->rx_wait)) { 901 - dev_dbg(&dev->pdev->dev, "Waking up client!\n"); 904 + dev_dbg(&dev->pdev->dev, "Waking up reading client!\n"); 902 905 wake_up_interruptible(&cl->rx_wait); 906 + } 907 + if (waitqueue_active(&cl->tx_wait)) { 908 + dev_dbg(&dev->pdev->dev, "Waking up writing client!\n"); 909 + wake_up_interruptible(&cl->tx_wait); 903 910 } 904 911 } 905 912 }
+8 -1
drivers/misc/mei/client.h
··· 84 84 /* 85 85 * MEI input output function prototype 86 86 */ 87 + static inline bool mei_cl_is_connected(struct mei_cl *cl) 88 + { 89 + return (cl->dev && 90 + cl->dev->dev_state == MEI_DEV_ENABLED && 91 + cl->state == MEI_FILE_CONNECTED); 92 + } 93 + 87 94 bool mei_cl_is_other_connecting(struct mei_cl *cl); 88 95 int mei_cl_disconnect(struct mei_cl *cl); 89 96 int mei_cl_connect(struct mei_cl *cl, struct file *file); ··· 106 99 107 100 108 101 void mei_cl_all_disconnect(struct mei_device *dev); 109 - void mei_cl_all_read_wakeup(struct mei_device *dev); 102 + void mei_cl_all_wakeup(struct mei_device *dev); 110 103 void mei_cl_all_write_clear(struct mei_device *dev); 111 104 112 105 #endif /* _MEI_CLIENT_H_ */
+3 -6
drivers/misc/mei/hw-me.c
··· 176 176 struct mei_me_hw *hw = to_me_hw(dev); 177 177 u32 hcsr = mei_hcsr_read(hw); 178 178 179 - dev_dbg(&dev->pdev->dev, "before reset HCSR = 0x%08x.\n", hcsr); 180 - 181 - hcsr |= (H_RST | H_IG); 179 + hcsr |= H_RST | H_IG | H_IS; 182 180 183 181 if (intr_enable) 184 182 hcsr |= H_IE; 185 183 else 186 - hcsr |= ~H_IE; 184 + hcsr &= ~H_IE; 187 185 188 - mei_hcsr_set(hw, hcsr); 186 + mei_me_reg_write(hw, H_CSR, hcsr); 189 187 190 188 if (dev->dev_state == MEI_DEV_POWER_DOWN) 191 189 mei_me_hw_reset_release(dev); 192 190 193 - dev_dbg(&dev->pdev->dev, "current HCSR = 0x%08x.\n", mei_hcsr_read(hw)); 194 191 return 0; 195 192 } 196 193
+6 -5
drivers/misc/mei/init.c
··· 154 154 dev->dev_state != MEI_DEV_POWER_DOWN) 155 155 dev->dev_state = MEI_DEV_RESETTING; 156 156 157 + /* remove all waiting requests */ 158 + mei_cl_all_write_clear(dev); 159 + 157 160 mei_cl_all_disconnect(dev); 161 + 162 + /* wake up all readings so they can be interrupted */ 163 + mei_cl_all_wakeup(dev); 158 164 159 165 /* remove entry if already in list */ 160 166 dev_dbg(&dev->pdev->dev, "remove iamthif and wd from the file list.\n"); ··· 202 196 203 197 mei_hbm_start_req(dev); 204 198 205 - /* wake up all readings so they can be interrupted */ 206 - mei_cl_all_read_wakeup(dev); 207 - 208 - /* remove all waiting requests */ 209 - mei_cl_all_write_clear(dev); 210 199 } 211 200 EXPORT_SYMBOL_GPL(mei_reset); 212 201
+15 -7
drivers/misc/mei/main.c
··· 625 625 unsigned int mask = 0; 626 626 627 627 if (WARN_ON(!cl || !cl->dev)) 628 - return mask; 628 + return POLLERR; 629 629 630 630 dev = cl->dev; 631 631 632 632 mutex_lock(&dev->device_lock); 633 633 634 - if (dev->dev_state != MEI_DEV_ENABLED) 635 - goto out; 636 - 637 - 638 - if (cl == &dev->iamthif_cl) { 639 - mask = mei_amthif_poll(dev, file, wait); 634 + if (!mei_cl_is_connected(cl)) { 635 + mask = POLLERR; 640 636 goto out; 641 637 } 642 638 643 639 mutex_unlock(&dev->device_lock); 640 + 641 + 642 + if (cl == &dev->iamthif_cl) 643 + return mei_amthif_poll(dev, file, wait); 644 + 644 645 poll_wait(file, &cl->tx_wait, wait); 646 + 645 647 mutex_lock(&dev->device_lock); 648 + 649 + if (!mei_cl_is_connected(cl)) { 650 + mask = POLLERR; 651 + goto out; 652 + } 653 + 646 654 if (MEI_WRITE_COMPLETE == cl->writing_state) 647 655 mask |= (POLLIN | POLLRDNORM); 648 656
+2 -1
drivers/misc/sram.c
··· 68 68 ret = gen_pool_add_virt(sram->pool, (unsigned long)virt_base, 69 69 res->start, size, -1); 70 70 if (ret < 0) { 71 - gen_pool_destroy(sram->pool); 71 + if (sram->clk) 72 + clk_disable_unprepare(sram->clk); 72 73 return ret; 73 74 } 74 75
+2
drivers/misc/ti-st/st_core.c
··· 562 562 if ((st_gdata->protos_registered != ST_EMPTY) && 563 563 (test_bit(ST_REG_PENDING, &st_gdata->st_state))) { 564 564 pr_err(" KIM failure complete callback "); 565 + spin_lock_irqsave(&st_gdata->lock, flags); 565 566 st_reg_complete(st_gdata, err); 567 + spin_unlock_irqrestore(&st_gdata->lock, flags); 566 568 clear_bit(ST_REG_PENDING, &st_gdata->st_state); 567 569 } 568 570 return -EINVAL;
+1 -1
drivers/misc/vmw_balloon.c
··· 133 133 #define VMWARE_BALLOON_CMD(cmd, data, result) \ 134 134 ({ \ 135 135 unsigned long __stat, __dummy1, __dummy2; \ 136 - __asm__ __volatile__ ("inl (%%dx)" : \ 136 + __asm__ __volatile__ ("inl %%dx" : \ 137 137 "=a"(__stat), \ 138 138 "=c"(__dummy1), \ 139 139 "=d"(__dummy2), \
+1 -1
drivers/misc/vmw_vmci/vmci_driver.c
··· 113 113 114 114 MODULE_AUTHOR("VMware, Inc."); 115 115 MODULE_DESCRIPTION("VMware Virtual Machine Communication Interface."); 116 - MODULE_VERSION("1.0.0.0-k"); 116 + MODULE_VERSION("1.1.0.0-k"); 117 117 MODULE_LICENSE("GPL v2");
+7
drivers/misc/vmw_vmci/vmci_driver.h
··· 35 35 enum vmci_obj_type type; 36 36 }; 37 37 38 + /* 39 + * Needed by other components of this module. It's okay to have one global 40 + * instance of this because there can only ever be one VMCI device. Our 41 + * virtual hardware enforces this. 42 + */ 43 + extern struct pci_dev *vmci_pdev; 44 + 38 45 u32 vmci_get_context_id(void); 39 46 int vmci_send_datagram(struct vmci_datagram *dg); 40 47
+16 -6
drivers/misc/vmw_vmci/vmci_guest.c
··· 65 65 66 66 void *data_buffer; 67 67 void *notification_bitmap; 68 + dma_addr_t notification_base; 68 69 }; 69 70 70 71 /* vmci_dev singleton device and supporting data*/ 72 + struct pci_dev *vmci_pdev; 71 73 static struct vmci_guest_device *vmci_dev_g; 72 74 static DEFINE_SPINLOCK(vmci_dev_spinlock); 73 75 ··· 530 528 * well. 531 529 */ 532 530 if (capabilities & VMCI_CAPS_NOTIFICATIONS) { 533 - vmci_dev->notification_bitmap = vmalloc(PAGE_SIZE); 531 + vmci_dev->notification_bitmap = dma_alloc_coherent( 532 + &pdev->dev, PAGE_SIZE, &vmci_dev->notification_base, 533 + GFP_KERNEL); 534 534 if (!vmci_dev->notification_bitmap) { 535 535 dev_warn(&pdev->dev, 536 536 "Unable to allocate notification bitmap\n"); ··· 550 546 /* Set up global device so that we can start sending datagrams */ 551 547 spin_lock_irq(&vmci_dev_spinlock); 552 548 vmci_dev_g = vmci_dev; 549 + vmci_pdev = pdev; 553 550 spin_unlock_irq(&vmci_dev_spinlock); 554 551 555 552 /* ··· 558 553 * used. 559 554 */ 560 555 if (capabilities & VMCI_CAPS_NOTIFICATIONS) { 561 - struct page *page = 562 - vmalloc_to_page(vmci_dev->notification_bitmap); 563 - unsigned long bitmap_ppn = page_to_pfn(page); 556 + unsigned long bitmap_ppn = 557 + vmci_dev->notification_base >> PAGE_SHIFT; 564 558 if (!vmci_dbell_register_notification_bitmap(bitmap_ppn)) { 565 559 dev_warn(&pdev->dev, 566 560 "VMCI device unable to register notification bitmap with PPN 0x%x\n", ··· 669 665 if (vmci_dev->notification_bitmap) { 670 666 iowrite32(VMCI_CONTROL_RESET, 671 667 vmci_dev->iobase + VMCI_CONTROL_ADDR); 672 - vfree(vmci_dev->notification_bitmap); 668 + dma_free_coherent(&pdev->dev, PAGE_SIZE, 669 + vmci_dev->notification_bitmap, 670 + vmci_dev->notification_base); 673 671 } 674 672 675 673 err_remove_vmci_dev_g: 676 674 spin_lock_irq(&vmci_dev_spinlock); 675 + vmci_pdev = NULL; 677 676 vmci_dev_g = NULL; 678 677 spin_unlock_irq(&vmci_dev_spinlock); 679 678 ··· 706 699 707 700 spin_lock_irq(&vmci_dev_spinlock); 708 701 vmci_dev_g = NULL; 702 + vmci_pdev = NULL; 709 703 spin_unlock_irq(&vmci_dev_spinlock); 710 704 711 705 dev_dbg(&pdev->dev, "Resetting vmci device\n"); ··· 735 727 * device, so we can safely free it here. 736 728 */ 737 729 738 - vfree(vmci_dev->notification_bitmap); 730 + dma_free_coherent(&pdev->dev, PAGE_SIZE, 731 + vmci_dev->notification_bitmap, 732 + vmci_dev->notification_base); 739 733 } 740 734 741 735 vfree(vmci_dev->data_buffer);
+118 -195
drivers/misc/vmw_vmci/vmci_queue_pair.c
··· 21 21 #include <linux/module.h> 22 22 #include <linux/mutex.h> 23 23 #include <linux/pagemap.h> 24 + #include <linux/pci.h> 24 25 #include <linux/sched.h> 25 26 #include <linux/slab.h> 26 27 #include <linux/uio.h> ··· 147 146 148 147 /* The Kernel specific component of the struct vmci_queue structure. */ 149 148 struct vmci_queue_kern_if { 150 - struct page **page; 151 - struct page **header_page; 152 - void *va; 153 149 struct mutex __mutex; /* Protects the queue. */ 154 150 struct mutex *mutex; /* Shared by producer and consumer queues. */ 155 - bool host; 156 - size_t num_pages; 157 - bool mapped; 151 + size_t num_pages; /* Number of pages incl. header. */ 152 + bool host; /* Host or guest? */ 153 + union { 154 + struct { 155 + dma_addr_t *pas; 156 + void **vas; 157 + } g; /* Used by the guest. */ 158 + struct { 159 + struct page **page; 160 + struct page **header_page; 161 + } h; /* Used by the host. */ 162 + } u; 158 163 }; 159 164 160 165 /* ··· 272 265 struct vmci_queue *queue = q; 273 266 274 267 if (queue) { 275 - u64 i = DIV_ROUND_UP(size, PAGE_SIZE); 268 + u64 i; 276 269 277 - if (queue->kernel_if->mapped) { 278 - vunmap(queue->kernel_if->va); 279 - queue->kernel_if->va = NULL; 270 + /* Given size does not include header, so add in a page here. */ 271 + for (i = 0; i < DIV_ROUND_UP(size, PAGE_SIZE) + 1; i++) { 272 + dma_free_coherent(&vmci_pdev->dev, PAGE_SIZE, 273 + queue->kernel_if->u.g.vas[i], 274 + queue->kernel_if->u.g.pas[i]); 280 275 } 281 276 282 - while (i) 283 - __free_page(queue->kernel_if->page[--i]); 284 - 285 - vfree(queue->q_header); 277 + vfree(queue); 286 278 } 287 279 } 288 280 289 281 /* 290 - * Allocates kernel VA space of specified size, plus space for the 291 - * queue structure/kernel interface and the queue header. Allocates 292 - * physical pages for the queue data pages. 293 - * 294 - * PAGE m: struct vmci_queue_header (struct vmci_queue->q_header) 295 - * PAGE m+1: struct vmci_queue 296 - * PAGE m+1+q: struct vmci_queue_kern_if (struct vmci_queue->kernel_if) 297 - * PAGE n-size: Data pages (struct vmci_queue->kernel_if->page[]) 282 + * Allocates kernel queue pages of specified size with IOMMU mappings, 283 + * plus space for the queue structure/kernel interface and the queue 284 + * header. 298 285 */ 299 286 static void *qp_alloc_queue(u64 size, u32 flags) 300 287 { 301 288 u64 i; 302 289 struct vmci_queue *queue; 303 - struct vmci_queue_header *q_header; 304 - const u64 num_data_pages = DIV_ROUND_UP(size, PAGE_SIZE); 305 - const uint queue_size = 306 - PAGE_SIZE + 307 - sizeof(*queue) + sizeof(*(queue->kernel_if)) + 308 - num_data_pages * sizeof(*(queue->kernel_if->page)); 290 + const size_t num_pages = DIV_ROUND_UP(size, PAGE_SIZE) + 1; 291 + const size_t pas_size = num_pages * sizeof(*queue->kernel_if->u.g.pas); 292 + const size_t vas_size = num_pages * sizeof(*queue->kernel_if->u.g.vas); 293 + const size_t queue_size = 294 + sizeof(*queue) + sizeof(*queue->kernel_if) + 295 + pas_size + vas_size; 309 296 310 - q_header = vmalloc(queue_size); 311 - if (!q_header) 297 + queue = vmalloc(queue_size); 298 + if (!queue) 312 299 return NULL; 313 300 314 - queue = (void *)q_header + PAGE_SIZE; 315 - queue->q_header = q_header; 301 + queue->q_header = NULL; 316 302 queue->saved_header = NULL; 317 303 queue->kernel_if = (struct vmci_queue_kern_if *)(queue + 1); 318 - queue->kernel_if->header_page = NULL; /* Unused in guest. */ 319 - queue->kernel_if->page = (struct page **)(queue->kernel_if + 1); 304 + queue->kernel_if->mutex = NULL; 305 + queue->kernel_if->num_pages = num_pages; 306 + queue->kernel_if->u.g.pas = (dma_addr_t *)(queue->kernel_if + 1); 307 + queue->kernel_if->u.g.vas = 308 + (void **)((u8 *)queue->kernel_if->u.g.pas + pas_size); 320 309 queue->kernel_if->host = false; 321 - queue->kernel_if->va = NULL; 322 - queue->kernel_if->mapped = false; 323 310 324 - for (i = 0; i < num_data_pages; i++) { 325 - queue->kernel_if->page[i] = alloc_pages(GFP_KERNEL, 0); 326 - if (!queue->kernel_if->page[i]) 327 - goto fail; 311 + for (i = 0; i < num_pages; i++) { 312 + queue->kernel_if->u.g.vas[i] = 313 + dma_alloc_coherent(&vmci_pdev->dev, PAGE_SIZE, 314 + &queue->kernel_if->u.g.pas[i], 315 + GFP_KERNEL); 316 + if (!queue->kernel_if->u.g.vas[i]) { 317 + /* Size excl. the header. */ 318 + qp_free_queue(queue, i * PAGE_SIZE); 319 + return NULL; 320 + } 328 321 } 329 322 330 - if (vmci_qp_pinned(flags)) { 331 - queue->kernel_if->va = 332 - vmap(queue->kernel_if->page, num_data_pages, VM_MAP, 333 - PAGE_KERNEL); 334 - if (!queue->kernel_if->va) 335 - goto fail; 323 + /* Queue header is the first page. */ 324 + queue->q_header = queue->kernel_if->u.g.vas[0]; 336 325 337 - queue->kernel_if->mapped = true; 338 - } 339 - 340 - return (void *)queue; 341 - 342 - fail: 343 - qp_free_queue(queue, i * PAGE_SIZE); 344 - return NULL; 326 + return queue; 345 327 } 346 328 347 329 /* ··· 349 353 size_t bytes_copied = 0; 350 354 351 355 while (bytes_copied < size) { 352 - u64 page_index = (queue_offset + bytes_copied) / PAGE_SIZE; 353 - size_t page_offset = 356 + const u64 page_index = 357 + (queue_offset + bytes_copied) / PAGE_SIZE; 358 + const size_t page_offset = 354 359 (queue_offset + bytes_copied) & (PAGE_SIZE - 1); 355 360 void *va; 356 361 size_t to_copy; 357 362 358 - if (!kernel_if->mapped) 359 - va = kmap(kernel_if->page[page_index]); 363 + if (kernel_if->host) 364 + va = kmap(kernel_if->u.h.page[page_index]); 360 365 else 361 - va = (void *)((u8 *)kernel_if->va + 362 - (page_index * PAGE_SIZE)); 366 + va = kernel_if->u.g.vas[page_index + 1]; 367 + /* Skip header. */ 363 368 364 369 if (size - bytes_copied > PAGE_SIZE - page_offset) 365 370 /* Enough payload to fill up from this page. */ ··· 376 379 err = memcpy_fromiovec((u8 *)va + page_offset, 377 380 iov, to_copy); 378 381 if (err != 0) { 379 - kunmap(kernel_if->page[page_index]); 382 + if (kernel_if->host) 383 + kunmap(kernel_if->u.h.page[page_index]); 380 384 return VMCI_ERROR_INVALID_ARGS; 381 385 } 382 386 } else { ··· 386 388 } 387 389 388 390 bytes_copied += to_copy; 389 - if (!kernel_if->mapped) 390 - kunmap(kernel_if->page[page_index]); 391 + if (kernel_if->host) 392 + kunmap(kernel_if->u.h.page[page_index]); 391 393 } 392 394 393 395 return VMCI_SUCCESS; ··· 409 411 size_t bytes_copied = 0; 410 412 411 413 while (bytes_copied < size) { 412 - u64 page_index = (queue_offset + bytes_copied) / PAGE_SIZE; 413 - size_t page_offset = 414 + const u64 page_index = 415 + (queue_offset + bytes_copied) / PAGE_SIZE; 416 + const size_t page_offset = 414 417 (queue_offset + bytes_copied) & (PAGE_SIZE - 1); 415 418 void *va; 416 419 size_t to_copy; 417 420 418 - if (!kernel_if->mapped) 419 - va = kmap(kernel_if->page[page_index]); 421 + if (kernel_if->host) 422 + va = kmap(kernel_if->u.h.page[page_index]); 420 423 else 421 - va = (void *)((u8 *)kernel_if->va + 422 - (page_index * PAGE_SIZE)); 424 + va = kernel_if->u.g.vas[page_index + 1]; 425 + /* Skip header. */ 423 426 424 427 if (size - bytes_copied > PAGE_SIZE - page_offset) 425 428 /* Enough payload to fill up this page. */ ··· 436 437 err = memcpy_toiovec(iov, (u8 *)va + page_offset, 437 438 to_copy); 438 439 if (err != 0) { 439 - kunmap(kernel_if->page[page_index]); 440 + if (kernel_if->host) 441 + kunmap(kernel_if->u.h.page[page_index]); 440 442 return VMCI_ERROR_INVALID_ARGS; 441 443 } 442 444 } else { ··· 446 446 } 447 447 448 448 bytes_copied += to_copy; 449 - if (!kernel_if->mapped) 450 - kunmap(kernel_if->page[page_index]); 449 + if (kernel_if->host) 450 + kunmap(kernel_if->u.h.page[page_index]); 451 451 } 452 452 453 453 return VMCI_SUCCESS; ··· 489 489 return VMCI_ERROR_NO_MEM; 490 490 } 491 491 492 - produce_ppns[0] = page_to_pfn(vmalloc_to_page(produce_q->q_header)); 493 - for (i = 1; i < num_produce_pages; i++) { 492 + for (i = 0; i < num_produce_pages; i++) { 494 493 unsigned long pfn; 495 494 496 495 produce_ppns[i] = 497 - page_to_pfn(produce_q->kernel_if->page[i - 1]); 496 + produce_q->kernel_if->u.g.pas[i] >> PAGE_SHIFT; 498 497 pfn = produce_ppns[i]; 499 498 500 499 /* Fail allocation if PFN isn't supported by hypervisor. */ ··· 502 503 goto ppn_error; 503 504 } 504 505 505 - consume_ppns[0] = page_to_pfn(vmalloc_to_page(consume_q->q_header)); 506 - for (i = 1; i < num_consume_pages; i++) { 506 + for (i = 0; i < num_consume_pages; i++) { 507 507 unsigned long pfn; 508 508 509 509 consume_ppns[i] = 510 - page_to_pfn(consume_q->kernel_if->page[i - 1]); 510 + consume_q->kernel_if->u.g.pas[i] >> PAGE_SHIFT; 511 511 pfn = consume_ppns[i]; 512 512 513 513 /* Fail allocation if PFN isn't supported by hypervisor. */ ··· 617 619 const size_t num_pages = DIV_ROUND_UP(size, PAGE_SIZE) + 1; 618 620 const size_t queue_size = sizeof(*queue) + sizeof(*(queue->kernel_if)); 619 621 const size_t queue_page_size = 620 - num_pages * sizeof(*queue->kernel_if->page); 622 + num_pages * sizeof(*queue->kernel_if->u.h.page); 621 623 622 624 queue = kzalloc(queue_size + queue_page_size, GFP_KERNEL); 623 625 if (queue) { 624 626 queue->q_header = NULL; 625 627 queue->saved_header = NULL; 626 - queue->kernel_if = 627 - (struct vmci_queue_kern_if *)((u8 *)queue + 628 - sizeof(*queue)); 628 + queue->kernel_if = (struct vmci_queue_kern_if *)(queue + 1); 629 629 queue->kernel_if->host = true; 630 630 queue->kernel_if->mutex = NULL; 631 631 queue->kernel_if->num_pages = num_pages; 632 - queue->kernel_if->header_page = 632 + queue->kernel_if->u.h.header_page = 633 633 (struct page **)((u8 *)queue + queue_size); 634 - queue->kernel_if->page = &queue->kernel_if->header_page[1]; 635 - queue->kernel_if->va = NULL; 636 - queue->kernel_if->mapped = false; 634 + queue->kernel_if->u.h.page = 635 + &queue->kernel_if->u.h.header_page[1]; 637 636 } 638 637 639 638 return queue; ··· 737 742 current->mm, 738 743 (uintptr_t) produce_uva, 739 744 produce_q->kernel_if->num_pages, 740 - 1, 0, produce_q->kernel_if->header_page, NULL); 745 + 1, 0, 746 + produce_q->kernel_if->u.h.header_page, NULL); 741 747 if (retval < produce_q->kernel_if->num_pages) { 742 748 pr_warn("get_user_pages(produce) failed (retval=%d)", retval); 743 - qp_release_pages(produce_q->kernel_if->header_page, retval, 744 - false); 749 + qp_release_pages(produce_q->kernel_if->u.h.header_page, 750 + retval, false); 745 751 err = VMCI_ERROR_NO_MEM; 746 752 goto out; 747 753 } ··· 751 755 current->mm, 752 756 (uintptr_t) consume_uva, 753 757 consume_q->kernel_if->num_pages, 754 - 1, 0, consume_q->kernel_if->header_page, NULL); 758 + 1, 0, 759 + consume_q->kernel_if->u.h.header_page, NULL); 755 760 if (retval < consume_q->kernel_if->num_pages) { 756 761 pr_warn("get_user_pages(consume) failed (retval=%d)", retval); 757 - qp_release_pages(consume_q->kernel_if->header_page, retval, 758 - false); 759 - qp_release_pages(produce_q->kernel_if->header_page, 762 + qp_release_pages(consume_q->kernel_if->u.h.header_page, 763 + retval, false); 764 + qp_release_pages(produce_q->kernel_if->u.h.header_page, 760 765 produce_q->kernel_if->num_pages, false); 761 766 err = VMCI_ERROR_NO_MEM; 762 767 } ··· 800 803 static void qp_host_unregister_user_memory(struct vmci_queue *produce_q, 801 804 struct vmci_queue *consume_q) 802 805 { 803 - qp_release_pages(produce_q->kernel_if->header_page, 806 + qp_release_pages(produce_q->kernel_if->u.h.header_page, 804 807 produce_q->kernel_if->num_pages, true); 805 - memset(produce_q->kernel_if->header_page, 0, 806 - sizeof(*produce_q->kernel_if->header_page) * 808 + memset(produce_q->kernel_if->u.h.header_page, 0, 809 + sizeof(*produce_q->kernel_if->u.h.header_page) * 807 810 produce_q->kernel_if->num_pages); 808 - qp_release_pages(consume_q->kernel_if->header_page, 811 + qp_release_pages(consume_q->kernel_if->u.h.header_page, 809 812 consume_q->kernel_if->num_pages, true); 810 - memset(consume_q->kernel_if->header_page, 0, 811 - sizeof(*consume_q->kernel_if->header_page) * 813 + memset(consume_q->kernel_if->u.h.header_page, 0, 814 + sizeof(*consume_q->kernel_if->u.h.header_page) * 812 815 consume_q->kernel_if->num_pages); 813 816 } 814 817 ··· 831 834 if (produce_q->q_header != consume_q->q_header) 832 835 return VMCI_ERROR_QUEUEPAIR_MISMATCH; 833 836 834 - if (produce_q->kernel_if->header_page == NULL || 835 - *produce_q->kernel_if->header_page == NULL) 837 + if (produce_q->kernel_if->u.h.header_page == NULL || 838 + *produce_q->kernel_if->u.h.header_page == NULL) 836 839 return VMCI_ERROR_UNAVAILABLE; 837 840 838 - headers[0] = *produce_q->kernel_if->header_page; 839 - headers[1] = *consume_q->kernel_if->header_page; 841 + headers[0] = *produce_q->kernel_if->u.h.header_page; 842 + headers[1] = *consume_q->kernel_if->u.h.header_page; 840 843 841 844 produce_q->q_header = vmap(headers, 2, VM_MAP, PAGE_KERNEL); 842 845 if (produce_q->q_header != NULL) { ··· 1717 1720 if (result < VMCI_SUCCESS) 1718 1721 return result; 1719 1722 1720 - /* 1721 - * Preemptively load in the headers if non-blocking to 1722 - * prevent blocking later. 1723 - */ 1724 - if (entry->qp.flags & VMCI_QPFLAG_NONBLOCK) { 1725 - result = qp_host_map_queues(entry->produce_q, 1726 - entry->consume_q); 1727 - if (result < VMCI_SUCCESS) { 1728 - qp_host_unregister_user_memory( 1729 - entry->produce_q, 1730 - entry->consume_q); 1731 - return result; 1732 - } 1733 - } 1734 - 1735 1723 entry->state = VMCIQPB_ATTACHED_MEM; 1736 1724 } else { 1737 1725 entry->state = VMCIQPB_ATTACHED_NO_MEM; ··· 1731 1749 1732 1750 return VMCI_ERROR_UNAVAILABLE; 1733 1751 } else { 1734 - /* 1735 - * For non-blocking queue pairs, we cannot rely on 1736 - * enqueue/dequeue to map in the pages on the 1737 - * host-side, since it may block, so we make an 1738 - * attempt here. 1739 - */ 1740 - 1741 - if (flags & VMCI_QPFLAG_NONBLOCK) { 1742 - result = 1743 - qp_host_map_queues(entry->produce_q, 1744 - entry->consume_q); 1745 - if (result < VMCI_SUCCESS) 1746 - return result; 1747 - 1748 - entry->qp.flags |= flags & 1749 - (VMCI_QPFLAG_NONBLOCK | VMCI_QPFLAG_PINNED); 1750 - } 1751 - 1752 1752 /* The host side has successfully attached to a queue pair. */ 1753 1753 entry->state = VMCIQPB_ATTACHED_MEM; 1754 1754 } ··· 2507 2543 * Since non-blocking isn't yet implemented on the host personality we 2508 2544 * have no reason to acquire a spin lock. So to avoid the use of an 2509 2545 * unnecessary lock only acquire the mutex if we can block. 2510 - * Note: It is assumed that QPFLAG_PINNED implies QPFLAG_NONBLOCK. Therefore 2511 - * we can use the same locking function for access to both the queue 2512 - * and the queue headers as it is the same logic. Assert this behvior. 2513 2546 */ 2514 2547 static void qp_lock(const struct vmci_qp *qpair) 2515 2548 { 2516 - if (vmci_can_block(qpair->flags)) 2517 - qp_acquire_queue_mutex(qpair->produce_q); 2549 + qp_acquire_queue_mutex(qpair->produce_q); 2518 2550 } 2519 2551 2520 2552 /* 2521 2553 * Helper routine that unlocks the queue pair after calling 2522 - * qp_lock. Respects non-blocking and pinning flags. 2554 + * qp_lock. 2523 2555 */ 2524 2556 static void qp_unlock(const struct vmci_qp *qpair) 2525 2557 { 2526 - if (vmci_can_block(qpair->flags)) 2527 - qp_release_queue_mutex(qpair->produce_q); 2558 + qp_release_queue_mutex(qpair->produce_q); 2528 2559 } 2529 2560 2530 2561 /* ··· 2527 2568 * currently not mapped, it will be attempted to do so. 2528 2569 */ 2529 2570 static int qp_map_queue_headers(struct vmci_queue *produce_q, 2530 - struct vmci_queue *consume_q, 2531 - bool can_block) 2571 + struct vmci_queue *consume_q) 2532 2572 { 2533 2573 int result; 2534 2574 2535 2575 if (NULL == produce_q->q_header || NULL == consume_q->q_header) { 2536 - if (can_block) 2537 - result = qp_host_map_queues(produce_q, consume_q); 2538 - else 2539 - result = VMCI_ERROR_QUEUEPAIR_NOT_READY; 2540 - 2576 + result = qp_host_map_queues(produce_q, consume_q); 2541 2577 if (result < VMCI_SUCCESS) 2542 2578 return (produce_q->saved_header && 2543 2579 consume_q->saved_header) ? ··· 2555 2601 { 2556 2602 int result; 2557 2603 2558 - result = qp_map_queue_headers(qpair->produce_q, qpair->consume_q, 2559 - vmci_can_block(qpair->flags)); 2604 + result = qp_map_queue_headers(qpair->produce_q, qpair->consume_q); 2560 2605 if (result == VMCI_SUCCESS) { 2561 2606 *produce_q_header = qpair->produce_q->q_header; 2562 2607 *consume_q_header = qpair->consume_q->q_header; ··· 2598 2645 { 2599 2646 unsigned int generation; 2600 2647 2601 - if (qpair->flags & VMCI_QPFLAG_NONBLOCK) 2602 - return false; 2603 - 2604 2648 qpair->blocked++; 2605 2649 generation = qpair->generation; 2606 2650 qp_unlock(qpair); ··· 2624 2674 const u64 produce_q_size, 2625 2675 const void *buf, 2626 2676 size_t buf_size, 2627 - vmci_memcpy_to_queue_func memcpy_to_queue, 2628 - bool can_block) 2677 + vmci_memcpy_to_queue_func memcpy_to_queue) 2629 2678 { 2630 2679 s64 free_space; 2631 2680 u64 tail; 2632 2681 size_t written; 2633 2682 ssize_t result; 2634 2683 2635 - result = qp_map_queue_headers(produce_q, consume_q, can_block); 2684 + result = qp_map_queue_headers(produce_q, consume_q); 2636 2685 if (unlikely(result != VMCI_SUCCESS)) 2637 2686 return result; 2638 2687 ··· 2686 2737 void *buf, 2687 2738 size_t buf_size, 2688 2739 vmci_memcpy_from_queue_func memcpy_from_queue, 2689 - bool update_consumer, 2690 - bool can_block) 2740 + bool update_consumer) 2691 2741 { 2692 2742 s64 buf_ready; 2693 2743 u64 head; 2694 2744 size_t read; 2695 2745 ssize_t result; 2696 2746 2697 - result = qp_map_queue_headers(produce_q, consume_q, can_block); 2747 + result = qp_map_queue_headers(produce_q, consume_q); 2698 2748 if (unlikely(result != VMCI_SUCCESS)) 2699 2749 return result; 2700 2750 ··· 2790 2842 route = vmci_guest_code_active() ? 2791 2843 VMCI_ROUTE_AS_GUEST : VMCI_ROUTE_AS_HOST; 2792 2844 2793 - /* If NONBLOCK or PINNED is set, we better be the guest personality. */ 2794 - if ((!vmci_can_block(flags) || vmci_qp_pinned(flags)) && 2795 - VMCI_ROUTE_AS_GUEST != route) { 2796 - pr_devel("Not guest personality w/ NONBLOCK OR PINNED set"); 2845 + if (flags & (VMCI_QPFLAG_NONBLOCK | VMCI_QPFLAG_PINNED)) { 2846 + pr_devel("NONBLOCK OR PINNED set"); 2797 2847 return VMCI_ERROR_INVALID_ARGS; 2798 - } 2799 - 2800 - /* 2801 - * Limit the size of pinned QPs and check sanity. 2802 - * 2803 - * Pinned pages implies non-blocking mode. Mutexes aren't acquired 2804 - * when the NONBLOCK flag is set in qpair code; and also should not be 2805 - * acquired when the PINNED flagged is set. Since pinning pages 2806 - * implies we want speed, it makes no sense not to have NONBLOCK 2807 - * set if PINNED is set. Hence enforce this implication. 2808 - */ 2809 - if (vmci_qp_pinned(flags)) { 2810 - if (vmci_can_block(flags)) { 2811 - pr_err("Attempted to enable pinning w/o non-blocking"); 2812 - return VMCI_ERROR_INVALID_ARGS; 2813 - } 2814 - 2815 - if (produce_qsize + consume_qsize > VMCI_MAX_PINNED_QP_MEMORY) 2816 - return VMCI_ERROR_NO_RESOURCES; 2817 2848 } 2818 2849 2819 2850 my_qpair = kzalloc(sizeof(*my_qpair), GFP_KERNEL); ··· 3122 3195 qpair->consume_q, 3123 3196 qpair->produce_q_size, 3124 3197 buf, buf_size, 3125 - qp_memcpy_to_queue, 3126 - vmci_can_block(qpair->flags)); 3198 + qp_memcpy_to_queue); 3127 3199 3128 3200 if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY && 3129 3201 !qp_wait_for_ready_queue(qpair)) ··· 3163 3237 qpair->consume_q, 3164 3238 qpair->consume_q_size, 3165 3239 buf, buf_size, 3166 - qp_memcpy_from_queue, true, 3167 - vmci_can_block(qpair->flags)); 3240 + qp_memcpy_from_queue, true); 3168 3241 3169 3242 if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY && 3170 3243 !qp_wait_for_ready_queue(qpair)) ··· 3205 3280 qpair->consume_q, 3206 3281 qpair->consume_q_size, 3207 3282 buf, buf_size, 3208 - qp_memcpy_from_queue, false, 3209 - vmci_can_block(qpair->flags)); 3283 + qp_memcpy_from_queue, false); 3210 3284 3211 3285 if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY && 3212 3286 !qp_wait_for_ready_queue(qpair)) ··· 3247 3323 qpair->consume_q, 3248 3324 qpair->produce_q_size, 3249 3325 iov, iov_size, 3250 - qp_memcpy_to_queue_iov, 3251 - vmci_can_block(qpair->flags)); 3326 + qp_memcpy_to_queue_iov); 3252 3327 3253 3328 if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY && 3254 3329 !qp_wait_for_ready_queue(qpair)) ··· 3290 3367 qpair->consume_q_size, 3291 3368 iov, iov_size, 3292 3369 qp_memcpy_from_queue_iov, 3293 - true, vmci_can_block(qpair->flags)); 3370 + true); 3294 3371 3295 3372 if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY && 3296 3373 !qp_wait_for_ready_queue(qpair)) ··· 3334 3411 qpair->consume_q_size, 3335 3412 iov, iov_size, 3336 3413 qp_memcpy_from_queue_iov, 3337 - false, vmci_can_block(qpair->flags)); 3414 + false); 3338 3415 3339 3416 if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY && 3340 3417 !qp_wait_for_ready_queue(qpair))
-18
drivers/misc/vmw_vmci/vmci_queue_pair.h
··· 146 146 return page_store->len >= 2; 147 147 } 148 148 149 - /* 150 - * Helper function to check if the non-blocking flag 151 - * is set for a given queue pair. 152 - */ 153 - static inline bool vmci_can_block(u32 flags) 154 - { 155 - return !(flags & VMCI_QPFLAG_NONBLOCK); 156 - } 157 - 158 - /* 159 - * Helper function to check if the queue pair is pinned 160 - * into memory. 161 - */ 162 - static inline bool vmci_qp_pinned(u32 flags) 163 - { 164 - return flags & VMCI_QPFLAG_PINNED; 165 - } 166 - 167 149 void vmci_qp_broker_exit(void); 168 150 int vmci_qp_broker_alloc(struct vmci_handle handle, u32 peer, 169 151 u32 flags, u32 priv_flags,
-2
drivers/net/hyperv/netvsc_drv.c
··· 306 306 struct ethtool_drvinfo *info) 307 307 { 308 308 strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); 309 - strlcpy(info->version, HV_DRV_VERSION, sizeof(info->version)); 310 309 strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); 311 310 } 312 311 ··· 528 529 } 529 530 530 531 MODULE_LICENSE("GPL"); 531 - MODULE_VERSION(HV_DRV_VERSION); 532 532 MODULE_DESCRIPTION("Microsoft Hyper-V network driver"); 533 533 534 534 module_init(netvsc_drv_init);
+1 -1
drivers/parport/Kconfig
··· 37 37 tristate "PC-style hardware" 38 38 depends on (!SPARC64 || PCI) && !SPARC32 && !M32R && !FRV && !S390 && \ 39 39 (!M68K || ISA) && !MN10300 && !AVR32 && !BLACKFIN && \ 40 - !XTENSA && !CRIS 40 + !XTENSA && !CRIS && !H8300 41 41 42 42 ---help--- 43 43 You should say Y here if you have a PC-style parallel port. All
-1
drivers/parport/parport_amiga.c
··· 232 232 if (port->irq != PARPORT_IRQ_NONE) 233 233 free_irq(IRQ_AMIGA_CIAA_FLG, port); 234 234 parport_put_port(port); 235 - platform_set_drvdata(pdev, NULL); 236 235 return 0; 237 236 } 238 237
-1
drivers/scsi/storvsc_drv.c
··· 1879 1879 } 1880 1880 1881 1881 MODULE_LICENSE("GPL"); 1882 - MODULE_VERSION(HV_DRV_VERSION); 1883 1882 MODULE_DESCRIPTION("Microsoft Hyper-V virtual storage driver"); 1884 1883 module_init(storvsc_drv_init); 1885 1884 module_exit(storvsc_drv_exit);
+14 -7
drivers/uio/Kconfig
··· 1 1 menuconfig UIO 2 2 tristate "Userspace I/O drivers" 3 + depends on MMU 3 4 help 4 5 Enable this to allow the userspace driver core code to be 5 6 built. This code allows userspace programs easy access to ··· 23 22 24 23 To compile this driver as a module, choose M here: the module 25 24 will be called uio_cif. 26 - 27 - config UIO_PDRV 28 - tristate "Userspace I/O platform driver" 29 - help 30 - Generic platform driver for Userspace I/O devices. 31 - 32 - If you don't know what to do here, say N. 33 25 34 26 config UIO_PDRV_GENIRQ 35 27 tristate "Userspace I/O platform driver with generic IRQ handling" ··· 121 127 122 128 To compile this driver as a module, choose M here: the module 123 129 will be called uio_pruss. 130 + 131 + config UIO_MF624 132 + tristate "Humusoft MF624 DAQ PCI card driver" 133 + depends on PCI 134 + help 135 + Userspace I/O interface for the Humusoft MF624 PCI card. 136 + A sample userspace application using this driver is available 137 + (among other MF624 related information and software components) 138 + for download in a git repository: 139 + 140 + git clone git://rtime.felk.cvut.cz/mf6xx.git 141 + 142 + If you compile this as a module, it will be called uio_mf624. 124 143 125 144 endif
+1 -1
drivers/uio/Makefile
··· 1 1 obj-$(CONFIG_UIO) += uio.o 2 2 obj-$(CONFIG_UIO_CIF) += uio_cif.o 3 - obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o 4 3 obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o 5 4 obj-$(CONFIG_UIO_DMEM_GENIRQ) += uio_dmem_genirq.o 6 5 obj-$(CONFIG_UIO_AEC) += uio_aec.o ··· 7 8 obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o 8 9 obj-$(CONFIG_UIO_NETX) += uio_netx.o 9 10 obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o 11 + obj-$(CONFIG_UIO_MF624) += uio_mf624.o
+16 -24
drivers/uio/uio.c
··· 35 35 atomic_t event; 36 36 struct fasync_struct *async_queue; 37 37 wait_queue_head_t wait; 38 - int vma_count; 39 38 struct uio_info *info; 40 39 struct kobject *map_dir; 41 40 struct kobject *portio_dir; ··· 592 593 return -1; 593 594 } 594 595 595 - static void uio_vma_open(struct vm_area_struct *vma) 596 - { 597 - struct uio_device *idev = vma->vm_private_data; 598 - idev->vma_count++; 599 - } 600 - 601 - static void uio_vma_close(struct vm_area_struct *vma) 602 - { 603 - struct uio_device *idev = vma->vm_private_data; 604 - idev->vma_count--; 605 - } 606 - 607 596 static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 608 597 { 609 598 struct uio_device *idev = vma->vm_private_data; ··· 617 630 return 0; 618 631 } 619 632 620 - static const struct vm_operations_struct uio_vm_ops = { 621 - .open = uio_vma_open, 622 - .close = uio_vma_close, 633 + static const struct vm_operations_struct uio_logical_vm_ops = { 623 634 .fault = uio_vma_fault, 635 + }; 636 + 637 + static int uio_mmap_logical(struct vm_area_struct *vma) 638 + { 639 + vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; 640 + vma->vm_ops = &uio_logical_vm_ops; 641 + return 0; 642 + } 643 + 644 + static const struct vm_operations_struct uio_physical_vm_ops = { 645 + #ifdef CONFIG_HAVE_IOREMAP_PROT 646 + .access = generic_access_phys, 647 + #endif 624 648 }; 625 649 626 650 static int uio_mmap_physical(struct vm_area_struct *vma) ··· 641 643 if (mi < 0) 642 644 return -EINVAL; 643 645 646 + vma->vm_ops = &uio_physical_vm_ops; 647 + 644 648 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 645 649 646 650 return remap_pfn_range(vma, ··· 650 650 idev->info->mem[mi].addr >> PAGE_SHIFT, 651 651 vma->vm_end - vma->vm_start, 652 652 vma->vm_page_prot); 653 - } 654 - 655 - static int uio_mmap_logical(struct vm_area_struct *vma) 656 - { 657 - vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; 658 - vma->vm_ops = &uio_vm_ops; 659 - uio_vma_open(vma); 660 - return 0; 661 653 } 662 654 663 655 static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
+1 -1
drivers/uio/uio_dmem_genirq.c
··· 146 146 147 147 static int uio_dmem_genirq_probe(struct platform_device *pdev) 148 148 { 149 - struct uio_dmem_genirq_pdata *pdata = pdev->dev.platform_data; 149 + struct uio_dmem_genirq_pdata *pdata = dev_get_platdata(&pdev->dev); 150 150 struct uio_info *uioinfo = &pdata->uioinfo; 151 151 struct uio_dmem_genirq_platdata *priv; 152 152 struct uio_mem *uiomem;
+247
drivers/uio/uio_mf624.c
··· 1 + /* 2 + * UIO driver fo Humusoft MF624 DAQ card. 3 + * Copyright (C) 2011 Rostislav Lisovy <lisovy@gmail.com>, 4 + * Czech Technical University in Prague 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 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + * 16 + * You should have received a copy of the GNU General Public License 17 + * along with this program; if not, write to the Free Software 18 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 + */ 20 + 21 + #include <linux/init.h> 22 + #include <linux/module.h> 23 + #include <linux/device.h> 24 + #include <linux/pci.h> 25 + #include <linux/slab.h> 26 + #include <linux/io.h> 27 + #include <linux/kernel.h> 28 + #include <linux/uio_driver.h> 29 + 30 + #define PCI_VENDOR_ID_HUMUSOFT 0x186c 31 + #define PCI_DEVICE_ID_MF624 0x0624 32 + #define PCI_SUBVENDOR_ID_HUMUSOFT 0x186c 33 + #define PCI_SUBDEVICE_DEVICE 0x0624 34 + 35 + /* BAR0 Interrupt control/status register */ 36 + #define INTCSR 0x4C 37 + #define INTCSR_ADINT_ENABLE (1 << 0) 38 + #define INTCSR_CTR4INT_ENABLE (1 << 3) 39 + #define INTCSR_PCIINT_ENABLE (1 << 6) 40 + #define INTCSR_ADINT_STATUS (1 << 2) 41 + #define INTCSR_CTR4INT_STATUS (1 << 5) 42 + 43 + enum mf624_interrupt_source {ADC, CTR4, ALL}; 44 + 45 + void mf624_disable_interrupt(enum mf624_interrupt_source source, 46 + struct uio_info *info) 47 + { 48 + void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; 49 + 50 + switch (source) { 51 + case ADC: 52 + iowrite32(ioread32(INTCSR_reg) 53 + & ~(INTCSR_ADINT_ENABLE | INTCSR_PCIINT_ENABLE), 54 + INTCSR_reg); 55 + break; 56 + 57 + case CTR4: 58 + iowrite32(ioread32(INTCSR_reg) 59 + & ~(INTCSR_CTR4INT_ENABLE | INTCSR_PCIINT_ENABLE), 60 + INTCSR_reg); 61 + break; 62 + 63 + case ALL: 64 + default: 65 + iowrite32(ioread32(INTCSR_reg) 66 + & ~(INTCSR_ADINT_ENABLE | INTCSR_CTR4INT_ENABLE 67 + | INTCSR_PCIINT_ENABLE), 68 + INTCSR_reg); 69 + break; 70 + } 71 + } 72 + 73 + void mf624_enable_interrupt(enum mf624_interrupt_source source, 74 + struct uio_info *info) 75 + { 76 + void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; 77 + 78 + switch (source) { 79 + case ADC: 80 + iowrite32(ioread32(INTCSR_reg) 81 + | INTCSR_ADINT_ENABLE | INTCSR_PCIINT_ENABLE, 82 + INTCSR_reg); 83 + break; 84 + 85 + case CTR4: 86 + iowrite32(ioread32(INTCSR_reg) 87 + | INTCSR_CTR4INT_ENABLE | INTCSR_PCIINT_ENABLE, 88 + INTCSR_reg); 89 + break; 90 + 91 + case ALL: 92 + default: 93 + iowrite32(ioread32(INTCSR_reg) 94 + | INTCSR_ADINT_ENABLE | INTCSR_CTR4INT_ENABLE 95 + | INTCSR_PCIINT_ENABLE, 96 + INTCSR_reg); 97 + break; 98 + } 99 + } 100 + 101 + static irqreturn_t mf624_irq_handler(int irq, struct uio_info *info) 102 + { 103 + void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; 104 + 105 + if ((ioread32(INTCSR_reg) & INTCSR_ADINT_ENABLE) 106 + && (ioread32(INTCSR_reg) & INTCSR_ADINT_STATUS)) { 107 + mf624_disable_interrupt(ADC, info); 108 + return IRQ_HANDLED; 109 + } 110 + 111 + if ((ioread32(INTCSR_reg) & INTCSR_CTR4INT_ENABLE) 112 + && (ioread32(INTCSR_reg) & INTCSR_CTR4INT_STATUS)) { 113 + mf624_disable_interrupt(CTR4, info); 114 + return IRQ_HANDLED; 115 + } 116 + 117 + return IRQ_NONE; 118 + } 119 + 120 + static int mf624_irqcontrol(struct uio_info *info, s32 irq_on) 121 + { 122 + if (irq_on == 0) 123 + mf624_disable_interrupt(ALL, info); 124 + else if (irq_on == 1) 125 + mf624_enable_interrupt(ALL, info); 126 + 127 + return 0; 128 + } 129 + 130 + static int mf624_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) 131 + { 132 + struct uio_info *info; 133 + 134 + info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); 135 + if (!info) 136 + return -ENOMEM; 137 + 138 + if (pci_enable_device(dev)) 139 + goto out_free; 140 + 141 + if (pci_request_regions(dev, "mf624")) 142 + goto out_disable; 143 + 144 + info->name = "mf624"; 145 + info->version = "0.0.1"; 146 + 147 + /* Note: Datasheet says device uses BAR0, BAR1, BAR2 -- do not trust it */ 148 + 149 + /* BAR0 */ 150 + info->mem[0].name = "PCI chipset, interrupts, status " 151 + "bits, special functions"; 152 + info->mem[0].addr = pci_resource_start(dev, 0); 153 + if (!info->mem[0].addr) 154 + goto out_release; 155 + info->mem[0].size = pci_resource_len(dev, 0); 156 + info->mem[0].memtype = UIO_MEM_PHYS; 157 + info->mem[0].internal_addr = pci_ioremap_bar(dev, 0); 158 + if (!info->mem[0].internal_addr) 159 + goto out_release; 160 + 161 + /* BAR2 */ 162 + info->mem[1].name = "ADC, DAC, DIO"; 163 + info->mem[1].addr = pci_resource_start(dev, 2); 164 + if (!info->mem[1].addr) 165 + goto out_unmap0; 166 + info->mem[1].size = pci_resource_len(dev, 2); 167 + info->mem[1].memtype = UIO_MEM_PHYS; 168 + info->mem[1].internal_addr = pci_ioremap_bar(dev, 2); 169 + if (!info->mem[1].internal_addr) 170 + goto out_unmap0; 171 + 172 + /* BAR4 */ 173 + info->mem[2].name = "Counter/timer chip"; 174 + info->mem[2].addr = pci_resource_start(dev, 4); 175 + if (!info->mem[2].addr) 176 + goto out_unmap1; 177 + info->mem[2].size = pci_resource_len(dev, 4); 178 + info->mem[2].memtype = UIO_MEM_PHYS; 179 + info->mem[2].internal_addr = pci_ioremap_bar(dev, 4); 180 + if (!info->mem[2].internal_addr) 181 + goto out_unmap1; 182 + 183 + info->irq = dev->irq; 184 + info->irq_flags = IRQF_SHARED; 185 + info->handler = mf624_irq_handler; 186 + 187 + info->irqcontrol = mf624_irqcontrol; 188 + 189 + if (uio_register_device(&dev->dev, info)) 190 + goto out_unmap2; 191 + 192 + pci_set_drvdata(dev, info); 193 + 194 + return 0; 195 + 196 + out_unmap2: 197 + iounmap(info->mem[2].internal_addr); 198 + out_unmap1: 199 + iounmap(info->mem[1].internal_addr); 200 + out_unmap0: 201 + iounmap(info->mem[0].internal_addr); 202 + 203 + out_release: 204 + pci_release_regions(dev); 205 + 206 + out_disable: 207 + pci_disable_device(dev); 208 + 209 + out_free: 210 + kfree(info); 211 + return -ENODEV; 212 + } 213 + 214 + static void mf624_pci_remove(struct pci_dev *dev) 215 + { 216 + struct uio_info *info = pci_get_drvdata(dev); 217 + 218 + mf624_disable_interrupt(ALL, info); 219 + 220 + uio_unregister_device(info); 221 + pci_release_regions(dev); 222 + pci_disable_device(dev); 223 + pci_set_drvdata(dev, NULL); 224 + 225 + iounmap(info->mem[0].internal_addr); 226 + iounmap(info->mem[1].internal_addr); 227 + iounmap(info->mem[2].internal_addr); 228 + 229 + kfree(info); 230 + } 231 + 232 + static DEFINE_PCI_DEVICE_TABLE(mf624_pci_id) = { 233 + { PCI_DEVICE(PCI_VENDOR_ID_HUMUSOFT, PCI_DEVICE_ID_MF624) }, 234 + { 0, } 235 + }; 236 + 237 + static struct pci_driver mf624_pci_driver = { 238 + .name = "mf624", 239 + .id_table = mf624_pci_id, 240 + .probe = mf624_pci_probe, 241 + .remove = mf624_pci_remove, 242 + }; 243 + MODULE_DEVICE_TABLE(pci, mf624_pci_id); 244 + 245 + module_pci_driver(mf624_pci_driver); 246 + MODULE_LICENSE("GPL v2"); 247 + MODULE_AUTHOR("Rostislav Lisovy <lisovy@gmail.com>");
-113
drivers/uio/uio_pdrv.c
··· 1 - /* 2 - * drivers/uio/uio_pdrv.c 3 - * 4 - * Copyright (C) 2008 by Digi International Inc. 5 - * All rights reserved. 6 - * 7 - * This program is free software; you can redistribute it and/or modify it 8 - * under the terms of the GNU General Public License version 2 as published by 9 - * the Free Software Foundation. 10 - */ 11 - #include <linux/platform_device.h> 12 - #include <linux/uio_driver.h> 13 - #include <linux/stringify.h> 14 - #include <linux/module.h> 15 - #include <linux/slab.h> 16 - 17 - #define DRIVER_NAME "uio_pdrv" 18 - 19 - struct uio_platdata { 20 - struct uio_info *uioinfo; 21 - }; 22 - 23 - static int uio_pdrv_probe(struct platform_device *pdev) 24 - { 25 - struct uio_info *uioinfo = pdev->dev.platform_data; 26 - struct uio_platdata *pdata; 27 - struct uio_mem *uiomem; 28 - int ret = -ENODEV; 29 - int i; 30 - 31 - if (!uioinfo || !uioinfo->name || !uioinfo->version) { 32 - dev_dbg(&pdev->dev, "%s: err_uioinfo\n", __func__); 33 - goto err_uioinfo; 34 - } 35 - 36 - pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); 37 - if (!pdata) { 38 - ret = -ENOMEM; 39 - dev_dbg(&pdev->dev, "%s: err_alloc_pdata\n", __func__); 40 - goto err_alloc_pdata; 41 - } 42 - 43 - pdata->uioinfo = uioinfo; 44 - 45 - uiomem = &uioinfo->mem[0]; 46 - 47 - for (i = 0; i < pdev->num_resources; ++i) { 48 - struct resource *r = &pdev->resource[i]; 49 - 50 - if (r->flags != IORESOURCE_MEM) 51 - continue; 52 - 53 - if (uiomem >= &uioinfo->mem[MAX_UIO_MAPS]) { 54 - dev_warn(&pdev->dev, "device has more than " 55 - __stringify(MAX_UIO_MAPS) 56 - " I/O memory resources.\n"); 57 - break; 58 - } 59 - 60 - uiomem->memtype = UIO_MEM_PHYS; 61 - uiomem->addr = r->start; 62 - uiomem->size = resource_size(r); 63 - uiomem->name = r->name; 64 - ++uiomem; 65 - } 66 - 67 - while (uiomem < &uioinfo->mem[MAX_UIO_MAPS]) { 68 - uiomem->size = 0; 69 - ++uiomem; 70 - } 71 - 72 - pdata->uioinfo->priv = pdata; 73 - 74 - ret = uio_register_device(&pdev->dev, pdata->uioinfo); 75 - 76 - if (ret) { 77 - kfree(pdata); 78 - err_alloc_pdata: 79 - err_uioinfo: 80 - return ret; 81 - } 82 - 83 - platform_set_drvdata(pdev, pdata); 84 - 85 - return 0; 86 - } 87 - 88 - static int uio_pdrv_remove(struct platform_device *pdev) 89 - { 90 - struct uio_platdata *pdata = platform_get_drvdata(pdev); 91 - 92 - uio_unregister_device(pdata->uioinfo); 93 - 94 - kfree(pdata); 95 - 96 - return 0; 97 - } 98 - 99 - static struct platform_driver uio_pdrv = { 100 - .probe = uio_pdrv_probe, 101 - .remove = uio_pdrv_remove, 102 - .driver = { 103 - .name = DRIVER_NAME, 104 - .owner = THIS_MODULE, 105 - }, 106 - }; 107 - 108 - module_platform_driver(uio_pdrv); 109 - 110 - MODULE_AUTHOR("Uwe Kleine-Koenig"); 111 - MODULE_DESCRIPTION("Userspace I/O platform driver"); 112 - MODULE_LICENSE("GPL v2"); 113 - MODULE_ALIAS("platform:" DRIVER_NAME);
+1 -1
drivers/uio/uio_pdrv_genirq.c
··· 104 104 105 105 static int uio_pdrv_genirq_probe(struct platform_device *pdev) 106 106 { 107 - struct uio_info *uioinfo = pdev->dev.platform_data; 107 + struct uio_info *uioinfo = dev_get_platdata(&pdev->dev); 108 108 struct uio_pdrv_genirq_platdata *priv; 109 109 struct uio_mem *uiomem; 110 110 int ret = -EINVAL;
+1 -2
drivers/uio/uio_pruss.c
··· 121 121 struct uio_pruss_dev *gdev; 122 122 struct resource *regs_prussio; 123 123 int ret = -ENODEV, cnt = 0, len; 124 - struct uio_pruss_pdata *pdata = dev->dev.platform_data; 124 + struct uio_pruss_pdata *pdata = dev_get_platdata(&dev->dev); 125 125 126 126 gdev = kzalloc(sizeof(struct uio_pruss_dev), GFP_KERNEL); 127 127 if (!gdev) ··· 224 224 struct uio_pruss_dev *gdev = platform_get_drvdata(dev); 225 225 226 226 pruss_cleanup(dev, gdev); 227 - platform_set_drvdata(dev, NULL); 228 227 return 0; 229 228 } 230 229
+1
drivers/usb/dwc3/Kconfig
··· 1 1 config USB_DWC3 2 2 tristate "DesignWare USB3 DRD Core Support" 3 3 depends on (USB || USB_GADGET) && GENERIC_HARDIRQS && HAS_DMA 4 + depends on EXTCON 4 5 select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD 5 6 help 6 7 Say Y or M here if your system has a Dual Role SuperSpeed
+106 -19
drivers/usb/dwc3/dwc3-omap.c
··· 23 23 #include <linux/spinlock.h> 24 24 #include <linux/platform_device.h> 25 25 #include <linux/platform_data/dwc3-omap.h> 26 - #include <linux/usb/dwc3-omap.h> 27 26 #include <linux/pm_runtime.h> 28 27 #include <linux/dma-mapping.h> 29 28 #include <linux/ioport.h> 30 29 #include <linux/io.h> 31 30 #include <linux/of.h> 32 31 #include <linux/of_platform.h> 32 + #include <linux/extcon.h> 33 + #include <linux/extcon/of_extcon.h> 34 + #include <linux/regulator/consumer.h> 33 35 34 36 #include <linux/usb/otg.h> 35 37 ··· 137 135 u32 revision; 138 136 139 137 u32 dma_status:1; 138 + 139 + struct extcon_specific_cable_nb extcon_vbus_dev; 140 + struct extcon_specific_cable_nb extcon_id_dev; 141 + struct notifier_block vbus_nb; 142 + struct notifier_block id_nb; 143 + 144 + struct regulator *vbus_reg; 140 145 }; 141 146 142 - static struct dwc3_omap *_omap; 147 + enum omap_dwc3_vbus_id_status { 148 + OMAP_DWC3_ID_FLOAT, 149 + OMAP_DWC3_ID_GROUND, 150 + OMAP_DWC3_VBUS_OFF, 151 + OMAP_DWC3_VBUS_VALID, 152 + }; 143 153 144 154 static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset) 145 155 { ··· 215 201 omap->irq0_offset, value); 216 202 } 217 203 218 - int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) 204 + static void dwc3_omap_set_mailbox(struct dwc3_omap *omap, 205 + enum omap_dwc3_vbus_id_status status) 219 206 { 220 - u32 val; 221 - struct dwc3_omap *omap = _omap; 222 - 223 - if (!omap) 224 - return -EPROBE_DEFER; 207 + int ret; 208 + u32 val; 225 209 226 210 switch (status) { 227 211 case OMAP_DWC3_ID_GROUND: 228 212 dev_dbg(omap->dev, "ID GND\n"); 213 + 214 + if (omap->vbus_reg) { 215 + ret = regulator_enable(omap->vbus_reg); 216 + if (ret) { 217 + dev_dbg(omap->dev, "regulator enable failed\n"); 218 + return; 219 + } 220 + } 229 221 230 222 val = dwc3_omap_read_utmi_status(omap); 231 223 val &= ~(USBOTGSS_UTMI_OTG_STATUS_IDDIG ··· 255 235 break; 256 236 257 237 case OMAP_DWC3_ID_FLOAT: 238 + if (omap->vbus_reg) 239 + regulator_disable(omap->vbus_reg); 240 + 258 241 case OMAP_DWC3_VBUS_OFF: 259 242 dev_dbg(omap->dev, "VBUS Disconnect\n"); 260 243 ··· 271 248 break; 272 249 273 250 default: 274 - dev_dbg(omap->dev, "ID float\n"); 251 + dev_dbg(omap->dev, "invalid state\n"); 275 252 } 276 - 277 - return 0; 278 253 } 279 - EXPORT_SYMBOL_GPL(dwc3_omap_mailbox); 280 254 281 255 static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap) 282 256 { ··· 366 346 367 347 static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32); 368 348 349 + static int dwc3_omap_id_notifier(struct notifier_block *nb, 350 + unsigned long event, void *ptr) 351 + { 352 + struct dwc3_omap *omap = container_of(nb, struct dwc3_omap, id_nb); 353 + 354 + if (event) 355 + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); 356 + else 357 + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_FLOAT); 358 + 359 + return NOTIFY_DONE; 360 + } 361 + 362 + static int dwc3_omap_vbus_notifier(struct notifier_block *nb, 363 + unsigned long event, void *ptr) 364 + { 365 + struct dwc3_omap *omap = container_of(nb, struct dwc3_omap, vbus_nb); 366 + 367 + if (event) 368 + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); 369 + else 370 + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_OFF); 371 + 372 + return NOTIFY_DONE; 373 + } 374 + 369 375 static int dwc3_omap_probe(struct platform_device *pdev) 370 376 { 371 377 struct device_node *node = pdev->dev.of_node; ··· 399 353 struct dwc3_omap *omap; 400 354 struct resource *res; 401 355 struct device *dev = &pdev->dev; 356 + struct extcon_dev *edev; 357 + struct regulator *vbus_reg = NULL; 402 358 403 359 int ret = -ENOMEM; 404 360 int irq; ··· 441 393 if (IS_ERR(base)) 442 394 return PTR_ERR(base); 443 395 396 + if (of_property_read_bool(node, "vbus-supply")) { 397 + vbus_reg = devm_regulator_get(dev, "vbus"); 398 + if (IS_ERR(vbus_reg)) { 399 + dev_err(dev, "vbus init failed\n"); 400 + return PTR_ERR(vbus_reg); 401 + } 402 + } 403 + 444 404 spin_lock_init(&omap->lock); 445 405 446 406 omap->dev = dev; 447 407 omap->irq = irq; 448 408 omap->base = base; 409 + omap->vbus_reg = vbus_reg; 449 410 dev->dma_mask = &dwc3_omap_dma_mask; 450 - 451 - /* 452 - * REVISIT if we ever have two instances of the wrapper, we will be 453 - * in big trouble 454 - */ 455 - _omap = omap; 456 411 457 412 pm_runtime_enable(dev); 458 413 ret = pm_runtime_get_sync(dev); ··· 531 480 532 481 dwc3_omap_enable_irqs(omap); 533 482 483 + if (of_property_read_bool(node, "extcon")) { 484 + edev = of_extcon_get_extcon_dev(dev, 0); 485 + if (IS_ERR(edev)) { 486 + dev_vdbg(dev, "couldn't get extcon device\n"); 487 + ret = PTR_ERR(edev); 488 + goto err2; 489 + } 490 + 491 + omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier; 492 + ret = extcon_register_interest(&omap->extcon_vbus_dev, 493 + edev->name, "USB", &omap->vbus_nb); 494 + if (ret < 0) 495 + dev_vdbg(dev, "failed to register notifier for USB\n"); 496 + omap->id_nb.notifier_call = dwc3_omap_id_notifier; 497 + ret = extcon_register_interest(&omap->extcon_id_dev, edev->name, 498 + "USB-HOST", &omap->id_nb); 499 + if (ret < 0) 500 + dev_vdbg(dev, 501 + "failed to register notifier for USB-HOST\n"); 502 + 503 + if (extcon_get_cable_state(edev, "USB") == true) 504 + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); 505 + if (extcon_get_cable_state(edev, "USB-HOST") == true) 506 + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); 507 + } 508 + 534 509 ret = of_platform_populate(node, NULL, NULL, dev); 535 510 if (ret) { 536 511 dev_err(&pdev->dev, "failed to create dwc3 core\n"); 537 - goto err2; 512 + goto err3; 538 513 } 539 514 540 515 return 0; 516 + 517 + err3: 518 + if (omap->extcon_vbus_dev.edev) 519 + extcon_unregister_interest(&omap->extcon_vbus_dev); 520 + if (omap->extcon_id_dev.edev) 521 + extcon_unregister_interest(&omap->extcon_id_dev); 541 522 542 523 err2: 543 524 dwc3_omap_disable_irqs(omap); ··· 587 504 { 588 505 struct dwc3_omap *omap = platform_get_drvdata(pdev); 589 506 507 + if (omap->extcon_vbus_dev.edev) 508 + extcon_unregister_interest(&omap->extcon_vbus_dev); 509 + if (omap->extcon_id_dev.edev) 510 + extcon_unregister_interest(&omap->extcon_id_dev); 590 511 dwc3_omap_disable_irqs(omap); 591 512 pm_runtime_put_sync(&pdev->dev); 592 513 pm_runtime_disable(&pdev->dev);
-1
drivers/video/hyperv_fb.c
··· 825 825 module_exit(hvfb_drv_exit); 826 826 827 827 MODULE_LICENSE("GPL"); 828 - MODULE_VERSION(HV_DRV_VERSION); 829 828 MODULE_DESCRIPTION("Microsoft Hyper-V Synthetic Video Frame Buffer Driver");
+1 -1
drivers/vme/boards/vme_vmivme7805.c
··· 23 23 static void vmic_remove(struct pci_dev *); 24 24 25 25 /** Base address to access FPGA register */ 26 - static void *vmic_base; 26 + static void __iomem *vmic_base; 27 27 28 28 static const char driver_name[] = "vmivme_7805"; 29 29
+7 -3
drivers/vme/bridges/vme_ca91cx42.c
··· 243 243 static void ca91cx42_irq_exit(struct ca91cx42_driver *bridge, 244 244 struct pci_dev *pdev) 245 245 { 246 + struct vme_bridge *ca91cx42_bridge; 247 + 246 248 /* Disable interrupts from PCI to VME */ 247 249 iowrite32(0, bridge->base + VINT_EN); 248 250 ··· 253 251 /* Clear Any Pending PCI Interrupts */ 254 252 iowrite32(0x00FFFFFF, bridge->base + LINT_STAT); 255 253 256 - free_irq(pdev->irq, pdev); 254 + ca91cx42_bridge = container_of((void *)bridge, struct vme_bridge, 255 + driver_priv); 256 + free_irq(pdev->irq, ca91cx42_bridge); 257 257 } 258 258 259 259 static int ca91cx42_iack_received(struct ca91cx42_driver *bridge, int level) ··· 860 856 void *buf, size_t count, loff_t offset) 861 857 { 862 858 ssize_t retval; 863 - void *addr = image->kern_base + offset; 859 + void __iomem *addr = image->kern_base + offset; 864 860 unsigned int done = 0; 865 861 unsigned int count32; 866 862 ··· 920 916 void *buf, size_t count, loff_t offset) 921 917 { 922 918 ssize_t retval; 923 - void *addr = image->kern_base + offset; 919 + void __iomem *addr = image->kern_base + offset; 924 920 unsigned int done = 0; 925 921 unsigned int count32; 926 922
+2 -2
drivers/vme/bridges/vme_tsi148.c
··· 1267 1267 u32 aspace, cycle, dwidth; 1268 1268 struct vme_bus_error *vme_err = NULL; 1269 1269 struct vme_bridge *tsi148_bridge; 1270 - void *addr = image->kern_base + offset; 1270 + void __iomem *addr = image->kern_base + offset; 1271 1271 unsigned int done = 0; 1272 1272 unsigned int count32; 1273 1273 ··· 1348 1348 int retval = 0, enabled; 1349 1349 unsigned long long vme_base, size; 1350 1350 u32 aspace, cycle, dwidth; 1351 - void *addr = image->kern_base + offset; 1351 + void __iomem *addr = image->kern_base + offset; 1352 1352 unsigned int done = 0; 1353 1353 unsigned int count32; 1354 1354
+31
include/linux/extcon/of_extcon.h
··· 1 + /* 2 + * OF helpers for External connector (extcon) framework 3 + * 4 + * Copyright (C) 2013 Texas Instruments, Inc. 5 + * Kishon Vijay Abraham I <kishon@ti.com> 6 + * 7 + * Copyright (C) 2013 Samsung Electronics 8 + * Chanwoo Choi <cw00.choi@samsung.com> 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License as published by 12 + * the Free Software Foundation; either version 2 of the License, or 13 + * (at your option) any later version. 14 + */ 15 + 16 + #ifndef __LINUX_OF_EXTCON_H 17 + #define __LINUX_OF_EXTCON_H 18 + 19 + #include <linux/err.h> 20 + 21 + #if IS_ENABLED(CONFIG_OF_EXTCON) 22 + extern struct extcon_dev 23 + *of_extcon_get_extcon_dev(struct device *dev, int index); 24 + #else 25 + static inline struct extcon_dev 26 + *of_extcon_get_extcon_dev(struct device *dev, int index) 27 + { 28 + return ERR_PTR(-ENOSYS); 29 + } 30 + #endif /* CONFIG_OF_EXTCON */ 31 + #endif /* __LINUX_OF_EXTCON_H */
+9 -22
include/linux/hyperv.h
··· 27 27 28 28 #include <linux/types.h> 29 29 30 + /* 31 + * Framework version for util services. 32 + */ 33 + 34 + #define UTIL_FW_MAJOR 3 35 + #define UTIL_FW_MINOR 0 36 + #define UTIL_FW_MAJOR_MINOR (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR) 37 + 30 38 31 39 /* 32 40 * Implementation of host controlled snapshot of the guest. ··· 462 454 read_loc - write_loc; 463 455 *read = dsize - *write; 464 456 } 465 - 466 - 467 - /* 468 - * We use the same version numbering for all Hyper-V modules. 469 - * 470 - * Definition of versioning is as follows; 471 - * 472 - * Major Number Changes for these scenarios; 473 - * 1. When a new version of Windows Hyper-V 474 - * is released. 475 - * 2. A Major change has occurred in the 476 - * Linux IC's. 477 - * (For example the merge for the first time 478 - * into the kernel) Every time the Major Number 479 - * changes, the Revision number is reset to 0. 480 - * Minor Number Changes when new functionality is added 481 - * to the Linux IC's that is not a bug fix. 482 - * 483 - * 3.1 - Added completed hv_utils driver. Shutdown/Heartbeat/Timesync 484 - */ 485 - #define HV_DRV_VERSION "3.1" 486 457 487 458 /* 488 459 * VMBUS version is 32 bit entity broken up into ··· 1481 1494 }; 1482 1495 1483 1496 #define MAX_SRV_VER 0x7ffffff 1484 - extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, 1497 + extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *, 1485 1498 struct icmsg_negotiate *, u8 *, int, 1486 1499 int); 1487 1500
+3 -5
include/linux/mfd/palmas.h
··· 372 372 373 373 struct extcon_dev edev; 374 374 375 - /* used to set vbus, in atomic path */ 376 - struct work_struct set_vbus_work; 377 - 378 375 int id_otg_irq; 379 376 int id_irq; 380 377 int vbus_otg_irq; 381 378 int vbus_irq; 382 379 383 - int vbus_enable; 384 - 385 380 enum palmas_usb_state linkstat; 381 + int wakeup; 382 + bool enable_vbus_detection; 383 + bool enable_id_detection; 386 384 }; 387 385 388 386 #define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
-30
include/linux/usb/dwc3-omap.h
··· 1 - /* 2 - * Copyright (C) 2013 by Texas Instruments 3 - * 4 - * The Inventra Controller Driver for Linux is free software; you 5 - * can redistribute it and/or modify it under the terms of the GNU 6 - * General Public License version 2 as published by the Free Software 7 - * Foundation. 8 - */ 9 - 10 - #ifndef __DWC3_OMAP_H__ 11 - #define __DWC3_OMAP_H__ 12 - 13 - enum omap_dwc3_vbus_id_status { 14 - OMAP_DWC3_UNKNOWN = 0, 15 - OMAP_DWC3_ID_GROUND, 16 - OMAP_DWC3_ID_FLOAT, 17 - OMAP_DWC3_VBUS_VALID, 18 - OMAP_DWC3_VBUS_OFF, 19 - }; 20 - 21 - #if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE)) 22 - extern int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status); 23 - #else 24 - static inline int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) 25 - { 26 - return -ENODEV; 27 - } 28 - #endif 29 - 30 - #endif /* __DWC3_OMAP_H__ */
+1
mm/memory.c
··· 4079 4079 4080 4080 return len; 4081 4081 } 4082 + EXPORT_SYMBOL_GPL(generic_access_phys); 4082 4083 #endif 4083 4084 4084 4085 /*
+26 -18
tools/hv/hv_kvp_daemon.c
··· 79 79 DNS 80 80 }; 81 81 82 - static char kvp_send_buffer[4096]; 83 - static char kvp_recv_buffer[4096 * 2]; 84 82 static struct sockaddr_nl addr; 85 83 static int in_hand_shake = 1; 86 84 ··· 1299 1301 } 1300 1302 1301 1303 error = kvp_write_file(file, "HWADDR", "", mac_addr); 1304 + free(mac_addr); 1302 1305 if (error) 1303 1306 goto setval_error; 1304 1307 ··· 1345 1346 goto setval_error; 1346 1347 1347 1348 setval_done: 1348 - free(mac_addr); 1349 1349 fclose(file); 1350 1350 1351 1351 /* ··· 1353 1355 */ 1354 1356 1355 1357 snprintf(cmd, sizeof(cmd), "%s %s", "hv_set_ifconfig", if_file); 1356 - system(cmd); 1358 + if (system(cmd)) { 1359 + syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s", 1360 + cmd, errno, strerror(errno)); 1361 + return HV_E_FAIL; 1362 + } 1357 1363 return 0; 1358 1364 1359 1365 setval_error: 1360 1366 syslog(LOG_ERR, "Failed to write config file"); 1361 - free(mac_addr); 1362 1367 fclose(file); 1363 1368 return error; 1364 1369 } ··· 1392 1391 static int 1393 1392 netlink_send(int fd, struct cn_msg *msg) 1394 1393 { 1395 - struct nlmsghdr *nlh; 1394 + struct nlmsghdr nlh = { .nlmsg_type = NLMSG_DONE }; 1396 1395 unsigned int size; 1397 1396 struct msghdr message; 1398 - char buffer[64]; 1399 1397 struct iovec iov[2]; 1400 1398 1401 - size = NLMSG_SPACE(sizeof(struct cn_msg) + msg->len); 1399 + size = sizeof(struct cn_msg) + msg->len; 1402 1400 1403 - nlh = (struct nlmsghdr *)buffer; 1404 - nlh->nlmsg_seq = 0; 1405 - nlh->nlmsg_pid = getpid(); 1406 - nlh->nlmsg_type = NLMSG_DONE; 1407 - nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh)); 1408 - nlh->nlmsg_flags = 0; 1401 + nlh.nlmsg_pid = getpid(); 1402 + nlh.nlmsg_len = NLMSG_LENGTH(size); 1409 1403 1410 - iov[0].iov_base = nlh; 1411 - iov[0].iov_len = sizeof(*nlh); 1404 + iov[0].iov_base = &nlh; 1405 + iov[0].iov_len = sizeof(nlh); 1412 1406 1413 1407 iov[1].iov_base = msg; 1414 1408 iov[1].iov_len = size; ··· 1433 1437 int pool; 1434 1438 char *if_name; 1435 1439 struct hv_kvp_ipaddr_value *kvp_ip_val; 1440 + char *kvp_send_buffer; 1441 + char *kvp_recv_buffer; 1442 + size_t kvp_recv_buffer_len; 1436 1443 1437 - daemon(1, 0); 1444 + if (daemon(1, 0)) 1445 + return 1; 1438 1446 openlog("KVP", 0, LOG_USER); 1439 1447 syslog(LOG_INFO, "KVP starting; pid is:%d", getpid()); 1448 + 1449 + kvp_recv_buffer_len = NLMSG_HDRLEN + sizeof(struct cn_msg) + sizeof(struct hv_kvp_msg); 1450 + kvp_send_buffer = calloc(1, kvp_recv_buffer_len); 1451 + kvp_recv_buffer = calloc(1, kvp_recv_buffer_len); 1452 + if (!(kvp_send_buffer && kvp_recv_buffer)) { 1453 + syslog(LOG_ERR, "Failed to allocate netlink buffers"); 1454 + exit(EXIT_FAILURE); 1455 + } 1440 1456 /* 1441 1457 * Retrieve OS release information. 1442 1458 */ ··· 1522 1514 continue; 1523 1515 } 1524 1516 1525 - len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0, 1517 + len = recvfrom(fd, kvp_recv_buffer, kvp_recv_buffer_len, 0, 1526 1518 addr_p, &addr_l); 1527 1519 1528 1520 if (len < 0) {
+39 -20
tools/hv/hv_vss_daemon.c
··· 38 38 #include <linux/netlink.h> 39 39 #include <syslog.h> 40 40 41 - static char vss_recv_buffer[4096]; 42 - static char vss_send_buffer[4096]; 43 41 static struct sockaddr_nl addr; 44 42 45 43 #ifndef SOL_NETLINK ··· 105 107 106 108 static int netlink_send(int fd, struct cn_msg *msg) 107 109 { 108 - struct nlmsghdr *nlh; 110 + struct nlmsghdr nlh = { .nlmsg_type = NLMSG_DONE }; 109 111 unsigned int size; 110 112 struct msghdr message; 111 - char buffer[64]; 112 113 struct iovec iov[2]; 113 114 114 - size = NLMSG_SPACE(sizeof(struct cn_msg) + msg->len); 115 + size = sizeof(struct cn_msg) + msg->len; 115 116 116 - nlh = (struct nlmsghdr *)buffer; 117 - nlh->nlmsg_seq = 0; 118 - nlh->nlmsg_pid = getpid(); 119 - nlh->nlmsg_type = NLMSG_DONE; 120 - nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh)); 121 - nlh->nlmsg_flags = 0; 117 + nlh.nlmsg_pid = getpid(); 118 + nlh.nlmsg_len = NLMSG_LENGTH(size); 122 119 123 - iov[0].iov_base = nlh; 124 - iov[0].iov_len = sizeof(*nlh); 120 + iov[0].iov_base = &nlh; 121 + iov[0].iov_len = sizeof(nlh); 125 122 126 123 iov[1].iov_base = msg; 127 124 iov[1].iov_len = size; ··· 140 147 struct cn_msg *incoming_cn_msg; 141 148 int op; 142 149 struct hv_vss_msg *vss_msg; 150 + char *vss_send_buffer; 151 + char *vss_recv_buffer; 152 + size_t vss_recv_buffer_len; 143 153 144 154 if (daemon(1, 0)) 145 155 return 1; ··· 150 154 openlog("Hyper-V VSS", 0, LOG_USER); 151 155 syslog(LOG_INFO, "VSS starting; pid is:%d", getpid()); 152 156 157 + vss_recv_buffer_len = NLMSG_HDRLEN + sizeof(struct cn_msg) + sizeof(struct hv_vss_msg); 158 + vss_send_buffer = calloc(1, vss_recv_buffer_len); 159 + vss_recv_buffer = calloc(1, vss_recv_buffer_len); 160 + if (!(vss_send_buffer && vss_recv_buffer)) { 161 + syslog(LOG_ERR, "Failed to allocate netlink buffers"); 162 + exit(EXIT_FAILURE); 163 + } 164 + 153 165 fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); 154 166 if (fd < 0) { 155 - syslog(LOG_ERR, "netlink socket creation failed; error:%d", fd); 167 + syslog(LOG_ERR, "netlink socket creation failed; error:%d %s", 168 + errno, strerror(errno)); 156 169 exit(EXIT_FAILURE); 157 170 } 158 171 addr.nl_family = AF_NETLINK; ··· 172 167 173 168 error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); 174 169 if (error < 0) { 175 - syslog(LOG_ERR, "bind failed; error:%d", error); 170 + syslog(LOG_ERR, "bind failed; error:%d %s", errno, strerror(errno)); 176 171 close(fd); 177 172 exit(EXIT_FAILURE); 178 173 } 179 174 nl_group = CN_VSS_IDX; 180 - setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)); 175 + if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)) < 0) { 176 + syslog(LOG_ERR, "setsockopt failed; error:%d %s", errno, strerror(errno)); 177 + close(fd); 178 + exit(EXIT_FAILURE); 179 + } 181 180 /* 182 181 * Register ourselves with the kernel. 183 182 */ ··· 196 187 197 188 len = netlink_send(fd, message); 198 189 if (len < 0) { 199 - syslog(LOG_ERR, "netlink_send failed; error:%d", len); 190 + syslog(LOG_ERR, "netlink_send failed; error:%d %s", errno, strerror(errno)); 200 191 close(fd); 201 192 exit(EXIT_FAILURE); 202 193 } ··· 208 199 socklen_t addr_l = sizeof(addr); 209 200 pfd.events = POLLIN; 210 201 pfd.revents = 0; 211 - poll(&pfd, 1, -1); 212 202 213 - len = recvfrom(fd, vss_recv_buffer, sizeof(vss_recv_buffer), 0, 203 + if (poll(&pfd, 1, -1) < 0) { 204 + syslog(LOG_ERR, "poll failed; error:%d %s", errno, strerror(errno)); 205 + if (errno == EINVAL) { 206 + close(fd); 207 + exit(EXIT_FAILURE); 208 + } 209 + else 210 + continue; 211 + } 212 + 213 + len = recvfrom(fd, vss_recv_buffer, vss_recv_buffer_len, 0, 214 214 addr_p, &addr_l); 215 215 216 216 if (len < 0) { ··· 259 241 vss_msg->error = error; 260 242 len = netlink_send(fd, incoming_cn_msg); 261 243 if (len < 0) { 262 - syslog(LOG_ERR, "net_link send failed; error:%d", len); 244 + syslog(LOG_ERR, "net_link send failed; error:%d %s", 245 + errno, strerror(errno)); 263 246 exit(EXIT_FAILURE); 264 247 } 265 248 }