All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stuart Yoder <stuart.yoder@nxp.com>
To: <gregkh@linuxfoundation.org>
Cc: <german.rivera@nxp.com>, <devel@driverdev.osuosl.org>,
	<linux-kernel@vger.kernel.org>, <agraf@suse.de>, <arnd@arndb.de>,
	<leoyang.li@nxp.com>, Stuart Yoder <stuart.yoder@nxp.com>
Subject: [PATCH 01/11] staging: fsl-mc: add support for the modalias sysfs attribute
Date: Wed, 22 Jun 2016 16:40:42 -0500	[thread overview]
Message-ID: <1466631652-25731-2-git-send-email-stuart.yoder@nxp.com> (raw)
In-Reply-To: <1466631652-25731-1-git-send-email-stuart.yoder@nxp.com>

In order to support uevent based module loading implement modalias support
for the fsl-mc bus driver. Aliases are based on vendor and object/device
id and are of the form "fsl-mc:vNdN".

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
---
 drivers/staging/fsl-mc/bus/mc-bus.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c
index 4053643..d8776dd 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -82,10 +82,35 @@ static int fsl_mc_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
 	return 0;
 }
 
+static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
+			     char *buf)
+{
+	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
+
+	return sprintf(buf, "fsl-mc:v%08Xd%s\n", mc_dev->obj_desc.vendor,
+		       mc_dev->obj_desc.type);
+}
+static DEVICE_ATTR_RO(modalias);
+
+static struct attribute *fsl_mc_dev_attrs[] = {
+	&dev_attr_modalias.attr,
+	NULL,
+};
+
+static const struct attribute_group fsl_mc_dev_group = {
+	.attrs = fsl_mc_dev_attrs,
+};
+
+static const struct attribute_group *fsl_mc_dev_groups[] = {
+	&fsl_mc_dev_group,
+	NULL,
+};
+
 struct bus_type fsl_mc_bus_type = {
 	.name = "fsl-mc",
 	.match = fsl_mc_bus_match,
 	.uevent = fsl_mc_bus_uevent,
+	.dev_groups = fsl_mc_dev_groups,
 };
 EXPORT_SYMBOL_GPL(fsl_mc_bus_type);
 
-- 
1.9.0

  reply	other threads:[~2016-06-22 21:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 21:40 [PATCH 00/11] staging: fsl-mc: module loading support, fixes, and cleanup Stuart Yoder
2016-06-22 21:40 ` Stuart Yoder [this message]
2016-06-22 21:40 ` [PATCH 02/11] staging: fsl-mc: implement uevent callback and set the modalias Stuart Yoder
2016-06-22 21:40 ` [PATCH 03/11] staging: fsl-mc: clean up the device id struct Stuart Yoder
2016-06-29 15:03   ` Matthias Brugger
2016-06-22 21:40 ` [PATCH 04/11] staging: fsl-mc: add support for device table matching Stuart Yoder
2016-06-22 21:40 ` [PATCH 05/11] staging: fsl-mc: export mc_get_version Stuart Yoder
2016-06-22 21:40 ` [PATCH 06/11] staging: fsl-mc: make fsl_mc_is_root_dprc() global Stuart Yoder
2016-06-29 14:17   ` Matthias Brugger
2016-06-29 14:25     ` Stuart Yoder
2016-06-29 15:01       ` Matthias Brugger
2016-06-22 21:40 ` [PATCH 07/11] staging: fsl-mc: fix asymmetry in destroy of mc_io Stuart Yoder
2016-06-22 21:40 ` [PATCH 08/11] staging: fsl-mc: dprc: add missing irq free Stuart Yoder
2016-06-22 21:40 ` [PATCH 09/11] staging: fsl-mc: dprc: fix ordering problem freeing resources in remove of dprc Stuart Yoder
2016-06-22 21:40 ` [PATCH 10/11] staging: fsl-mc: properly set hwirq in msi set_desc Stuart Yoder
2016-06-22 21:40 ` [PATCH 11/11] staging: fsl-mc: convert mc command build/parse to use C structs Stuart Yoder

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=1466631652-25731-2-git-send-email-stuart.yoder@nxp.com \
    --to=stuart.yoder@nxp.com \
    --cc=agraf@suse.de \
    --cc=arnd@arndb.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=german.rivera@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=leoyang.li@nxp.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.