Merge tag 'platform-drivers-x86-v7.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver fixes from

 - Add ACPI_HANDLE()/ACPI_COMPANION() NULL checks (many drivers) to
   handle match overrides gracefully

 - asus-armoury:
    - Fix mini-LED mode get/set
    - Add support for FA401EA, FX607VU, G614FR, and GU605CP

 - bitland-mifs-wmi:
    - Add CONFIG_LEDS_CLASS dependency

 - hp-wmi:
    - Add thermal support for Omen 16-c0xxx (board 8902)

 - intel/vsec:
    - Fix enable_cnt imbalance due to PCIe error recovery

 - surface/aggregator_registry:
    - Remove battery & AC nodes on Surface Laptop 7 to avoid duplicated
      devices

 - uniwill-laptop:
    - Handle uninitialized and invalid charging threshold values
    - Accept charging threshold of 0 through power supply sysfs ABI and
      clamp it to 1
    - Make 'force' parameter to work also when device descriptor is
      found
    - Do not enable charging limit despite the 'force' parameter to
      avoid permanent damage to battery

* tag 'platform-drivers-x86-v7.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (35 commits)
  platform/x86: bitland-mifs-wmi: add CONFIG_LEDS_CLASS dependency
  platform/x86: wireless-hotkey: Check ACPI_COMPANION() against NULL
  platform/x86: toshiba_haps: Check ACPI_COMPANION() against NULL
  platform/x86: toshiba_bluetooth: Check ACPI_COMPANION() against NULL
  platform/x86: toshiba_acpi: Check ACPI_COMPANION() against NULL
  platform/x86: system76: Check ACPI_COMPANION() against NULL
  platform/x86: sony-laptop: Check ACPI_COMPANION() against NULL
  platform/x86: panasonic-laptop: Check ACPI_COMPANION() against NULL
  platform/x86: lg-laptop: Check ACPI_COMPANION() against NULL
  platform/x86: intel/smartconnect: Check ACPI_HANDLE() against NULL
  platform/x86: intel/rst: Check ACPI_COMPANION() against NULL
  platform/x86: fujitsu-tablet: Check ACPI_COMPANION() against NULL
  platform/x86: fujitsu: Check ACPI_COMPANION() against NULL
  platform/x86: eeepc-laptop: Check ACPI_COMPANION() against NULL
  platform/x86: dell/dell-rbtn: Check ACPI_COMPANION() against NULL
  platform/x86: asus-laptop: Check ACPI_COMPANION() against NULL
  platform/x86: acer-wireless: Check ACPI_COMPANION() against NULL
  platform/x86: asus-armoury: add support for GU605CP
  platform/x86: asus-armoury: add support for FA401EA
  platform/x86: asus-armoury: add support for G614FR
  ...
This commit is contained in:
Linus Torvalds
2026-05-22 15:45:26 -07:00
30 changed files with 338 additions and 63 deletions

View File

@@ -43,6 +43,11 @@ Support for changing the platform performance mode is currently not implemented.
Battery Charging Control
------------------------
.. warning:: Some devices do not properly implement the charging threshold interface. Forcing
the driver to enable access to said interface on such devices might damage the
battery [1]_. Because of this the driver will not enable said feature even when
using the ``force`` module parameter.
The ``uniwill-laptop`` driver supports controlling the battery charge limit. This happens over
the standard ``charge_control_end_threshold`` power supply sysfs attribute. All values
between 1 and 100 percent are supported.
@@ -70,3 +75,8 @@ The ``uniwill-laptop`` driver allows to set the configurable TGP for devices wit
allow it.
See Documentation/ABI/testing/sysfs-driver-uniwill-laptop for details.
References
==========
.. [1] https://www.reddit.com/r/XMG_gg/comments/ld9yyf/battery_limit_hidden_function_discovered_on/

View File

@@ -295,8 +295,6 @@ static const struct software_node *ssam_node_group_sl6[] = {
/* Devices for Surface Laptop 7. */
static const struct software_node *ssam_node_group_sl7[] = {
&ssam_node_root,
&ssam_node_bat_ac,
&ssam_node_bat_main,
&ssam_node_tmp_perf_profile_with_fan,
&ssam_node_fan_speed,
&ssam_node_hid_sam_keyboard,

View File

@@ -185,12 +185,15 @@ static bool surface_button_check_MSHW0040(struct device *dev, acpi_handle handle
static int surface_button_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct surface_button *button;
struct acpi_device *device;
struct input_dev *input;
const char *hid = acpi_device_hid(device);
int error;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
if (strncmp(acpi_device_bid(device), SURFACE_BUTTON_OBJ_NAME,
strlen(SURFACE_BUTTON_OBJ_NAME)))
return -ENODEV;
@@ -210,7 +213,8 @@ static int surface_button_probe(struct platform_device *pdev)
}
strscpy(acpi_device_name(device), SURFACE_BUTTON_DEVICE_NAME);
snprintf(button->phys, sizeof(button->phys), "%s/buttons", hid);
snprintf(button->phys, sizeof(button->phys), "%s/buttons",
acpi_device_hid(device));
input->name = acpi_device_name(device);
input->phys = button->phys;

View File

@@ -118,6 +118,7 @@ config BITLAND_MIFS_WMI
depends on ACPI_WMI
depends on HWMON
depends on INPUT
depends on LEDS_CLASS
depends on POWER_SUPPLY
select ACPI_PLATFORM_PROFILE
select INPUT_SPARSEKMAP

View File

@@ -37,9 +37,14 @@ static void acer_wireless_notify(acpi_handle handle, u32 event, void *data)
static int acer_wireless_probe(struct platform_device *pdev)
{
struct acpi_device *adev;
struct input_dev *idev;
int ret;
adev = ACPI_COMPANION(&pdev->dev);
if (!adev)
return -ENODEV;
idev = devm_input_allocate_device(&pdev->dev);
if (!idev)
return -ENOMEM;
@@ -57,8 +62,7 @@ static int acer_wireless_probe(struct platform_device *pdev)
if (ret)
return ret;
return acpi_dev_install_notify_handler(ACPI_COMPANION(&pdev->dev),
ACPI_DEVICE_NOTIFY,
return acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
acer_wireless_notify,
&pdev->dev);
}

View File

@@ -48,10 +48,14 @@ static int adv_swbutton_probe(struct platform_device *device)
{
struct adv_swbutton *button;
struct input_dev *input;
acpi_handle handle = ACPI_HANDLE(&device->dev);
acpi_handle handle;
acpi_status status;
int error;
handle = ACPI_HANDLE(&device->dev);
if (!handle)
return -ENODEV;
button = devm_kzalloc(&device->dev, sizeof(*button), GFP_KERNEL);
if (!button)
return -ENOMEM;

View File

@@ -370,7 +370,7 @@ static ssize_t mini_led_mode_current_value_show(struct kobject *kobj,
if (err)
return err;
mode = FIELD_GET(ASUS_MINI_LED_MODE_MASK, 0);
mode = FIELD_GET(ASUS_MINI_LED_MODE_MASK, mode);
for (i = 0; i < mini_led_mode_map_size; i++)
if (mode == mini_led_mode_map[i])
@@ -386,6 +386,7 @@ static ssize_t mini_led_mode_current_value_store(struct kobject *kobj,
{
u32 *mini_led_mode_map;
size_t mini_led_mode_map_size;
char mapped_value[12];
u32 mode;
int err;
@@ -414,9 +415,16 @@ static ssize_t mini_led_mode_current_value_store(struct kobject *kobj,
return -ENODEV;
}
return armoury_attr_uint_store(kobj, attr, buf, count,
0, mini_led_mode_map[mode],
NULL, asus_armoury.mini_led_dev_id);
/*
* armoury_attr_uint_store() parses and sends the value from the
* passed buffer; hand it the mapped firmware value so the device
* receives the translated mode instead of the raw index.
*/
snprintf(mapped_value, sizeof(mapped_value), "%u", mini_led_mode_map[mode]);
return armoury_attr_uint_store(kobj, attr, mapped_value, count, 0,
mini_led_mode_map[mode], NULL,
asus_armoury.mini_led_dev_id);
}
static ssize_t mini_led_mode_possible_values_show(struct kobject *kobj,

View File

@@ -346,6 +346,29 @@ struct power_data {
* _def is not required and will be assumed to be default == max if missing.
*/
static const struct dmi_system_id power_limits[] = {
{
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "FA401EA"),
},
.driver_data = &(struct power_data) {
.ac_data = &(struct power_limits) {
.ppt_pl1_spl_min = 15,
.ppt_pl1_spl_max = 95,
.ppt_pl2_sppt_min = 35,
.ppt_pl2_sppt_max = 100,
.ppt_pl3_fppt_min = 35,
.ppt_pl3_fppt_max = 115,
},
.dc_data = &(struct power_limits) {
.ppt_pl1_spl_min = 15,
.ppt_pl1_spl_max = 71,
.ppt_pl2_sppt_min = 35,
.ppt_pl2_sppt_max = 71,
.ppt_pl3_fppt_min = 35,
.ppt_pl3_fppt_max = 71,
},
},
},
{
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "FA401UM"),
@@ -886,6 +909,33 @@ static const struct dmi_system_id power_limits[] = {
.requires_fan_curve = true,
},
},
{
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "FX607VU"),
},
.driver_data = &(struct power_data) {
.ac_data = &(struct power_limits) {
.ppt_pl1_spl_min = 28,
.ppt_pl1_spl_def = 115,
.ppt_pl1_spl_max = 135,
.ppt_pl2_sppt_min = 28,
.ppt_pl2_sppt_max = 135,
.nv_dynamic_boost_min = 5,
.nv_dynamic_boost_max = 25,
.nv_temp_target_min = 75,
.nv_temp_target_max = 87,
},
.dc_data = &(struct power_limits) {
.ppt_pl1_spl_min = 25,
.ppt_pl1_spl_max = 45,
.ppt_pl2_sppt_min = 35,
.ppt_pl2_sppt_max = 60,
.nv_temp_target_min = 75,
.nv_temp_target_max = 87,
},
.requires_fan_curve = true,
},
},
{
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "GA401Q"),
@@ -1253,6 +1303,35 @@ static const struct dmi_system_id power_limits[] = {
},
},
},
{
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "GU605CP"),
},
.driver_data = &(struct power_data) {
.ac_data = &(struct power_limits) {
.ppt_pl1_spl_min = 45,
.ppt_pl1_spl_max = 75,
.ppt_pl2_sppt_min = 56,
.ppt_pl2_sppt_max = 95,
.nv_dynamic_boost_min = 5,
.nv_dynamic_boost_max = 15,
.nv_temp_target_min = 75,
.nv_temp_target_max = 87,
.nv_tgp_min = 55,
.nv_tgp_def = 75,
.nv_tgp_max = 95,
},
.dc_data = &(struct power_limits) {
.ppt_pl1_spl_min = 25,
.ppt_pl1_spl_max = 75,
.ppt_pl2_sppt_min = 32,
.ppt_pl2_sppt_max = 95,
.nv_temp_target_min = 75,
.nv_temp_target_max = 87,
},
.requires_fan_curve = true,
},
},
{
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "GU605CR"),
@@ -1759,6 +1838,40 @@ static const struct dmi_system_id power_limits[] = {
.requires_fan_curve = true,
},
},
{
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "G614FR"),
},
.driver_data = &(struct power_data) {
.ac_data = &(struct power_limits) {
.ppt_pl1_spl_min = 30,
.ppt_pl1_spl_max = 120,
.ppt_pl2_sppt_min = 65,
.ppt_pl2_sppt_def = 140,
.ppt_pl2_sppt_max = 162,
.ppt_pl3_fppt_min = 65,
.ppt_pl3_fppt_def = 140,
.ppt_pl3_fppt_max = 162,
.nv_temp_target_min = 75,
.nv_temp_target_max = 87,
.nv_dynamic_boost_min = 5,
.nv_dynamic_boost_max = 25,
.nv_tgp_min = 65,
.nv_tgp_max = 115,
},
.dc_data = &(struct power_limits) {
.ppt_pl1_spl_min = 25,
.ppt_pl1_spl_max = 65,
.ppt_pl2_sppt_min = 25,
.ppt_pl2_sppt_max = 65,
.ppt_pl3_fppt_min = 35,
.ppt_pl3_fppt_max = 75,
.nv_temp_target_min = 75,
.nv_temp_target_max = 87,
},
.requires_fan_curve = true,
},
},
{
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "G614J"),

View File

@@ -1826,10 +1826,14 @@ static bool asus_device_present;
static int asus_acpi_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct acpi_device *device;
struct asus_laptop *asus;
int result;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
pr_notice("Asus Laptop Support version %s\n",
ASUS_LAPTOP_VERSION);
asus = kzalloc_obj(struct asus_laptop);

View File

@@ -396,11 +396,15 @@ static void rbtn_cleanup(struct device *dev)
static int rbtn_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct rbtn_data *rbtn_data;
struct acpi_device *device;
enum rbtn_type type;
int ret = 0;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
type = rbtn_check(device);
if (type == RBTN_UNKNOWN) {
dev_info(&pdev->dev, "Unknown device type\n");

View File

@@ -1363,10 +1363,14 @@ static bool eeepc_device_present;
static int eeepc_acpi_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct acpi_device *device;
struct eeepc_laptop *eeepc;
int result;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
pr_notice(EEEPC_LAPTOP_NAME "\n");
eeepc = kzalloc_obj(struct eeepc_laptop);
if (!eeepc)

View File

@@ -530,10 +530,14 @@ static void acpi_fujitsu_bl_notify(acpi_handle handle, u32 event, void *data)
static int acpi_fujitsu_bl_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct acpi_device *device;
struct fujitsu_bl *priv;
int ret;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
return -ENODEV;
@@ -993,10 +997,14 @@ static void acpi_fujitsu_laptop_notify(acpi_handle handle, u32 event, void *data
static int acpi_fujitsu_laptop_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct fujitsu_laptop *priv;
struct acpi_device *device;
int ret, i = 0;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;

View File

@@ -445,10 +445,14 @@ static acpi_status fujitsu_walk_resources(struct acpi_resource *res, void *data)
static int acpi_fujitsu_probe(struct platform_device *pdev)
{
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
struct acpi_device *adev;
acpi_status status;
int error;
adev = ACPI_COMPANION(&pdev->dev);
if (!adev)
return -ENODEV;
status = acpi_walk_resources(adev->handle, METHOD_NAME__CRS,
fujitsu_walk_resources, NULL);
if (ACPI_FAILURE(status) || !fujitsu.irq || !fujitsu.io_base)

View File

@@ -189,6 +189,10 @@ static const char * const victus_thermal_profile_boards[] = {
/* DMI Board names of Victus 16-r and Victus 16-s laptops */
static const struct dmi_system_id victus_s_thermal_profile_boards[] __initconst = {
{
.matches = { DMI_MATCH(DMI_BOARD_NAME, "8902") },
.driver_data = (void *)&omen_v1_legacy_thermal_params,
},
{
.matches = { DMI_MATCH(DMI_BOARD_NAME, "8A44") },
.driver_data = (void *)&omen_v1_legacy_thermal_params,

View File

@@ -300,6 +300,9 @@ static int lis3lv02d_probe(struct platform_device *device)
int ret;
lis3_dev.bus_priv = ACPI_COMPANION(&device->dev);
if (!lis3_dev.bus_priv)
return -ENODEV;
lis3_dev.init = lis3lv02d_acpi_init;
lis3_dev.read = lis3lv02d_acpi_read;
lis3_dev.write = lis3lv02d_acpi_write;

View File

@@ -688,12 +688,16 @@ static bool button_array_present(struct platform_device *device)
static int intel_hid_probe(struct platform_device *device)
{
acpi_handle handle = ACPI_HANDLE(&device->dev);
unsigned long long mode, dummy;
struct intel_hid_priv *priv;
acpi_handle handle;
acpi_status status;
int err;
handle = ACPI_HANDLE(&device->dev);
if (!handle)
return -ENODEV;
intel_hid_init_dsm(handle);
if (!intel_hid_evaluate_method(handle, INTEL_HID_DSM_HDMM_FN, &mode)) {

View File

@@ -245,15 +245,20 @@ static void sar_get_data(int reg, struct wwan_sar_context *context)
static int sar_probe(struct platform_device *device)
{
struct wwan_sar_context *context;
acpi_handle handle;
int reg;
int result;
handle = ACPI_HANDLE(&device->dev);
if (!handle)
return -ENODEV;
context = kzalloc_obj(*context);
if (!context)
return -ENOMEM;
context->sar_device = device;
context->handle = ACPI_HANDLE(&device->dev);
context->handle = handle;
dev_set_drvdata(&device->dev, context);
result = guid_parse(SAR_DSM_UUID, &context->guid);

View File

@@ -102,9 +102,13 @@ static struct device_attribute irst_timeout_attr = {
static int irst_probe(struct platform_device *pdev)
{
struct acpi_device *acpi = ACPI_COMPANION(&pdev->dev);
struct acpi_device *acpi;
int error;
acpi = ACPI_COMPANION(&pdev->dev);
if (!acpi)
return -ENODEV;
error = device_create_file(&acpi->dev, &irst_timeout_attr);
if (unlikely(error))
return error;

View File

@@ -12,10 +12,14 @@ MODULE_LICENSE("GPL");
static int smartconnect_acpi_probe(struct platform_device *pdev)
{
acpi_handle handle = ACPI_HANDLE(&pdev->dev);
unsigned long long value;
acpi_handle handle;
acpi_status status;
handle = ACPI_HANDLE(&pdev->dev);
if (!handle)
return -ENODEV;
status = acpi_evaluate_integer(handle, "GAOS", NULL, &value);
if (ACPI_FAILURE(status))
return -EINVAL;

View File

@@ -275,12 +275,16 @@ static bool intel_vbtn_has_switches(acpi_handle handle, bool dual_accel)
static int intel_vbtn_probe(struct platform_device *device)
{
acpi_handle handle = ACPI_HANDLE(&device->dev);
bool dual_accel, has_buttons, has_switches;
struct intel_vbtn_priv *priv;
acpi_handle handle;
acpi_status status;
int err;
handle = ACPI_HANDLE(&device->dev);
if (!handle)
return -ENODEV;
dual_accel = dual_accel_detect();
has_buttons = acpi_has_method(handle, "VBDL");
has_switches = intel_vbtn_has_switches(handle, dual_accel);

View File

@@ -649,29 +649,13 @@ static void intel_vsec_skip_missing_dependencies(struct pci_dev *pdev)
}
}
static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
static int intel_vsec_pci_init(struct pci_dev *pdev)
{
const struct intel_vsec_platform_info *info;
struct vsec_priv *priv;
int num_caps, ret;
struct vsec_priv *priv = pci_get_drvdata(pdev);
const struct intel_vsec_platform_info *info = priv->info;
int run_once = 0;
bool found_any = false;
ret = pcim_enable_device(pdev);
if (ret)
return ret;
pci_save_state(pdev);
info = (const struct intel_vsec_platform_info *)id->driver_data;
if (!info)
return -EINVAL;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
priv->info = info;
pci_set_drvdata(pdev, priv);
int num_caps;
num_caps = hweight_long(info->caps);
while (num_caps--) {
@@ -692,6 +676,31 @@ static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id
return 0;
}
static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
const struct intel_vsec_platform_info *info;
struct vsec_priv *priv;
int ret;
ret = pcim_enable_device(pdev);
if (ret)
return ret;
pci_save_state(pdev);
info = (const struct intel_vsec_platform_info *)id->driver_data;
if (!info)
return -EINVAL;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
priv->info = info;
pci_set_drvdata(pdev, priv);
return intel_vsec_pci_init(pdev);
}
int intel_vsec_set_mapping(struct oobmsm_plat_info *plat_info,
struct intel_vsec_device *vsec_dev)
{
@@ -832,7 +841,6 @@ static pci_ers_result_t intel_vsec_pci_slot_reset(struct pci_dev *pdev)
{
struct intel_vsec_device *intel_vsec_dev;
pci_ers_result_t status = PCI_ERS_RESULT_DISCONNECT;
const struct pci_device_id *pci_dev_id;
unsigned long index;
dev_info(&pdev->dev, "Resetting PCI slot\n");
@@ -853,10 +861,8 @@ static pci_ers_result_t intel_vsec_pci_slot_reset(struct pci_dev *pdev)
devm_release_action(&pdev->dev, intel_vsec_remove_aux,
&intel_vsec_dev->auxdev);
}
pci_disable_device(pdev);
pci_restore_state(pdev);
pci_dev_id = pci_match_id(intel_vsec_pci_ids, pdev);
intel_vsec_pci_probe(pdev, pci_dev_id);
intel_vsec_pci_init(pdev);
out:
return status;

View File

@@ -761,12 +761,11 @@ static void lg_laptop_remove_address_space_handler(void *data)
static int acpi_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct platform_device_info pdev_info = {
.fwnode = acpi_fwnode_handle(device),
.name = PLATFORM_NAME,
.id = PLATFORM_DEVID_NONE,
};
struct acpi_device *device;
acpi_status status;
int ret;
const char *product;
@@ -775,6 +774,12 @@ static int acpi_probe(struct platform_device *pdev)
if (pf_device)
return 0;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
pdev_info.fwnode = acpi_fwnode_handle(device),
status = acpi_install_address_space_handler(device->handle, LG_ADDRESS_SPACE_ID,
&lg_laptop_address_space_handler,
NULL, &pdev->dev);

View File

@@ -981,11 +981,15 @@ static int acpi_pcc_hotkey_resume(struct device *dev)
static int acpi_pcc_hotkey_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct backlight_properties props;
struct acpi_device *device;
struct pcc_acpi *pcc;
int num_sifr, result;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
num_sifr = acpi_pcc_get_sqty(device);
/*

View File

@@ -3147,11 +3147,15 @@ static void sony_nc_backlight_cleanup(void)
static int sony_nc_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct acpi_device *device;
acpi_status status;
int result = 0;
struct sony_nc_value *item;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
sony_nc_acpi_device = device;
strscpy(acpi_device_class(device), "sony/hotkey");
@@ -4509,11 +4513,15 @@ static void sony_pic_remove(struct platform_device *pdev)
static int sony_pic_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct sony_pic_ioport *io, *tmp_io;
struct sony_pic_irq *irq, *tmp_irq;
struct acpi_device *device;
int result;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
spic_dev.acpi_dev = device;
strscpy(acpi_device_class(device), "sony/hotkey");
sony_pic_detect_device_type(&spic_dev);

View File

@@ -674,10 +674,14 @@ static void system76_notify(acpi_handle handle, u32 event, void *context)
// Probe a System76 platform device
static int system76_probe(struct platform_device *pdev)
{
struct acpi_device *acpi_dev = ACPI_COMPANION(&pdev->dev);
struct acpi_device *acpi_dev;
struct system76_data *data;
int err;
acpi_dev = ACPI_COMPANION(&pdev->dev);
if (!acpi_dev)
return -ENODEV;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;

View File

@@ -3374,7 +3374,7 @@ static const struct dmi_system_id toshiba_dmi_quirks[] __initconst = {
static int toshiba_acpi_probe(struct platform_device *pdev)
{
struct acpi_device *acpi_dev = ACPI_COMPANION(&pdev->dev);
struct acpi_device *acpi_dev;
struct toshiba_acpi_dev *dev;
const char *hci_method;
u32 dummy;
@@ -3383,6 +3383,10 @@ static int toshiba_acpi_probe(struct platform_device *pdev)
if (toshiba_acpi)
return -EBUSY;
acpi_dev = ACPI_COMPANION(&pdev->dev);
if (!acpi_dev)
return -ENODEV;
pr_info("Toshiba Laptop ACPI Extras version %s\n",
TOSHIBA_ACPI_VERSION);

View File

@@ -230,10 +230,14 @@ static int toshiba_bt_resume(struct device *dev)
static int toshiba_bt_rfkill_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct toshiba_bluetooth_dev *bt_dev;
struct acpi_device *device;
int result;
device = ACPI_COMPANION(&pdev->dev);
if (!device)
return -ENODEV;
result = toshiba_bluetooth_present(device->handle);
if (result)
return result;

View File

@@ -182,13 +182,17 @@ static int toshiba_haps_available(acpi_handle handle)
static int toshiba_haps_probe(struct platform_device *pdev)
{
struct acpi_device *acpi_dev = ACPI_COMPANION(&pdev->dev);
struct toshiba_haps_dev *haps;
struct acpi_device *acpi_dev;
int ret;
if (toshiba_haps)
return -EBUSY;
acpi_dev = ACPI_COMPANION(&pdev->dev);
if (!acpi_dev)
return -ENODEV;
if (!toshiba_haps_available(acpi_dev->handle))
return -ENODEV;

View File

@@ -1359,6 +1359,16 @@ static int uniwill_led_init(struct uniwill_data *data)
&init_data);
}
static unsigned int uniwill_sanitize_battery_threshold(unsigned int value)
{
/* 0 means "charging threshold not active" */
if (!value)
return 100;
/* Guard against invalid values */
return min(value, 100);
}
static int uniwill_get_property(struct power_supply *psy, const struct power_supply_ext *ext,
void *drvdata, enum power_supply_property psp,
union power_supply_propval *val)
@@ -1405,7 +1415,8 @@ static int uniwill_get_property(struct power_supply *psy, const struct power_sup
if (ret < 0)
return ret;
val->intval = clamp_val(FIELD_GET(CHARGE_CTRL_MASK, regval), 0, 100);
regval = FIELD_GET(CHARGE_CTRL_MASK, regval);
val->intval = uniwill_sanitize_battery_threshold(regval);
return 0;
default:
return -EINVAL;
@@ -1420,11 +1431,11 @@ static int uniwill_set_property(struct power_supply *psy, const struct power_sup
switch (psp) {
case POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD:
if (val->intval < 1 || val->intval > 100)
if (val->intval < 0 || val->intval > 100)
return -EINVAL;
return regmap_update_bits(data->regmap, EC_ADDR_CHARGE_CTRL, CHARGE_CTRL_MASK,
val->intval);
max(val->intval, 1));
default:
return -EINVAL;
}
@@ -1500,11 +1511,33 @@ static int uniwill_remove_battery(struct power_supply *battery, struct acpi_batt
static int uniwill_battery_init(struct uniwill_data *data)
{
unsigned int value, threshold, sanitized;
int ret;
if (!uniwill_device_supports(data, UNIWILL_FEATURE_BATTERY))
return 0;
ret = regmap_read(data->regmap, EC_ADDR_CHARGE_CTRL, &value);
if (ret < 0)
return ret;
/*
* The charge control threshold might be initialized with 0 by
* the EC to signal that said threshold is uninitialized. We thus
* need to replace this placeholder value with a valid one (100)
* to signal that we want to take control of battery charging.
* For the sake of completeness we also apply this to other
* invalid threshold values.
*/
threshold = FIELD_GET(CHARGE_CTRL_MASK, value);
sanitized = uniwill_sanitize_battery_threshold(threshold);
if (threshold != sanitized) {
FIELD_MODIFY(CHARGE_CTRL_MASK, &value, sanitized);
ret = regmap_write(data->regmap, EC_ADDR_CHARGE_CTRL, value);
if (ret < 0)
return ret;
}
ret = devm_mutex_init(data->dev, &data->battery_lock);
if (ret < 0)
return ret;
@@ -2456,8 +2489,6 @@ static int __init uniwill_init(void)
if (!force)
return -ENODEV;
/* Assume that the device supports all features */
device_descriptor.features = UINT_MAX;
pr_warn("Loading on a potentially unsupported device\n");
} else {
/*
@@ -2475,6 +2506,12 @@ static int __init uniwill_init(void)
device_descriptor = *descriptor;
}
if (force) {
/* Assume that the device supports all features except the charge limit */
device_descriptor.features = UINT_MAX & ~UNIWILL_FEATURE_BATTERY;
pr_warn("Enabling potentially unsupported features\n");
}
ret = platform_driver_register(&uniwill_driver);
if (ret < 0)
return ret;

View File

@@ -89,9 +89,14 @@ static void wl_notify(acpi_handle handle, u32 event, void *data)
static int wl_probe(struct platform_device *pdev)
{
struct acpi_device *adev;
struct wl_button *button;
int err;
adev = ACPI_COMPANION(&pdev->dev);
if (!adev)
return -ENODEV;
button = kzalloc_obj(struct wl_button);
if (!button)
return -ENOMEM;
@@ -104,8 +109,8 @@ static int wl_probe(struct platform_device *pdev)
kfree(button);
return err;
}
err = acpi_dev_install_notify_handler(ACPI_COMPANION(&pdev->dev),
ACPI_DEVICE_NOTIFY, wl_notify, button);
err = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
wl_notify, button);
if (err) {
pr_err("Failed to install ACPI notify handler\n");
wireless_input_destroy(&pdev->dev);