Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1620669

[PATCH v6 13/23] drivers/fsi: Add client driver register utilities

From Christopher Bostic <cbostic@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH v6 13/23] drivers/fsi: Add client driver register utilities
Date 2017-04-10 22:00 +0200
Message-ID <tuNDI-5ev-15@gated-at.bofh.it> (permalink)
References <tuNu1-5aC-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Chris Bostic <cbostic@linux.vnet.ibm.com>

Add driver_register and driver_unregister wrappers for FSI.

Signed-off-by: Chris Bostic <cbostic@linux.vnet.ibm.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/fsi/fsi-core.c | 17 +++++++++++++++++
 include/linux/fsi.h    | 12 ++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 75d2a88..4359e26 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -585,6 +585,23 @@ static int fsi_bus_match(struct device *dev, struct device_driver *drv)
 	return 0;
 }
 
+int fsi_driver_register(struct fsi_driver *fsi_drv)
+{
+	if (!fsi_drv)
+		return -EINVAL;
+	if (!fsi_drv->id_table)
+		return -EINVAL;
+
+	return driver_register(&fsi_drv->drv);
+}
+EXPORT_SYMBOL_GPL(fsi_driver_register);
+
+void fsi_driver_unregister(struct fsi_driver *fsi_drv)
+{
+	driver_unregister(&fsi_drv->drv);
+}
+EXPORT_SYMBOL_GPL(fsi_driver_unregister);
+
 struct bus_type fsi_bus_type = {
 	.name		= "fsi",
 	.match		= fsi_bus_match,
diff --git a/include/linux/fsi.h b/include/linux/fsi.h
index 66bce48..34f1e9a 100644
--- a/include/linux/fsi.h
+++ b/include/linux/fsi.h
@@ -54,6 +54,18 @@ struct fsi_driver {
 #define to_fsi_dev(devp) container_of(devp, struct fsi_device, dev)
 #define to_fsi_drv(drvp) container_of(drvp, struct fsi_driver, drv)
 
+extern int fsi_driver_register(struct fsi_driver *fsi_drv);
+extern void fsi_driver_unregister(struct fsi_driver *fsi_drv);
+
+/* module_fsi_driver() - Helper macro for drivers that don't do
+ * anything special in module init/exit.  This eliminates a lot of
+ * boilerplate.  Each module may only use this macro once, and
+ * calling it replaces module_init() and module_exit()
+ */
+#define module_fsi_driver(__fsi_driver) \
+		module_driver(__fsi_driver, fsi_driver_register, \
+				fsi_driver_unregister)
+
 extern struct bus_type fsi_bus_type;
 
 #endif /* LINUX_FSI_H */
-- 
1.8.2.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 00/23] FSI device driver implementation Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 21:50 +0200
  [PATCH v6 14/23] drivers/fsi: Add sysfs files for FSI master & slave accesses Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 21:50 +0200
  [PATCH v6 12/23] drivers/fsi: Add documentation for GPIO bindings Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 21:50 +0200
  [PATCH v6 03/23] drivers/fsi: Add empty master scan Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 21:50 +0200
  [PATCH v6 11/23] drivers/fsi: Add master unscan Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 21:50 +0200
  [PATCH v6 06/23] drivers/fsi: Set up links for slave communication Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 21:50 +0200
  [PATCH v6 09/23] drivers/fsi: scan slaves & register devices Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 21:50 +0200
  [PATCH v6 10/23] drivers/fsi: Add device read/write/peek API Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 21:50 +0200
  [PATCH v6 02/23] drivers/fsi: Add slave definition Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 21:50 +0200
  [PATCH v6 05/23] drivers/fsi: Add slave & master read/write APIs Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 21:50 +0200
  [PATCH v6 13/23] drivers/fsi: Add client driver register utilities Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 22:00 +0200
  [PATCH v6 15/23] drivers/fsi: expose direct-access slave API Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 22:00 +0200
  [PATCH v6 21/23] drivers/fsi: Add SCOM FSI client device driver Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 22:00 +0200
  [PATCH v6 23/23] drivers/fsi: Use asynchronous slave mode Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 22:00 +0200
  [PATCH v6 16/23] drivers/fsi: Add tracepoints for low-level operations Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 22:00 +0200
  [PATCH v6 18/23] drivers/fsi: Document FSI master sysfs files in ABI Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 22:00 +0200
  [PATCH v6 20/23] drivers/fsi/gpio: Add tracepoints for GPIO master Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 22:00 +0200
  [PATCH v6 17/23] drivers/fsi: Add error handling for slave communication errors Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 22:00 +0200
  [PATCH v6 22/23] drivers/ fsi: Add hub master support Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 22:00 +0200
  [PATCH v6 19/23] drivers/fsi: Add GPIO based FSI master Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-04-10 22:00 +0200

csiph-web