From: Greg Kroah-Hartman Date: Mon, 9 Oct 2023 12:34:55 +0000 (+0200) Subject: drop a bunch of 4.19 typec patches X-Git-Tag: v4.14.327~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f508c6487b695516e53078f14abf17937fb53e51;p=thirdparty%2Fkernel%2Fstable-queue.git drop a bunch of 4.19 typec patches --- diff --git a/queue-4.19/series b/queue-4.19/series index ffaf99d8d08..5bb4c496fcf 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -15,10 +15,6 @@ i2c-mux-demux-pinctrl-check-the-return-value-of-devm.patch input-i8042-add-quirk-for-tuxedo-gemini-17-gen1-clev.patch scsi-qla2xxx-add-protection-mask-module-parameters.patch scsi-qla2xxx-remove-unsupported-ql2xenabledif-option.patch -usb-typec-group-all-tcpci-tcpm-code-together.patch -usb-typec-tcpm-refactor-tcpm_handle_vdm_request-payl.patch -usb-typec-tcpm-refactor-tcpm_handle_vdm_request.patch -usb-typec-bus-verify-partner-exists-in-typec_altmode.patch scsi-megaraid_sas-load-balance-completions-across-al.patch scsi-megaraid_sas-fix-deadlock-on-firmware-crashdump.patch ext4-remove-the-group-parameter-of-ext4_trim_extent.patch @@ -46,8 +42,6 @@ nvme-pci-do-not-set-the-numa-node-of-device-if-it-ha.patch watchdog-itco_wdt-no-need-to-stop-the-timer-in-probe.patch watchdog-itco_wdt-set-no_reboot-if-the-watchdog-is-n.patch net-fix-unwanted-sign-extension-in-netdev_stats_to_s.patch -usb-typec-wcove-use-le-to-cpu-conversion-when-access.patch -usb-typec-tcpm-usb-typec-tcpm-fix-a-signedness-bug-i.patch scsi-megaraid_sas-enable-msix_load_balance-for-invad.patch smack-use-overlay-inode-label-in-smack_inode_copy_up.patch smack-retrieve-transmuting-information-in-smack_inod.patch diff --git a/queue-4.19/usb-typec-bus-verify-partner-exists-in-typec_altmode.patch b/queue-4.19/usb-typec-bus-verify-partner-exists-in-typec_altmode.patch deleted file mode 100644 index 37b21951b83..00000000000 --- a/queue-4.19/usb-typec-bus-verify-partner-exists-in-typec_altmode.patch +++ /dev/null @@ -1,93 +0,0 @@ -From a73fdd2d1d0ccdd40a7832fc85a8a7d6239b688e Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 14 Aug 2023 18:05:59 +0000 -Subject: usb: typec: bus: verify partner exists in typec_altmode_attention - -From: RD Babiera - -[ Upstream commit f23643306430f86e2f413ee2b986e0773e79da31 ] - -Some usb hubs will negotiate DisplayPort Alt mode with the device -but will then negotiate a data role swap after entering the alt -mode. The data role swap causes the device to unregister all alt -modes, however the usb hub will still send Attention messages -even after failing to reregister the Alt Mode. type_altmode_attention -currently does not verify whether or not a device's altmode partner -exists, which results in a NULL pointer error when dereferencing -the typec_altmode and typec_altmode_ops belonging to the altmode -partner. - -Verify the presence of a device's altmode partner before sending -the Attention message to the Alt Mode driver. - -Fixes: 8a37d87d72f0 ("usb: typec: Bus type for alternate modes") -Cc: stable@vger.kernel.org -Signed-off-by: RD Babiera -Reviewed-by: Heikki Krogerus -Reviewed-by: Guenter Roeck -Link: https://lore.kernel.org/r/20230814180559.923475-1-rdbabiera@google.com -Signed-off-by: Greg Kroah-Hartman -Signed-off-by: Sasha Levin ---- - drivers/usb/typec/bus.c | 12 ++++++++++-- - drivers/usb/typec/tcpm/tcpm.c | 3 ++- - include/linux/usb/typec_altmode.h | 2 +- - 3 files changed, 13 insertions(+), 4 deletions(-) - -diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c -index 7605963f71ede..31188354bca04 100644 ---- a/drivers/usb/typec/bus.c -+++ b/drivers/usb/typec/bus.c -@@ -146,12 +146,20 @@ EXPORT_SYMBOL_GPL(typec_altmode_exit); - * - * Notifies the partner of @adev about Attention command. - */ --void typec_altmode_attention(struct typec_altmode *adev, u32 vdo) -+int typec_altmode_attention(struct typec_altmode *adev, u32 vdo) - { -- struct typec_altmode *pdev = &to_altmode(adev)->partner->adev; -+ struct altmode *partner = to_altmode(adev)->partner; -+ struct typec_altmode *pdev; -+ -+ if (!partner) -+ return -ENODEV; -+ -+ pdev = &partner->adev; - - if (pdev->ops && pdev->ops->attention) - pdev->ops->attention(pdev, vdo); -+ -+ return 0; - } - EXPORT_SYMBOL_GPL(typec_altmode_attention); - -diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c -index 9cb781e6a0b53..c5132f2942f71 100644 ---- a/drivers/usb/typec/tcpm/tcpm.c -+++ b/drivers/usb/typec/tcpm/tcpm.c -@@ -1258,7 +1258,8 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port, - } - break; - case ADEV_ATTENTION: -- typec_altmode_attention(adev, p[1]); -+ if (typec_altmode_attention(adev, p[1])) -+ tcpm_log(port, "typec_altmode_attention no port partner altmode"); - break; - } - } -diff --git a/include/linux/usb/typec_altmode.h b/include/linux/usb/typec_altmode.h -index 9a88c74a1d0d0..969b7c5040875 100644 ---- a/include/linux/usb/typec_altmode.h -+++ b/include/linux/usb/typec_altmode.h -@@ -67,7 +67,7 @@ struct typec_altmode_ops { - - int typec_altmode_enter(struct typec_altmode *altmode); - int typec_altmode_exit(struct typec_altmode *altmode); --void typec_altmode_attention(struct typec_altmode *altmode, u32 vdo); -+int typec_altmode_attention(struct typec_altmode *altmode, u32 vdo); - int typec_altmode_vdm(struct typec_altmode *altmode, - const u32 header, const u32 *vdo, int count); - int typec_altmode_notify(struct typec_altmode *altmode, unsigned long conf, --- -2.40.1 - diff --git a/queue-4.19/usb-typec-group-all-tcpci-tcpm-code-together.patch b/queue-4.19/usb-typec-group-all-tcpci-tcpm-code-together.patch deleted file mode 100644 index a027fd043fe..00000000000 --- a/queue-4.19/usb-typec-group-all-tcpci-tcpm-code-together.patch +++ /dev/null @@ -1,259 +0,0 @@ -From f2618e9c223c548dead24007d7ee7ab21531cab4 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 20 Sep 2018 14:23:47 +0300 -Subject: usb: typec: Group all TCPCI/TCPM code together - -From: Heikki Krogerus - -[ Upstream commit ae8a2ca8a2215c7e31e6d874f7303801bb15fbbc ] - -Moving all the drivers that depend on the Port Controller -Manager under a new directory drivers/usb/typec/tcpm/ and -making Guenter Roeck the designated reviewer of that code. - -Acked-by: Guenter Roeck -Signed-off-by: Heikki Krogerus -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: f23643306430 ("usb: typec: bus: verify partner exists in typec_altmode_attention") -Signed-off-by: Sasha Levin ---- - MAINTAINERS | 6 +++ - drivers/usb/typec/Kconfig | 45 +--------------- - drivers/usb/typec/Makefile | 6 +-- - drivers/usb/typec/fusb302/Kconfig | 7 --- - drivers/usb/typec/fusb302/Makefile | 2 - - drivers/usb/typec/tcpm/Kconfig | 52 +++++++++++++++++++ - drivers/usb/typec/tcpm/Makefile | 7 +++ - drivers/usb/typec/{fusb302 => tcpm}/fusb302.c | 0 - .../usb/typec/{fusb302 => tcpm}/fusb302_reg.h | 0 - drivers/usb/typec/{ => tcpm}/tcpci.c | 0 - drivers/usb/typec/{ => tcpm}/tcpci.h | 0 - drivers/usb/typec/{ => tcpm}/tcpci_rt1711h.c | 0 - drivers/usb/typec/{ => tcpm}/tcpm.c | 0 - .../usb/typec/{typec_wcove.c => tcpm/wcove.c} | 0 - 14 files changed, 67 insertions(+), 58 deletions(-) - delete mode 100644 drivers/usb/typec/fusb302/Kconfig - delete mode 100644 drivers/usb/typec/fusb302/Makefile - create mode 100644 drivers/usb/typec/tcpm/Kconfig - create mode 100644 drivers/usb/typec/tcpm/Makefile - rename drivers/usb/typec/{fusb302 => tcpm}/fusb302.c (100%) - rename drivers/usb/typec/{fusb302 => tcpm}/fusb302_reg.h (100%) - rename drivers/usb/typec/{ => tcpm}/tcpci.c (100%) - rename drivers/usb/typec/{ => tcpm}/tcpci.h (100%) - rename drivers/usb/typec/{ => tcpm}/tcpci_rt1711h.c (100%) - rename drivers/usb/typec/{ => tcpm}/tcpm.c (100%) - rename drivers/usb/typec/{typec_wcove.c => tcpm/wcove.c} (100%) - -diff --git a/MAINTAINERS b/MAINTAINERS -index 59003315a9597..bf33725ca5157 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -15307,6 +15307,12 @@ F: Documentation/driver-api/usb/typec_bus.rst - F: drivers/usb/typec/altmodes/ - F: include/linux/usb/typec_altmode.h - -+USB TYPEC PORT CONTROLLER DRIVERS -+M: Guenter Roeck -+L: linux-usb@vger.kernel.org -+S: Maintained -+F: drivers/usb/typec/tcpm/ -+ - USB UHCI DRIVER - M: Alan Stern - L: linux-usb@vger.kernel.org -diff --git a/drivers/usb/typec/Kconfig b/drivers/usb/typec/Kconfig -index 8445890accdfe..e078f23e3f8d5 100644 ---- a/drivers/usb/typec/Kconfig -+++ b/drivers/usb/typec/Kconfig -@@ -45,50 +45,7 @@ menuconfig TYPEC - - if TYPEC - --config TYPEC_TCPM -- tristate "USB Type-C Port Controller Manager" -- depends on USB -- select USB_ROLE_SWITCH -- select POWER_SUPPLY -- help -- The Type-C Port Controller Manager provides a USB PD and USB Type-C -- state machine for use with Type-C Port Controllers. -- --if TYPEC_TCPM -- --config TYPEC_TCPCI -- tristate "Type-C Port Controller Interface driver" -- depends on I2C -- select REGMAP_I2C -- help -- Type-C Port Controller driver for TCPCI-compliant controller. -- --config TYPEC_RT1711H -- tristate "Richtek RT1711H Type-C chip driver" -- depends on I2C -- select TYPEC_TCPCI -- help -- Richtek RT1711H Type-C chip driver that works with -- Type-C Port Controller Manager to provide USB PD and USB -- Type-C functionalities. -- --source "drivers/usb/typec/fusb302/Kconfig" -- --config TYPEC_WCOVE -- tristate "Intel WhiskeyCove PMIC USB Type-C PHY driver" -- depends on ACPI -- depends on INTEL_SOC_PMIC -- depends on INTEL_PMC_IPC -- depends on BXT_WC_PMIC_OPREGION -- help -- This driver adds support for USB Type-C detection on Intel Broxton -- platforms that have Intel Whiskey Cove PMIC. The driver can detect the -- role and cable orientation. -- -- To compile this driver as module, choose M here: the module will be -- called typec_wcove -- --endif # TYPEC_TCPM -+source "drivers/usb/typec/tcpm/Kconfig" - - source "drivers/usb/typec/ucsi/Kconfig" - -diff --git a/drivers/usb/typec/Makefile b/drivers/usb/typec/Makefile -index 45b0aef428a82..6696b7263d61a 100644 ---- a/drivers/usb/typec/Makefile -+++ b/drivers/usb/typec/Makefile -@@ -2,11 +2,7 @@ - obj-$(CONFIG_TYPEC) += typec.o - typec-y := class.o mux.o bus.o - obj-$(CONFIG_TYPEC) += altmodes/ --obj-$(CONFIG_TYPEC_TCPM) += tcpm.o --obj-y += fusb302/ --obj-$(CONFIG_TYPEC_WCOVE) += typec_wcove.o -+obj-$(CONFIG_TYPEC_TCPM) += tcpm/ - obj-$(CONFIG_TYPEC_UCSI) += ucsi/ - obj-$(CONFIG_TYPEC_TPS6598X) += tps6598x.o - obj-$(CONFIG_TYPEC) += mux/ --obj-$(CONFIG_TYPEC_TCPCI) += tcpci.o --obj-$(CONFIG_TYPEC_RT1711H) += tcpci_rt1711h.o -diff --git a/drivers/usb/typec/fusb302/Kconfig b/drivers/usb/typec/fusb302/Kconfig -deleted file mode 100644 -index fce099ff39fea..0000000000000 ---- a/drivers/usb/typec/fusb302/Kconfig -+++ /dev/null -@@ -1,7 +0,0 @@ --config TYPEC_FUSB302 -- tristate "Fairchild FUSB302 Type-C chip driver" -- depends on I2C -- help -- The Fairchild FUSB302 Type-C chip driver that works with -- Type-C Port Controller Manager to provide USB PD and USB -- Type-C functionalities. -diff --git a/drivers/usb/typec/fusb302/Makefile b/drivers/usb/typec/fusb302/Makefile -deleted file mode 100644 -index 3b51b33631a08..0000000000000 ---- a/drivers/usb/typec/fusb302/Makefile -+++ /dev/null -@@ -1,2 +0,0 @@ --# SPDX-License-Identifier: GPL-2.0 --obj-$(CONFIG_TYPEC_FUSB302) += fusb302.o -diff --git a/drivers/usb/typec/tcpm/Kconfig b/drivers/usb/typec/tcpm/Kconfig -new file mode 100644 -index 0000000000000..f03ea8a617686 ---- /dev/null -+++ b/drivers/usb/typec/tcpm/Kconfig -@@ -0,0 +1,52 @@ -+config TYPEC_TCPM -+ tristate "USB Type-C Port Controller Manager" -+ depends on USB -+ select USB_ROLE_SWITCH -+ select POWER_SUPPLY -+ help -+ The Type-C Port Controller Manager provides a USB PD and USB Type-C -+ state machine for use with Type-C Port Controllers. -+ -+if TYPEC_TCPM -+ -+config TYPEC_TCPCI -+ tristate "Type-C Port Controller Interface driver" -+ depends on I2C -+ select REGMAP_I2C -+ help -+ Type-C Port Controller driver for TCPCI-compliant controller. -+ -+if TYPEC_TCPCI -+ -+config TYPEC_RT1711H -+ tristate "Richtek RT1711H Type-C chip driver" -+ help -+ Richtek RT1711H Type-C chip driver that works with -+ Type-C Port Controller Manager to provide USB PD and USB -+ Type-C functionalities. -+ -+endif # TYPEC_TCPCI -+ -+config TYPEC_FUSB302 -+ tristate "Fairchild FUSB302 Type-C chip driver" -+ depends on I2C -+ help -+ The Fairchild FUSB302 Type-C chip driver that works with -+ Type-C Port Controller Manager to provide USB PD and USB -+ Type-C functionalities. -+ -+config TYPEC_WCOVE -+ tristate "Intel WhiskeyCove PMIC USB Type-C PHY driver" -+ depends on ACPI -+ depends on INTEL_SOC_PMIC -+ depends on INTEL_PMC_IPC -+ depends on BXT_WC_PMIC_OPREGION -+ help -+ This driver adds support for USB Type-C on Intel Broxton platforms -+ that have Intel Whiskey Cove PMIC. The driver works with USB Type-C -+ Port Controller Manager to provide USB PD and Type-C functionalities. -+ -+ To compile this driver as module, choose M here: the module will be -+ called typec_wcove.ko -+ -+endif # TYPEC_TCPM -diff --git a/drivers/usb/typec/tcpm/Makefile b/drivers/usb/typec/tcpm/Makefile -new file mode 100644 -index 0000000000000..a5ff6c8eb8922 ---- /dev/null -+++ b/drivers/usb/typec/tcpm/Makefile -@@ -0,0 +1,7 @@ -+# SPDX-License-Identifier: GPL-2.0 -+obj-$(CONFIG_TYPEC_TCPM) += tcpm.o -+obj-$(CONFIG_TYPEC_FUSB302) += fusb302.o -+obj-$(CONFIG_TYPEC_WCOVE) += typec_wcove.o -+typec_wcove-y := wcove.o -+obj-$(CONFIG_TYPEC_TCPCI) += tcpci.o -+obj-$(CONFIG_TYPEC_RT1711H) += tcpci_rt1711h.o -diff --git a/drivers/usb/typec/fusb302/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c -similarity index 100% -rename from drivers/usb/typec/fusb302/fusb302.c -rename to drivers/usb/typec/tcpm/fusb302.c -diff --git a/drivers/usb/typec/fusb302/fusb302_reg.h b/drivers/usb/typec/tcpm/fusb302_reg.h -similarity index 100% -rename from drivers/usb/typec/fusb302/fusb302_reg.h -rename to drivers/usb/typec/tcpm/fusb302_reg.h -diff --git a/drivers/usb/typec/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c -similarity index 100% -rename from drivers/usb/typec/tcpci.c -rename to drivers/usb/typec/tcpm/tcpci.c -diff --git a/drivers/usb/typec/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h -similarity index 100% -rename from drivers/usb/typec/tcpci.h -rename to drivers/usb/typec/tcpm/tcpci.h -diff --git a/drivers/usb/typec/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c -similarity index 100% -rename from drivers/usb/typec/tcpci_rt1711h.c -rename to drivers/usb/typec/tcpm/tcpci_rt1711h.c -diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c -similarity index 100% -rename from drivers/usb/typec/tcpm.c -rename to drivers/usb/typec/tcpm/tcpm.c -diff --git a/drivers/usb/typec/typec_wcove.c b/drivers/usb/typec/tcpm/wcove.c -similarity index 100% -rename from drivers/usb/typec/typec_wcove.c -rename to drivers/usb/typec/tcpm/wcove.c --- -2.40.1 - diff --git a/queue-4.19/usb-typec-tcpm-refactor-tcpm_handle_vdm_request-payl.patch b/queue-4.19/usb-typec-tcpm-refactor-tcpm_handle_vdm_request-payl.patch deleted file mode 100644 index f2ad1a2daba..00000000000 --- a/queue-4.19/usb-typec-tcpm-refactor-tcpm_handle_vdm_request-payl.patch +++ /dev/null @@ -1,186 +0,0 @@ -From 85a3921f0d91a275cdd0ede4cf05bf66ce215388 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 24 Jul 2020 19:46:59 +0200 -Subject: usb: typec: tcpm: Refactor tcpm_handle_vdm_request payload handling - -From: Hans de Goede - -[ Upstream commit 8afe9a3548f9d1805dcea6d97978f2179c8403a3 ] - -Refactor the tcpm_handle_vdm_request payload handling by doing the -endianness conversion only once directly inside tcpm_handle_vdm_request -itself instead of doing it multiple times inside various helper functions -called by tcpm_handle_vdm_request. - -This is a preparation patch for some further refactoring to fix an AB BA -lock inversion between the tcpm code and some altmode drivers. - -Reviewed-by: Guenter Roeck -Reviewed-by: Heikki Krogerus -Signed-off-by: Hans de Goede -Link: https://lore.kernel.org/r/20200724174702.61754-3-hdegoede@redhat.com -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: f23643306430 ("usb: typec: bus: verify partner exists in typec_altmode_attention") -Signed-off-by: Sasha Levin ---- - drivers/usb/typec/tcpm/tcpm.c | 49 ++++++++++++++++------------------- - 1 file changed, 22 insertions(+), 27 deletions(-) - -diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c -index 0fdae44c9b8cf..7487efbd8c2d3 100644 ---- a/drivers/usb/typec/tcpm/tcpm.c -+++ b/drivers/usb/typec/tcpm/tcpm.c -@@ -957,16 +957,15 @@ static void tcpm_queue_vdm(struct tcpm_port *port, const u32 header, - port->vdm_state = VDM_STATE_READY; - } - --static void svdm_consume_identity(struct tcpm_port *port, const __le32 *payload, -- int cnt) -+static void svdm_consume_identity(struct tcpm_port *port, const u32 *p, int cnt) - { -- u32 vdo = le32_to_cpu(payload[VDO_INDEX_IDH]); -- u32 product = le32_to_cpu(payload[VDO_INDEX_PRODUCT]); -+ u32 vdo = p[VDO_INDEX_IDH]; -+ u32 product = p[VDO_INDEX_PRODUCT]; - - memset(&port->mode_data, 0, sizeof(port->mode_data)); - - port->partner_ident.id_header = vdo; -- port->partner_ident.cert_stat = le32_to_cpu(payload[VDO_INDEX_CSTAT]); -+ port->partner_ident.cert_stat = p[VDO_INDEX_CSTAT]; - port->partner_ident.product = product; - - typec_partner_set_identity(port->partner); -@@ -976,17 +975,15 @@ static void svdm_consume_identity(struct tcpm_port *port, const __le32 *payload, - PD_PRODUCT_PID(product), product & 0xffff); - } - --static bool svdm_consume_svids(struct tcpm_port *port, const __le32 *payload, -- int cnt) -+static bool svdm_consume_svids(struct tcpm_port *port, const u32 *p, int cnt) - { - struct pd_mode_data *pmdata = &port->mode_data; - int i; - - for (i = 1; i < cnt; i++) { -- u32 p = le32_to_cpu(payload[i]); - u16 svid; - -- svid = (p >> 16) & 0xffff; -+ svid = (p[i] >> 16) & 0xffff; - if (!svid) - return false; - -@@ -996,7 +993,7 @@ static bool svdm_consume_svids(struct tcpm_port *port, const __le32 *payload, - pmdata->svids[pmdata->nsvids++] = svid; - tcpm_log(port, "SVID %d: 0x%x", pmdata->nsvids, svid); - -- svid = p & 0xffff; -+ svid = p[i] & 0xffff; - if (!svid) - return false; - -@@ -1026,8 +1023,7 @@ static bool svdm_consume_svids(struct tcpm_port *port, const __le32 *payload, - return false; - } - --static void svdm_consume_modes(struct tcpm_port *port, const __le32 *payload, -- int cnt) -+static void svdm_consume_modes(struct tcpm_port *port, const u32 *p, int cnt) - { - struct pd_mode_data *pmdata = &port->mode_data; - struct typec_altmode_desc *paltmode; -@@ -1044,7 +1040,7 @@ static void svdm_consume_modes(struct tcpm_port *port, const __le32 *payload, - - paltmode->svid = pmdata->svids[pmdata->svid_index]; - paltmode->mode = i; -- paltmode->vdo = le32_to_cpu(payload[i]); -+ paltmode->vdo = p[i]; - - tcpm_log(port, " Alternate mode %d: SVID 0x%04x, VDO %d: 0x%08x", - pmdata->altmodes, paltmode->svid, -@@ -1072,21 +1068,17 @@ static void tcpm_register_partner_altmodes(struct tcpm_port *port) - - #define supports_modal(port) PD_IDH_MODAL_SUPP((port)->partner_ident.id_header) - --static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, -+static int tcpm_pd_svdm(struct tcpm_port *port, const u32 *p, int cnt, - u32 *response) - { - struct typec_altmode *adev; - struct typec_altmode *pdev; - struct pd_mode_data *modep; -- u32 p[PD_MAX_PAYLOAD]; - int rlen = 0; - int cmd_type; - int cmd; - int i; - -- for (i = 0; i < cnt; i++) -- p[i] = le32_to_cpu(payload[i]); -- - cmd_type = PD_VDO_CMDT(p[0]); - cmd = PD_VDO_CMD(p[0]); - -@@ -1147,13 +1139,13 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, - switch (cmd) { - case CMD_DISCOVER_IDENT: - /* 6.4.4.3.1 */ -- svdm_consume_identity(port, payload, cnt); -+ svdm_consume_identity(port, p, cnt); - response[0] = VDO(USB_SID_PD, 1, CMD_DISCOVER_SVID); - rlen = 1; - break; - case CMD_DISCOVER_SVID: - /* 6.4.4.3.2 */ -- if (svdm_consume_svids(port, payload, cnt)) { -+ if (svdm_consume_svids(port, p, cnt)) { - response[0] = VDO(USB_SID_PD, 1, - CMD_DISCOVER_SVID); - rlen = 1; -@@ -1165,7 +1157,7 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, - break; - case CMD_DISCOVER_MODES: - /* 6.4.4.3.3 */ -- svdm_consume_modes(port, payload, cnt); -+ svdm_consume_modes(port, p, cnt); - modep->svid_index++; - if (modep->svid_index < modep->nsvids) { - u16 svid = modep->svids[modep->svid_index]; -@@ -1228,15 +1220,18 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, - static void tcpm_handle_vdm_request(struct tcpm_port *port, - const __le32 *payload, int cnt) - { -- int rlen = 0; -+ u32 p[PD_MAX_PAYLOAD]; - u32 response[8] = { }; -- u32 p0 = le32_to_cpu(payload[0]); -+ int i, rlen = 0; -+ -+ for (i = 0; i < cnt; i++) -+ p[i] = le32_to_cpu(payload[i]); - - if (port->vdm_state == VDM_STATE_BUSY) { - /* If UFP responded busy retry after timeout */ -- if (PD_VDO_CMDT(p0) == CMDT_RSP_BUSY) { -+ if (PD_VDO_CMDT(p[0]) == CMDT_RSP_BUSY) { - port->vdm_state = VDM_STATE_WAIT_RSP_BUSY; -- port->vdo_retry = (p0 & ~VDO_CMDT_MASK) | -+ port->vdo_retry = (p[0] & ~VDO_CMDT_MASK) | - CMDT_INIT; - mod_delayed_work(port->wq, &port->vdm_state_machine, - msecs_to_jiffies(PD_T_VDM_BUSY)); -@@ -1245,8 +1240,8 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port, - port->vdm_state = VDM_STATE_DONE; - } - -- if (PD_VDO_SVDM(p0)) -- rlen = tcpm_pd_svdm(port, payload, cnt, response); -+ if (PD_VDO_SVDM(p[0])) -+ rlen = tcpm_pd_svdm(port, p, cnt, response); - - if (rlen > 0) { - tcpm_queue_vdm(port, response[0], &response[1], rlen - 1); --- -2.40.1 - diff --git a/queue-4.19/usb-typec-tcpm-refactor-tcpm_handle_vdm_request.patch b/queue-4.19/usb-typec-tcpm-refactor-tcpm_handle_vdm_request.patch deleted file mode 100644 index 9486df77115..00000000000 --- a/queue-4.19/usb-typec-tcpm-refactor-tcpm_handle_vdm_request.patch +++ /dev/null @@ -1,187 +0,0 @@ -From f466ff43d249d583e28dbece37f4110f9c1f8239 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 24 Jul 2020 19:47:00 +0200 -Subject: usb: typec: tcpm: Refactor tcpm_handle_vdm_request - -From: Hans de Goede - -[ Upstream commit 95b4d51c96a87cd760c2a4f27fb28a59a27b6368 ] - -Refactor tcpm_handle_vdm_request and its tcpm_pd_svdm helper function so -that reporting the results of the vdm to the altmode-driver is separated -out into a clear separate step inside tcpm_handle_vdm_request, instead -of being scattered over various places inside the tcpm_pd_svdm helper. - -This is a preparation patch for fixing an AB BA lock inversion between the -tcpm code and some altmode drivers. - -Reviewed-by: Heikki Krogerus -Reviewed-by: Guenter Roeck -Signed-off-by: Hans de Goede -Link: https://lore.kernel.org/r/20200724174702.61754-4-hdegoede@redhat.com -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: f23643306430 ("usb: typec: bus: verify partner exists in typec_altmode_attention") -Signed-off-by: Sasha Levin ---- - drivers/usb/typec/tcpm/tcpm.c | 76 ++++++++++++++++++++++------------- - 1 file changed, 48 insertions(+), 28 deletions(-) - -diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c -index 7487efbd8c2d3..9cb781e6a0b53 100644 ---- a/drivers/usb/typec/tcpm/tcpm.c -+++ b/drivers/usb/typec/tcpm/tcpm.c -@@ -158,6 +158,14 @@ enum pd_msg_request { - PD_MSG_DATA_SOURCE_CAP, - }; - -+enum adev_actions { -+ ADEV_NONE = 0, -+ ADEV_NOTIFY_USB_AND_QUEUE_VDM, -+ ADEV_QUEUE_VDM, -+ ADEV_QUEUE_VDM_SEND_EXIT_MODE_ON_FAIL, -+ ADEV_ATTENTION, -+}; -+ - /* Events from low level driver */ - - #define TCPM_CC_EVENT BIT(0) -@@ -1068,10 +1076,10 @@ static void tcpm_register_partner_altmodes(struct tcpm_port *port) - - #define supports_modal(port) PD_IDH_MODAL_SUPP((port)->partner_ident.id_header) - --static int tcpm_pd_svdm(struct tcpm_port *port, const u32 *p, int cnt, -- u32 *response) -+static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev, -+ const u32 *p, int cnt, u32 *response, -+ enum adev_actions *adev_action) - { -- struct typec_altmode *adev; - struct typec_altmode *pdev; - struct pd_mode_data *modep; - int rlen = 0; -@@ -1087,9 +1095,6 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const u32 *p, int cnt, - - modep = &port->mode_data; - -- adev = typec_match_altmode(port->port_altmode, ALTMODE_DISCOVERY_MAX, -- PD_VDO_VID(p[0]), PD_VDO_OPOS(p[0])); -- - pdev = typec_match_altmode(port->partner_altmode, ALTMODE_DISCOVERY_MAX, - PD_VDO_VID(p[0]), PD_VDO_OPOS(p[0])); - -@@ -1115,8 +1120,7 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const u32 *p, int cnt, - break; - case CMD_ATTENTION: - /* Attention command does not have response */ -- if (adev) -- typec_altmode_attention(adev, p[1]); -+ *adev_action = ADEV_ATTENTION; - return 0; - default: - break; -@@ -1170,23 +1174,15 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const u32 *p, int cnt, - case CMD_ENTER_MODE: - if (adev && pdev) { - typec_altmode_update_active(pdev, true); -- -- if (typec_altmode_vdm(adev, p[0], &p[1], cnt)) { -- response[0] = VDO(adev->svid, 1, -- CMD_EXIT_MODE); -- response[0] |= VDO_OPOS(adev->mode); -- return 1; -- } -+ *adev_action = ADEV_QUEUE_VDM_SEND_EXIT_MODE_ON_FAIL; - } - return 0; - case CMD_EXIT_MODE: - if (adev && pdev) { - typec_altmode_update_active(pdev, false); -- - /* Back to USB Operation */ -- WARN_ON(typec_altmode_notify(adev, -- TYPEC_STATE_USB, -- NULL)); -+ *adev_action = ADEV_NOTIFY_USB_AND_QUEUE_VDM; -+ return 0; - } - break; - default: -@@ -1197,11 +1193,8 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const u32 *p, int cnt, - switch (cmd) { - case CMD_ENTER_MODE: - /* Back to USB Operation */ -- if (adev) -- WARN_ON(typec_altmode_notify(adev, -- TYPEC_STATE_USB, -- NULL)); -- break; -+ *adev_action = ADEV_NOTIFY_USB_AND_QUEUE_VDM; -+ return 0; - default: - break; - } -@@ -1211,15 +1204,15 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const u32 *p, int cnt, - } - - /* Informing the alternate mode drivers about everything */ -- if (adev) -- typec_altmode_vdm(adev, p[0], &p[1], cnt); -- -+ *adev_action = ADEV_QUEUE_VDM; - return rlen; - } - - static void tcpm_handle_vdm_request(struct tcpm_port *port, - const __le32 *payload, int cnt) - { -+ enum adev_actions adev_action = ADEV_NONE; -+ struct typec_altmode *adev; - u32 p[PD_MAX_PAYLOAD]; - u32 response[8] = { }; - int i, rlen = 0; -@@ -1227,6 +1220,9 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port, - for (i = 0; i < cnt; i++) - p[i] = le32_to_cpu(payload[i]); - -+ adev = typec_match_altmode(port->port_altmode, ALTMODE_DISCOVERY_MAX, -+ PD_VDO_VID(p[0]), PD_VDO_OPOS(p[0])); -+ - if (port->vdm_state == VDM_STATE_BUSY) { - /* If UFP responded busy retry after timeout */ - if (PD_VDO_CMDT(p[0]) == CMDT_RSP_BUSY) { -@@ -1241,7 +1237,31 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port, - } - - if (PD_VDO_SVDM(p[0])) -- rlen = tcpm_pd_svdm(port, p, cnt, response); -+ rlen = tcpm_pd_svdm(port, adev, p, cnt, response, &adev_action); -+ -+ if (adev) { -+ switch (adev_action) { -+ case ADEV_NONE: -+ break; -+ case ADEV_NOTIFY_USB_AND_QUEUE_VDM: -+ WARN_ON(typec_altmode_notify(adev, TYPEC_STATE_USB, NULL)); -+ typec_altmode_vdm(adev, p[0], &p[1], cnt); -+ break; -+ case ADEV_QUEUE_VDM: -+ typec_altmode_vdm(adev, p[0], &p[1], cnt); -+ break; -+ case ADEV_QUEUE_VDM_SEND_EXIT_MODE_ON_FAIL: -+ if (typec_altmode_vdm(adev, p[0], &p[1], cnt)) { -+ response[0] = VDO(adev->svid, 1, CMD_EXIT_MODE); -+ response[0] |= VDO_OPOS(adev->mode); -+ rlen = 1; -+ } -+ break; -+ case ADEV_ATTENTION: -+ typec_altmode_attention(adev, p[1]); -+ break; -+ } -+ } - - if (rlen > 0) { - tcpm_queue_vdm(port, response[0], &response[1], rlen - 1); --- -2.40.1 - diff --git a/queue-4.19/usb-typec-tcpm-usb-typec-tcpm-fix-a-signedness-bug-i.patch b/queue-4.19/usb-typec-tcpm-usb-typec-tcpm-fix-a-signedness-bug-i.patch deleted file mode 100644 index 3a631f7975c..00000000000 --- a/queue-4.19/usb-typec-tcpm-usb-typec-tcpm-fix-a-signedness-bug-i.patch +++ /dev/null @@ -1,60 +0,0 @@ -From bf9bcf6220a783be2c3ae2547e99749f91e9ee6d Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 1 Oct 2019 15:01:17 +0300 -Subject: usb: typec: tcpm: usb: typec: tcpm: Fix a signedness bug in - tcpm_fw_get_caps() - -From: Dan Carpenter - -[ Upstream commit 7101949f36fc77b530b73e4c6bd0066a2740d75b ] - -The "port->typec_caps.data" and "port->typec_caps.type" variables are -enums and in this context GCC will treat them as an unsigned int so they -can never be less than zero. - -Fixes: ae8a2ca8a221 ("usb: typec: Group all TCPCI/TCPM code together") -Signed-off-by: Dan Carpenter -Cc: stable -Reviewed-by: Guenter Roeck -Reviewed-by: Heikki Krogerus -Link: https://lore.kernel.org/r/20191001120117.GA23528@mwanda -Signed-off-by: Greg Kroah-Hartman -Signed-off-by: Sasha Levin ---- - drivers/usb/typec/tcpm/tcpm.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c -index c5132f2942f71..6b0ecaae2cdba 100644 ---- a/drivers/usb/typec/tcpm/tcpm.c -+++ b/drivers/usb/typec/tcpm/tcpm.c -@@ -4440,18 +4440,20 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, - /* USB data support is optional */ - ret = fwnode_property_read_string(fwnode, "data-role", &cap_str); - if (ret == 0) { -- port->typec_caps.data = typec_find_port_data_role(cap_str); -- if (port->typec_caps.data < 0) -- return -EINVAL; -+ ret = typec_find_port_data_role(cap_str); -+ if (ret < 0) -+ return ret; -+ port->typec_caps.data = ret; - } - - ret = fwnode_property_read_string(fwnode, "power-role", &cap_str); - if (ret < 0) - return ret; - -- port->typec_caps.type = typec_find_port_power_role(cap_str); -- if (port->typec_caps.type < 0) -- return -EINVAL; -+ ret = typec_find_port_power_role(cap_str); -+ if (ret < 0) -+ return ret; -+ port->typec_caps.type = ret; - port->port_type = port->typec_caps.type; - - if (port->port_type == TYPEC_PORT_SNK) --- -2.40.1 - diff --git a/queue-4.19/usb-typec-wcove-use-le-to-cpu-conversion-when-access.patch b/queue-4.19/usb-typec-wcove-use-le-to-cpu-conversion-when-access.patch deleted file mode 100644 index 9258d198c50..00000000000 --- a/queue-4.19/usb-typec-wcove-use-le-to-cpu-conversion-when-access.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 5656139ec7aada056ef23e31066525cf48879043 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 9 Jun 2021 20:22:02 +0300 -Subject: usb: typec: wcove: Use LE to CPU conversion when accessing - msg->header - -From: Andy Shevchenko - -[ Upstream commit d5ab95da2a41567440097c277c5771ad13928dad ] - -As LKP noticed the Sparse is not happy about strict type handling: - .../typec/tcpm/wcove.c:380:50: sparse: expected unsigned short [usertype] header - .../typec/tcpm/wcove.c:380:50: sparse: got restricted __le16 const [usertype] header - -Fix this by switching to use pd_header_cnt_le() instead of pd_header_cnt() -in the affected code. - -Fixes: ae8a2ca8a221 ("usb: typec: Group all TCPCI/TCPM code together") -Fixes: 3c4fb9f16921 ("usb: typec: wcove: start using tcpm for USB PD support") -Reported-by: kernel test robot -Reviewed-by: Heikki Krogerus -Reviewed-by: Guenter Roeck -Signed-off-by: Andy Shevchenko -Link: https://lore.kernel.org/r/20210609172202.83377-1-andriy.shevchenko@linux.intel.com -Cc: stable -Signed-off-by: Greg Kroah-Hartman -Signed-off-by: Sasha Levin ---- - drivers/usb/typec/tcpm/wcove.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/usb/typec/tcpm/wcove.c b/drivers/usb/typec/tcpm/wcove.c -index f1f8f45e2f3dc..ca3af15a1f9e8 100644 ---- a/drivers/usb/typec/tcpm/wcove.c -+++ b/drivers/usb/typec/tcpm/wcove.c -@@ -377,7 +377,7 @@ static int wcove_pd_transmit(struct tcpc_dev *tcpc, - const u8 *data = (void *)msg; - int i; - -- for (i = 0; i < pd_header_cnt(msg->header) * 4 + 2; i++) { -+ for (i = 0; i < pd_header_cnt_le(msg->header) * 4 + 2; i++) { - ret = regmap_write(wcove->regmap, USBC_TX_DATA + i, - data[i]); - if (ret) --- -2.40.1 -