linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Prarit Bhargava <prarit@redhat.com>,
	Tomas Winkler <tomas.winkler@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Joe Perches <joe@perches.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jiri Kosina <jkosina@suse.cz>,
	Sharon Dvir <sharon.dvir1@mail.huji.ac.il>,
	"Suthikulpanit, Suravee" <Suravee.Suthikulpanit@amd.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	James Hogan <james.hogan@imgtec.com>,
	Daniel Thompson <daniel.thompson@linaro.org>,
	Michael Opdenacker <michael.opdenacker@free-electrons.com>,
	David Cohen <david.a.cohen@linux.intel.com>,
	Felipe Balbi <balbi@ti.com>, Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH] mei, make modules.alias UUID information easier to read
Date: Fri, 14 Aug 2015 09:05:40 -0400	[thread overview]
Message-ID: <1439557540-1989-1-git-send-email-prarit@redhat.com> (raw)

2nd try on this ...

P.

---8<---

scripts/mod/file2alias.c:add_uuid() munges a UUID into a single string
which does not conform to the standard little endian UUID.  This patch
changes add_uuid() to use the UUID correctly so that future drivers which
use UUID matches can simply use the %pUL format, and modifies the mei
driver with those changes.

Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Joe Perches <joe@perches.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Sharon Dvir <sharon.dvir1@mail.huji.ac.il>
Cc: "Suthikulpanit, Suravee" <Suravee.Suthikulpanit@amd.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Cc: David Cohen <david.a.cohen@linux.intel.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Ralf Baechle <ralf@linux-mips.org>

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 drivers/misc/mei/bus.c          |    6 ++----
 include/linux/mod_devicetable.h |    4 ----
 scripts/mod/file2alias.c        |    9 ++++++---
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 458aa5a..457e132 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -141,8 +141,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
 	const uuid_le *uuid = mei_me_cl_uuid(device->me_cl);
 	size_t len;
 
-	len = snprintf(buf, PAGE_SIZE, "mei:%s:" MEI_CL_UUID_FMT ":",
-		device->name, MEI_CL_UUID_ARGS(uuid->b));
+	len = snprintf(buf, PAGE_SIZE, "mei:%s:%pUl:", device->name, uuid);
 
 	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
 }
@@ -167,8 +166,7 @@ static int mei_cl_uevent(struct device *dev, struct kobj_uevent_env *env)
 	if (add_uevent_var(env, "MEI_CL_NAME=%s", device->name))
 		return -ENOMEM;
 
-	if (add_uevent_var(env, "MODALIAS=mei:%s:" MEI_CL_UUID_FMT ":",
-		device->name, MEI_CL_UUID_ARGS(uuid->b)))
+	if (add_uevent_var(env, "MODALIAS=mei:%s:%pUl:", device->name, uuid))
 		return -ENOMEM;
 
 	return 0;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 34f25b7..becda6f 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -601,10 +601,6 @@ struct ipack_device_id {
 
 #define MEI_CL_MODULE_PREFIX "mei:"
 #define MEI_CL_NAME_SIZE 32
-#define MEI_CL_UUID_FMT "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
-#define MEI_CL_UUID_ARGS(_u) \
-	_u[0], _u[1], _u[2], _u[3], _u[4], _u[5], _u[6], _u[7], \
-	_u[8], _u[9], _u[10], _u[11], _u[12], _u[13], _u[14], _u[15]
 
 /**
  * struct mei_cl_device_id - MEI client device identifier
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 5f20882..8a46c60 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -137,10 +137,13 @@ static inline void add_wildcard(char *str)
 static inline void add_uuid(char *str, uuid_le uuid)
 {
 	int len = strlen(str);
-	int i;
 
-	for (i = 0; i < 16; i++)
-		sprintf(str + len + (i << 1), "%02x", uuid.b[i]);
+	sprintf(str + len,
+		"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+		uuid.b[3], uuid.b[2], uuid.b[1], uuid.b[0],
+		uuid.b[5], uuid.b[4], uuid.b[7], uuid.b[6],
+		uuid.b[8], uuid.b[9], uuid.b[10], uuid.b[11],
+		uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]);
 }
 
 /**
-- 
1.7.9.3


             reply	other threads:[~2015-08-14 13:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14 13:05 Prarit Bhargava [this message]
2015-08-28 11:50 ` [PATCH] mei, make modules.alias UUID information easier to read Prarit Bhargava
2015-08-28 12:46   ` Heikki Krogerus
2015-08-29 21:21     ` Winkler, Tomas
2015-08-30 17:36       ` Prarit Bhargava
2015-08-31  7:17         ` Winkler, Tomas
2015-09-01  0:09       ` Prarit Bhargava
2015-09-21  2:25 ` Greg Kroah-Hartman
2015-09-21  8:13   ` Winkler, Tomas
  -- strict thread matches above, loose matches on Subject: below --
2015-08-07 14:06 Prarit Bhargava

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=1439557540-1989-1-git-send-email-prarit@redhat.com \
    --to=prarit@redhat.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=balbi@ti.com \
    --cc=daniel.thompson@linaro.org \
    --cc=davem@davemloft.net \
    --cc=david.a.cohen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=james.hogan@imgtec.com \
    --cc=jkosina@suse.cz \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.opdenacker@free-electrons.com \
    --cc=ralf@linux-mips.org \
    --cc=sharon.dvir1@mail.huji.ac.il \
    --cc=tomas.winkler@intel.com \
    /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 NNTP newsgroup(s).