]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
HSI: export method to (un)register clients
authorSebastian Reichel <sre@kernel.org>
Fri, 28 Mar 2014 21:54:25 +0000 (22:54 +0100)
committerSebastian Reichel <sre@kernel.org>
Thu, 15 May 2014 22:54:41 +0000 (00:54 +0200)
Expose method for registering and unregistering HSI clients, so that
client drivers can register other client drivers.

This is useful for HSI drivers, which want to use the functionality
of other HSI drivers. For example the N900 modem driver can load HSI
drivers for mcsaab protocol and speech protocol.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Tested-By: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
drivers/hsi/hsi.c
include/linux/hsi/hsi.h

index de2ad8f20d55745a28a231c6bf3cde13b484227f..834a2d6b444e4edff81cdc80431a0265438b3614 100644 (file)
@@ -69,14 +69,15 @@ static void hsi_client_release(struct device *dev)
        kfree(cl);
 }
 
-static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info)
+struct hsi_client *hsi_new_client(struct hsi_port *port,
+                                               struct hsi_board_info *info)
 {
        struct hsi_client *cl;
        size_t size;
 
        cl = kzalloc(sizeof(*cl), GFP_KERNEL);
        if (!cl)
-               return;
+               return NULL;
 
        cl->tx_cfg = info->tx_cfg;
        if (cl->tx_cfg.channels) {
@@ -103,7 +104,10 @@ static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info)
                pr_err("hsi: failed to register client: %s\n", info->name);
                put_device(&cl->device);
        }
+
+       return cl;
 }
+EXPORT_SYMBOL_GPL(hsi_new_client);
 
 static void hsi_scan_board_info(struct hsi_controller *hsi)
 {
@@ -119,12 +123,13 @@ static void hsi_scan_board_info(struct hsi_controller *hsi)
                }
 }
 
-static int hsi_remove_client(struct device *dev, void *data __maybe_unused)
+int hsi_remove_client(struct device *dev, void *data __maybe_unused)
 {
        device_unregister(dev);
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(hsi_remove_client);
 
 static int hsi_remove_port(struct device *dev, void *data __maybe_unused)
 {
index e3cff94bef047bee9905896d20d33bc21983ca7d..e20a3999a696112c88fa05fa269bddf39123497f 100644 (file)
@@ -296,6 +296,9 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags);
 void hsi_put_controller(struct hsi_controller *hsi);
 int hsi_register_controller(struct hsi_controller *hsi);
 void hsi_unregister_controller(struct hsi_controller *hsi);
+struct hsi_client *hsi_new_client(struct hsi_port *port,
+                                               struct hsi_board_info *info);
+int hsi_remove_client(struct device *dev, void *data);
 void hsi_port_unregister_clients(struct hsi_port *port);
 
 static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi,