usb: typec: ucsi: Stop abuse of bit definitions from ucsi.h
authorChristian A. Ehrhardt <lk@c--e.de>
Wed, 27 Mar 2024 22:45:52 +0000 (23:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Apr 2024 15:07:16 +0000 (17:07 +0200)
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>
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20240327224554.1772525-2-lk@c--e.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/ucsi.h
drivers/usb/typec/ucsi/ucsi_acpi.c
drivers/usb/typec/ucsi/ucsi_stm32g0.c

index f478218cbb54de907ea1f26f8aa0ecf6378f78d2..2caf2969668c7aec79d461cce41cab67246d630f 100644 (file)
@@ -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 */
index 7b3ac133ef86180823bf92e8a5f85cfe3e03b4dd..cc03a49c589cb289103795afbca566a5b20d4f7a 100644 (file)
@@ -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))
index 93d7806681cf0147baf37a98281fc2b8192c73a3..ac48b776311442e9100bc532cfd8e1c89fbb8b98 100644 (file)
@@ -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;