aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/Kconfig2
-rw-r--r--drivers/misc/apds990x.c4
-rw-r--r--drivers/misc/bh1770glc.c2
-rw-r--r--drivers/misc/eeprom/at25.c34
-rw-r--r--drivers/misc/eeprom/eeprom_93cx6.c62
-rw-r--r--drivers/misc/enclosure.c44
-rw-r--r--drivers/misc/genwqe/card_dev.c2
-rw-r--r--drivers/misc/lis3lv02d/lis3lv02d_i2c.c4
-rw-r--r--drivers/misc/mei/mei_dev.h4
-rw-r--r--drivers/misc/mei/pci-me.c8
-rw-r--r--drivers/misc/mei/pci-txe.c8
-rw-r--r--drivers/misc/mic/card/mic_virtio.c14
-rw-r--r--drivers/misc/vexpress-syscfg.c60
-rw-r--r--drivers/misc/vmw_vmci/vmci_queue_pair.c17
14 files changed, 160 insertions, 105 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index bbeb4516facf..006242c8bca0 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -75,7 +75,7 @@ config ATMEL_TCB_CLKSRC
75config ATMEL_TCB_CLKSRC_BLOCK 75config ATMEL_TCB_CLKSRC_BLOCK
76 int 76 int
77 depends on ATMEL_TCB_CLKSRC 77 depends on ATMEL_TCB_CLKSRC
78 prompt "TC Block" if ARCH_AT91RM9200 || ARCH_AT91SAM9260 || CPU_AT32AP700X 78 prompt "TC Block" if CPU_AT32AP700X
79 default 0 79 default 0
80 range 0 1 80 range 0 1
81 help 81 help
diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index 868a30a1b417..3739ffa9cdf1 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -609,7 +609,7 @@ static int apds990x_detect(struct apds990x_chip *chip)
609 return ret; 609 return ret;
610} 610}
611 611
612#if defined(CONFIG_PM) || defined(CONFIG_PM_RUNTIME) 612#ifdef CONFIG_PM
613static int apds990x_chip_on(struct apds990x_chip *chip) 613static int apds990x_chip_on(struct apds990x_chip *chip)
614{ 614{
615 int err = regulator_bulk_enable(ARRAY_SIZE(chip->regs), 615 int err = regulator_bulk_enable(ARRAY_SIZE(chip->regs),
@@ -1237,7 +1237,7 @@ static int apds990x_resume(struct device *dev)
1237} 1237}
1238#endif 1238#endif
1239 1239
1240#ifdef CONFIG_PM_RUNTIME 1240#ifdef CONFIG_PM
1241static int apds990x_runtime_suspend(struct device *dev) 1241static int apds990x_runtime_suspend(struct device *dev)
1242{ 1242{
1243 struct i2c_client *client = container_of(dev, struct i2c_client, dev); 1243 struct i2c_client *client = container_of(dev, struct i2c_client, dev);
diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c
index 7b55f8a152d4..b756381b8250 100644
--- a/drivers/misc/bh1770glc.c
+++ b/drivers/misc/bh1770glc.c
@@ -1358,7 +1358,7 @@ static int bh1770_resume(struct device *dev)
1358} 1358}
1359#endif 1359#endif
1360 1360
1361#ifdef CONFIG_PM_RUNTIME 1361#ifdef CONFIG_PM
1362static int bh1770_runtime_suspend(struct device *dev) 1362static int bh1770_runtime_suspend(struct device *dev)
1363{ 1363{
1364 struct i2c_client *client = container_of(dev, struct i2c_client, dev); 1364 struct i2c_client *client = container_of(dev, struct i2c_client, dev);
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index 634f72929e12..0a1af93ec638 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -18,7 +18,7 @@
18 18
19#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
20#include <linux/spi/eeprom.h> 20#include <linux/spi/eeprom.h>
21#include <linux/of.h> 21#include <linux/property.h>
22 22
23/* 23/*
24 * NOTE: this is an *EEPROM* driver. The vagaries of product naming 24 * NOTE: this is an *EEPROM* driver. The vagaries of product naming
@@ -301,35 +301,33 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf,
301 301
302/*-------------------------------------------------------------------------*/ 302/*-------------------------------------------------------------------------*/
303 303
304static int at25_np_to_chip(struct device *dev, 304static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
305 struct device_node *np,
306 struct spi_eeprom *chip)
307{ 305{
308 u32 val; 306 u32 val;
309 307
310 memset(chip, 0, sizeof(*chip)); 308 memset(chip, 0, sizeof(*chip));
311 strncpy(chip->name, np->name, sizeof(chip->name)); 309 strncpy(chip->name, "at25", sizeof(chip->name));
312 310
313 if (of_property_read_u32(np, "size", &val) == 0 || 311 if (device_property_read_u32(dev, "size", &val) == 0 ||
314 of_property_read_u32(np, "at25,byte-len", &val) == 0) { 312 device_property_read_u32(dev, "at25,byte-len", &val) == 0) {
315 chip->byte_len = val; 313 chip->byte_len = val;
316 } else { 314 } else {
317 dev_err(dev, "Error: missing \"size\" property\n"); 315 dev_err(dev, "Error: missing \"size\" property\n");
318 return -ENODEV; 316 return -ENODEV;
319 } 317 }
320 318
321 if (of_property_read_u32(np, "pagesize", &val) == 0 || 319 if (device_property_read_u32(dev, "pagesize", &val) == 0 ||
322 of_property_read_u32(np, "at25,page-size", &val) == 0) { 320 device_property_read_u32(dev, "at25,page-size", &val) == 0) {
323 chip->page_size = (u16)val; 321 chip->page_size = (u16)val;
324 } else { 322 } else {
325 dev_err(dev, "Error: missing \"pagesize\" property\n"); 323 dev_err(dev, "Error: missing \"pagesize\" property\n");
326 return -ENODEV; 324 return -ENODEV;
327 } 325 }
328 326
329 if (of_property_read_u32(np, "at25,addr-mode", &val) == 0) { 327 if (device_property_read_u32(dev, "at25,addr-mode", &val) == 0) {
330 chip->flags = (u16)val; 328 chip->flags = (u16)val;
331 } else { 329 } else {
332 if (of_property_read_u32(np, "address-width", &val)) { 330 if (device_property_read_u32(dev, "address-width", &val)) {
333 dev_err(dev, 331 dev_err(dev,
334 "Error: missing \"address-width\" property\n"); 332 "Error: missing \"address-width\" property\n");
335 return -ENODEV; 333 return -ENODEV;
@@ -350,7 +348,7 @@ static int at25_np_to_chip(struct device *dev,
350 val); 348 val);
351 return -ENODEV; 349 return -ENODEV;
352 } 350 }
353 if (of_find_property(np, "read-only", NULL)) 351 if (device_property_present(dev, "read-only"))
354 chip->flags |= EE_READONLY; 352 chip->flags |= EE_READONLY;
355 } 353 }
356 return 0; 354 return 0;
@@ -360,21 +358,15 @@ static int at25_probe(struct spi_device *spi)
360{ 358{
361 struct at25_data *at25 = NULL; 359 struct at25_data *at25 = NULL;
362 struct spi_eeprom chip; 360 struct spi_eeprom chip;
363 struct device_node *np = spi->dev.of_node;
364 int err; 361 int err;
365 int sr; 362 int sr;
366 int addrlen; 363 int addrlen;
367 364
368 /* Chip description */ 365 /* Chip description */
369 if (!spi->dev.platform_data) { 366 if (!spi->dev.platform_data) {
370 if (np) { 367 err = at25_fw_to_chip(&spi->dev, &chip);
371 err = at25_np_to_chip(&spi->dev, np, &chip); 368 if (err)
372 if (err) 369 return err;
373 return err;
374 } else {
375 dev_err(&spi->dev, "Error: no chip description\n");
376 return -ENODEV;
377 }
378 } else 370 } else
379 chip = *(struct spi_eeprom *)spi->dev.platform_data; 371 chip = *(struct spi_eeprom *)spi->dev.platform_data;
380 372
diff --git a/drivers/misc/eeprom/eeprom_93cx6.c b/drivers/misc/eeprom/eeprom_93cx6.c
index 0ff4b02177be..0cf2c9d676be 100644
--- a/drivers/misc/eeprom/eeprom_93cx6.c
+++ b/drivers/misc/eeprom/eeprom_93cx6.c
@@ -170,7 +170,7 @@ static void eeprom_93cx6_read_bits(struct eeprom_93cx6 *eeprom,
170} 170}
171 171
172/** 172/**
173 * eeprom_93cx6_read - Read multiple words from eeprom 173 * eeprom_93cx6_read - Read a word from eeprom
174 * @eeprom: Pointer to eeprom structure 174 * @eeprom: Pointer to eeprom structure
175 * @word: Word index from where we should start reading 175 * @word: Word index from where we should start reading
176 * @data: target pointer where the information will have to be stored 176 * @data: target pointer where the information will have to be stored
@@ -235,6 +235,66 @@ void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, const u8 word,
235EXPORT_SYMBOL_GPL(eeprom_93cx6_multiread); 235EXPORT_SYMBOL_GPL(eeprom_93cx6_multiread);
236 236
237/** 237/**
238 * eeprom_93cx6_readb - Read a byte from eeprom
239 * @eeprom: Pointer to eeprom structure
240 * @word: Byte index from where we should start reading
241 * @data: target pointer where the information will have to be stored
242 *
243 * This function will read a byte of the eeprom data
244 * into the given data pointer.
245 */
246void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom, const u8 byte,
247 u8 *data)
248{
249 u16 command;
250 u16 tmp;
251
252 /*
253 * Initialize the eeprom register
254 */
255 eeprom_93cx6_startup(eeprom);
256
257 /*
258 * Select the read opcode and the byte to be read.
259 */
260 command = (PCI_EEPROM_READ_OPCODE << (eeprom->width + 1)) | byte;
261 eeprom_93cx6_write_bits(eeprom, command,
262 PCI_EEPROM_WIDTH_OPCODE + eeprom->width + 1);
263
264 /*
265 * Read the requested 8 bits.
266 */
267 eeprom_93cx6_read_bits(eeprom, &tmp, 8);
268 *data = tmp & 0xff;
269
270 /*
271 * Cleanup eeprom register.
272 */
273 eeprom_93cx6_cleanup(eeprom);
274}
275EXPORT_SYMBOL_GPL(eeprom_93cx6_readb);
276
277/**
278 * eeprom_93cx6_multireadb - Read multiple bytes from eeprom
279 * @eeprom: Pointer to eeprom structure
280 * @byte: Index from where we should start reading
281 * @data: target pointer where the information will have to be stored
282 * @words: Number of bytes that should be read.
283 *
284 * This function will read all requested bytes from the eeprom,
285 * this is done by calling eeprom_93cx6_readb() multiple times.
286 */
287void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom, const u8 byte,
288 u8 *data, const u16 bytes)
289{
290 unsigned int i;
291
292 for (i = 0; i < bytes; i++)
293 eeprom_93cx6_readb(eeprom, byte + i, &data[i]);
294}
295EXPORT_SYMBOL_GPL(eeprom_93cx6_multireadb);
296
297/**
238 * eeprom_93cx6_wren - set the write enable state 298 * eeprom_93cx6_wren - set the write enable state
239 * @eeprom: Pointer to eeprom structure 299 * @eeprom: Pointer to eeprom structure
240 * @enable: true to enable writes, otherwise disable writes 300 * @enable: true to enable writes, otherwise disable writes
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index 2cf2bbc0b927..180a5442fd4b 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -187,6 +187,7 @@ void enclosure_unregister(struct enclosure_device *edev)
187EXPORT_SYMBOL_GPL(enclosure_unregister); 187EXPORT_SYMBOL_GPL(enclosure_unregister);
188 188
189#define ENCLOSURE_NAME_SIZE 64 189#define ENCLOSURE_NAME_SIZE 64
190#define COMPONENT_NAME_SIZE 64
190 191
191static void enclosure_link_name(struct enclosure_component *cdev, char *name) 192static void enclosure_link_name(struct enclosure_component *cdev, char *name)
192{ 193{
@@ -246,6 +247,29 @@ static void enclosure_component_release(struct device *dev)
246 put_device(dev->parent); 247 put_device(dev->parent);
247} 248}
248 249
250static struct enclosure_component *
251enclosure_component_find_by_name(struct enclosure_device *edev,
252 const char *name)
253{
254 int i;
255 const char *cname;
256 struct enclosure_component *ecomp;
257
258 if (!edev || !name || !name[0])
259 return NULL;
260
261 for (i = 0; i < edev->components; i++) {
262 ecomp = &edev->component[i];
263 cname = dev_name(&ecomp->cdev);
264 if (ecomp->number != -1 &&
265 cname && cname[0] &&
266 !strcmp(cname, name))
267 return ecomp;
268 }
269
270 return NULL;
271}
272
249static const struct attribute_group *enclosure_component_groups[]; 273static const struct attribute_group *enclosure_component_groups[];
250 274
251/** 275/**
@@ -269,7 +293,8 @@ enclosure_component_register(struct enclosure_device *edev,
269{ 293{
270 struct enclosure_component *ecomp; 294 struct enclosure_component *ecomp;
271 struct device *cdev; 295 struct device *cdev;
272 int err; 296 int err, i;
297 char newname[COMPONENT_NAME_SIZE];
273 298
274 if (number >= edev->components) 299 if (number >= edev->components)
275 return ERR_PTR(-EINVAL); 300 return ERR_PTR(-EINVAL);
@@ -283,9 +308,20 @@ enclosure_component_register(struct enclosure_device *edev,
283 ecomp->number = number; 308 ecomp->number = number;
284 cdev = &ecomp->cdev; 309 cdev = &ecomp->cdev;
285 cdev->parent = get_device(&edev->edev); 310 cdev->parent = get_device(&edev->edev);
286 if (name && name[0]) 311
287 dev_set_name(cdev, "%s", name); 312 if (name && name[0]) {
288 else 313 /* Some hardware (e.g. enclosure in RX300 S6) has components
314 * with non unique names. Registering duplicates in sysfs
315 * will lead to warnings during bootup. So make the names
316 * unique by appending consecutive numbers -1, -2, ... */
317 i = 1;
318 snprintf(newname, COMPONENT_NAME_SIZE,
319 "%s", name);
320 while (enclosure_component_find_by_name(edev, newname))
321 snprintf(newname, COMPONENT_NAME_SIZE,
322 "%s-%i", name, i++);
323 dev_set_name(cdev, "%s", newname);
324 } else
289 dev_set_name(cdev, "%u", number); 325 dev_set_name(cdev, "%u", number);
290 326
291 cdev->release = enclosure_component_release; 327 cdev->release = enclosure_component_release;
diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c
index 5918586f2f76..c49d244265ec 100644
--- a/drivers/misc/genwqe/card_dev.c
+++ b/drivers/misc/genwqe/card_dev.c
@@ -395,7 +395,7 @@ static void genwqe_vma_open(struct vm_area_struct *vma)
395static void genwqe_vma_close(struct vm_area_struct *vma) 395static void genwqe_vma_close(struct vm_area_struct *vma)
396{ 396{
397 unsigned long vsize = vma->vm_end - vma->vm_start; 397 unsigned long vsize = vma->vm_end - vma->vm_start;
398 struct inode *inode = vma->vm_file->f_dentry->d_inode; 398 struct inode *inode = file_inode(vma->vm_file);
399 struct dma_mapping *dma_map; 399 struct dma_mapping *dma_map;
400 struct genwqe_dev *cd = container_of(inode->i_cdev, struct genwqe_dev, 400 struct genwqe_dev *cd = container_of(inode->i_cdev, struct genwqe_dev,
401 cdev_genwqe); 401 cdev_genwqe);
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
index d324f8a97b88..63fe096d4462 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
@@ -235,7 +235,7 @@ static int lis3lv02d_i2c_resume(struct device *dev)
235} 235}
236#endif /* CONFIG_PM_SLEEP */ 236#endif /* CONFIG_PM_SLEEP */
237 237
238#ifdef CONFIG_PM_RUNTIME 238#ifdef CONFIG_PM
239static int lis3_i2c_runtime_suspend(struct device *dev) 239static int lis3_i2c_runtime_suspend(struct device *dev)
240{ 240{
241 struct i2c_client *client = container_of(dev, struct i2c_client, dev); 241 struct i2c_client *client = container_of(dev, struct i2c_client, dev);
@@ -253,7 +253,7 @@ static int lis3_i2c_runtime_resume(struct device *dev)
253 lis3lv02d_poweron(lis3); 253 lis3lv02d_poweron(lis3);
254 return 0; 254 return 0;
255} 255}
256#endif /* CONFIG_PM_RUNTIME */ 256#endif /* CONFIG_PM */
257 257
258static const struct i2c_device_id lis3lv02d_id[] = { 258static const struct i2c_device_id lis3lv02d_id[] = {
259 {"lis3lv02d", LIS3LV02D}, 259 {"lis3lv02d", LIS3LV02D},
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 71744b16cc8c..61b04d7646f1 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -530,9 +530,9 @@ struct mei_device {
530 * Power Gating support 530 * Power Gating support
531 */ 531 */
532 enum mei_pg_event pg_event; 532 enum mei_pg_event pg_event;
533#ifdef CONFIG_PM_RUNTIME 533#ifdef CONFIG_PM
534 struct dev_pm_domain pg_domain; 534 struct dev_pm_domain pg_domain;
535#endif /* CONFIG_PM_RUNTIME */ 535#endif /* CONFIG_PM */
536 536
537 unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE]; 537 unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE];
538 u32 rd_msg_hdr; 538 u32 rd_msg_hdr;
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index f3225b1643ab..cf20d397068a 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -89,13 +89,13 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
89 89
90MODULE_DEVICE_TABLE(pci, mei_me_pci_tbl); 90MODULE_DEVICE_TABLE(pci, mei_me_pci_tbl);
91 91
92#ifdef CONFIG_PM_RUNTIME 92#ifdef CONFIG_PM
93static inline void mei_me_set_pm_domain(struct mei_device *dev); 93static inline void mei_me_set_pm_domain(struct mei_device *dev);
94static inline void mei_me_unset_pm_domain(struct mei_device *dev); 94static inline void mei_me_unset_pm_domain(struct mei_device *dev);
95#else 95#else
96static inline void mei_me_set_pm_domain(struct mei_device *dev) {} 96static inline void mei_me_set_pm_domain(struct mei_device *dev) {}
97static inline void mei_me_unset_pm_domain(struct mei_device *dev) {} 97static inline void mei_me_unset_pm_domain(struct mei_device *dev) {}
98#endif /* CONFIG_PM_RUNTIME */ 98#endif /* CONFIG_PM */
99 99
100/** 100/**
101 * mei_me_quirk_probe - probe for devices that doesn't valid ME interface 101 * mei_me_quirk_probe - probe for devices that doesn't valid ME interface
@@ -357,7 +357,7 @@ static int mei_me_pci_resume(struct device *device)
357} 357}
358#endif /* CONFIG_PM_SLEEP */ 358#endif /* CONFIG_PM_SLEEP */
359 359
360#ifdef CONFIG_PM_RUNTIME 360#ifdef CONFIG_PM
361static int mei_me_pm_runtime_idle(struct device *device) 361static int mei_me_pm_runtime_idle(struct device *device)
362{ 362{
363 struct pci_dev *pdev = to_pci_dev(device); 363 struct pci_dev *pdev = to_pci_dev(device);
@@ -453,9 +453,7 @@ static inline void mei_me_unset_pm_domain(struct mei_device *dev)
453 /* stop using pm callbacks if any */ 453 /* stop using pm callbacks if any */
454 dev->dev->pm_domain = NULL; 454 dev->dev->pm_domain = NULL;
455} 455}
456#endif /* CONFIG_PM_RUNTIME */
457 456
458#ifdef CONFIG_PM
459static const struct dev_pm_ops mei_me_pm_ops = { 457static const struct dev_pm_ops mei_me_pm_ops = {
460 SET_SYSTEM_SLEEP_PM_OPS(mei_me_pci_suspend, 458 SET_SYSTEM_SLEEP_PM_OPS(mei_me_pci_suspend,
461 mei_me_pci_resume) 459 mei_me_pci_resume)
diff --git a/drivers/misc/mei/pci-txe.c b/drivers/misc/mei/pci-txe.c
index bee1c6fb7e75..1f572deacf54 100644
--- a/drivers/misc/mei/pci-txe.c
+++ b/drivers/misc/mei/pci-txe.c
@@ -42,13 +42,13 @@ static const struct pci_device_id mei_txe_pci_tbl[] = {
42}; 42};
43MODULE_DEVICE_TABLE(pci, mei_txe_pci_tbl); 43MODULE_DEVICE_TABLE(pci, mei_txe_pci_tbl);
44 44
45#ifdef CONFIG_PM_RUNTIME 45#ifdef CONFIG_PM
46static inline void mei_txe_set_pm_domain(struct mei_device *dev); 46static inline void mei_txe_set_pm_domain(struct mei_device *dev);
47static inline void mei_txe_unset_pm_domain(struct mei_device *dev); 47static inline void mei_txe_unset_pm_domain(struct mei_device *dev);
48#else 48#else
49static inline void mei_txe_set_pm_domain(struct mei_device *dev) {} 49static inline void mei_txe_set_pm_domain(struct mei_device *dev) {}
50static inline void mei_txe_unset_pm_domain(struct mei_device *dev) {} 50static inline void mei_txe_unset_pm_domain(struct mei_device *dev) {}
51#endif /* CONFIG_PM_RUNTIME */ 51#endif /* CONFIG_PM */
52 52
53static void mei_txe_pci_iounmap(struct pci_dev *pdev, struct mei_txe_hw *hw) 53static void mei_txe_pci_iounmap(struct pci_dev *pdev, struct mei_txe_hw *hw)
54{ 54{
@@ -295,7 +295,7 @@ static int mei_txe_pci_resume(struct device *device)
295} 295}
296#endif /* CONFIG_PM_SLEEP */ 296#endif /* CONFIG_PM_SLEEP */
297 297
298#ifdef CONFIG_PM_RUNTIME 298#ifdef CONFIG_PM
299static int mei_txe_pm_runtime_idle(struct device *device) 299static int mei_txe_pm_runtime_idle(struct device *device)
300{ 300{
301 struct pci_dev *pdev = to_pci_dev(device); 301 struct pci_dev *pdev = to_pci_dev(device);
@@ -401,9 +401,7 @@ static inline void mei_txe_unset_pm_domain(struct mei_device *dev)
401 /* stop using pm callbacks if any */ 401 /* stop using pm callbacks if any */
402 dev->dev->pm_domain = NULL; 402 dev->dev->pm_domain = NULL;
403} 403}
404#endif /* CONFIG_PM_RUNTIME */
405 404
406#ifdef CONFIG_PM
407static const struct dev_pm_ops mei_txe_pm_ops = { 405static const struct dev_pm_ops mei_txe_pm_ops = {
408 SET_SYSTEM_SLEEP_PM_OPS(mei_txe_pci_suspend, 406 SET_SYSTEM_SLEEP_PM_OPS(mei_txe_pci_suspend,
409 mei_txe_pci_resume) 407 mei_txe_pci_resume)
diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c
index e64794730e21..e486a0c26267 100644
--- a/drivers/misc/mic/card/mic_virtio.c
+++ b/drivers/misc/mic/card/mic_virtio.c
@@ -68,7 +68,7 @@ static inline struct device *mic_dev(struct mic_vdev *mvdev)
68} 68}
69 69
70/* This gets the device's feature bits. */ 70/* This gets the device's feature bits. */
71static u32 mic_get_features(struct virtio_device *vdev) 71static u64 mic_get_features(struct virtio_device *vdev)
72{ 72{
73 unsigned int i, bits; 73 unsigned int i, bits;
74 u32 features = 0; 74 u32 features = 0;
@@ -76,8 +76,7 @@ static u32 mic_get_features(struct virtio_device *vdev)
76 u8 __iomem *in_features = mic_vq_features(desc); 76 u8 __iomem *in_features = mic_vq_features(desc);
77 int feature_len = ioread8(&desc->feature_len); 77 int feature_len = ioread8(&desc->feature_len);
78 78
79 bits = min_t(unsigned, feature_len, 79 bits = min_t(unsigned, feature_len, sizeof(features)) * 8;
80 sizeof(vdev->features)) * 8;
81 for (i = 0; i < bits; i++) 80 for (i = 0; i < bits; i++)
82 if (ioread8(&in_features[i / 8]) & (BIT(i % 8))) 81 if (ioread8(&in_features[i / 8]) & (BIT(i % 8)))
83 features |= BIT(i); 82 features |= BIT(i);
@@ -85,7 +84,7 @@ static u32 mic_get_features(struct virtio_device *vdev)
85 return features; 84 return features;
86} 85}
87 86
88static void mic_finalize_features(struct virtio_device *vdev) 87static int mic_finalize_features(struct virtio_device *vdev)
89{ 88{
90 unsigned int i, bits; 89 unsigned int i, bits;
91 struct mic_device_desc __iomem *desc = to_micvdev(vdev)->desc; 90 struct mic_device_desc __iomem *desc = to_micvdev(vdev)->desc;
@@ -97,14 +96,19 @@ static void mic_finalize_features(struct virtio_device *vdev)
97 /* Give virtio_ring a chance to accept features. */ 96 /* Give virtio_ring a chance to accept features. */
98 vring_transport_features(vdev); 97 vring_transport_features(vdev);
99 98
99 /* Make sure we don't have any features > 32 bits! */
100 BUG_ON((u32)vdev->features != vdev->features);
101
100 memset_io(out_features, 0, feature_len); 102 memset_io(out_features, 0, feature_len);
101 bits = min_t(unsigned, feature_len, 103 bits = min_t(unsigned, feature_len,
102 sizeof(vdev->features)) * 8; 104 sizeof(vdev->features)) * 8;
103 for (i = 0; i < bits; i++) { 105 for (i = 0; i < bits; i++) {
104 if (test_bit(i, vdev->features)) 106 if (__virtio_test_bit(vdev, i))
105 iowrite8(ioread8(&out_features[i / 8]) | (1 << (i % 8)), 107 iowrite8(ioread8(&out_features[i / 8]) | (1 << (i % 8)),
106 &out_features[i / 8]); 108 &out_features[i / 8]);
107 } 109 }
110
111 return 0;
108} 112}
109 113
110/* 114/*
diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c
index b3a812384a6f..c344483fa7d6 100644
--- a/drivers/misc/vexpress-syscfg.c
+++ b/drivers/misc/vexpress-syscfg.c
@@ -145,7 +145,7 @@ static struct regmap_config vexpress_syscfg_regmap_config = {
145static struct regmap *vexpress_syscfg_regmap_init(struct device *dev, 145static struct regmap *vexpress_syscfg_regmap_init(struct device *dev,
146 void *context) 146 void *context)
147{ 147{
148 struct platform_device *pdev = to_platform_device(dev); 148 int err;
149 struct vexpress_syscfg *syscfg = context; 149 struct vexpress_syscfg *syscfg = context;
150 struct vexpress_syscfg_func *func; 150 struct vexpress_syscfg_func *func;
151 struct property *prop; 151 struct property *prop;
@@ -155,32 +155,18 @@ static struct regmap *vexpress_syscfg_regmap_init(struct device *dev,
155 u32 site, position, dcc; 155 u32 site, position, dcc;
156 int i; 156 int i;
157 157
158 if (dev->of_node) { 158 err = vexpress_config_get_topo(dev->of_node, &site,
159 int err = vexpress_config_get_topo(dev->of_node, &site,
160 &position, &dcc); 159 &position, &dcc);
160 if (err)
161 return ERR_PTR(err);
161 162
162 if (err) 163 prop = of_find_property(dev->of_node,
163 return ERR_PTR(err); 164 "arm,vexpress-sysreg,func", NULL);
164 165 if (!prop)
165 prop = of_find_property(dev->of_node, 166 return ERR_PTR(-EINVAL);
166 "arm,vexpress-sysreg,func", NULL); 167
167 if (!prop) 168 num = prop->length / sizeof(u32) / 2;
168 return ERR_PTR(-EINVAL); 169 val = prop->value;
169
170 num = prop->length / sizeof(u32) / 2;
171 val = prop->value;
172 } else {
173 if (pdev->num_resources != 1 ||
174 pdev->resource[0].flags != IORESOURCE_BUS)
175 return ERR_PTR(-EFAULT);
176
177 site = pdev->resource[0].start;
178 if (site == VEXPRESS_SITE_MASTER)
179 site = vexpress_config_get_master();
180 position = 0;
181 dcc = 0;
182 num = 1;
183 }
184 170
185 /* 171 /*
186 * "arm,vexpress-energy" function used to be described 172 * "arm,vexpress-energy" function used to be described
@@ -207,13 +193,8 @@ static struct regmap *vexpress_syscfg_regmap_init(struct device *dev,
207 for (i = 0; i < num; i++) { 193 for (i = 0; i < num; i++) {
208 u32 function, device; 194 u32 function, device;
209 195
210 if (dev->of_node) { 196 function = be32_to_cpup(val++);
211 function = be32_to_cpup(val++); 197 device = be32_to_cpup(val++);
212 device = be32_to_cpup(val++);
213 } else {
214 function = pdev->resource[0].end;
215 device = pdev->id;
216 }
217 198
218 dev_dbg(dev, "func %p: %u/%u/%u/%u/%u\n", 199 dev_dbg(dev, "func %p: %u/%u/%u/%u/%u\n",
219 func, site, position, dcc, 200 func, site, position, dcc,
@@ -265,17 +246,6 @@ static struct vexpress_config_bridge_ops vexpress_syscfg_bridge_ops = {
265}; 246};
266 247
267 248
268/* Non-DT hack, to be gone... */
269static struct device *vexpress_syscfg_bridge;
270
271int vexpress_syscfg_device_register(struct platform_device *pdev)
272{
273 pdev->dev.parent = vexpress_syscfg_bridge;
274
275 return platform_device_register(pdev);
276}
277
278
279static int vexpress_syscfg_probe(struct platform_device *pdev) 249static int vexpress_syscfg_probe(struct platform_device *pdev)
280{ 250{
281 struct vexpress_syscfg *syscfg; 251 struct vexpress_syscfg *syscfg;
@@ -303,10 +273,6 @@ static int vexpress_syscfg_probe(struct platform_device *pdev)
303 if (IS_ERR(bridge)) 273 if (IS_ERR(bridge))
304 return PTR_ERR(bridge); 274 return PTR_ERR(bridge);
305 275
306 /* Non-DT case */
307 if (!pdev->dev.of_node)
308 vexpress_syscfg_bridge = bridge;
309
310 return 0; 276 return 0;
311} 277}
312 278
diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index 1b7b303085d2..7aaaf51e1596 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -27,6 +27,7 @@
27#include <linux/uio.h> 27#include <linux/uio.h>
28#include <linux/wait.h> 28#include <linux/wait.h>
29#include <linux/vmalloc.h> 29#include <linux/vmalloc.h>
30#include <linux/skbuff.h>
30 31
31#include "vmci_handle_array.h" 32#include "vmci_handle_array.h"
32#include "vmci_queue_pair.h" 33#include "vmci_queue_pair.h"
@@ -429,11 +430,11 @@ static int __qp_memcpy_from_queue(void *dest,
429 to_copy = size - bytes_copied; 430 to_copy = size - bytes_copied;
430 431
431 if (is_iovec) { 432 if (is_iovec) {
432 struct iovec *iov = (struct iovec *)dest; 433 struct msghdr *msg = dest;
433 int err; 434 int err;
434 435
435 /* The iovec will track bytes_copied internally. */ 436 /* The iovec will track bytes_copied internally. */
436 err = memcpy_toiovec(iov, (u8 *)va + page_offset, 437 err = memcpy_to_msg(msg, (u8 *)va + page_offset,
437 to_copy); 438 to_copy);
438 if (err != 0) { 439 if (err != 0) {
439 if (kernel_if->host) 440 if (kernel_if->host)
@@ -3264,13 +3265,13 @@ EXPORT_SYMBOL_GPL(vmci_qpair_enquev);
3264 * of bytes dequeued or < 0 on error. 3265 * of bytes dequeued or < 0 on error.
3265 */ 3266 */
3266ssize_t vmci_qpair_dequev(struct vmci_qp *qpair, 3267ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
3267 void *iov, 3268 struct msghdr *msg,
3268 size_t iov_size, 3269 size_t iov_size,
3269 int buf_type) 3270 int buf_type)
3270{ 3271{
3271 ssize_t result; 3272 ssize_t result;
3272 3273
3273 if (!qpair || !iov) 3274 if (!qpair)
3274 return VMCI_ERROR_INVALID_ARGS; 3275 return VMCI_ERROR_INVALID_ARGS;
3275 3276
3276 qp_lock(qpair); 3277 qp_lock(qpair);
@@ -3279,7 +3280,7 @@ ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
3279 result = qp_dequeue_locked(qpair->produce_q, 3280 result = qp_dequeue_locked(qpair->produce_q,
3280 qpair->consume_q, 3281 qpair->consume_q,
3281 qpair->consume_q_size, 3282 qpair->consume_q_size,
3282 iov, iov_size, 3283 msg, iov_size,
3283 qp_memcpy_from_queue_iov, 3284 qp_memcpy_from_queue_iov,
3284 true); 3285 true);
3285 3286
@@ -3308,13 +3309,13 @@ EXPORT_SYMBOL_GPL(vmci_qpair_dequev);
3308 * of bytes peeked or < 0 on error. 3309 * of bytes peeked or < 0 on error.
3309 */ 3310 */
3310ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, 3311ssize_t vmci_qpair_peekv(struct vmci_qp *qpair,
3311 void *iov, 3312 struct msghdr *msg,
3312 size_t iov_size, 3313 size_t iov_size,
3313 int buf_type) 3314 int buf_type)
3314{ 3315{
3315 ssize_t result; 3316 ssize_t result;
3316 3317
3317 if (!qpair || !iov) 3318 if (!qpair)
3318 return VMCI_ERROR_INVALID_ARGS; 3319 return VMCI_ERROR_INVALID_ARGS;
3319 3320
3320 qp_lock(qpair); 3321 qp_lock(qpair);
@@ -3323,7 +3324,7 @@ ssize_t vmci_qpair_peekv(struct vmci_qp *qpair,
3323 result = qp_dequeue_locked(qpair->produce_q, 3324 result = qp_dequeue_locked(qpair->produce_q,
3324 qpair->consume_q, 3325 qpair->consume_q,
3325 qpair->consume_q_size, 3326 qpair->consume_q_size,
3326 iov, iov_size, 3327 msg, iov_size,
3327 qp_memcpy_from_queue_iov, 3328 qp_memcpy_from_queue_iov,
3328 false); 3329 false);
3329 3330