diff mbox series

[1/3] usb: typec: ucsi: Stop abuse of bit definitions from ucsi.h

Message ID 20240327224554.1772525-2-lk@c--e.de
State New
Headers show
Series usb: typec: ucsi: Ack connector change early | expand

Commit Message

Christian A. Ehrhardt March 27, 2024, 10:45 p.m. UTC
In ucsi.h there are flag definitions for the ->flags field
in struct ucsi. Some implementations abuse these bits for
their private ->flags fields e.g. in struct ucsi_acpi.

Move the definitions into the backend implementations that
still need them. While there fix one instance where the flag
name was not converted in a previous change.

No semantic change intended.

Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
---
 drivers/usb/typec/ucsi/ucsi.h         | 2 --
 drivers/usb/typec/ucsi/ucsi_acpi.c    | 3 ++-
 drivers/usb/typec/ucsi/ucsi_stm32g0.c | 1 +
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Heikki Krogerus April 3, 2024, 10:39 a.m. UTC | #1
On Wed, Mar 27, 2024 at 11:45:52PM +0100, Christian A. Ehrhardt wrote:
> In ucsi.h there are flag definitions for the ->flags field
> in struct ucsi. Some implementations abuse these bits for
> their private ->flags fields e.g. in struct ucsi_acpi.
> 
> Move the definitions into the backend implementations that
> still need them. While there fix one instance where the flag
> name was not converted in a previous change.
> 
> No semantic change intended.
> 
> Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/ucsi/ucsi.h         | 2 --
>  drivers/usb/typec/ucsi/ucsi_acpi.c    | 3 ++-
>  drivers/usb/typec/ucsi/ucsi_stm32g0.c | 1 +
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> index 0e7c92eb1b22..591f734d457b 100644
> --- a/drivers/usb/typec/ucsi/ucsi.h
> +++ b/drivers/usb/typec/ucsi/ucsi.h
> @@ -403,8 +403,6 @@ struct ucsi {
>  	/* PPM communication flags */
>  	unsigned long flags;
>  #define EVENT_PENDING	0
> -#define COMMAND_PENDING	1
> -#define ACK_PENDING	2
>  
>  	unsigned long quirks;
>  #define UCSI_NO_PARTNER_PDOS	BIT(0)	/* Don't read partner's PDOs */
> diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
> index 7b3ac133ef86..cc03a49c589c 100644
> --- a/drivers/usb/typec/ucsi/ucsi_acpi.c
> +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
> @@ -203,7 +203,8 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data)
>  	    !test_bit(UCSI_ACPI_SUPPRESS_EVENT, &ua->flags))
>  		ucsi_connector_change(ua->ucsi, UCSI_CCI_CONNECTOR(cci));
>  
> -	if (cci & UCSI_CCI_ACK_COMPLETE && test_bit(ACK_PENDING, &ua->flags))
> +	if (cci & UCSI_CCI_ACK_COMPLETE &&
> +	    test_bit(UCSI_ACPI_ACK_PENDING, &ua->flags))
>  		complete(&ua->complete);
>  	if (cci & UCSI_CCI_COMMAND_COMPLETE &&
>  	    test_bit(UCSI_ACPI_COMMAND_PENDING, &ua->flags))
> diff --git a/drivers/usb/typec/ucsi/ucsi_stm32g0.c b/drivers/usb/typec/ucsi/ucsi_stm32g0.c
> index 93d7806681cf..ac48b7763114 100644
> --- a/drivers/usb/typec/ucsi/ucsi_stm32g0.c
> +++ b/drivers/usb/typec/ucsi/ucsi_stm32g0.c
> @@ -64,6 +64,7 @@ struct ucsi_stm32g0 {
>  	struct completion complete;
>  	struct device *dev;
>  	unsigned long flags;
> +#define COMMAND_PENDING	1
>  	const char *fw_name;
>  	struct ucsi *ucsi;
>  	bool suspended;
> -- 
> 2.40.1
diff mbox series

Patch

diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index 0e7c92eb1b22..591f734d457b 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -403,8 +403,6 @@  struct ucsi {
 	/* PPM communication flags */
 	unsigned long flags;
 #define EVENT_PENDING	0
-#define COMMAND_PENDING	1
-#define ACK_PENDING	2
 
 	unsigned long quirks;
 #define UCSI_NO_PARTNER_PDOS	BIT(0)	/* Don't read partner's PDOs */
diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
index 7b3ac133ef86..cc03a49c589c 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -203,7 +203,8 @@  static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data)
 	    !test_bit(UCSI_ACPI_SUPPRESS_EVENT, &ua->flags))
 		ucsi_connector_change(ua->ucsi, UCSI_CCI_CONNECTOR(cci));
 
-	if (cci & UCSI_CCI_ACK_COMPLETE && test_bit(ACK_PENDING, &ua->flags))
+	if (cci & UCSI_CCI_ACK_COMPLETE &&
+	    test_bit(UCSI_ACPI_ACK_PENDING, &ua->flags))
 		complete(&ua->complete);
 	if (cci & UCSI_CCI_COMMAND_COMPLETE &&
 	    test_bit(UCSI_ACPI_COMMAND_PENDING, &ua->flags))
diff --git a/drivers/usb/typec/ucsi/ucsi_stm32g0.c b/drivers/usb/typec/ucsi/ucsi_stm32g0.c
index 93d7806681cf..ac48b7763114 100644
--- a/drivers/usb/typec/ucsi/ucsi_stm32g0.c
+++ b/drivers/usb/typec/ucsi/ucsi_stm32g0.c
@@ -64,6 +64,7 @@  struct ucsi_stm32g0 {
 	struct completion complete;
 	struct device *dev;
 	unsigned long flags;
+#define COMMAND_PENDING	1
 	const char *fw_name;
 	struct ucsi *ucsi;
 	bool suspended;