Merge tag 'char-misc-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH: "Here is the big set of char/misc patches for 4.20-rc1. Loads of things here, we have new code in all of these driver subsystems: - fpga - stm - extcon - nvmem - eeprom - hyper-v - gsmi - coresight - thunderbolt - vmw_balloon - goldfish - soundwire along with lots of fixes and minor changes to other small drivers. All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (245 commits) Documentation/security-bugs: Clarify treatment of embargoed information lib: Fix ia64 bootloader linkage MAINTAINERS: Clarify UIO vs UIOVEC maintainer docs/uio: fix a grammar nitpick docs: fpga: document programming fpgas using regions fpga: add devm_fpga_region_create fpga: bridge: add devm_fpga_bridge_create fpga: mgr: add devm_fpga_mgr_create hv_balloon: Replace spin_is_locked() with lockdep sgi-xp: Replace spin_is_locked() with lockdep eeprom: New ee1004 driver for DDR4 memory eeprom: at25: remove unneeded 'at25_remove' w1: IAD Register is yet readable trough iad sys file. Fix snprintf (%u for unsigned, count for max size). misc: mic: scif: remove set but not used variables 'src_dma_addr, dst_dma_addr' misc: mic: fix a DMA pool free failure platform: goldfish: pipe: Add a blank line to separate varibles and code platform: goldfish: pipe: Remove redundant casting platform: goldfish: pipe: Call misc_deregister if init fails platform: goldfish: pipe: Move the file-scope goldfish_pipe_dev variable into the driver state platform: goldfish: pipe: Move the file-scope goldfish_pipe_miscdev variable into the driver state ...
This commit is contained in:
@@ -114,6 +114,6 @@ static struct i2c_driver ad_dpot_i2c_driver = {
|
||||
|
||||
module_i2c_driver(ad_dpot_i2c_driver);
|
||||
|
||||
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
|
||||
MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
|
||||
MODULE_DESCRIPTION("digital potentiometer I2C bus driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@@ -140,7 +140,7 @@ static struct spi_driver ad_dpot_spi_driver = {
|
||||
|
||||
module_spi_driver(ad_dpot_spi_driver);
|
||||
|
||||
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
|
||||
MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
|
||||
MODULE_DESCRIPTION("digital potentiometer SPI bus driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("spi:ad_dpot");
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ad525x_dpot: Driver for the Analog Devices digital potentiometers
|
||||
* Copyright (c) 2009-2010 Analog Devices, Inc.
|
||||
* Author: Michael Hennerich <hennerich@blackfin.uclinux.org>
|
||||
* Author: Michael Hennerich <michael.hennerich@analog.com>
|
||||
*
|
||||
* DEVID #Wipers #Positions Resistor Options (kOhm)
|
||||
* AD5258 1 64 1, 10, 50, 100
|
||||
@@ -64,7 +64,7 @@
|
||||
* Author: Chris Verges <chrisv@cyberswitching.com>
|
||||
*
|
||||
* derived from ad5252.c
|
||||
* Copyright (c) 2006-2011 Michael Hennerich <hennerich@blackfin.uclinux.org>
|
||||
* Copyright (c) 2006-2011 Michael Hennerich <michael.hennerich@analog.com>
|
||||
*
|
||||
* Licensed under the GPL-2 or later.
|
||||
*/
|
||||
@@ -760,6 +760,6 @@ EXPORT_SYMBOL(ad_dpot_remove);
|
||||
|
||||
|
||||
MODULE_AUTHOR("Chris Verges <chrisv@cyberswitching.com>, "
|
||||
"Michael Hennerich <hennerich@blackfin.uclinux.org>");
|
||||
"Michael Hennerich <michael.hennerich@analog.com>");
|
||||
MODULE_DESCRIPTION("Digital potentiometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@@ -188,7 +188,6 @@ struct apds990x_chip {
|
||||
#define APDS_LUX_DEFAULT_RATE 200
|
||||
|
||||
static const u8 again[] = {1, 8, 16, 120}; /* ALS gain steps */
|
||||
static const u8 ir_currents[] = {100, 50, 25, 12}; /* IRled currents in mA */
|
||||
|
||||
/* Following two tables must match i.e 10Hz rate means 1 as persistence value */
|
||||
static const u16 arates_hz[] = {10, 5, 2, 1};
|
||||
|
@@ -180,9 +180,6 @@ static const char reg_vleds[] = "Vleds";
|
||||
static const s16 prox_rates_hz[] = {100, 50, 33, 25, 14, 10, 5, 2};
|
||||
static const s16 prox_rates_ms[] = {10, 20, 30, 40, 70, 100, 200, 500};
|
||||
|
||||
/* Supported IR-led currents in mA */
|
||||
static const u8 prox_curr_ma[] = {5, 10, 20, 50, 100, 150, 200};
|
||||
|
||||
/*
|
||||
* Supported stand alone rates in ms from chip data sheet
|
||||
* {100, 200, 500, 1000, 2000};
|
||||
|
@@ -92,8 +92,8 @@ static int update_property(struct device_node *dn, const char *name,
|
||||
|
||||
val = (u32 *)new_prop->value;
|
||||
rc = cxl_update_properties(dn, new_prop);
|
||||
pr_devel("%s: update property (%s, length: %i, value: %#x)\n",
|
||||
dn->name, name, vd, be32_to_cpu(*val));
|
||||
pr_devel("%pOFn: update property (%s, length: %i, value: %#x)\n",
|
||||
dn, name, vd, be32_to_cpu(*val));
|
||||
|
||||
if (rc) {
|
||||
kfree(new_prop->name);
|
||||
|
@@ -1018,8 +1018,6 @@ err1:
|
||||
|
||||
void cxl_guest_remove_afu(struct cxl_afu *afu)
|
||||
{
|
||||
pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
|
||||
|
||||
if (!afu)
|
||||
return;
|
||||
|
||||
|
@@ -381,7 +381,7 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
|
||||
*/
|
||||
ec->factor = 0;
|
||||
ec->shift = 0;
|
||||
if ((ec->nonupdate_dwell == 0)) {
|
||||
if (!ec->nonupdate_dwell) {
|
||||
int p, logp, shift;
|
||||
|
||||
/* Determine:
|
||||
|
@@ -111,4 +111,15 @@ config EEPROM_IDT_89HPESX
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called idt_89hpesx.
|
||||
|
||||
config EEPROM_EE1004
|
||||
tristate "SPD EEPROMs on DDR4 memory modules"
|
||||
depends on I2C && SYSFS
|
||||
help
|
||||
Enable this driver to get read support to SPD EEPROMs following
|
||||
the JEDEC EE1004 standard. These are typically found on DDR4
|
||||
SDRAM memory modules.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called ee1004.
|
||||
|
||||
endmenu
|
||||
|
@@ -7,3 +7,4 @@ obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o
|
||||
obj-$(CONFIG_EEPROM_93XX46) += eeprom_93xx46.o
|
||||
obj-$(CONFIG_EEPROM_DIGSY_MTC_CFG) += digsy_mtc_eeprom.o
|
||||
obj-$(CONFIG_EEPROM_IDT_89HPESX) += idt_89hpesx.o
|
||||
obj-$(CONFIG_EEPROM_EE1004) += ee1004.o
|
||||
|
@@ -366,7 +366,7 @@ static int at25_probe(struct spi_device *spi)
|
||||
at25->nvmem_config.word_size = 1;
|
||||
at25->nvmem_config.size = chip.byte_len;
|
||||
|
||||
at25->nvmem = nvmem_register(&at25->nvmem_config);
|
||||
at25->nvmem = devm_nvmem_register(&spi->dev, &at25->nvmem_config);
|
||||
if (IS_ERR(at25->nvmem))
|
||||
return PTR_ERR(at25->nvmem);
|
||||
|
||||
@@ -379,16 +379,6 @@ static int at25_probe(struct spi_device *spi)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int at25_remove(struct spi_device *spi)
|
||||
{
|
||||
struct at25_data *at25;
|
||||
|
||||
at25 = spi_get_drvdata(spi);
|
||||
nvmem_unregister(at25->nvmem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static const struct of_device_id at25_of_match[] = {
|
||||
@@ -403,7 +393,6 @@ static struct spi_driver at25_driver = {
|
||||
.of_match_table = at25_of_match,
|
||||
},
|
||||
.probe = at25_probe,
|
||||
.remove = at25_remove,
|
||||
};
|
||||
|
||||
module_spi_driver(at25_driver);
|
||||
|
281
drivers/misc/eeprom/ee1004.c
Normal file
281
drivers/misc/eeprom/ee1004.c
Normal file
@@ -0,0 +1,281 @@
|
||||
/*
|
||||
* ee1004 - driver for DDR4 SPD EEPROMs
|
||||
*
|
||||
* Copyright (C) 2017 Jean Delvare
|
||||
*
|
||||
* Based on the at24 driver:
|
||||
* Copyright (C) 2005-2007 David Brownell
|
||||
* Copyright (C) 2008 Wolfram Sang, Pengutronix
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
/*
|
||||
* DDR4 memory modules use special EEPROMs following the Jedec EE1004
|
||||
* specification. These are 512-byte EEPROMs using a single I2C address
|
||||
* in the 0x50-0x57 range for data. One of two 256-byte page is selected
|
||||
* by writing a command to I2C address 0x36 or 0x37 on the same I2C bus.
|
||||
*
|
||||
* Therefore we need to request these 2 additional addresses, and serialize
|
||||
* access to all such EEPROMs with a single mutex.
|
||||
*
|
||||
* We assume it is safe to read up to 32 bytes at once from these EEPROMs.
|
||||
* We use SMBus access even if I2C is available, these EEPROMs are small
|
||||
* enough, and reading from them infrequent enough, that we favor simplicity
|
||||
* over performance.
|
||||
*/
|
||||
|
||||
#define EE1004_ADDR_SET_PAGE 0x36
|
||||
#define EE1004_EEPROM_SIZE 512
|
||||
#define EE1004_PAGE_SIZE 256
|
||||
#define EE1004_PAGE_SHIFT 8
|
||||
|
||||
/*
|
||||
* Mutex protects ee1004_set_page and ee1004_dev_count, and must be held
|
||||
* from page selection to end of read.
|
||||
*/
|
||||
static DEFINE_MUTEX(ee1004_bus_lock);
|
||||
static struct i2c_client *ee1004_set_page[2];
|
||||
static unsigned int ee1004_dev_count;
|
||||
static int ee1004_current_page;
|
||||
|
||||
static const struct i2c_device_id ee1004_ids[] = {
|
||||
{ "ee1004", 0 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, ee1004_ids);
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static ssize_t ee1004_eeprom_read(struct i2c_client *client, char *buf,
|
||||
unsigned int offset, size_t count)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (count > I2C_SMBUS_BLOCK_MAX)
|
||||
count = I2C_SMBUS_BLOCK_MAX;
|
||||
/* Can't cross page boundaries */
|
||||
if (unlikely(offset + count > EE1004_PAGE_SIZE))
|
||||
count = EE1004_PAGE_SIZE - offset;
|
||||
|
||||
status = i2c_smbus_read_i2c_block_data_or_emulated(client, offset,
|
||||
count, buf);
|
||||
dev_dbg(&client->dev, "read %zu@%d --> %d\n", count, offset, status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static ssize_t ee1004_read(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr,
|
||||
char *buf, loff_t off, size_t count)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
size_t requested = count;
|
||||
int page;
|
||||
|
||||
if (unlikely(!count))
|
||||
return count;
|
||||
|
||||
page = off >> EE1004_PAGE_SHIFT;
|
||||
if (unlikely(page > 1))
|
||||
return 0;
|
||||
off &= (1 << EE1004_PAGE_SHIFT) - 1;
|
||||
|
||||
/*
|
||||
* Read data from chip, protecting against concurrent access to
|
||||
* other EE1004 SPD EEPROMs on the same adapter.
|
||||
*/
|
||||
mutex_lock(&ee1004_bus_lock);
|
||||
|
||||
while (count) {
|
||||
int status;
|
||||
|
||||
/* Select page */
|
||||
if (page != ee1004_current_page) {
|
||||
/* Data is ignored */
|
||||
status = i2c_smbus_write_byte(ee1004_set_page[page],
|
||||
0x00);
|
||||
if (status < 0) {
|
||||
dev_err(dev, "Failed to select page %d (%d)\n",
|
||||
page, status);
|
||||
mutex_unlock(&ee1004_bus_lock);
|
||||
return status;
|
||||
}
|
||||
dev_dbg(dev, "Selected page %d\n", page);
|
||||
ee1004_current_page = page;
|
||||
}
|
||||
|
||||
status = ee1004_eeprom_read(client, buf, off, count);
|
||||
if (status < 0) {
|
||||
mutex_unlock(&ee1004_bus_lock);
|
||||
return status;
|
||||
}
|
||||
buf += status;
|
||||
off += status;
|
||||
count -= status;
|
||||
|
||||
if (off == EE1004_PAGE_SIZE) {
|
||||
page++;
|
||||
off = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&ee1004_bus_lock);
|
||||
|
||||
return requested;
|
||||
}
|
||||
|
||||
static const struct bin_attribute eeprom_attr = {
|
||||
.attr = {
|
||||
.name = "eeprom",
|
||||
.mode = 0444,
|
||||
},
|
||||
.size = EE1004_EEPROM_SIZE,
|
||||
.read = ee1004_read,
|
||||
};
|
||||
|
||||
static int ee1004_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
int err, cnr = 0;
|
||||
const char *slow = NULL;
|
||||
|
||||
/* Make sure we can operate on this adapter */
|
||||
if (!i2c_check_functionality(client->adapter,
|
||||
I2C_FUNC_SMBUS_READ_BYTE |
|
||||
I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
|
||||
if (i2c_check_functionality(client->adapter,
|
||||
I2C_FUNC_SMBUS_READ_BYTE |
|
||||
I2C_FUNC_SMBUS_READ_WORD_DATA))
|
||||
slow = "word";
|
||||
else if (i2c_check_functionality(client->adapter,
|
||||
I2C_FUNC_SMBUS_READ_BYTE |
|
||||
I2C_FUNC_SMBUS_READ_BYTE_DATA))
|
||||
slow = "byte";
|
||||
else
|
||||
return -EPFNOSUPPORT;
|
||||
}
|
||||
|
||||
/* Use 2 dummy devices for page select command */
|
||||
mutex_lock(&ee1004_bus_lock);
|
||||
if (++ee1004_dev_count == 1) {
|
||||
for (cnr = 0; cnr < 2; cnr++) {
|
||||
ee1004_set_page[cnr] = i2c_new_dummy(client->adapter,
|
||||
EE1004_ADDR_SET_PAGE + cnr);
|
||||
if (!ee1004_set_page[cnr]) {
|
||||
dev_err(&client->dev,
|
||||
"address 0x%02x unavailable\n",
|
||||
EE1004_ADDR_SET_PAGE + cnr);
|
||||
err = -EADDRINUSE;
|
||||
goto err_clients;
|
||||
}
|
||||
}
|
||||
} else if (i2c_adapter_id(client->adapter) !=
|
||||
i2c_adapter_id(ee1004_set_page[0]->adapter)) {
|
||||
dev_err(&client->dev,
|
||||
"Driver only supports devices on a single I2C bus\n");
|
||||
err = -EOPNOTSUPP;
|
||||
goto err_clients;
|
||||
}
|
||||
|
||||
/* Remember current page to avoid unneeded page select */
|
||||
err = i2c_smbus_read_byte(ee1004_set_page[0]);
|
||||
if (err == -ENXIO) {
|
||||
/* Nack means page 1 is selected */
|
||||
ee1004_current_page = 1;
|
||||
} else if (err < 0) {
|
||||
/* Anything else is a real error, bail out */
|
||||
goto err_clients;
|
||||
} else {
|
||||
/* Ack means page 0 is selected, returned value meaningless */
|
||||
ee1004_current_page = 0;
|
||||
}
|
||||
dev_dbg(&client->dev, "Currently selected page: %d\n",
|
||||
ee1004_current_page);
|
||||
mutex_unlock(&ee1004_bus_lock);
|
||||
|
||||
/* Create the sysfs eeprom file */
|
||||
err = sysfs_create_bin_file(&client->dev.kobj, &eeprom_attr);
|
||||
if (err)
|
||||
goto err_clients_lock;
|
||||
|
||||
dev_info(&client->dev,
|
||||
"%u byte EE1004-compliant SPD EEPROM, read-only\n",
|
||||
EE1004_EEPROM_SIZE);
|
||||
if (slow)
|
||||
dev_notice(&client->dev,
|
||||
"Falling back to %s reads, performance will suffer\n",
|
||||
slow);
|
||||
|
||||
return 0;
|
||||
|
||||
err_clients_lock:
|
||||
mutex_lock(&ee1004_bus_lock);
|
||||
err_clients:
|
||||
if (--ee1004_dev_count == 0) {
|
||||
for (cnr--; cnr >= 0; cnr--) {
|
||||
i2c_unregister_device(ee1004_set_page[cnr]);
|
||||
ee1004_set_page[cnr] = NULL;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&ee1004_bus_lock);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ee1004_remove(struct i2c_client *client)
|
||||
{
|
||||
int i;
|
||||
|
||||
sysfs_remove_bin_file(&client->dev.kobj, &eeprom_attr);
|
||||
|
||||
/* Remove page select clients if this is the last device */
|
||||
mutex_lock(&ee1004_bus_lock);
|
||||
if (--ee1004_dev_count == 0) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
i2c_unregister_device(ee1004_set_page[i]);
|
||||
ee1004_set_page[i] = NULL;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&ee1004_bus_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static struct i2c_driver ee1004_driver = {
|
||||
.driver = {
|
||||
.name = "ee1004",
|
||||
},
|
||||
.probe = ee1004_probe,
|
||||
.remove = ee1004_remove,
|
||||
.id_table = ee1004_ids,
|
||||
};
|
||||
|
||||
static int __init ee1004_init(void)
|
||||
{
|
||||
return i2c_add_driver(&ee1004_driver);
|
||||
}
|
||||
module_init(ee1004_init);
|
||||
|
||||
static void __exit ee1004_exit(void)
|
||||
{
|
||||
i2c_del_driver(&ee1004_driver);
|
||||
}
|
||||
module_exit(ee1004_exit);
|
||||
|
||||
MODULE_DESCRIPTION("Driver for EE1004-compliant DDR4 SPD EEPROMs");
|
||||
MODULE_AUTHOR("Jean Delvare");
|
||||
MODULE_LICENSE("GPL");
|
@@ -439,7 +439,7 @@ static int eeprom_93xx46_probe(struct spi_device *spi)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
edev = kzalloc(sizeof(*edev), GFP_KERNEL);
|
||||
edev = devm_kzalloc(&spi->dev, sizeof(*edev), GFP_KERNEL);
|
||||
if (!edev)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -449,8 +449,7 @@ static int eeprom_93xx46_probe(struct spi_device *spi)
|
||||
edev->addrlen = 6;
|
||||
else {
|
||||
dev_err(&spi->dev, "unspecified address type\n");
|
||||
err = -EINVAL;
|
||||
goto fail;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_init(&edev->lock);
|
||||
@@ -473,11 +472,9 @@ static int eeprom_93xx46_probe(struct spi_device *spi)
|
||||
edev->nvmem_config.word_size = 1;
|
||||
edev->nvmem_config.size = edev->size;
|
||||
|
||||
edev->nvmem = nvmem_register(&edev->nvmem_config);
|
||||
if (IS_ERR(edev->nvmem)) {
|
||||
err = PTR_ERR(edev->nvmem);
|
||||
goto fail;
|
||||
}
|
||||
edev->nvmem = devm_nvmem_register(&spi->dev, &edev->nvmem_config);
|
||||
if (IS_ERR(edev->nvmem))
|
||||
return PTR_ERR(edev->nvmem);
|
||||
|
||||
dev_info(&spi->dev, "%d-bit eeprom %s\n",
|
||||
(pd->flags & EE_ADDR8) ? 8 : 16,
|
||||
@@ -490,21 +487,15 @@ static int eeprom_93xx46_probe(struct spi_device *spi)
|
||||
|
||||
spi_set_drvdata(spi, edev);
|
||||
return 0;
|
||||
fail:
|
||||
kfree(edev);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int eeprom_93xx46_remove(struct spi_device *spi)
|
||||
{
|
||||
struct eeprom_93xx46_dev *edev = spi_get_drvdata(spi);
|
||||
|
||||
nvmem_unregister(edev->nvmem);
|
||||
|
||||
if (!(edev->pdata->flags & EE_READONLY))
|
||||
device_remove_file(&spi->dev, &dev_attr_erase);
|
||||
|
||||
kfree(edev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,6 @@
|
||||
* controlled from here.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/err.h>
|
||||
|
@@ -27,7 +27,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/pci.h>
|
||||
|
@@ -23,14 +23,12 @@
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/page-flags.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/hugetlb.h>
|
||||
#include <linux/iommu.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/ctype.h>
|
||||
@@ -298,7 +296,7 @@ static int genwqe_sgl_size(int num_pages)
|
||||
int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
|
||||
void __user *user_addr, size_t user_size, int write)
|
||||
{
|
||||
int rc;
|
||||
int ret = -ENOMEM;
|
||||
struct pci_dev *pci_dev = cd->pci_dev;
|
||||
|
||||
sgl->fpage_offs = offset_in_page((unsigned long)user_addr);
|
||||
@@ -318,7 +316,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
|
||||
if (get_order(sgl->sgl_size) > MAX_ORDER) {
|
||||
dev_err(&pci_dev->dev,
|
||||
"[%s] err: too much memory requested!\n", __func__);
|
||||
return -ENOMEM;
|
||||
return ret;
|
||||
}
|
||||
|
||||
sgl->sgl = __genwqe_alloc_consistent(cd, sgl->sgl_size,
|
||||
@@ -326,7 +324,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
|
||||
if (sgl->sgl == NULL) {
|
||||
dev_err(&pci_dev->dev,
|
||||
"[%s] err: no memory available!\n", __func__);
|
||||
return -ENOMEM;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Only use buffering on incomplete pages */
|
||||
@@ -339,7 +337,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
|
||||
/* Sync with user memory */
|
||||
if (copy_from_user(sgl->fpage + sgl->fpage_offs,
|
||||
user_addr, sgl->fpage_size)) {
|
||||
rc = -EFAULT;
|
||||
ret = -EFAULT;
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
@@ -352,7 +350,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
|
||||
/* Sync with user memory */
|
||||
if (copy_from_user(sgl->lpage, user_addr + user_size -
|
||||
sgl->lpage_size, sgl->lpage_size)) {
|
||||
rc = -EFAULT;
|
||||
ret = -EFAULT;
|
||||
goto err_out2;
|
||||
}
|
||||
}
|
||||
@@ -374,7 +372,8 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
|
||||
sgl->sgl = NULL;
|
||||
sgl->sgl_dma_addr = 0;
|
||||
sgl->sgl_size = 0;
|
||||
return -ENOMEM;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int genwqe_setup_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
|
||||
|
@@ -985,6 +985,12 @@ static void kgdbts_run_tests(void)
|
||||
int nmi_sleep = 0;
|
||||
int i;
|
||||
|
||||
verbose = 0;
|
||||
if (strstr(config, "V1"))
|
||||
verbose = 1;
|
||||
if (strstr(config, "V2"))
|
||||
verbose = 2;
|
||||
|
||||
ptr = strchr(config, 'F');
|
||||
if (ptr)
|
||||
fork_test = simple_strtol(ptr + 1, NULL, 10);
|
||||
@@ -1068,13 +1074,6 @@ static int kgdbts_option_setup(char *opt)
|
||||
return -ENOSPC;
|
||||
}
|
||||
strcpy(config, opt);
|
||||
|
||||
verbose = 0;
|
||||
if (strstr(config, "V1"))
|
||||
verbose = 1;
|
||||
if (strstr(config, "V2"))
|
||||
verbose = 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1086,9 +1085,6 @@ static int configure_kgdbts(void)
|
||||
|
||||
if (!strlen(config) || isspace(config[0]))
|
||||
goto noconfig;
|
||||
err = kgdbts_option_setup(config);
|
||||
if (err)
|
||||
goto noconfig;
|
||||
|
||||
final_ack = 0;
|
||||
run_plant_and_detach_test(1);
|
||||
|
@@ -18,7 +18,7 @@
|
||||
* hardened usercopy checks by added "unconst" to all the const copies,
|
||||
* and making sure "cache_size" isn't optimized into a const.
|
||||
*/
|
||||
static volatile size_t unconst = 0;
|
||||
static volatile size_t unconst;
|
||||
static volatile size_t cache_size = 1024;
|
||||
static struct kmem_cache *whitelist_cache;
|
||||
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/uuid.h>
|
||||
|
@@ -599,10 +599,10 @@ static __poll_t mei_poll(struct file *file, poll_table *wait)
|
||||
mei_cl_read_start(cl, mei_cl_mtu(cl), file);
|
||||
}
|
||||
|
||||
if (req_events & (POLLOUT | POLLWRNORM)) {
|
||||
if (req_events & (EPOLLOUT | EPOLLWRNORM)) {
|
||||
poll_wait(file, &cl->tx_wait, wait);
|
||||
if (cl->tx_cb_queued < dev->tx_queue_limit)
|
||||
mask |= POLLOUT | POLLWRNORM;
|
||||
mask |= EPOLLOUT | EPOLLWRNORM;
|
||||
}
|
||||
|
||||
out:
|
||||
|
@@ -1035,8 +1035,6 @@ scif_rma_list_dma_copy_unaligned(struct scif_copy_work *work,
|
||||
}
|
||||
dma_async_issue_pending(chan);
|
||||
}
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
offset += loop_len;
|
||||
temp += loop_len;
|
||||
temp_phys += loop_len;
|
||||
@@ -1553,9 +1551,8 @@ static int scif_rma_list_dma_copy_wrapper(struct scif_endpt *epd,
|
||||
int src_cache_off, dst_cache_off;
|
||||
s64 src_offset = work->src_offset, dst_offset = work->dst_offset;
|
||||
u8 *temp = NULL;
|
||||
bool src_local = true, dst_local = false;
|
||||
bool src_local = true;
|
||||
struct scif_dma_comp_cb *comp_cb;
|
||||
dma_addr_t src_dma_addr, dst_dma_addr;
|
||||
int err;
|
||||
|
||||
if (is_dma_copy_aligned(chan->device, 1, 1, 1))
|
||||
@@ -1569,12 +1566,8 @@ static int scif_rma_list_dma_copy_wrapper(struct scif_endpt *epd,
|
||||
|
||||
if (work->loopback)
|
||||
return scif_rma_list_cpu_copy(work);
|
||||
src_dma_addr = __scif_off_to_dma_addr(work->src_window, src_offset);
|
||||
dst_dma_addr = __scif_off_to_dma_addr(work->dst_window, dst_offset);
|
||||
src_local = work->src_window->type == SCIF_WINDOW_SELF;
|
||||
dst_local = work->dst_window->type == SCIF_WINDOW_SELF;
|
||||
|
||||
dst_local = dst_local;
|
||||
/* Allocate dma_completion cb */
|
||||
comp_cb = kzalloc(sizeof(*comp_cb), GFP_KERNEL);
|
||||
if (!comp_cb)
|
||||
|
@@ -272,7 +272,7 @@ static int _scif_prog_signal(scif_epd_t epd, dma_addr_t dst, u64 val)
|
||||
dma_fail:
|
||||
if (!x100)
|
||||
dma_pool_free(ep->remote_dev->signal_pool, status,
|
||||
status->src_dma_addr);
|
||||
src - offsetof(struct scif_status, val));
|
||||
alloc_fail:
|
||||
return err;
|
||||
}
|
||||
|
@@ -634,7 +634,7 @@ static int send_noop_message(void *cb, struct gru_message_queue_desc *mqd,
|
||||
break;
|
||||
case CBSS_PAGE_OVERFLOW:
|
||||
STAT(mesq_noop_page_overflow);
|
||||
/* fallthru */
|
||||
/* fall through */
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
@@ -792,7 +792,7 @@ static int send_message_failure(void *cb, struct gru_message_queue_desc *mqd,
|
||||
break;
|
||||
case CBSS_PAGE_OVERFLOW:
|
||||
STAT(mesq_page_overflow);
|
||||
/* fallthru */
|
||||
/* fall through */
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
|
||||
{
|
||||
enum xp_retval ret;
|
||||
|
||||
DBUG_ON(!spin_is_locked(&ch->lock));
|
||||
lockdep_assert_held(&ch->lock);
|
||||
|
||||
if (!(ch->flags & XPC_C_OPENREQUEST) ||
|
||||
!(ch->flags & XPC_C_ROPENREQUEST)) {
|
||||
@@ -82,7 +82,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
|
||||
struct xpc_partition *part = &xpc_partitions[ch->partid];
|
||||
u32 channel_was_connected = (ch->flags & XPC_C_WASCONNECTED);
|
||||
|
||||
DBUG_ON(!spin_is_locked(&ch->lock));
|
||||
lockdep_assert_held(&ch->lock);
|
||||
|
||||
if (!(ch->flags & XPC_C_DISCONNECTING))
|
||||
return;
|
||||
@@ -755,7 +755,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
|
||||
{
|
||||
u32 channel_was_connected = (ch->flags & XPC_C_CONNECTED);
|
||||
|
||||
DBUG_ON(!spin_is_locked(&ch->lock));
|
||||
lockdep_assert_held(&ch->lock);
|
||||
|
||||
if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_DISCONNECTED))
|
||||
return;
|
||||
|
@@ -98,8 +98,7 @@ xpc_get_rsvd_page_pa(int nasid)
|
||||
len = L1_CACHE_ALIGN(len);
|
||||
|
||||
if (len > buf_len) {
|
||||
if (buf_base != NULL)
|
||||
kfree(buf_base);
|
||||
kfree(buf_base);
|
||||
buf_len = L1_CACHE_ALIGN(len);
|
||||
buf = xpc_kmalloc_cacheline_aligned(buf_len, GFP_KERNEL,
|
||||
&buf_base);
|
||||
|
@@ -1671,7 +1671,7 @@ xpc_teardown_msg_structures_sn2(struct xpc_channel *ch)
|
||||
{
|
||||
struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
|
||||
|
||||
DBUG_ON(!spin_is_locked(&ch->lock));
|
||||
lockdep_assert_held(&ch->lock);
|
||||
|
||||
ch_sn2->remote_msgqueue_pa = 0;
|
||||
|
||||
|
@@ -1183,7 +1183,7 @@ xpc_teardown_msg_structures_uv(struct xpc_channel *ch)
|
||||
{
|
||||
struct xpc_channel_uv *ch_uv = &ch->sn.uv;
|
||||
|
||||
DBUG_ON(!spin_is_locked(&ch->lock));
|
||||
lockdep_assert_held(&ch->lock);
|
||||
|
||||
kfree(ch_uv->cached_notify_gru_mq_desc);
|
||||
ch_uv->cached_notify_gru_mq_desc = NULL;
|
||||
|
@@ -323,10 +323,8 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res)
|
||||
cur_start = block->start + block->size;
|
||||
}
|
||||
|
||||
err_chunks:
|
||||
if (child)
|
||||
of_node_put(child);
|
||||
|
||||
err_chunks:
|
||||
of_node_put(child);
|
||||
kfree(rblocks);
|
||||
|
||||
return ret;
|
||||
|
文件差異過大導致無法顯示
Load Diff
@@ -113,5 +113,5 @@ module_exit(vmci_drv_exit);
|
||||
|
||||
MODULE_AUTHOR("VMware, Inc.");
|
||||
MODULE_DESCRIPTION("VMware Virtual Machine Communication Interface.");
|
||||
MODULE_VERSION("1.1.5.0-k");
|
||||
MODULE_VERSION("1.1.6.0-k");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <linux/vmw_vmci_defs.h>
|
||||
#include <linux/vmw_vmci_api.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/highmem.h>
|
||||
@@ -448,15 +447,12 @@ static int vmci_host_do_alloc_queuepair(struct vmci_host_dev *vmci_host_dev,
|
||||
struct vmci_handle handle;
|
||||
int vmci_status;
|
||||
int __user *retptr;
|
||||
u32 cid;
|
||||
|
||||
if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) {
|
||||
vmci_ioctl_err("only valid for contexts\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cid = vmci_ctx_get_id(vmci_host_dev->context);
|
||||
|
||||
if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) {
|
||||
struct vmci_qp_alloc_info_vmvm alloc_info;
|
||||
struct vmci_qp_alloc_info_vmvm __user *info = uptr;
|
||||
|
@@ -57,7 +57,8 @@ static struct vmci_resource *vmci_resource_lookup(struct vmci_handle handle,
|
||||
|
||||
if (r->type == type &&
|
||||
rid == handle.resource &&
|
||||
(cid == handle.context || cid == VMCI_INVALID_ID)) {
|
||||
(cid == handle.context || cid == VMCI_INVALID_ID ||
|
||||
handle.context == VMCI_INVALID_ID)) {
|
||||
resource = r;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user