HID: i2c-hid: add Mediacom FlexBook edge13 to descriptor override
Subsystems (11)
Sasha Levin
maintainerPATCH 5/19 dmaengine: tegra210-adma: Fix runtime PM imbalance on error
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit 5b78fac4b1ba731cf4177fdbc1e3a4661521bcd0 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/dma/tegra210-adma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dma/tegra210-adma.c +4 -1
@@ -583,6 +583,7 @@ static int tegra_adma_alloc_chan_resources(struct dma_chan *dc) ret =pm_runtime_get_sync (tdc2dev (tdc));if (ret <0 ) { +pm_runtime_put_noidle (tdc2dev (tdc));free_irq (tdc->irq, tdc);return ret; }
@@ -764,8 +765,10 @@ static int tegra_adma_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev); ret =pm_runtime_get_sync (&pdev->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (&pdev->dev); goto rpm_disable; + } ret =tegra_adma_init (tdma);if (ret)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 9/19 hwmon: (aspeed-pwm-tacho) Avoid possible buffer overflow
In reply to Sasha LevinFrom: Evgeny Novikov <[email protected]>
[ Upstream commit bc4071aafcf4d0535ee423b69167696d6c03207d ]
aspeed_create_fan() reads a pwm_port value using of_property_read_u32(). If pwm_port will be more than ARRAY_SIZE(pwm_port_params), there will be a buffer overflow in aspeed_create_pwm_port()->aspeed_set_pwm_port_enable(). The patch fixes the potential buffer overflow.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/hwmon/aspeed-pwm-tacho.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hwmon/aspeed-pwm-tacho.c +2 -0
@@ -880,6 +880,8 @@ static int aspeed_create_fan(struct device *dev, ret =of_property_read_u32 (child,"reg" , &pwm_port);if (ret)return ret; +if (pwm_port >=ARRAY_SIZE (pwm_port_params)) +return -EINVAL ;aspeed_create_pwm_port (priv, (u8 )pwm_port); ret =of_property_count_u8_elems (child,"cooling-levels" );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 1/19 HID: i2c-hid: add Mediacom FlexBook edge13 to descriptor override
From: Federico Ricchiuto <[email protected]>
[ Upstream commit 43e666acb79f3d355dd89bf20f4d25d3b15da13e ]
The Mediacom FlexBook edge13 uses the SIPODEV SP1064 touchpad, which does not supply descriptors, so it has to be added to the override list.
--- drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c +8 -0
@@ -373,6 +373,14 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = { }, .driver_data = (void *)&sipodev_desc }, + { + .ident = "Mediacom FlexBook edge 13", + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"MEDIACOM" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FlexBook_edge13-M-FBE13"), + }, + .driver_data = (void *)&sipodev_desc + }, { .ident ="Odys Winbook 13" , .matches = {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 4/19 HID: apple: Disable Fn-key key-re-mapping on clone keyboards
From: Hans de Goede <[email protected]>
[ Upstream commit a5d81646fa294eed57786a9310b06ca48902adf8 ]
The Maxxter KB-BT-001 Bluetooth keyboard, which looks somewhat like the Apple Wireless Keyboard, is using the vendor and product IDs (05AC:0239) of the Apple Wireless Keyboard (2009 ANSI version) <sigh>.
But its F1 - F10 keys are marked as sending F1 - F10, not the special functions hid-apple.c maps them too; and since its descriptors do not contain the HID_UP_CUSTOM | 0x0003 usage apple-hid looks for for the Fn-key, apple_setup_input() never gets called, so F1 - F6 are mapped to key-codes which have not been set in the keybit array causing them to not send any events at all.
The lack of a usage code matching the Fn key in the clone is actually useful as this allows solving this problem in a generic way.
This commits adds a fn_found flag and it adds a input_configured callback which checks if this flag is set once all usages have been mapped. If it is not set, then assume this is a clone and clear the quirks bitmap so that the hid-apple code does not add any special handling to this keyboard.
This fixes F1 - F6 not sending anything at all and F7 - F12 sending the wrong codes on the Maxxter KB-BT-001 Bluetooth keyboard and on similar clones.
--- drivers/hid/hid-apple.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/hid/hid-apple.c +18 -0
@@ -57,6 +57,7 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\")struct apple_sc {unsigned long quirks;unsigned int fn_on; +unsigned int fn_found; DECLARE_BITMAP(pressed_numlock, KEY_CNT); };
@@ -342,12 +343,15 @@ static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { + struct apple_sc *asc = hid_get_drvdata(hdev); +if (usage->hid == (HID_UP_CUSTOM |0x0003 ) || usage->hid == (HID_UP_MSVENDOR |0x0003 ) || usage->hid == (HID_UP_HPVENDOR2 |0x0003 )) {/* The fn key on Apple USB keyboards */ set_bit (EV_REP , hi->input->evbit);hid_map_usage_clear (hi, usage, bit, max,EV_KEY ,KEY_FN ); + asc->fn_found = true;apple_setup_input (hi->input);return 1 ; }
@@ -374,6 +378,19 @@ static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi,return 0 ; } +static int apple_input_configured (struct hid_device *hdev, +struct hid_input *hidinput) +{ +struct apple_sc *asc =hid_get_drvdata (hdev); + +if ((asc->quirks &APPLE_HAS_FN ) && !asc->fn_found) { +hid_info (hdev,"Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n" ); + asc->quirks =0 ; + } + +return 0 ; +} +static int apple_probe (struct hid_device *hdev,const struct hid_device_id *id) {
@@ -588,6 +605,7 @@ static struct hid_driver apple_driver = { .event = apple_event, .input_mapping = apple_input_mapping, .input_mapped = apple_input_mapped, + .input_configured = apple_input_configured, };module_hid_driver (apple_driver);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 6/19 Input: add `SW_MACHINE_COVER`
In reply to Sasha LevinFrom: Merlijn Wajer <[email protected]>
[ Upstream commit c463bb2a8f8d7d97aa414bf7714fc77e9d3b10df ]
This event code represents the state of a removable cover of a device. Value 0 means that the cover is open or removed, value 1 means that the cover is closed.
--- include/linux/mod_devicetable.h | 2 +- include/uapi/linux/input-event-codes.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
include/linux/mod_devicetable.h +1 -1
@@ -299,7 +299,7 @@ struct pcmcia_device_id {#define INPUT_DEVICE_ID_LED_MAX 0x0f#define INPUT_DEVICE_ID_SND_MAX 0x07#define INPUT_DEVICE_ID_FF_MAX 0x7f -#define INPUT_DEVICE_ID_SW_MAX 0x0f +#define INPUT_DEVICE_ID_SW_MAX 0x10#define INPUT_DEVICE_ID_PROP_MAX 0x1f#define INPUT_DEVICE_ID_MATCH_BUS 1
include/uapi/linux/input-event-codes.h +2 -1
@@ -795,7 +795,8 @@#define SW_LINEIN_INSERT 0x0d/* set = inserted */ #define SW_MUTE_DEVICE 0x0e/* set = device disabled */ #define SW_PEN_INSERTED 0x0f/* set = pen inserted */ -#define SW_MAX 0x0f +#define SW_MACHINE_COVER 0x10/* set = cover closed */ +#define SW_MAX 0x10#define SW_CNT (SW_MAX+1)/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 7/19 spi: mediatek: use correct SPI_CFG2_REG MACRO
In reply to Sasha LevinFrom: "leilk.liu" <[email protected]>
[ Upstream commit 44b37eb79e16a56cb30ba55b2da452396b941e7a ]
this patch use correct SPI_CFG2_REG offset.
--- drivers/spi/spi-mt65xx.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/spi/spi-mt65xx.c +8 -7
@@ -41,7 +41,6 @@#define SPI_CFG0_SCK_LOW_OFFSET 8#define SPI_CFG0_CS_HOLD_OFFSET 16#define SPI_CFG0_CS_SETUP_OFFSET 24 -#define SPI_ADJUST_CFG0_SCK_LOW_OFFSET 16#define SPI_ADJUST_CFG0_CS_HOLD_OFFSET 0#define SPI_ADJUST_CFG0_CS_SETUP_OFFSET 16
@@ -53,6 +52,8 @@#define SPI_CFG1_CS_IDLE_MASK 0xff#define SPI_CFG1_PACKET_LOOP_MASK 0xff00#define SPI_CFG1_PACKET_LENGTH_MASK 0x3ff0000 +#define SPI_CFG2_SCK_HIGH_OFFSET 0 +#define SPI_CFG2_SCK_LOW_OFFSET 16#define SPI_CMD_ACT BIT(0)#define SPI_CMD_RESUME BIT(1)
@@ -259,7 +260,7 @@ static void mtk_spi_set_cs(struct spi_device *spi, bool enable)static void mtk_spi_prepare_transfer (struct spi_master *master,struct spi_transfer *xfer) { -u32 spi_clk_hz, div, sck_time, cs_time, reg_val =0 ; +u32 spi_clk_hz, div, sck_time, cs_time, reg_val;struct mtk_spi *mdata =spi_master_get_devdata (master); spi_clk_hz =clk_get_rate (mdata->spi_clk);
@@ -272,18 +273,18 @@ static void mtk_spi_prepare_transfer(struct spi_master *master, cs_time = sck_time *2 ;if (mdata->dev_comp->enhance_timing) { + reg_val = (((sck_time -1 ) &0xffff ) + <<SPI_CFG2_SCK_HIGH_OFFSET ); reg_val |= (((sck_time -1 ) &0xffff ) - <<SPI_CFG0_SCK_HIGH_OFFSET ); - reg_val |= (((sck_time -1 ) &0xffff ) - <<SPI_ADJUST_CFG0_SCK_LOW_OFFSET ); + <<SPI_CFG2_SCK_LOW_OFFSET );writel (reg_val, mdata->base +SPI_CFG2_REG ); - reg_val |= (((cs_time -1 ) &0xffff ) + reg_val = (((cs_time -1 ) &0xffff ) <<SPI_ADJUST_CFG0_CS_HOLD_OFFSET ); reg_val |= (((cs_time -1 ) &0xffff ) <<SPI_ADJUST_CFG0_CS_SETUP_OFFSET );writel (reg_val, mdata->base +SPI_CFG0_REG ); }else { - reg_val |= (((sck_time -1 ) &0xff ) + reg_val = (((sck_time -1 ) &0xff ) <<SPI_CFG0_SCK_HIGH_OFFSET ); reg_val |= (((sck_time -1 ) &0xff ) <<SPI_CFG0_SCK_LOW_OFFSET ); reg_val |= (((cs_time -1 ) &0xff ) <<SPI_CFG0_CS_HOLD_OFFSET );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 16/19 arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP
In reply to Sasha LevinFrom: Will Deacon <[email protected]>
[ Upstream commit 5afc78551bf5d53279036e0bf63314e35631d79f ]
Rather than open-code test_tsk_thread_flag() at each callsite, simply replace the couple of offenders with calls to test_tsk_thread_flag() directly.
--- arch/arm64/kernel/debug-monitors.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/debug-monitors.c +2 -2
@@ -389,14 +389,14 @@ void user_rewind_single_step(struct task_struct *task)* If single step is active for this thread, then set SPSR.SS * to 1 to avoid returning to the active-pending state. */ -if (test_ti_thread_flag (task_thread_info (task),TIF_SINGLESTEP )) +if (test_tsk_thread_flag (task,TIF_SINGLESTEP ))set_regs_spsr_ss (task_pt_regs (task)); }NOKPROBE_SYMBOL (user_rewind_single_step);void user_fastforward_single_step (struct task_struct *task) { -if (test_ti_thread_flag (task_thread_info (task),TIF_SINGLESTEP )) +if (test_tsk_thread_flag (task,TIF_SINGLESTEP ))clear_regs_spsr_ss (task_pt_regs (task)); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 17/19 x86: math-emu: Fix up 'cmp' insn for clang ias
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 81e96851ea32deb2c921c870eecabf335f598aeb ]
The clang integrated assembler requires the 'cmp' instruction to have a length prefix here:
arch/x86/math-emu/wm_sqrt.S:212:2: error: ambiguous instructions require an explicit suffix (could be 'cmpb', 'cmpw', or 'cmpl')
cmp $0xffffffff,-24(%ebp)
^
Make this a 32-bit comparison, which it was clearly meant to be.
--- arch/x86/math-emu/wm_sqrt.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/math-emu/wm_sqrt.S +1 -1
@@ -209,7 +209,7 @@ sqrt_stage_2_finish: #ifdef PARANOID /* It should be possible to get here only if the arg is ffff....ffff */ - cmp $0xffffffff,FPU_fsqrt_arg_1 + cmpl $0xffffffff,FPU_fsqrt_arg_1 jnz sqrt_stage_2_error #endif /* PARANOID */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 19/19 SUNRPC reverting d03727b248d0 ("NFSv4 fix CLOSE not waiting for direct IO compeletion")
In reply to Sasha LevinFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit 65caafd0d2145d1dd02072c4ced540624daeab40 ]
Reverting commit d03727b248d0 "NFSv4 fix CLOSE not waiting for direct IO compeletion". This patch made it so that fput() by calling inode_dio_done() in nfs_file_release() would wait uninterruptably for any outstanding directIO to the file (but that wait on IO should be killable).
The problem the patch was also trying to address was REMOVE returning ERR_ACCESS because the file is still opened, is supposed to be resolved by server returning ERR_FILE_OPEN and not ERR_ACCESS.
--- fs/nfs/direct.c | 13 ++++--------- fs/nfs/file.c | 1 - 2 files changed, 4 insertions(+), 10 deletions(-)
fs/nfs/direct.c +4 -9
@@ -396,6 +396,8 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq) {struct inode *inode = dreq->inode; +inode_dio_end (inode); +if (dreq->iocb) {long res = (long ) dreq->error;if (dreq->count !=0 ) {
@@ -407,10 +409,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq)complete (&dreq->completion); -igrab (inode);nfs_direct_req_release (dreq); -inode_dio_end (inode); -iput (inode); }static void nfs_direct_read_completion (struct nfs_pgio_header *hdr)
@@ -540,10 +539,8 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,* generic layer handle the completion. */ if (requested_bytes ==0 ) { -igrab (inode); -nfs_direct_req_release (dreq);inode_dio_end (inode); -iput (inode); +nfs_direct_req_release (dreq);return result <0 ? result : -EIO ; }
@@ -960,10 +957,8 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,* generic layer handle the completion. */ if (requested_bytes ==0 ) { -igrab (inode); -nfs_direct_req_release (dreq);inode_dio_end (inode); -iput (inode); +nfs_direct_req_release (dreq);return result <0 ? result : -EIO ; }
fs/nfs/file.c +0 -1
@@ -82,7 +82,6 @@ nfs_file_release(struct inode *inode, struct file *filp)dprintk ("NFS: release(%pD2)\n" , filp);nfs_inc_stats (inode,NFSIOS_VFSRELEASE ); -inode_dio_wait (inode);nfs_file_clear_open_context (filp);return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 13/19 usb: gadget: udc: gr_udc: fix memleak on error handling path in gr_ep_init()
In reply to Sasha LevinFrom: Evgeny Novikov <[email protected]>
[ Upstream commit c8f8529e2c4141afa2ebb487ad48e8a6ec3e8c99 ]
gr_ep_init() does not assign the allocated request anywhere if allocation of memory for the buffer fails. This is a memory leak fixed by the given patch.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/usb/gadget/udc/gr_udc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/gadget/udc/gr_udc.c +5 -2
@@ -1980,9 +1980,12 @@ static int gr_ep_init(struct gr_udc *dev, int num, int is_in, u32 maxplimit)if (num ==0 ) { _req =gr_alloc_request (&ep->ep,GFP_ATOMIC ); +if (!_req) +return -ENOMEM ; + buf =devm_kzalloc (dev->dev,PAGE_SIZE ,GFP_DMA |GFP_ATOMIC ); -if (!_req || !buf) { -/* possible _req freed by gr_probe via gr_remove */ +if (!buf) { +gr_free_request (&ep->ep, _req);return -ENOMEM ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 12/19 Input: elan_i2c - only increment wakeup count on touch
In reply to Sasha LevinFrom: Derek Basehore <[email protected]>
[ Upstream commit 966334dfc472bdfa67bed864842943b19755d192 ]
This moves the wakeup increment for elan devices to the touch report. This prevents the drivers from incorrectly reporting a wakeup when the resume callback resets then device, which causes an interrupt to occur.
--- drivers/input/mouse/elan_i2c_core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/input/mouse/elan_i2c_core.c +5 -2
@@ -917,6 +917,8 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)u8 hover_info = packet[ETP_HOVER_INFO_OFFSET ];bool contact_valid, hover_event; +pm_wakeup_event (&data->client->dev,0 ); + hover_event = hover_info &0x40 ;for (i =0 ; i <ETP_MAX_FINGERS ; i++) { contact_valid = tp_info & (1U << (3 + i));
@@ -939,6 +941,8 @@ static void elan_report_trackpoint(struct elan_tp_data *data, u8 *report)u8 *packet = &report[ETP_REPORT_ID_OFFSET +1 ];int x, y; +pm_wakeup_event (&data->client->dev,0 ); +if (!data->tp_input) {dev_warn_once (&data->client->dev,"received a trackpoint report while no trackpoint device has been created. Please report upstream.\n" );
@@ -963,7 +967,6 @@ static void elan_report_trackpoint(struct elan_tp_data *data, u8 *report)static irqreturn_t elan_isr (int irq,void *dev_id) {struct elan_tp_data *data = dev_id; -struct device *dev = &data->client->dev;int error;u8 report[ETP_MAX_REPORT_LEN ];
@@ -989,7 +992,7 @@ static irqreturn_t elan_isr(int irq, void *dev_id)elan_report_trackpoint (data, report);break ;default : -dev_err (dev,"invalid report id data (%x)\n" , +dev_err (&data->client->dev,"invalid report id data (%x)\n" , report[ETP_REPORT_ID_OFFSET ]); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 14/19 hwmon: (adm1275) Make sure we are reading enough data for different chips
In reply to Sasha LevinFrom: Chu Lin <[email protected]>
[ Upstream commit 6d1d41c075a1a54ba03370e268171fec20e06563 ]
Issue:
When PEC is enabled, binding adm1272 to the adm1275 would fail due to PEC error. See below:
adm1275: probe of xxxx failed with error -74
Diagnosis:
Per the datasheet of adm1272, adm1278, adm1293 and amd1294, PMON_CONFIG (0xd4) is 16bits wide. On the other hand, PMON_CONFIG (0xd4) for adm1275 is 8bits wide. The driver should not assume everything is 8bits wide and read only 8bits from it.
Solution:
If it is adm1272, adm1278, adm1293 and adm1294, use i2c_read_word. Else, use i2c_read_byte
Testing:
Binding adm1272 to the driver.
The change is only tested on adm1272.
--- drivers/hwmon/pmbus/adm1275.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/hwmon/pmbus/adm1275.c +8 -2
@@ -364,6 +364,7 @@ MODULE_DEVICE_TABLE(i2c, adm1275_id);static int adm1275_probe (struct i2c_client *client,const struct i2c_device_id *id) { +s32 (*config_read_fn)(const struct i2c_client *client,u8 reg);u8 block_buffer[I2C_SMBUS_BLOCK_MAX +1 ];int config, device_config;int ret;
@@ -408,11 +409,16 @@ static int adm1275_probe(struct i2c_client *client,"Device mismatch: Configured %s, detected %s\n" , id->name, mid->name); - config =i2c_smbus_read_byte_data (client,ADM1275_PMON_CONFIG ); +if (mid->driver_data == adm1272 || mid->driver_data == adm1278 || + mid->driver_data == adm1293 || mid->driver_data == adm1294) + config_read_fn = i2c_smbus_read_word_data; +else + config_read_fn = i2c_smbus_read_byte_data; + config =config_read_fn (client,ADM1275_PMON_CONFIG );if (config <0 )return config; - device_config =i2c_smbus_read_byte_data (client,ADM1275_DEVICE_CONFIG ); + device_config =config_read_fn (client,ADM1275_DEVICE_CONFIG );if (device_config <0 )return device_config;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 18/19 RISC-V: Upgrade smp_mb__after_spinlock() to iorw,iorw
In reply to Sasha LevinFrom: Palmer Dabbelt <[email protected]>
[ Upstream commit 38b7c2a3ffb1fce8358ddc6006cfe5c038ff9963 ]
While digging through the recent mmiowb preemption issue it came up that we aren't actually preventing IO from crossing a scheduling boundary. While it's a bit ugly to overload smp_mb__after_spinlock() with this behavior, it's what PowerPC is doing so there's some precedent.
--- arch/riscv/include/asm/barrier.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/riscv/include/asm/barrier.h +9 -1
@@ -69,8 +69,16 @@ do { \* The AQ/RL pair provides a RCpc critical section, but there's not really any * way we can take advantage of that here because the ordering is only enforced * on that one lock. Thus, we're just doing a full fence. +* +* Since we allow writeX to be called from preemptive regions we need at least +* an "o" in the predecessor set to ensure device writes are visible before the +* task is marked as available for scheduling on a new hart. While I don't see +* any concrete reason we need a full IO fence, it seems safer to just upgrade +* this in order to avoid any IO crossing a scheduling boundary. In both +* instances the scheduler pairs this with an mb(), so nothing is necessary on +* the new hart. */ -#define smp_mb__after_spinlock () RISCV_FENCE(rw,rw) +#define smp_mb__after_spinlock () RISCV_FENCE(iorw,iorw)#include <asm-generic/barrier.h>
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 15/19 hwmon: (scmi) Fix potential buffer overflow in scmi_hwmon_probe()
In reply to Sasha LevinFrom: Cristian Marussi <[email protected]>
[ Upstream commit 3ce17cd2b94907f6d91b81b32848044b84c97606 ]
SMATCH detected a potential buffer overflow in the manipulation of hwmon_attributes array inside the scmi_hwmon_probe function:
drivers/hwmon/scmi-hwmon.c:226
scmi_hwmon_probe() error: buffer overflow 'hwmon_attributes' 6 <= 9
Fix it by statically declaring the size of the array as the maximum possible as defined by hwmon_max define.
--- drivers/hwmon/scmi-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/scmi-hwmon.c +1 -1
@@ -99,7 +99,7 @@ static enum hwmon_sensor_types scmi_types[] = { [ENERGY] = hwmon_energy, }; -static u32 hwmon_attributes[] = { +static u32 hwmon_attributes[hwmon_max] = { [hwmon_chip] =HWMON_C_REGISTER_TZ , [hwmon_temp] =HWMON_T_INPUT |HWMON_T_LABEL , [hwmon_in] =HWMON_I_INPUT |HWMON_I_LABEL ,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 11/19 Input: synaptics - enable InterTouch for ThinkPad X1E 1st gen
In reply to Sasha LevinFrom: Ilya Katsnelson <[email protected]>
[ Upstream commit dcb00fc799dc03fd320e123e4c81b3278c763ea5 ]
Tested on my own laptop, touchpad feels slightly more responsive with this on, though it might just be placebo.
--- drivers/input/mouse/synaptics.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/mouse/synaptics.c +1 -0
@@ -182,6 +182,7 @@ static const char * const smbus_pnp_ids[] = {"LEN0093" ,/* T480 */ "LEN0096" ,/* X280 */ "LEN0097" ,/* X280 -> ALPS trackpoint */ +"LEN0099" ,/* X1 Extreme 1st */ "LEN009b" ,/* T580 */ "LEN200f" ,/* T450s */ "LEN2044", /* L470 */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 10/19 dmaengine: ioat setting ioat timeout as module parameter
In reply to Sasha LevinFrom: Leonid Ravich <[email protected]>
[ Upstream commit 87730ccbddcb48478b1b88e88b14e73424130764 ]
DMA transaction time to completion is a function of PCI bandwidth, transaction size and a queue depth. So hard coded value for timeouts might be wrong for some scenarios.
--- drivers/dma/ioat/dma.c | 12 ++++++++++++ drivers/dma/ioat/dma.h | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-)
drivers/dma/ioat/dma.c +12 -0
@@ -38,6 +38,18 @@#include "../dmaengine.h" +int completion_timeout =200 ; +module_param (completion_timeout, int,0644 ); +MODULE_PARM_DESC (completion_timeout, +"set ioat completion timeout [msec] (default 200 [msec])" ); +int idle_timeout =2000 ; +module_param (idle_timeout, int,0644 ); +MODULE_PARM_DESC (idle_timeout, +"set ioat idel timeout [msec] (default 2000 [msec])" ); + +#define IDLE_TIMEOUT msecs_to_jiffies(idle_timeout) +#define COMPLETION_TIMEOUT msecs_to_jiffies(completion_timeout) +static char *chanerr_str[] = {"DMA Transfer Source Address Error" ,"DMA Transfer Destination Address Error" ,
drivers/dma/ioat/dma.h +0 -2
@@ -111,8 +111,6 @@ struct ioatdma_chan {#define IOAT_RUN 5#define IOAT_CHAN_ACTIVE 6struct timer_list timer; -#define COMPLETION_TIMEOUT msecs_to_jiffies(100) -#define IDLE_TIMEOUT msecs_to_jiffies(2000)#define RESET_DELAY msecs_to_jiffies(100)struct ioatdma_device *ioat_dma;dma_addr_t completion_dma;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 8/19 regmap: dev_get_regmap_match(): fix string comparison
In reply to Sasha LevinFrom: Marc Kleine-Budde <[email protected]>
[ Upstream commit e84861fec32dee8a2e62bbaa52cded6b05a2a456 ]
This function is used by dev_get_regmap() to retrieve a regmap for the specified device. If the device has more than one regmap, the name parameter can be used to specify one.
The code here uses a pointer comparison to check for equal strings. This however will probably always fail, as the regmap->name is allocated via kstrdup_const() from the regmap's config->name.
Fix this by using strcmp() instead.
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -1343,7 +1343,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data)/* If the user didn't specify a name match any */ if (data) -return (*r)->name == data; +return !strcmp ((*r)->name, data);else return 1 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 2/19 HID: alps: support devices with report id 2
In reply to Sasha LevinFrom: Caiyuan Xie <[email protected]>
[ Upstream commit aa3c439c144f0a465ed1f28f11c772886fb02b35 ]
Add support for devices which that have reports with id == 2
--- drivers/hid/hid-alps.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-alps.c +2 -0
@@ -29,6 +29,7 @@#define U1_MOUSE_REPORT_ID 0x01/* Mouse data ReportID */ #define U1_ABSOLUTE_REPORT_ID 0x03/* Absolute data ReportID */ +#define U1_ABSOLUTE_REPORT_ID_SECD 0x02/* FW-PTP Absolute data ReportID */ #define U1_FEATURE_REPORT_ID 0x05/* Feature ReportID */ #define U1_SP_ABSOLUTE_REPORT_ID 0x06/* Feature ReportID */
@@ -372,6 +373,7 @@ static int u1_raw_event(struct alps_dev *hdata, u8 *data, int size)case U1_FEATURE_REPORT_ID :break ;case U1_ABSOLUTE_REPORT_ID : +case U1_ABSOLUTE_REPORT_ID_SECD :for (i =0 ; i < hdata->max_fingers; i++) {u8 *contact = &data[i *5 ];
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 3/19 HID: steam: fixes race in handling device list.
In reply to Sasha LevinFrom: Rodrigo Rivas Costa <[email protected]>
[ Upstream commit 2d3f53a80e4eed078669853a178ed96d88f74143 ]
Using uhid and KASAN this driver crashed because it was getting several connection events where it only expected one. Then the device was added several times to the static device list and it got corrupted.
This patch checks if the device is already in the list before adding it.
--- drivers/hid/hid-steam.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/hid/hid-steam.c +4 -2
@@ -526,7 +526,8 @@ static int steam_register(struct steam_device *steam)steam_battery_register (steam);mutex_lock (&steam_devices_lock); -list_add (&steam->list, &steam_devices); +if (list_empty (&steam->list)) +list_add (&steam->list, &steam_devices);mutex_unlock (&steam_devices_lock); }
@@ -552,7 +553,7 @@ static void steam_unregister(struct steam_device *steam)hid_info (steam->hdev,"Steam Controller '%s' disconnected" , steam->serial_no);mutex_lock (&steam_devices_lock); -list_del (&steam->list); +list_del_init (&steam->list);mutex_unlock (&steam_devices_lock); steam->serial_no[0 ] =0 ; }
@@ -738,6 +739,7 @@ static int steam_probe(struct hid_device *hdev,mutex_init (&steam->mutex); steam->quirks = id->driver_data;INIT_WORK (&steam->work_connect, steam_work_connect_cb); +INIT_LIST_HEAD (&steam->list); steam->client_hdev =steam_create_client_hid (hdev);if (IS_ERR (steam->client_hdev)) {
Signature · 1 line
2.25.1
Re: [PATCH AUTOSEL 4.19 18/19] RISC-V: Upgrade smp_mb__after_spinlock() to iorw,iorw
In reply to Sasha LevinQuoted 26 lines · On Mon, 20 Jul 2020 14:38:49 PDT (-0700), [email protected] wrote:
From: Palmer Dabbelt <[email protected]>
[ Upstream commit
38b7c2a3ffb1fce8358ddc6006cfe5c038ff9963]While digging through the recent mmiowb preemption issue it came up that we aren't actually preventing IO from crossing a scheduling boundary. While it's a bit ugly to overload
smp_mb__after_spinlock()with this behavior, it's what PowerPC is doing so there's some precedent.Signed-off-by Palmer Dabbelt <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/riscv/include/asm/barrier.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)arch/riscv/include/asm/barrier.h +3
-0@@ -69,8 +69,16 @@ do { \* The AQ/RL pair provides a RCpc critical section, but there's not really any * way we can take advantage of that here because the ordering is only enforced * on that one lock. Thus, we're just doing a full fence. +* +* Since we allow writeX to be called from preemptive regions we need at least +* an "o" in the predecessor set to ensure device writes are visible before the
arch/riscv/include/asm/barrier.h do { \ · line 83
Quoted 10 lines
arch/riscv/include/asm/barrier.h +6
-1+* task is marked as available for scheduling on a new hart. While I don't see +* any concrete reason we need a full IO fence, it seems safer to just upgrade +* this in order to avoid any IO crossing a scheduling boundary. In both +* instances the scheduler pairs this with an mb(), so nothing is necessary on +* the new hart. */ -#define smp_mb__after_spinlock () RISCV_FENCE(rw,rw) +#define smp_mb__after_spinlock () RISCV_FENCE(iorw,iorw)#include <asm-generic/barrier.h>
While I don't think it hurts to have this, IIRC we didn't have the generic mmiowb spinlock stuff back then so it doesn't really fix the problem. That said, I'm pretty sure 4.19 doesn't make it to userspace so backports are really an academic discussion at this point. Whatever's less work for everyone is fine on my end for 4.19.