All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Stanley <joel@jms.id.au>
To: Rob Herring <robh+dt@kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>, Jeremy Kerr <jk@ozlabs.org>
Cc: Alistar Popple <alistair@popple.id.au>,
	Eddie James <eajames@linux.ibm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org
Subject: [PATCH v2 01/11] fsi: Add fsi-master class
Date: Fri,  8 Nov 2019 15:49:35 +1030	[thread overview]
Message-ID: <20191108051945.7109-2-joel@jms.id.au> (raw)
In-Reply-To: <20191108051945.7109-1-joel@jms.id.au>

From: Jeremy Kerr <jk@ozlabs.org>

This change adds a device class for FSI masters, allowing access under
/sys/class/fsi-master/, and easier udev rules.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/fsi/fsi-core.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 1f76740f33b6..0861f6097b33 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -1241,6 +1241,10 @@ static ssize_t master_break_store(struct device *dev,
 
 static DEVICE_ATTR(break, 0200, NULL, master_break_store);
 
+struct class fsi_master_class = {
+	.name = "fsi-master",
+};
+
 int fsi_master_register(struct fsi_master *master)
 {
 	int rc;
@@ -1249,6 +1253,7 @@ int fsi_master_register(struct fsi_master *master)
 	mutex_init(&master->scan_lock);
 	master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL);
 	dev_set_name(&master->dev, "fsi%d", master->idx);
+	master->dev.class = &fsi_master_class;
 
 	rc = device_register(&master->dev);
 	if (rc) {
@@ -1350,8 +1355,15 @@ static int __init fsi_init(void)
 	rc = bus_register(&fsi_bus_type);
 	if (rc)
 		goto fail_bus;
+
+	rc = class_register(&fsi_master_class);
+	if (rc)
+		goto fail_class;
+
 	return 0;
 
+ fail_class:
+	bus_unregister(&fsi_bus_type);
  fail_bus:
 	unregister_chrdev_region(fsi_base_dev, FSI_CHAR_MAX_DEVICES);
 	return rc;
@@ -1360,6 +1372,7 @@ postcore_initcall(fsi_init);
 
 static void fsi_exit(void)
 {
+	class_unregister(&fsi_master_class);
 	bus_unregister(&fsi_bus_type);
 	unregister_chrdev_region(fsi_base_dev, FSI_CHAR_MAX_DEVICES);
 	ida_destroy(&fsi_minor_ida);
-- 
2.24.0.rc1


WARNING: multiple messages have this Message-ID (diff)
From: Joel Stanley <joel@jms.id.au>
To: Rob Herring <robh+dt@kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>, Jeremy Kerr <jk@ozlabs.org>
Cc: devicetree@vger.kernel.org,
	Alistar Popple <alistair@popple.id.au>,
	Eddie James <eajames@linux.ibm.com>,
	linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org
Subject: [PATCH v2 01/11] fsi: Add fsi-master class
Date: Fri,  8 Nov 2019 15:49:35 +1030	[thread overview]
Message-ID: <20191108051945.7109-2-joel@jms.id.au> (raw)
In-Reply-To: <20191108051945.7109-1-joel@jms.id.au>

From: Jeremy Kerr <jk@ozlabs.org>

This change adds a device class for FSI masters, allowing access under
/sys/class/fsi-master/, and easier udev rules.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/fsi/fsi-core.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 1f76740f33b6..0861f6097b33 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -1241,6 +1241,10 @@ static ssize_t master_break_store(struct device *dev,
 
 static DEVICE_ATTR(break, 0200, NULL, master_break_store);
 
+struct class fsi_master_class = {
+	.name = "fsi-master",
+};
+
 int fsi_master_register(struct fsi_master *master)
 {
 	int rc;
@@ -1249,6 +1253,7 @@ int fsi_master_register(struct fsi_master *master)
 	mutex_init(&master->scan_lock);
 	master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL);
 	dev_set_name(&master->dev, "fsi%d", master->idx);
+	master->dev.class = &fsi_master_class;
 
 	rc = device_register(&master->dev);
 	if (rc) {
@@ -1350,8 +1355,15 @@ static int __init fsi_init(void)
 	rc = bus_register(&fsi_bus_type);
 	if (rc)
 		goto fail_bus;
+
+	rc = class_register(&fsi_master_class);
+	if (rc)
+		goto fail_class;
+
 	return 0;
 
+ fail_class:
+	bus_unregister(&fsi_bus_type);
  fail_bus:
 	unregister_chrdev_region(fsi_base_dev, FSI_CHAR_MAX_DEVICES);
 	return rc;
@@ -1360,6 +1372,7 @@ postcore_initcall(fsi_init);
 
 static void fsi_exit(void)
 {
+	class_unregister(&fsi_master_class);
 	bus_unregister(&fsi_bus_type);
 	unregister_chrdev_region(fsi_base_dev, FSI_CHAR_MAX_DEVICES);
 	ida_destroy(&fsi_minor_ida);
-- 
2.24.0.rc1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-11-08  5:20 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08  5:19 [PATCH v2 00/11] fsi: Patches for 5.5 Joel Stanley
2019-11-08  5:19 ` Joel Stanley
2019-11-08  5:19 ` Joel Stanley [this message]
2019-11-08  5:19   ` [PATCH v2 01/11] fsi: Add fsi-master class Joel Stanley
2019-11-08  9:17   ` Alistair Popple
2019-11-08  9:17     ` Alistair Popple
2019-11-08  5:19 ` [PATCH v2 02/11] fsi: Move master attributes to " Joel Stanley
2019-11-08  5:19   ` Joel Stanley
2019-11-08  9:18   ` Alistair Popple
2019-11-08  9:18     ` Alistair Popple
2019-11-08  5:19 ` [PATCH v2 03/11] ABI: Update FSI path documentation Joel Stanley
2019-11-08  5:19   ` Joel Stanley
2019-11-08  9:27   ` Alistair Popple
2019-11-08  9:27     ` Alistair Popple
2019-11-08  5:19 ` [PATCH v2 04/11] trace: fsi: Print transfer size unsigned Joel Stanley
2019-11-08  5:19   ` Joel Stanley
2019-11-08  9:21   ` Alistair Popple
2019-11-08  9:21     ` Alistair Popple
2019-11-08  5:19 ` [PATCH v2 05/11] fsi: core: Fix small accesses and unaligned offsets via sysfs Joel Stanley
2019-11-08  5:19   ` Joel Stanley
2019-11-08  5:19 ` [PATCH v2 06/11] fsi: fsi_master_class can be static Joel Stanley
2019-11-08  5:19   ` Joel Stanley
2019-11-08  5:19 ` [PATCH v2 07/11] fsi: Move defines to common header Joel Stanley
2019-11-08  5:19   ` Joel Stanley
2019-11-08  5:19 ` [PATCH v2 08/11] dt-bindings: fsi: Add description of FSI master Joel Stanley
2019-11-08  5:19   ` Joel Stanley
2019-11-08  9:23   ` Alistair Popple
2019-11-08  9:23     ` Alistair Popple
2019-11-08 10:28   ` Greg KH
2019-11-08 10:28     ` Greg KH
2019-11-08  5:19 ` [PATCH v2 09/11] fsi: Add ast2600 master driver Joel Stanley
2019-11-08  5:19   ` Joel Stanley
2019-11-08  9:29   ` Alistair Popple
2019-11-08  9:29     ` Alistair Popple
2019-11-08  5:19 ` [PATCH v2 10/11] fsi: aspeed: Add trace points Joel Stanley
2019-11-08  5:19   ` Joel Stanley
2019-11-08  5:19 ` [PATCH v2 11/11] fsi: aspeed: Fix OPB0 byte order register values Joel Stanley
2019-11-08  5:19   ` Joel Stanley
2019-11-08  9:31   ` Alistair Popple
2019-11-08  9:31     ` Alistair Popple

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=20191108051945.7109-2-joel@jms.id.au \
    --to=joel@jms.id.au \
    --cc=alistair@popple.id.au \
    --cc=devicetree@vger.kernel.org \
    --cc=eajames@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jk@ozlabs.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsi@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=robh+dt@kernel.org \
    --cc=rostedt@goodmis.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.