Skip to content

Commit

Permalink
Merge tag 'platform-drivers-x86-v5.8-2' of git://git.infradead.org/li…
Browse files Browse the repository at this point in the history
…nux-platform-drivers-x86 into master

Pull x86 platform driver fixes from Andriy Shevchenko:
 "Small fixes for this cycle:

   - Fix procfs handling in Thinkpad ACPI driver

   - Fix battery management on new ASUS laptops

   - New IDs (Sapphire Rapids) in ISST tool"

* tag 'platform-drivers-x86-v5.8-2' of git://git.infradead.org/linux-platform-drivers-x86:
  platform/x86: asus-wmi: allow BAT1 battery name
  platform/x86: ISST: Add new PCI device ids
  platform/x86: thinkpad_acpi: Revert "Use strndup_user() in dispatch_proc_write()"
  • Loading branch information
Linus Torvalds committed Jul 15, 2020
2 parents 0665a4e + 9a33e37 commit 994e99a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions drivers/platform/x86/asus-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ static int asus_wmi_battery_add(struct power_supply *battery)
* battery is named BATT.
*/
if (strcmp(battery->desc->name, "BAT0") != 0 &&
strcmp(battery->desc->name, "BAT1") != 0 &&
strcmp(battery->desc->name, "BATT") != 0)
return -ENODEV;

Expand Down
3 changes: 3 additions & 0 deletions drivers/platform/x86/intel_speed_select_if/isst_if_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#define INTEL_RAPL_PRIO_DEVID_0 0x3451
#define INTEL_CFG_MBOX_DEVID_0 0x3459

#define INTEL_RAPL_PRIO_DEVID_1 0x3251
#define INTEL_CFG_MBOX_DEVID_1 0x3259

/*
* Validate maximum commands in a single request.
* This is enough to handle command to every core in one ioctl, or all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ static long isst_if_mbox_proc_cmd(u8 *cmd_ptr, int *write_only, int resume)

static const struct pci_device_id isst_if_mbox_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_CFG_MBOX_DEVID_0)},
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_CFG_MBOX_DEVID_1)},
{ 0 },
};
MODULE_DEVICE_TABLE(pci, isst_if_mbox_ids);
Expand Down
1 change: 1 addition & 0 deletions drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static long isst_if_mmio_rd_wr(u8 *cmd_ptr, int *write_only, int resume)

static const struct pci_device_id isst_if_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_RAPL_PRIO_DEVID_0)},
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_RAPL_PRIO_DEVID_1)},
{ 0 },
};
MODULE_DEVICE_TABLE(pci, isst_if_ids);
Expand Down
14 changes: 11 additions & 3 deletions drivers/platform/x86/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,11 +885,19 @@ static ssize_t dispatch_proc_write(struct file *file,

if (!ibm || !ibm->write)
return -EINVAL;
if (count > PAGE_SIZE - 1)
return -EINVAL;

kernbuf = kmalloc(count + 1, GFP_KERNEL);
if (!kernbuf)
return -ENOMEM;

kernbuf = strndup_user(userbuf, PAGE_SIZE);
if (IS_ERR(kernbuf))
return PTR_ERR(kernbuf);
if (copy_from_user(kernbuf, userbuf, count)) {
kfree(kernbuf);
return -EFAULT;
}

kernbuf[count] = 0;
ret = ibm->write(kernbuf);
if (ret == 0)
ret = count;
Expand Down

0 comments on commit 994e99a

Please sign in to comment.