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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'chrome-platform-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Tzung-Bi Shih:
"Improvements:

- Support legacy probe behavior in cros_ec_lightbar and
cros_ec_sensorhub

Fixes:

- Don't fall back to legacy probe behavior if it isn't a legacy
device in cros_usbpd_notify

- Fix an UAF after unbinding driver in cros_ec_ishtp"

* tag 'chrome-platform-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
platform/chrome: sensorhub: Support devices without FIFO_INT_ENABLE
platform/chrome: cros_ec_ishtp: Fix UAF after unbinding driver
platform/chrome: cros_ec_lightbar: Check if ec supports suspend commands
platform/chrome: cros_usbpd_notify: defer probe when parent EC driver isn't ready

+39 -6
+1
drivers/platform/chrome/cros_ec_ishtp.c
··· 667 667 668 668 cancel_work_sync(&client_data->work_ishtp_reset); 669 669 cancel_work_sync(&client_data->work_ec_evt); 670 + cros_ec_unregister(client_data->ec_dev); 670 671 cros_ish_deinit(cros_ish_cl); 671 672 ishtp_put_device(cl_device); 672 673 }
+12 -4
drivers/platform/chrome/cros_ec_lightbar.c
··· 30 30 */ 31 31 static bool userspace_control; 32 32 33 + /* 34 + * Whether or not the lightbar supports the manual suspend commands. 35 + * The Pixel 2013 (Link) does not while all other devices with a 36 + * lightbar do. 37 + */ 38 + static bool has_manual_suspend; 39 + 33 40 static ssize_t interval_msec_show(struct device *dev, 34 41 struct device_attribute *attr, char *buf) 35 42 { ··· 557 550 return -ENODEV; 558 551 559 552 /* Take control of the lightbar from the EC. */ 560 - lb_manual_suspend_ctrl(ec_dev, 1); 553 + has_manual_suspend = (lb_manual_suspend_ctrl(ec_dev, 1) != -EINVAL); 561 554 562 555 ret = sysfs_create_group(&ec_dev->class_dev.kobj, 563 556 &cros_ec_lightbar_attr_group); ··· 576 569 &cros_ec_lightbar_attr_group); 577 570 578 571 /* Let the EC take over the lightbar again. */ 579 - lb_manual_suspend_ctrl(ec_dev, 0); 572 + if (has_manual_suspend) 573 + lb_manual_suspend_ctrl(ec_dev, 0); 580 574 } 581 575 582 576 static int __maybe_unused cros_ec_lightbar_resume(struct device *dev) 583 577 { 584 578 struct cros_ec_dev *ec_dev = dev_get_drvdata(dev->parent); 585 579 586 - if (userspace_control) 580 + if (userspace_control || !has_manual_suspend) 587 581 return 0; 588 582 589 583 return lb_send_empty_cmd(ec_dev, LIGHTBAR_CMD_RESUME); ··· 594 586 { 595 587 struct cros_ec_dev *ec_dev = dev_get_drvdata(dev->parent); 596 588 597 - if (userspace_control) 589 + if (userspace_control || !has_manual_suspend) 598 590 return 0; 599 591 600 592 return lb_send_empty_cmd(ec_dev, LIGHTBAR_CMD_SUSPEND);
+11
drivers/platform/chrome/cros_ec_sensorhub_ring.c
··· 129 129 /* We expect to receive a payload of 4 bytes, ignore. */ 130 130 if (ret > 0) 131 131 ret = 0; 132 + /* 133 + * Some platforms (such as Smaug) don't support the FIFO_INT_ENABLE 134 + * command and the interrupt is always enabled. In the case, it 135 + * returns -EINVAL. 136 + * 137 + * N.B: there is no danger of -EINVAL meaning any other invalid 138 + * parameter since fifo_int_enable.enable is a bool and can never 139 + * be in an invalid range. 140 + */ 141 + else if (ret == -EINVAL) 142 + ret = 0; 132 143 133 144 return ret; 134 145 }
+15 -2
drivers/platform/chrome/cros_usbpd_notify.c
··· 6 6 */ 7 7 8 8 #include <linux/acpi.h> 9 + #include <linux/fwnode.h> 9 10 #include <linux/mod_devicetable.h> 10 11 #include <linux/module.h> 11 12 #include <linux/platform_data/cros_ec_proto.h> ··· 16 15 #define DRV_NAME "cros-usbpd-notify" 17 16 #define DRV_NAME_PLAT_ACPI "cros-usbpd-notify-acpi" 18 17 #define ACPI_DRV_NAME "GOOG0003" 18 + #define CREC_DRV_NAME "GOOG0004" 19 19 20 20 static BLOCKING_NOTIFIER_HEAD(cros_usbpd_notifier_list); 21 21 ··· 100 98 { 101 99 struct cros_usbpd_notify_data *pdnotify; 102 100 struct device *dev = &pdev->dev; 103 - struct acpi_device *adev; 101 + struct acpi_device *adev, *parent_adev; 104 102 struct cros_ec_device *ec_dev; 103 + struct fwnode_handle *parent_fwnode; 105 104 acpi_status status; 106 105 107 106 adev = ACPI_COMPANION(dev); ··· 117 114 /* 118 115 * We continue even for older devices which don't have the 119 116 * correct device heirarchy, namely, GOOG0003 is a child 120 - * of GOOG0004. 117 + * of GOOG0004. If GOOG0003 is a child of GOOG0004 and we 118 + * can't get a pointer to the Chrome EC device, defer the 119 + * probe function. 121 120 */ 121 + parent_fwnode = fwnode_get_parent(dev->fwnode); 122 + if (parent_fwnode) { 123 + parent_adev = to_acpi_device_node(parent_fwnode); 124 + if (parent_adev && 125 + acpi_dev_hid_match(parent_adev, CREC_DRV_NAME)) { 126 + return -EPROBE_DEFER; 127 + } 128 + } 122 129 dev_warn(dev, "Couldn't get Chrome EC device pointer.\n"); 123 130 } 124 131