diff mbox series

[12/13] platform/chrome: cros_ec_proto: arrange get_host_event_wake_mask()

Message ID 20220606141051.285823-13-tzungbi@kernel.org (mailing list archive)
State Superseded
Headers show
Series platform/chrome: Kunit tests and refactor for cros_ec_query_all() | expand

Commit Message

Tzung-Bi Shih June 6, 2022, 2:10 p.m. UTC
- cros_ec_get_host_event_wake_mask() is a private (static) function.
  Rename it to get_host_event_wake_mask().

- Join multiple lines into one if it can fit in 100 columns.

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 drivers/platform/chrome/cros_ec_proto.c      | 9 ++++-----
 drivers/platform/chrome/cros_ec_proto_test.c | 8 ++++----
 2 files changed, 8 insertions(+), 9 deletions(-)

Comments

Guenter Roeck June 6, 2022, 4:18 p.m. UTC | #1
On Mon, Jun 6, 2022 at 7:12 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> - cros_ec_get_host_event_wake_mask() is a private (static) function.
>   Rename it to get_host_event_wake_mask().
>
Same as before - I still prefer to have prefixes. Also, this is a bit
of point-of-view thing, so I'd rather leave function names alone
unless there is a good reason to change them. Otherwise we might end
up with sequences of function-name-rename patches for no good reason
besides someone mot liking the existing names.

Thanks,
Guenter

> - Join multiple lines into one if it can fit in 100 columns.
>
> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
> ---
>  drivers/platform/chrome/cros_ec_proto.c      | 9 ++++-----
>  drivers/platform/chrome/cros_ec_proto_test.c | 8 ++++----
>  2 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> index 91c945c9911f..1622e24747c9 100644
> --- a/drivers/platform/chrome/cros_ec_proto.c
> +++ b/drivers/platform/chrome/cros_ec_proto.c
> @@ -230,7 +230,7 @@ int cros_ec_check_result(struct cros_ec_device *ec_dev,
>  EXPORT_SYMBOL(cros_ec_check_result);
>
>  /*
> - * cros_ec_get_host_event_wake_mask
> + * get_host_event_wake_mask
>   *
>   * Get the mask of host events that cause wake from suspend.
>   *
> @@ -242,7 +242,7 @@ EXPORT_SYMBOL(cros_ec_check_result);
>   * the caller has ec_dev->lock mutex, or the caller knows there is
>   * no other command in progress.
>   */
> -static int cros_ec_get_host_event_wake_mask(struct cros_ec_device *ec_dev, uint32_t *mask)
> +static int get_host_event_wake_mask(struct cros_ec_device *ec_dev, uint32_t *mask)
>  {
>         struct cros_ec_command *msg;
>         struct ec_response_host_event_mask *r;
> @@ -498,7 +498,7 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
>         ec_dev->host_sleep_v1 = (ret > 0 && (ver_mask & EC_VER_MASK(1)));
>
>         /* Get host event wake mask. */
> -       ret = cros_ec_get_host_event_wake_mask(ec_dev, &ec_dev->host_event_wake_mask);
> +       ret = get_host_event_wake_mask(ec_dev, &ec_dev->host_event_wake_mask);
>         if (ret < 0) {
>                 /*
>                  * If the EC doesn't support EC_CMD_HOST_EVENT_GET_WAKE_MASK,
> @@ -522,8 +522,7 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
>                  * other errors.
>                  */
>                 if (ret != -EOPNOTSUPP)
> -                       dev_err(ec_dev->dev,
> -                               "failed to retrieve wake mask: %d\n", ret);
> +                       dev_err(ec_dev->dev, "failed to retrieve wake mask: %d\n", ret);
>         }
>
>         return 0;
> diff --git a/drivers/platform/chrome/cros_ec_proto_test.c b/drivers/platform/chrome/cros_ec_proto_test.c
> index 7d73aeb99d1d..f63196289f54 100644
> --- a/drivers/platform/chrome/cros_ec_proto_test.c
> +++ b/drivers/platform/chrome/cros_ec_proto_test.c
> @@ -239,7 +239,7 @@ static void cros_ec_proto_test_query_all_normal(struct kunit *test)
>                 data->version_mask = BIT(1);
>         }
>
> -       /* For cros_ec_get_host_event_wake_mask(). */
> +       /* For get_host_event_wake_mask(). */
>         {
>                 struct ec_response_host_event_mask *data;
>
> @@ -326,7 +326,7 @@ static void cros_ec_proto_test_query_all_normal(struct kunit *test)
>                 KUNIT_EXPECT_TRUE(test, ec_dev->host_sleep_v1);
>         }
>
> -       /* For cros_ec_get_host_event_wake_mask(). */
> +       /* For get_host_event_wake_mask(). */
>         {
>                 mock = cros_kunit_ec_xfer_mock_next();
>                 KUNIT_EXPECT_PTR_NE(test, mock, NULL);
> @@ -915,7 +915,7 @@ static void cros_ec_proto_test_query_all_default_wake_mask(struct kunit *test)
>                 KUNIT_ASSERT_PTR_NE(test, mock, NULL);
>         }
>
> -       /* For cros_ec_get_host_event_wake_mask(). */
> +       /* For get_host_event_wake_mask(). */
>         {
>                 mock = cros_kunit_ec_xfer_mock_addx(test, 0, EC_RES_INVALID_COMMAND,
>                                                     sizeof(struct ec_response_host_event_mask));
> @@ -976,7 +976,7 @@ static void cros_ec_proto_test_query_all_default_wake_mask(struct kunit *test)
>                 KUNIT_EXPECT_EQ(test, mock->msg.outsize, sizeof(struct ec_params_get_cmd_versions));
>         }
>
> -       /* For cros_ec_get_host_event_wake_mask(). */
> +       /* For get_host_event_wake_mask(). */
>         {
>                 u32 mask;
>
> --
> 2.36.1.255.ge46751e96f-goog
>
Tzung-Bi Shih June 7, 2022, 12:55 a.m. UTC | #2
On Mon, Jun 06, 2022 at 09:18:57AM -0700, Guenter Roeck wrote:
> On Mon, Jun 6, 2022 at 7:12 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> >
> > - cros_ec_get_host_event_wake_mask() is a private (static) function.
> >   Rename it to get_host_event_wake_mask().
> >
> Same as before - I still prefer to have prefixes. Also, this is a bit
> of point-of-view thing, so I'd rather leave function names alone
> unless there is a good reason to change them. Otherwise we might end
> up with sequences of function-name-rename patches for no good reason
> besides someone mot liking the existing names.

Ack.
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 91c945c9911f..1622e24747c9 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -230,7 +230,7 @@  int cros_ec_check_result(struct cros_ec_device *ec_dev,
 EXPORT_SYMBOL(cros_ec_check_result);
 
 /*
- * cros_ec_get_host_event_wake_mask
+ * get_host_event_wake_mask
  *
  * Get the mask of host events that cause wake from suspend.
  *
@@ -242,7 +242,7 @@  EXPORT_SYMBOL(cros_ec_check_result);
  * the caller has ec_dev->lock mutex, or the caller knows there is
  * no other command in progress.
  */
-static int cros_ec_get_host_event_wake_mask(struct cros_ec_device *ec_dev, uint32_t *mask)
+static int get_host_event_wake_mask(struct cros_ec_device *ec_dev, uint32_t *mask)
 {
 	struct cros_ec_command *msg;
 	struct ec_response_host_event_mask *r;
@@ -498,7 +498,7 @@  int cros_ec_query_all(struct cros_ec_device *ec_dev)
 	ec_dev->host_sleep_v1 = (ret > 0 && (ver_mask & EC_VER_MASK(1)));
 
 	/* Get host event wake mask. */
-	ret = cros_ec_get_host_event_wake_mask(ec_dev, &ec_dev->host_event_wake_mask);
+	ret = get_host_event_wake_mask(ec_dev, &ec_dev->host_event_wake_mask);
 	if (ret < 0) {
 		/*
 		 * If the EC doesn't support EC_CMD_HOST_EVENT_GET_WAKE_MASK,
@@ -522,8 +522,7 @@  int cros_ec_query_all(struct cros_ec_device *ec_dev)
 		 * other errors.
 		 */
 		if (ret != -EOPNOTSUPP)
-			dev_err(ec_dev->dev,
-				"failed to retrieve wake mask: %d\n", ret);
+			dev_err(ec_dev->dev, "failed to retrieve wake mask: %d\n", ret);
 	}
 
 	return 0;
diff --git a/drivers/platform/chrome/cros_ec_proto_test.c b/drivers/platform/chrome/cros_ec_proto_test.c
index 7d73aeb99d1d..f63196289f54 100644
--- a/drivers/platform/chrome/cros_ec_proto_test.c
+++ b/drivers/platform/chrome/cros_ec_proto_test.c
@@ -239,7 +239,7 @@  static void cros_ec_proto_test_query_all_normal(struct kunit *test)
 		data->version_mask = BIT(1);
 	}
 
-	/* For cros_ec_get_host_event_wake_mask(). */
+	/* For get_host_event_wake_mask(). */
 	{
 		struct ec_response_host_event_mask *data;
 
@@ -326,7 +326,7 @@  static void cros_ec_proto_test_query_all_normal(struct kunit *test)
 		KUNIT_EXPECT_TRUE(test, ec_dev->host_sleep_v1);
 	}
 
-	/* For cros_ec_get_host_event_wake_mask(). */
+	/* For get_host_event_wake_mask(). */
 	{
 		mock = cros_kunit_ec_xfer_mock_next();
 		KUNIT_EXPECT_PTR_NE(test, mock, NULL);
@@ -915,7 +915,7 @@  static void cros_ec_proto_test_query_all_default_wake_mask(struct kunit *test)
 		KUNIT_ASSERT_PTR_NE(test, mock, NULL);
 	}
 
-	/* For cros_ec_get_host_event_wake_mask(). */
+	/* For get_host_event_wake_mask(). */
 	{
 		mock = cros_kunit_ec_xfer_mock_addx(test, 0, EC_RES_INVALID_COMMAND,
 						    sizeof(struct ec_response_host_event_mask));
@@ -976,7 +976,7 @@  static void cros_ec_proto_test_query_all_default_wake_mask(struct kunit *test)
 		KUNIT_EXPECT_EQ(test, mock->msg.outsize, sizeof(struct ec_params_get_cmd_versions));
 	}
 
-	/* For cros_ec_get_host_event_wake_mask(). */
+	/* For get_host_event_wake_mask(). */
 	{
 		u32 mask;