From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: [PATCH 2/7] stm class: Replace uuid_t with plain u8 uuid[16]
Date: Wed, 14 Apr 2021 20:12:46 +0300 [thread overview]
Message-ID: <20210414171251.14672-3-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <20210414171251.14672-1-alexander.shishkin@linux.intel.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
It appears that uuid_t use in STM code abuses UUID API. Moreover,
this type is only useful when we parse user input. Due to above
replace uuid_t with u8 uuid[16] and use uuid_t only when parse
user input.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
drivers/hwtracing/stm/p_sys-t.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/hwtracing/stm/p_sys-t.c b/drivers/hwtracing/stm/p_sys-t.c
index 360b5c03df95..04d13b3785d3 100644
--- a/drivers/hwtracing/stm/p_sys-t.c
+++ b/drivers/hwtracing/stm/p_sys-t.c
@@ -76,7 +76,7 @@ enum sys_t_message_string_subtype {
MIPI_SYST_SEVERITY(MAX))
struct sys_t_policy_node {
- uuid_t uuid;
+ u8 uuid[UUID_SIZE];
bool do_len;
unsigned long ts_interval;
unsigned long clocksync_interval;
@@ -92,7 +92,7 @@ static void sys_t_policy_node_init(void *priv)
{
struct sys_t_policy_node *pn = priv;
- generate_random_uuid(pn->uuid.b);
+ generate_random_uuid(pn->uuid);
}
static int sys_t_output_open(void *priv, struct stm_output *output)
@@ -120,7 +120,7 @@ static ssize_t sys_t_policy_uuid_show(struct config_item *item,
{
struct sys_t_policy_node *pn = to_pdrv_policy_node(item);
- return sprintf(page, "%pU\n", &pn->uuid);
+ return sprintf(page, "%pU\n", pn->uuid);
}
static ssize_t
@@ -129,13 +129,17 @@ sys_t_policy_uuid_store(struct config_item *item, const char *page,
{
struct mutex *mutexp = &item->ci_group->cg_subsys->su_mutex;
struct sys_t_policy_node *pn = to_pdrv_policy_node(item);
+ uuid_t uuid;
int ret;
mutex_lock(mutexp);
- ret = uuid_parse(page, &pn->uuid);
+ ret = uuid_parse(page, &uuid);
mutex_unlock(mutexp);
+ if (ret)
+ return ret;
- return ret < 0 ? ret : count;
+ export_uuid(pn->uuid, &uuid);
+ return count;
}
CONFIGFS_ATTR(sys_t_policy_, uuid);
@@ -322,7 +326,7 @@ static ssize_t sys_t_write(struct stm_data *data, struct stm_output *output,
return sz;
/* GUID */
- sz = stm_data_write(data, m, c, false, op->node.uuid.b, UUID_SIZE);
+ sz = stm_data_write(data, m, c, false, op->node.uuid, sizeof(op->node.uuid));
if (sz <= 0)
return sz;
--
2.30.2
next prev parent reply other threads:[~2021-04-14 17:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-14 17:12 [PATCH 0/7] stm class/intel_th: Updates for v5.13 Alexander Shishkin
2021-04-14 17:12 ` [PATCH 1/7] stm class: Remove an unused function Alexander Shishkin
2021-04-14 17:12 ` Alexander Shishkin [this message]
2021-04-14 17:33 ` [PATCH 2/7] stm class: Replace uuid_t with plain u8 uuid[16] Greg Kroah-Hartman
2021-04-14 17:47 ` Andy Shevchenko
2021-04-14 18:56 ` Greg Kroah-Hartman
2021-04-14 19:12 ` Andy Shevchenko
2021-04-14 19:14 ` Alexander Shishkin
2021-04-14 19:16 ` Andy Shevchenko
2021-04-15 8:34 ` Greg Kroah-Hartman
2021-04-15 8:48 ` Andy Shevchenko
2021-04-15 9:08 ` Greg Kroah-Hartman
2021-04-15 9:20 ` Alexander Shishkin
2021-04-14 17:12 ` [PATCH 3/7] intel_th: Constify all drvdata references Alexander Shishkin
2021-04-14 17:12 ` [PATCH 4/7] intel_th: Constify attribute_group structs Alexander Shishkin
2021-04-14 17:12 ` [PATCH 5/7] intel_th: Consistency and off-by-one fix Alexander Shishkin
2021-04-14 17:12 ` [PATCH 6/7] intel_th: pci: Add Rocket Lake CPU support Alexander Shishkin
2021-04-14 17:12 ` [PATCH 7/7] intel_th: pci: Add Alder Lake-M support Alexander Shishkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210414171251.14672-3-alexander.shishkin@linux.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).