Merge tag 'platform-drivers-x86-v6.6-4' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Oct 2023 16:06:30 +0000 (09:06 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Oct 2023 16:06:30 +0000 (09:06 -0700)
Pull x86 platform driver fixes from Hans de Goede:
 "Bug fixes, build warning fixes and DMI quirk additions"

* tag 'platform-drivers-x86-v6.6-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
  platform/x86: hp-wmi:: Mark driver struct with __refdata to prevent section mismatch warning
  platform/x86: touchscreen_dmi: Add info for the Positivo C4128B
  platform/x86: touchscreen_dmi: Add info for the BUSH Bush Windows tablet
  platform/mellanox: tmfifo: fix kernel-doc warnings
  platform/x86/intel/ifs: release cpus_read_lock()
  platform/x86: hp-bioscfg: Fix reference leak
  platform/x86: think-lmi: Fix reference leak

drivers/platform/mellanox/mlxbf-tmfifo.c
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
drivers/platform/x86/hp/hp-wmi.c
drivers/platform/x86/intel/ifs/runtest.c
drivers/platform/x86/think-lmi.c
drivers/platform/x86/touchscreen_dmi.c

index f3696a5..fd38d8c 100644 (file)
@@ -53,7 +53,7 @@
 struct mlxbf_tmfifo;
 
 /**
- * mlxbf_tmfifo_vring - Structure of the TmFifo virtual ring
+ * struct mlxbf_tmfifo_vring - Structure of the TmFifo virtual ring
  * @va: virtual address of the ring
  * @dma: dma address of the ring
  * @vq: pointer to the virtio virtqueue
@@ -113,12 +113,13 @@ enum {
 };
 
 /**
- * mlxbf_tmfifo_vdev - Structure of the TmFifo virtual device
+ * struct mlxbf_tmfifo_vdev - Structure of the TmFifo virtual device
  * @vdev: virtio device, in which the vdev.id.device field has the
  *        VIRTIO_ID_xxx id to distinguish the virtual device.
  * @status: status of the device
  * @features: supported features of the device
  * @vrings: array of tmfifo vrings of this device
+ * @config: non-anonymous union for cons and net
  * @config.cons: virtual console config -
  *               select if vdev.id.device is VIRTIO_ID_CONSOLE
  * @config.net: virtual network config -
@@ -138,7 +139,7 @@ struct mlxbf_tmfifo_vdev {
 };
 
 /**
- * mlxbf_tmfifo_irq_info - Structure of the interrupt information
+ * struct mlxbf_tmfifo_irq_info - Structure of the interrupt information
  * @fifo: pointer to the tmfifo structure
  * @irq: interrupt number
  * @index: index into the interrupt array
@@ -150,7 +151,7 @@ struct mlxbf_tmfifo_irq_info {
 };
 
 /**
- * mlxbf_tmfifo_io - Structure of the TmFifo IO resource (for both rx & tx)
+ * struct mlxbf_tmfifo_io - Structure of the TmFifo IO resource (for both rx & tx)
  * @ctl: control register offset (TMFIFO_RX_CTL / TMFIFO_TX_CTL)
  * @sts: status register offset (TMFIFO_RX_STS / TMFIFO_TX_STS)
  * @data: data register offset (TMFIFO_RX_DATA / TMFIFO_TX_DATA)
@@ -162,7 +163,7 @@ struct mlxbf_tmfifo_io {
 };
 
 /**
- * mlxbf_tmfifo - Structure of the TmFifo
+ * struct mlxbf_tmfifo - Structure of the TmFifo
  * @vdev: array of the virtual devices running over the TmFifo
  * @lock: lock to protect the TmFifo access
  * @res0: mapped resource block 0
@@ -198,7 +199,7 @@ struct mlxbf_tmfifo {
 };
 
 /**
- * mlxbf_tmfifo_msg_hdr - Structure of the TmFifo message header
+ * struct mlxbf_tmfifo_msg_hdr - Structure of the TmFifo message header
  * @type: message type
  * @len: payload length in network byte order. Messages sent into the FIFO
  *       will be read by the other side as data stream in the same byte order.
@@ -208,6 +209,7 @@ struct mlxbf_tmfifo {
 struct mlxbf_tmfifo_msg_hdr {
        u8 type;
        __be16 len;
+       /* private: */
        u8 unused[5];
 } __packed __aligned(sizeof(u64));
 
index 8c4f9e1..5798b49 100644 (file)
@@ -659,7 +659,7 @@ static int hp_init_bios_package_attribute(enum hp_wmi_data_type attr_type,
                                          const char *guid, int min_elements,
                                          int instance_id)
 {
-       struct kobject *attr_name_kobj;
+       struct kobject *attr_name_kobj, *duplicate;
        union acpi_object *elements;
        struct kset *temp_kset;
 
@@ -704,8 +704,11 @@ static int hp_init_bios_package_attribute(enum hp_wmi_data_type attr_type,
        }
 
        /* All duplicate attributes found are ignored */
-       if (kset_find_obj(temp_kset, str_value)) {
+       duplicate = kset_find_obj(temp_kset, str_value);
+       if (duplicate) {
                pr_debug("Duplicate attribute name found - %s\n", str_value);
+               /* kset_find_obj() returns a reference */
+               kobject_put(duplicate);
                goto pack_attr_exit;
        }
 
@@ -768,7 +771,7 @@ static int hp_init_bios_buffer_attribute(enum hp_wmi_data_type attr_type,
                                         const char *guid, int min_elements,
                                         int instance_id)
 {
-       struct kobject *attr_name_kobj;
+       struct kobject *attr_name_kobj, *duplicate;
        struct kset *temp_kset;
        char str[MAX_BUFF_SIZE];
 
@@ -794,8 +797,11 @@ static int hp_init_bios_buffer_attribute(enum hp_wmi_data_type attr_type,
                temp_kset = bioscfg_drv.main_dir_kset;
 
        /* All duplicate attributes found are ignored */
-       if (kset_find_obj(temp_kset, str)) {
+       duplicate = kset_find_obj(temp_kset, str);
+       if (duplicate) {
                pr_debug("Duplicate attribute name found - %s\n", str);
+               /* kset_find_obj() returns a reference */
+               kobject_put(duplicate);
                goto buff_attr_exit;
        }
 
index e76e545..8ebb7be 100644 (file)
@@ -1548,7 +1548,13 @@ static const struct dev_pm_ops hp_wmi_pm_ops = {
        .restore  = hp_wmi_resume_handler,
 };
 
-static struct platform_driver hp_wmi_driver = {
+/*
+ * hp_wmi_bios_remove() lives in .exit.text. For drivers registered via
+ * module_platform_driver_probe() this is ok because they cannot get unbound at
+ * runtime. So mark the driver struct with __refdata to prevent modpost
+ * triggering a section mismatch warning.
+ */
+static struct platform_driver hp_wmi_driver __refdata = {
        .driver = {
                .name = "hp-wmi",
                .pm = &hp_wmi_pm_ops,
index 1061eb7..43c864a 100644 (file)
@@ -331,14 +331,15 @@ int do_core_test(int cpu, struct device *dev)
        switch (test->test_num) {
        case IFS_TYPE_SAF:
                if (!ifsd->loaded)
-                       return -EPERM;
-               ifs_test_core(cpu, dev);
+                       ret = -EPERM;
+               else
+                       ifs_test_core(cpu, dev);
                break;
        case IFS_TYPE_ARRAY_BIST:
                ifs_array_test_core(cpu, dev);
                break;
        default:
-               return -EINVAL;
+               ret = -EINVAL;
        }
 out:
        cpus_read_unlock();
index 7934688..aee8697 100644 (file)
@@ -1248,6 +1248,24 @@ static void tlmi_release_attr(void)
        kset_unregister(tlmi_priv.authentication_kset);
 }
 
+static int tlmi_validate_setting_name(struct kset *attribute_kset, char *name)
+{
+       struct kobject *duplicate;
+
+       if (!strcmp(name, "Reserved"))
+               return -EINVAL;
+
+       duplicate = kset_find_obj(attribute_kset, name);
+       if (duplicate) {
+               pr_debug("Duplicate attribute name found - %s\n", name);
+               /* kset_find_obj() returns a reference */
+               kobject_put(duplicate);
+               return -EBUSY;
+       }
+
+       return 0;
+}
+
 static int tlmi_sysfs_init(void)
 {
        int i, ret;
@@ -1276,10 +1294,8 @@ static int tlmi_sysfs_init(void)
                        continue;
 
                /* check for duplicate or reserved values */
-               if (kset_find_obj(tlmi_priv.attribute_kset, tlmi_priv.setting[i]->display_name) ||
-                   !strcmp(tlmi_priv.setting[i]->display_name, "Reserved")) {
-                       pr_debug("duplicate or reserved attribute name found - %s\n",
-                               tlmi_priv.setting[i]->display_name);
+               if (tlmi_validate_setting_name(tlmi_priv.attribute_kset,
+                                              tlmi_priv.setting[i]->display_name) < 0) {
                        kfree(tlmi_priv.setting[i]->possible_values);
                        kfree(tlmi_priv.setting[i]);
                        tlmi_priv.setting[i] = NULL;
index f9301a9..0c67337 100644 (file)
@@ -42,6 +42,21 @@ static const struct ts_dmi_data archos_101_cesium_educ_data = {
        .properties     = archos_101_cesium_educ_props,
 };
 
+static const struct property_entry bush_bush_windows_tablet_props[] = {
+       PROPERTY_ENTRY_U32("touchscreen-size-x", 1850),
+       PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
+       PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
+       PROPERTY_ENTRY_U32("silead,max-fingers", 10),
+       PROPERTY_ENTRY_BOOL("silead,home-button"),
+       PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-bush-bush-windows-tablet.fw"),
+       { }
+};
+
+static const struct ts_dmi_data bush_bush_windows_tablet_data = {
+       .acpi_name      = "MSSL1680:00",
+       .properties     = bush_bush_windows_tablet_props,
+};
+
 static const struct property_entry chuwi_hi8_props[] = {
        PROPERTY_ENTRY_U32("touchscreen-size-x", 1665),
        PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
@@ -756,6 +771,21 @@ static const struct ts_dmi_data pipo_w11_data = {
        .properties     = pipo_w11_props,
 };
 
+static const struct property_entry positivo_c4128b_props[] = {
+       PROPERTY_ENTRY_U32("touchscreen-min-x", 4),
+       PROPERTY_ENTRY_U32("touchscreen-min-y", 13),
+       PROPERTY_ENTRY_U32("touchscreen-size-x", 1915),
+       PROPERTY_ENTRY_U32("touchscreen-size-y", 1269),
+       PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-positivo-c4128b.fw"),
+       PROPERTY_ENTRY_U32("silead,max-fingers", 10),
+       { }
+};
+
+static const struct ts_dmi_data positivo_c4128b_data = {
+       .acpi_name      = "MSSL1680:00",
+       .properties     = positivo_c4128b_props,
+};
+
 static const struct property_entry pov_mobii_wintab_p800w_v20_props[] = {
        PROPERTY_ENTRY_U32("touchscreen-min-x", 32),
        PROPERTY_ENTRY_U32("touchscreen-min-y", 16),
@@ -1071,6 +1101,13 @@ const struct dmi_system_id touchscreen_dmi_table[] = {
                },
        },
        {
+               /* Bush Windows tablet */
+               .driver_data = (void *)&bush_bush_windows_tablet_data,
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Bush Windows tablet"),
+               },
+       },
+       {
                /* Chuwi Hi8 */
                .driver_data = (void *)&chuwi_hi8_data,
                .matches = {
@@ -1481,6 +1518,14 @@ const struct dmi_system_id touchscreen_dmi_table[] = {
                },
        },
        {
+               /* Positivo C4128B */
+               .driver_data = (void *)&positivo_c4128b_data,
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Positivo Tecnologia SA"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "C4128B-1"),
+               },
+       },
+       {
                /* Point of View mobii wintab p800w (v2.0) */
                .driver_data = (void *)&pov_mobii_wintab_p800w_v20_data,
                .matches = {