Skip to content

Commit 8491451

Browse files
committed
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>
1 parent a088cf1 commit 8491451

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎drivers/hsi/hsi.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,15 @@ static void hsi_client_release(struct device *dev)
6969
kfree(cl);
7070
}
7171

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)
7374
{
7475
struct hsi_client *cl;
7576
size_t size;
7677

7778
cl = kzalloc(sizeof(*cl), GFP_KERNEL);
7879
if (!cl)
79-
return;
80+
return NULL;
8081

8182
cl->tx_cfg = info->tx_cfg;
8283
if (cl->tx_cfg.channels) {
@@ -103,7 +104,10 @@ static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info)
103104
pr_err("hsi: failed to register client: %s\n", info->name);
104105
put_device(&cl->device);
105106
}
107+
108+
return cl;
106109
}
110+
EXPORT_SYMBOL_GPL(hsi_new_client);
107111

108112
static void hsi_scan_board_info(struct hsi_controller *hsi)
109113
{
@@ -119,12 +123,13 @@ static void hsi_scan_board_info(struct hsi_controller *hsi)
119123
}
120124
}
121125

122-
static int hsi_remove_client(struct device *dev, void *data __maybe_unused)
126+
int hsi_remove_client(struct device *dev, void *data __maybe_unused)
123127
{
124128
device_unregister(dev);
125129

126130
return 0;
127131
}
132+
EXPORT_SYMBOL_GPL(hsi_remove_client);
128133

129134
static int hsi_remove_port(struct device *dev, void *data __maybe_unused)
130135
{

‎include/linux/hsi/hsi.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags);
296296
void hsi_put_controller(struct hsi_controller *hsi);
297297
int hsi_register_controller(struct hsi_controller *hsi);
298298
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);
299302
void hsi_port_unregister_clients(struct hsi_port *port);
300303

301304
static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi,

0 commit comments

Comments
 (0)