Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HSI: export method to (un)register clients

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>

+11 -3
+8 -3
drivers/hsi/hsi.c
··· 69 69 kfree(cl); 70 70 } 71 71 72 - static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info) 72 + struct hsi_client *hsi_new_client(struct hsi_port *port, 73 + struct hsi_board_info *info) 73 74 { 74 75 struct hsi_client *cl; 75 76 size_t size; 76 77 77 78 cl = kzalloc(sizeof(*cl), GFP_KERNEL); 78 79 if (!cl) 79 - return; 80 + return NULL; 80 81 81 82 cl->tx_cfg = info->tx_cfg; 82 83 if (cl->tx_cfg.channels) { ··· 104 103 pr_err("hsi: failed to register client: %s\n", info->name); 105 104 put_device(&cl->device); 106 105 } 106 + 107 + return cl; 107 108 } 109 + EXPORT_SYMBOL_GPL(hsi_new_client); 108 110 109 111 static void hsi_scan_board_info(struct hsi_controller *hsi) 110 112 { ··· 123 119 } 124 120 } 125 121 126 - static int hsi_remove_client(struct device *dev, void *data __maybe_unused) 122 + int hsi_remove_client(struct device *dev, void *data __maybe_unused) 127 123 { 128 124 device_unregister(dev); 129 125 130 126 return 0; 131 127 } 128 + EXPORT_SYMBOL_GPL(hsi_remove_client); 132 129 133 130 static int hsi_remove_port(struct device *dev, void *data __maybe_unused) 134 131 {
+3
include/linux/hsi/hsi.h
··· 296 296 void hsi_put_controller(struct hsi_controller *hsi); 297 297 int hsi_register_controller(struct hsi_controller *hsi); 298 298 void hsi_unregister_controller(struct hsi_controller *hsi); 299 + struct hsi_client *hsi_new_client(struct hsi_port *port, 300 + struct hsi_board_info *info); 301 + int hsi_remove_client(struct device *dev, void *data); 299 302 void hsi_port_unregister_clients(struct hsi_port *port); 300 303 301 304 static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi,